Skip to content

Commit

Permalink
build: config files for building
Browse files Browse the repository at this point in the history
  • Loading branch information
msanguineti committed Apr 8, 2019
1 parent 174c23b commit a7cc3ce
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 3 deletions.
16 changes: 16 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = function (api) {
api.cache(true);

const presets = [["@babel/env", {
"targets": {
"node": true
}
}],
"@babel/preset-typescript"]
const plugins = []

return {
presets,
plugins
};
}
78 changes: 76 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"build": "rollup -c"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -37,6 +38,7 @@
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-node-resolve": "^4.2.1",
"rollup-plugin-terser": "^4.0.4",
"typescript": "^3.4.2"
}
}
44 changes: 44 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import resolve from 'rollup-plugin-node-resolve'
import cjs from 'rollup-plugin-commonjs'
import babel from 'rollup-plugin-babel'
import { terser } from 'rollup-plugin-terser'


const preamble = `#!/usr/bin/env node
//Copyright (c) 2019 Mirco Sanguineti
//This software is released under the MIT License.
//https://opensource.org/licenses/MIT
`

const extensions = [
'.js', '.ts',
]

const input = 'src/gof.ts'

const plugins = [
resolve({ extensions }),
cjs(),
babel({ extensions, include: ['src/**/*'] }),
terser({ output: { beautify: true, preamble: preamble } })
]

const output = {
file: 'bin/gof.js',
format: 'cjs'
}


export default {
input,

// Specify here external modules which you don't want to include in your bundle (for instance: 'lodash', 'moment' etc.)
// https://rollupjs.org/guide/en#external-e-external
// external: [],

plugins,

output,
}
3 changes: 3 additions & 0 deletions src/gof.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default (name: string): string => {
return `Hello ${name}`
}

0 comments on commit a7cc3ce

Please sign in to comment.