-
Notifications
You must be signed in to change notification settings - Fork 833
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix importing error for reexported adapters (#1634)
- Loading branch information
1 parent
5fad132
commit 845ad75
Showing
5 changed files
with
93 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
{ | ||
"build/dist/material-ui-pickers.esm.js": { | ||
"bundled": 190777, | ||
"minified": 103329, | ||
"gzipped": 26701, | ||
"bundled": 191726, | ||
"minified": 103839, | ||
"gzipped": 26870, | ||
"treeshaked": { | ||
"rollup": { | ||
"code": 85805, | ||
"import_statements": 2112 | ||
"code": 86187, | ||
"import_statements": 2162 | ||
}, | ||
"webpack": { | ||
"code": 95022 | ||
"code": 95489 | ||
} | ||
} | ||
}, | ||
"build/dist/material-ui-pickers.umd.js": { | ||
"bundled": 300842, | ||
"minified": 118907, | ||
"gzipped": 33715 | ||
"bundled": 301808, | ||
"minified": 119265, | ||
"gzipped": 33834 | ||
}, | ||
"build/dist/material-ui-pickers.umd.min.js": { | ||
"bundled": 259632, | ||
"minified": 109852, | ||
"gzipped": 30972 | ||
"bundled": 260598, | ||
"minified": 110210, | ||
"gzipped": 31113 | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
const path = require('path'); | ||
const fse = require('fs-extra'); | ||
|
||
function copyReadme() { | ||
return fse | ||
.copyFile( | ||
path.resolve(__dirname, '..', 'README.md'), | ||
path.resolve(__dirname, 'build', 'README.md') | ||
) | ||
.then(() => console.log('> Copied README.md')); | ||
} | ||
|
||
function createAdapterPackageFile(name) { | ||
const packageJson = { | ||
name: `@material-ui/pickers-adapter-${name}`, | ||
module: 'index.js', | ||
main: 'index.cjs.js', | ||
typings: `../${name}.d.ts`, | ||
}; | ||
|
||
return fse.writeFile( | ||
path.resolve(__dirname, 'build', 'adapter', name, 'package.json'), | ||
JSON.stringify(packageJson, null, 2) | ||
); | ||
} | ||
|
||
function createAdaptersPackages() { | ||
return Promise.all( | ||
['luxon', 'date-fns', 'dayjs', 'moment'].map(createAdapterPackageFile) | ||
).then(() => console.log('> Created package.json files for adapters')); | ||
} | ||
|
||
function createRootPackageFile() { | ||
return fse | ||
.readFile(path.resolve(__dirname, 'package.json'), 'utf8') | ||
.then(data => JSON.parse(data)) | ||
.then(packageData => { | ||
// cleanup produced package | ||
const { | ||
devDependencies, | ||
jest, | ||
husky, | ||
main, | ||
module, | ||
'lint-staged': ls, | ||
...other | ||
} = packageData; | ||
|
||
const newPackage = { | ||
...other, | ||
private: false, | ||
main: './dist/material-ui-pickers.js', | ||
module: './index.js', | ||
typings: './src/index.d.ts', | ||
}; | ||
|
||
const buildPath = path.resolve(__dirname, 'build', 'package.json'); | ||
const data = JSON.stringify(newPackage, null, 2); | ||
|
||
return fse | ||
.writeFile(buildPath, data) | ||
.then(() => console.log(`> Created package.json in ${buildPath}`)); | ||
}); | ||
} | ||
|
||
createRootPackageFile() | ||
.then(copyReadme) | ||
.then(createAdaptersPackages) | ||
.then(() => console.log('\nFinished build files preparation')) | ||
.catch(console.error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
845ad75
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to following URLs:
845ad75
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmtrKovalenko great, was already about to report it. Do you think you can make a relase with this?
845ad75
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmtrKovalenko I don't want to annoy you, but I would like to test the alpha, but it's not working because I get export errors, probably because what this commit fixes. Would you be able to do another alpha release ?
845ad75
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BjoernRave please for now pass a date-io adapter directly, as you will do for v3.
I am now in progress with new features we are going to release in alpha as well.
845ad75
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmtrKovalenko ah, didn't know that still works, thanks for the hint :)