Skip to content

Commit

Permalink
feat(build): add banner to all output files
Browse files Browse the repository at this point in the history
  • Loading branch information
niklashigi committed Dec 25, 2017
1 parent 3a94dd3 commit 2c7748a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"lint-md": "remark .",
"test": "nyc mocha src/**/*.spec.ts --require ts-node/register --watch-extensions ts",
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
"build": "rollup -c && uglifyjs dist/contro.js -cm > dist/contro.min.js",
"build": "rollup -c && uglifyjs dist/contro.js --comments /^!/ -cm -o dist/contro.min.js",
"release": "semantic-release",
"clean": "rimraf .nyc_output coverage dist"
},
Expand Down
17 changes: 14 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import typescript from 'rollup-plugin-typescript'

const removeComments = () => ({
transform(code, id) {
code = code.replace(/\/\*[^*]+\*\/\s+/g, '')
return { code, map: { mappings: '' } }
transform(source, id) {
return source.replace(/\/\*[^*]+\*\/\s+/g, '')
}
})

const addBanner = () => ({
transformBundle(source) {
return `/*!
* Contro
* (c) 2017 Niklas Higi
* Released under the MIT License.
*/
` + source
}
})

Expand All @@ -14,6 +24,7 @@ export default {
typescript: require('typescript'),
}),
removeComments(),
addBanner(),
],
output: [
{
Expand Down

0 comments on commit 2c7748a

Please sign in to comment.