Skip to content

Commit 243f10d

Browse files
committed
feat(rollup.js): Integrated rollup.js in the build process
1 parent 2e316ce commit 243f10d

52 files changed

Lines changed: 5378 additions & 719 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.babelrc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
2-
"stage":2,
3-
"loose":"all",
4-
"optional":['runtime'],
5-
"compact":true
2+
presets:['es2015-rollup','stage-2'],
3+
plugins:['transform-regenerator']
64
}

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ node_js:
1414
- iojs
1515
before_install:
1616
- npm i -g npm@^2.0.0
17+
- npm i -g rollup
1718
before_script:
1819
- npm prune
1920
after_success:

Gruntfile.js

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
module.exports = function(grunt) {
22

3-
var webpack = require('webpack');
4-
var webpackConfig = require('./webpack.config.js');
53
var babel = require('rollup-plugin-babel');
64
var npm = require('rollup-plugin-npm');
75
var commonjs = require('rollup-plugin-commonjs');
86
var replace = require('rollup-plugin-replace');
97
var build = require('./build.json');
8+
var inject = require('rollup-plugin-inject')
109

1110
grunt.initConfig({
1211

@@ -37,8 +36,8 @@ module.exports = function(grunt) {
3736
tasks: ['sass', 'postcss']
3837
},
3938
js: {
40-
files: ['src/js/**/*.es6', 'build.json'],
41-
tasks: ['webpack:build-dev', 'uglify']
39+
files: ['src/js/**/*.es6', 'build.json','src/js/vendor/*.js'],
40+
tasks: ['rollup', 'uglify']
4241
}
4342
},
4443

@@ -59,14 +58,6 @@ module.exports = function(grunt) {
5958

6059
clean: ["dist"],
6160

62-
webpack: {
63-
options: webpackConfig,
64-
"build-dev": {
65-
devtool: "sourcemap",
66-
debug: true
67-
}
68-
},
69-
7061
'sprite': {
7162
all: {
7263
src: './assets/images/ejs_emojis/*.png',
@@ -148,22 +139,26 @@ module.exports = function(grunt) {
148139
}
149140
},
150141

151-
rollup: {
152-
options: {
153-
format: 'cjs',
154-
banner: "<%= meta.banner %>",
155-
plugins: [
156-
babel(),
157-
replace(build),
158-
npm({
159-
jsnext: true,
160-
main: true
161-
}),
162-
commonjs({
163-
include: 'node_modules/**'
164-
})
165-
]
166-
},
142+
rollup: {
143+
options: {
144+
format: 'umd',
145+
banner: "<%= meta.banner %>",
146+
externals:['regeneratorRuntime'],
147+
sourceMap:true,
148+
useStrict:true,
149+
sourceMapFile:'src/embed.js',
150+
plugins: [
151+
npm({
152+
jsnext: true,
153+
main: true
154+
}),
155+
commonjs({
156+
include: 'node_modules/**'
157+
}),
158+
babel(),
159+
replace(build)
160+
]
161+
},
167162
files: {
168163
src: 'src/js/embed.es6',
169164
dest: 'src/embed.js'
@@ -174,15 +169,14 @@ module.exports = function(grunt) {
174169
grunt.loadNpmTasks("grunt-contrib-watch");
175170
grunt.loadNpmTasks("grunt-postcss");
176171
grunt.loadNpmTasks("grunt-contrib-clean");
177-
grunt.loadNpmTasks("grunt-webpack");
178172
grunt.loadNpmTasks("grunt-spritesmith");
179173
grunt.loadNpmTasks('grunt-retinafy');
180174
grunt.loadNpmTasks("grunt-contrib-sass");
181175
grunt.loadNpmTasks("grunt-contrib-uglify");
182176
grunt.loadNpmTasks("grunt-contrib-connect");
183177
grunt.loadNpmTasks("grunt-rollup")
184178

185-
grunt.registerTask("default", ["webpack:build-dev", "sass", "connect", "watch"]);
186-
grunt.registerTask("build", ["clean", "build-emoji", "webpack:build-dev", "uglify", "postcss"]);
179+
grunt.registerTask("default", ["rollup", "sass", "connect", "watch"]);
180+
grunt.registerTask("build", ["clean", "build-emoji", "rollup", "uglify", "postcss"]);
187181
grunt.registerTask("build-emoji", ["retinafy", "sprite", "sass"]);
188182
};

build.json

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
{
2-
"EMOJI" : true,
3-
"LINK" : true,
4-
"TWITTER" : false,
5-
"SMILEY" : true,
6-
"HIGHLIGHTCODE" : true,
2+
"EMOJI" : "true",
3+
"LINK" : "true",
4+
"TWITTER" : "true",
5+
"SMILEY" : "true",
6+
"HIGHLIGHTCODE" : "true",
77

8-
"MARKDOWN" : false,
8+
"MARKDOWN" : "true",
99

10-
"MAP" : true,
10+
"MAP" : "true",
1111

12-
"YOUTUBE" : true,
13-
"VIMEO" : true,
14-
"TED" : true,
15-
"DAILYMOTION" : true,
16-
"USTREAM" : true,
17-
"LIVELEAK" : true,
18-
"VINE" : true,
19-
"YOUTUBE" : true,
20-
"BASICVIDEO" : true,
12+
"YOUTUBE" : "true",
13+
"VIMEO" : "true",
14+
"TED" : "true",
15+
"DAILYMOTION" : "true",
16+
"USTREAM" : "true",
17+
"LIVELEAK" : "true",
18+
"VINE" : "true",
19+
"YOUTUBE" : "true",
20+
"BASICVIDEO" : "true",
2121

2222

23-
"SPOTIFY" : true,
24-
"SOUNDCLOUD" : false,
25-
"BASICAUDIO" : true,
23+
"SPOTIFY" : "true",
24+
"SOUNDCLOUD" : "true",
25+
"BASICAUDIO" : "true",
2626

27-
"CODEPEN" : true,
28-
"IDEONE" : true,
29-
"JSBIN" : true,
30-
"JSFIDDLE" : true,
31-
"PLUNKER" : true,
32-
"GIST" : true,
27+
"CODEPEN" : "true",
28+
"IDEONE" : "true",
29+
"JSBIN" : "true",
30+
"JSFIDDLE" : "true",
31+
"PLUNKER" : "true",
32+
"GIST" : "true",
3333

34-
"FLICKR" : true,
35-
"BASICIMAGE" : true,
36-
"INSTAGRAM" : true
34+
"FLICKR" : "true",
35+
"BASICIMAGE" : "true",
36+
"INSTAGRAM" : "true"
3737
}

dist/embed.min.js

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,52 +34,42 @@
3434
],
3535
"license": "MIT",
3636
"devDependencies": {
37-
"autoprefixer-core": "^5.2.1",
38-
"babel": "^5.8.34",
39-
"babel-core": "^5.8.34",
40-
"babel-eslint": "^4.1.3",
41-
"babel-loader": "^5.3.2",
42-
"babel-runtime": "^5.8.34",
37+
"autoprefixer-core": "^6.0.1",
38+
"babel": "^6.1.18",
39+
"babel-core": "^6.2.1",
40+
"babel-eslint": "^4.1.6",
41+
"babel-preset-es2015-rollup": "^1.0.0",
4342
"chai": "^3.2.0",
44-
"commitizen": "^1.0.4",
45-
"cssnano": "^2.6.1",
43+
"commitizen": "^2.4.6",
44+
"cssnano": "^3.3.2",
4645
"cz-conventional-changelog": "^1.1.0",
4746
"es6-promise": "^3.0.2",
4847
"eslint": "^1.6.0",
49-
"eslint-loader": "^1.1.0",
50-
"exports-loader": "^0.6.2",
51-
"fetch-jsonp": "^0.9.2",
52-
"ghooks": "^0.3.2",
48+
"ghooks": "^1.0.1",
5349
"grunt": "~0.4.5",
5450
"grunt-cli": "~0.1.13",
55-
"grunt-contrib-clean": "^0.6.0",
51+
"grunt-contrib-clean": "^0.7.0",
5652
"grunt-contrib-connect": "^0.11.2",
5753
"grunt-contrib-csslint": "^0.5.0",
5854
"grunt-contrib-sass": "^0.9.2",
59-
"grunt-contrib-uglify": "^0.9.2",
55+
"grunt-contrib-uglify": "^0.11.0",
6056
"grunt-contrib-watch": "^0.6.1",
61-
"grunt-postcss": "^0.5.5",
57+
"grunt-postcss": "^0.7.1",
6258
"grunt-retinafy": "^0.1.5",
6359
"grunt-rollup": "^0.5.0",
64-
"grunt-spritesmith": "^5.1.1",
65-
"grunt-webpack": "^1.0.11",
66-
"imports-loader": "^0.6.4",
67-
"mocha": "^2.2.5",
60+
"grunt-spritesmith": "^6.1.0",
61+
"mocha": "^2.3.4",
6862
"promise": "^7.0.4",
69-
"regenerator": "^0.8.41",
7063
"rollup": "^0.21.0",
71-
"rollup-plugin-babel": "^1.0.0",
64+
"rollup-plugin-babel": "^2.x",
7265
"rollup-plugin-commonjs": "^1.4.0",
7366
"rollup-plugin-npm": "^1.1.0",
7467
"rollup-plugin-replace": "^1.1.0",
75-
"semantic-release": "^4.3.5",
76-
"webpack": "^1.12.2",
77-
"webpack-dev-server": "^1.12.0",
78-
"whatwg-fetch": "^0.9.0"
68+
"semantic-release": "^4.3.5"
7969
},
8070
"scripts": {
8171
"commit": "git-cz",
82-
"test": "mocha --compilers js:babel/register test/index.test.js",
72+
"test": "rollup -c && mocha test/bundle.test.js",
8373
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
8474
},
8575
"config": {

rollup.config.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
var babel = require('rollup-plugin-babel');
2+
var commonjs = require('rollup-plugin-commonjs');
3+
var npm = require('rollup-plugin-npm');
4+
5+
var config = {
6+
entry: 'test/index.test.js',
7+
dest: 'test/bundle.test.js',
8+
format: 'cjs',
9+
plugins: [
10+
babel(),
11+
npm({
12+
jsnext: true,
13+
main: true
14+
}),
15+
commonjs({
16+
include: 'node_modules/**'
17+
}),
18+
]
19+
}
20+
21+
module.exports = config

0 commit comments

Comments
 (0)