Skip to content

Instantly share code, notes, and snippets.

🤖
boop. boop. boop beep boop.

Aurélien Delogu pyrsmk

🤖
boop. boop. boop beep boop.
Block or report user

Report or block pyrsmk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pyrsmk
pyrsmk / just-task.js
Created Jul 23, 2019
Just task example with source()
View just-task.js
task('bundle', () => {
source('src/MyLib.ts').rollup({
format: 'umd',
name: 'mylib',
plugins: [
typescript(),
prepack(),
],
}).tofile('dist/mylib.js')
}))
@pyrsmk
pyrsmk / uglify.js
Created Jul 23, 2019
Uglify task for Just
View uglify.js
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',
}
@pyrsmk
pyrsmk / eslint.js
Created Jul 23, 2019
Eslint task for Just
View eslint.js
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')
@pyrsmk
pyrsmk / rollup.js
Created Jul 23, 2019
Rollup task for Just
View rollup.js
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(),
@pyrsmk
pyrsmk / taskfile.js
Created Jun 13, 2019
Systèmes de build : taskr
View taskfile.js
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/**'])
@pyrsmk
pyrsmk / Gruntfile.js
Last active Jun 13, 2019
Systèmes de build : Grunt
View Gruntfile.js
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: {
@pyrsmk
pyrsmk / gulpfile.js
Last active Jun 13, 2019
Systèmes de build : Gulp
View gulpfile.js
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')
@pyrsmk
pyrsmk / just-task.js
Last active Jun 13, 2019
Systèmes de build : Just
View just-task.js
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()
@pyrsmk
pyrsmk / package.json
Last active Jun 10, 2019
Systèmes de build : scripts NPM
View package.json
{
"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",
}
}
@pyrsmk
pyrsmk / build.js
Last active Jun 13, 2019
Systèmes de build : vanilla JS
View build.js
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))
You can’t perform that action at this time.