-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance build tooling; add a tdd target
- Loading branch information
Mike Nason
committed
Oct 23, 2016
1 parent
419f245
commit ed7f70c
Showing
6 changed files
with
90 additions
and
87 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import babel from 'rollup-plugin-babel'; | ||
import filesize from 'rollup-plugin-filesize'; | ||
import conditional from 'rollup-plugin-conditional'; | ||
import cleanup from 'rollup-plugin-cleanup'; | ||
|
||
// Valid build targets | ||
const supportedRuntimes = [ | ||
'client', | ||
'node' | ||
]; | ||
|
||
// NPM injects the name from `package.json` to this env var | ||
const pkgName = process.env.npm_package_name; | ||
|
||
// Pass to rollup via --environment flag | ||
const runtimeEnv = process.env.RUNTIME_ENV; | ||
|
||
if (!supportedRuntimes.includes(runtimeEnv)) { | ||
throw new Error( | ||
`Invalid runtime environment ${runtimeEnv} sepcified. Valid options: ${supportedRuntimes.join(', ')}` | ||
); | ||
} | ||
|
||
export default { | ||
entry: `src/${runtimeEnv}.js`, | ||
targets: [ | ||
{ | ||
dest: `dist/${runtimeEnv}.js`, | ||
sourceMap: `dist/${runtimeEnv}.map.js`, | ||
format: 'cjs' | ||
} | ||
], | ||
moduleId: pkgName, | ||
moduleName: pkgName, | ||
plugins: [ | ||
conditional({ | ||
condition: runtimeEnv === 'client', | ||
plugin: babel({ | ||
exclude: './node_modules/**', | ||
moduleIds: true, | ||
|
||
// Custom babelrc for build | ||
babelrc: false, | ||
presets: [ | ||
[ 'es2015', { 'modules': false } ], | ||
'stage-0' | ||
], | ||
plugins: [ | ||
'external-helpers' | ||
] | ||
}) | ||
}), | ||
|
||
cleanup({ | ||
comments: ['some', 'jsdoc'] | ||
}), | ||
|
||
filesize() | ||
] | ||
}; |
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