-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade babel and do a module build (#336)
* Upgrade babel and do a module build * Make sure esm icon files have .svg so they can be resolved * Upgrade jest * Fix package.json module property * Make svgr use camelCase * Make sure svgr components go through babel * Dont use style alias anymore * use maxWorkers for jest in CI * Do not check in dist
- Loading branch information
1 parent
b29f8d3
commit 60939a8
Showing
29 changed files
with
1,637 additions
and
2,536 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
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,33 @@ | ||
# Logs | ||
*.log | ||
|
||
src | ||
scripts | ||
lib | ||
docs | ||
test | ||
.babelrc | ||
.codeclimate.yml | ||
.codecov.yml | ||
.eslintrc.js | ||
tsconfig.json | ||
prettier.config.js | ||
styleguide.config.js | ||
webpack.config.js | ||
webpack.release.config.js | ||
yarn.lock | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Dependency directories | ||
node_modules | ||
|
||
.DS_Store | ||
|
||
# IDE | ||
.idea | ||
.vscode | ||
|
||
# dev build folder | ||
tmp |
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,29 @@ | ||
module.exports = api => { | ||
const env = api.env() | ||
const isTest = env === 'test' | ||
|
||
return { | ||
presets: [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
modules: isTest ? 'commonjs' : false, | ||
loose: true, | ||
}, | ||
], | ||
'@babel/preset-react', | ||
], | ||
plugins: [ | ||
[ | ||
'@babel/plugin-proposal-decorators', | ||
{ | ||
legacy: true, | ||
}, | ||
], | ||
['@babel/plugin-proposal-class-properties', { loose: true }], | ||
['@babel/plugin-proposal-object-rest-spread', { loose: true }], | ||
['@babel/transform-runtime', { useESModules: isTest ? false : true }], | ||
'@babel/plugin-transform-react-constant-elements', | ||
], | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,30 @@ | ||
const path = require('path') | ||
const fs = require('fs') | ||
const execSync = require('child_process').execSync | ||
|
||
const exec = command => execSync(command, { stdio: 'inherit' }) | ||
|
||
const svgrTempDir = path.resolve(process.cwd(), 'tmp/svgr') | ||
const svgrAssetsDir = path.resolve(svgrTempDir, 'assets') | ||
const svgrComponentsDir = path.resolve(svgrTempDir, 'components') | ||
|
||
function ensureDir(dir) { | ||
if (!fs.existsSync(dir)) { | ||
fs.mkdirSync(dir) | ||
} | ||
} | ||
|
||
// svg will complain if the --out-dir does not exist | ||
ensureDir(svgrAssetsDir) | ||
ensureDir(svgrComponentsDir) | ||
|
||
console.log('Building ESM build...') | ||
|
||
exec('yarn babel --out-dir dist/esm --ignore=**/__tests__/**,**/docs/** src') | ||
|
||
// do these separately so we don't catch the svg font, it has no ignore option | ||
exec('yarn svgr --filename-case=camel --ext="svg.js" -d tmp/svgr/assets src/assets') | ||
exec('yarn svgr --filename-case=camel --ext="svg.js" -d tmp/svgr/components src/components') | ||
|
||
// now babel the icons | ||
exec('yarn babel --out-dir dist/esm tmp/svgr') |
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
Oops, something went wrong.