Skip to content

Commit ea4a7df

Browse files
author
Guillaume Chau
committed
refactor: use rollup and eslint
1 parent cb87986 commit ea4a7df

File tree

10 files changed

+6092
-10
lines changed

10 files changed

+6092
-10
lines changed

.babelrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"presets": [
3+
["env", { "modules": false }],
4+
"stage-0"
5+
],
6+
"plugins": [
7+
"external-helpers"
8+
]
9+
}

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
dist/

.eslintrc.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module.exports = {
2+
root: true,
3+
parser: 'babel-eslint',
4+
parserOptions: {
5+
sourceType: 'module'
6+
},
7+
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
8+
extends: 'standard',
9+
// required to lint *.vue files
10+
/* plugins: [
11+
'html'
12+
], */
13+
env: {
14+
browser: true,
15+
},
16+
// add your custom rules here
17+
rules: {
18+
// allow paren-less arrow functions
19+
'arrow-parens': 0,
20+
// allow async-await
21+
'generator-star-spacing': 0,
22+
// allow debugger during development
23+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
24+
// trailing comma
25+
'comma-dangle': ['error', 'always-multiline'],
26+
// beware of returning assignement
27+
'no-return-assign': 'off',
28+
'no-extend-native': 'warn',
29+
},
30+
globals: {
31+
Meteor: false,
32+
Tracker: false,
33+
},
34+
}

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
src/
2+
build/
3+
.babelrc
4+
.eslintrc.js

build/rollup.config.base.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import babel from 'rollup-plugin-babel'
2+
import cjs from 'rollup-plugin-commonjs'
3+
import replace from 'rollup-plugin-replace'
4+
import resolve from 'rollup-plugin-node-resolve'
5+
6+
const config = require('../package.json')
7+
8+
export default {
9+
input: 'src/index.js',
10+
plugins: [
11+
resolve({
12+
jsnext: true,
13+
main: true,
14+
browser: true,
15+
}),
16+
cjs({
17+
exclude: 'src/**',
18+
}),
19+
babel({
20+
exclude: 'node_modules/**',
21+
}),
22+
replace({
23+
VERSION: JSON.stringify(config.version),
24+
}),
25+
],
26+
}

build/rollup.config.browser.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import base from './rollup.config.base'
2+
import uglify from 'rollup-plugin-uglify'
3+
import { minify } from 'uglify-es'
4+
5+
const config = Object.assign({}, base, {
6+
output: {
7+
file: 'dist/vue-meteor-tracker.min.js',
8+
format: 'iife',
9+
name: 'VueMeteorTracker',
10+
},
11+
})
12+
13+
config.plugins.push(uglify({}, minify))
14+
15+
export default config

build/rollup.config.es.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import base from './rollup.config.base'
2+
3+
const config = Object.assign({}, base, {
4+
output: {
5+
file: 'dist/vue-meteor-tracker.esm.js',
6+
format: 'es',
7+
name: 'vue-meteor-tracker',
8+
},
9+
})
10+
11+
export default config

build/rollup.config.umd.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import base from './rollup.config.base'
2+
3+
const config = Object.assign({}, base, {
4+
output: {
5+
file: 'dist/vue-meteor-tracker.umd.js',
6+
format: 'umd',
7+
name: 'vue-meteor-tracker',
8+
},
9+
})
10+
11+
export default config

0 commit comments

Comments
 (0)