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
const { CLIEngine } = require('eslint') | |
const rollup = require('rollup') | |
const typescript = require('rollup-plugin-typescript2') | |
const prepack = require('rollup-plugin-prepack-up') | |
const uglify = require('uglify-js') | |
const fs = require('fs') | |
const chalk = require('chalk') | |
const info = message => { | |
console.info(chalk.yellow(' * ') + chalk.green(message)) |
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
{ | |
"scripts": { | |
"build": "yarn lint && yarn bundle && yarn minify && yarn minify-dev", | |
"lint": "eslint 'src/**'", | |
"bundle": "rollup -c", | |
"minify": "uglifyjs dist/toast.js -o dist/toast.min.js", | |
"minify-dev": "uglifyjs dist/toast.js -o tests/lib/toast.min.js --source-map filename=toast.js,url=inline && rm tests/lib/toast.min.js.map", | |
} | |
} |
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
const { task, series, logger } = require('just-task') | |
const { CLIEngine } = require('eslint') | |
const rollup = require('rollup') | |
const typescript = require('rollup-plugin-typescript2') | |
const prepack = require('rollup-plugin-prepack-up') | |
const uglify = require('uglify-js') | |
const fs = require('fs') | |
const lint = options => { | |
const eslint = new CLIEngine() |
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
const { src, dest, series } = require('gulp') | |
const eslint = require('gulp-eslint') | |
const rollup = require('gulp-better-rollup') | |
const typescript = require('rollup-plugin-typescript2') | |
const prepack = require('rollup-plugin-prepack-up') | |
const ts = require('gulp-typescript') | |
const sourcemaps = require('gulp-sourcemaps') | |
const uglify = require('gulp-uglify') | |
const rename = require('gulp-rename') |
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
const typescript = require('rollup-plugin-typescript2') | |
const prepack = require('rollup-plugin-prepack-up') | |
module.exports = grunt => { | |
grunt.loadNpmTasks('grunt-eslint') | |
grunt.loadNpmTasks('grunt-rollup') | |
grunt.loadNpmTasks('grunt-contrib-uglify') | |
grunt.initConfig({ | |
eslint: { |
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
const { CLIEngine } = require('eslint') | |
const rollup = require('rollup') | |
const typescript = require('rollup-plugin-typescript2') | |
const prepack = require('rollup-plugin-prepack-up') | |
exports.lint = function* () { | |
yield new Promise((resolve, reject) => { | |
const eslint = new CLIEngine() | |
const formatter = eslint.getFormatter() | |
const { results } = eslint.executeOnFiles(['src/**']) |
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
const rollup = require('rollup') | |
const typescript = require('rollup-plugin-typescript2') | |
const prepack = require('rollup-plugin-prepack-up') | |
module.exports = async options => { | |
await rollup.rollup({ | |
input: options.input, | |
plugins: [ | |
typescript({ useTsconfigDeclarationDir: true }), | |
prepack(), |
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
const { CLIEngine } = require('eslint') | |
const { logger } = require('just-task') | |
module.exports = options => { | |
const eslint = new CLIEngine() | |
const formatter = eslint.getFormatter() | |
const { results } = eslint.executeOnFiles([options.glob]) | |
if (results.reduce((value, item) => value + item.errorCount, 0)) { | |
logger.info(formatter(results)) | |
throw new Error('Linter has found errors') |
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
const uglify = require('uglify-js') | |
const fs = require('fs') | |
module.exports = async options => { | |
const params = {} | |
if ('sourcemap' in options && 'filename' in options) { | |
params.sourceMap = { | |
filename: options.filename, | |
url: 'inline', | |
} |
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
task('bundle', () => { | |
source('src/MyLib.ts').rollup({ | |
format: 'umd', | |
name: 'mylib', | |
plugins: [ | |
typescript(), | |
prepack(), | |
], | |
}).tofile('dist/mylib.js') | |
})) |
OlderNewer