-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pencil): Remove coverage from dist (#9)
* fix(pencil): Remove coverage from dist
- Loading branch information
Showing
6 changed files
with
156 additions
and
123 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,9 +1,68 @@ | ||
module.exports = { | ||
presets: ['@babel/preset-env', '@babel/preset-react'], | ||
plugins: [ | ||
['@babel/plugin-proposal-class-properties', {loose: true}], | ||
'@babel/plugin-transform-destructuring', | ||
['@babel/plugin-proposal-object-rest-spread', {loose: true}], | ||
'istanbul' | ||
] | ||
'use strict'; | ||
// Grab the env in the same fashion as Babel core | ||
const env = process.env.BABEL_ENV || 'default'; | ||
const presetReact = require('@babel/preset-react'); | ||
|
||
// Define shared configuration | ||
const DEFAULT_PLUGINS = [ | ||
['@babel/plugin-proposal-class-properties', {loose: true}], | ||
'@babel/plugin-transform-destructuring', | ||
['@babel/plugin-proposal-object-rest-spread', {loose: true}] | ||
]; | ||
const PRESET_ENV_CONFIG = { | ||
loose: true | ||
}; | ||
const PRESET_ENV_CONFIG_MOD_FALSE = { | ||
...PRESET_ENV_CONFIG, | ||
modules: false | ||
}; | ||
const TRANSFORM_IMPORT_CONFIG = { | ||
original: '^(.+?)\\.less$', | ||
replacement: '$1.css' | ||
}; | ||
|
||
const environments = { | ||
default: { | ||
presets: [ | ||
[require.resolve('@babel/preset-env'), PRESET_ENV_CONFIG], | ||
presetReact | ||
], | ||
plugins: DEFAULT_PLUGINS, | ||
comments: false | ||
}, | ||
esm: { | ||
presets: [ | ||
[require.resolve('@babel/preset-env'), PRESET_ENV_CONFIG_MOD_FALSE], | ||
presetReact | ||
], | ||
plugins: [ | ||
...DEFAULT_PLUGINS, | ||
['transform-rename-import', TRANSFORM_IMPORT_CONFIG] | ||
], | ||
comments: false | ||
}, | ||
modern: { | ||
presets: [ | ||
[require.resolve('@babel/preset-env'), PRESET_ENV_CONFIG], | ||
presetReact | ||
], | ||
plugins: [ | ||
...DEFAULT_PLUGINS, | ||
['transform-rename-import', TRANSFORM_IMPORT_CONFIG] | ||
], | ||
comments: false | ||
}, | ||
umd: { | ||
presets: [ | ||
[require.resolve('@babel/preset-env'), PRESET_ENV_CONFIG_MOD_FALSE], | ||
presetReact | ||
], | ||
plugins: DEFAULT_PLUGINS, | ||
comments: false | ||
} | ||
}; | ||
|
||
module.exports = (api) => { | ||
api.cache(false); | ||
return environments[env]; | ||
}; |
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,5 @@ | ||
// jest.config.js | ||
module.exports = { | ||
testEnvironment: 'jsdom', | ||
testMatch: ['**/tests/unit/*.test.js'] | ||
}; |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.