Skip to content

Commit 8b022ac

Browse files
committed
Merge pull request ritz078#49 from ritz078/feat/rollup
Feat/rollup
2 parents 1a91bf9 + 0c2d59c commit 8b022ac

54 files changed

Lines changed: 5535 additions & 4015 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: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
module.exports = function(grunt) {
22

3-
var webpack = require('webpack');
4-
var webpackConfig = require('./webpack.config.js');
3+
var babel = require('rollup-plugin-babel');
4+
var npm = require('rollup-plugin-npm');
5+
var commonjs = require('rollup-plugin-commonjs');
6+
var replace = require('rollup-plugin-replace');
7+
var build = require('./build.json');
58

69
grunt.initConfig({
710

@@ -32,8 +35,8 @@ module.exports = function(grunt) {
3235
tasks: ['sass', 'postcss']
3336
},
3437
js: {
35-
files: ['src/js/**/*.es6', 'build.json'],
36-
tasks: ['webpack:build-dev', 'uglify']
38+
files: ['src/js/**/*.es6', 'build.json','src/js/vendor/*.js'],
39+
tasks: ['rollup', 'uglify']
3740
}
3841
},
3942

@@ -54,14 +57,6 @@ module.exports = function(grunt) {
5457

5558
clean: ["dist"],
5659

57-
webpack: {
58-
options: webpackConfig,
59-
"build-dev": {
60-
devtool: "sourcemap",
61-
debug: true
62-
}
63-
},
64-
6560
'sprite': {
6661
all: {
6762
src: './assets/images/ejs_emojis/*.png',
@@ -141,20 +136,46 @@ module.exports = function(grunt) {
141136
}
142137
}
143138
}
139+
},
140+
141+
rollup: {
142+
options: {
143+
format: 'umd',
144+
banner: "<%= meta.banner %>",
145+
externals:['regeneratorRuntime'],
146+
sourceMap:true,
147+
useStrict:true,
148+
sourceMapFile:'src/embed.js',
149+
plugins: [
150+
npm({
151+
jsnext: true,
152+
main: true
153+
}),
154+
commonjs({
155+
include: 'node_modules/**'
156+
}),
157+
babel(),
158+
replace(build)
159+
]
160+
},
161+
files: {
162+
src: 'src/js/embed.es6',
163+
dest: 'src/embed.js'
164+
}
144165
}
145166
});
146167

147168
grunt.loadNpmTasks("grunt-contrib-watch");
148169
grunt.loadNpmTasks("grunt-postcss");
149170
grunt.loadNpmTasks("grunt-contrib-clean");
150-
grunt.loadNpmTasks("grunt-webpack");
151171
grunt.loadNpmTasks("grunt-spritesmith");
152172
grunt.loadNpmTasks('grunt-retinafy');
153173
grunt.loadNpmTasks("grunt-contrib-sass");
154174
grunt.loadNpmTasks("grunt-contrib-uglify");
155175
grunt.loadNpmTasks("grunt-contrib-connect");
176+
grunt.loadNpmTasks("grunt-rollup")
156177

157-
grunt.registerTask("default", ["webpack:build-dev", "sass", "connect", "watch"]);
158-
grunt.registerTask("build", ["clean", "build-emoji", "webpack:build-dev", "uglify", "postcss"]);
178+
grunt.registerTask("default", ["rollup", "sass", "connect", "watch"]);
179+
grunt.registerTask("build", ["clean", "build-emoji", "rollup", "uglify", "postcss"]);
159180
grunt.registerTask("build-emoji", ["retinafy", "sprite", "sass"]);
160181
};

build.json

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

9-
"MARKDOWN" : true,
8+
"MARKDOWN" : "true",
109

11-
"MAP" : true,
10+
"MAP" : "true",
1211

13-
"YOUTUBE" : true,
14-
"VIMEO" : true,
15-
"TED" : true,
16-
"DAILYMOTION" : true,
17-
"USTREAM" : true,
18-
"LIVELEAK" : true,
19-
"VINE" : true,
20-
"YOUTUBE" : true,
21-
"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",
2221

2322

24-
"SPOTIFY" : true,
25-
"SOUNDCLOUD" : true,
26-
"BASICAUDIO" : true,
23+
"SPOTIFY" : "true",
24+
"SOUNDCLOUD" : "true",
25+
"BASICAUDIO" : "true",
2726

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

35-
"FLICKR" : true,
36-
"BASICIMAGE" : true,
37-
"INSTAGRAM" : true
38-
}
34+
"FLICKR" : "true",
35+
"BASICIMAGE" : "true",
36+
"INSTAGRAM" : "true"
3937
}

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: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,45 +34,44 @@
3434
],
3535
"license": "MIT",
3636
"devDependencies": {
37-
"autoprefixer-core": "^5.2.1",
38-
"babel": "^5.8.23",
39-
"babel-core": "^5.8.25",
40-
"babel-eslint": "^4.1.3",
41-
"babel-loader": "^5.3.2",
42-
"babel-runtime": "^5.8.25",
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-plugin-transform-regenerator": "^6.2.0",
42+
"babel-preset-es2015-rollup": "^1.0.0",
43+
"babel-preset-stage-2": "^6.1.18",
4344
"chai": "^3.2.0",
44-
"commitizen": "^1.0.4",
45-
"cssnano": "^2.6.1",
45+
"commitizen": "^2.4.6",
46+
"cssnano": "^3.3.2",
4647
"cz-conventional-changelog": "^1.1.0",
4748
"es6-promise": "^3.0.2",
4849
"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",
50+
"ghooks": "^1.0.1",
5351
"grunt": "~0.4.5",
5452
"grunt-cli": "~0.1.13",
55-
"grunt-contrib-clean": "^0.6.0",
53+
"grunt-contrib-clean": "^0.7.0",
5654
"grunt-contrib-connect": "^0.11.2",
5755
"grunt-contrib-csslint": "^0.5.0",
5856
"grunt-contrib-sass": "^0.9.2",
59-
"grunt-contrib-uglify": "^0.9.2",
57+
"grunt-contrib-uglify": "^0.11.0",
6058
"grunt-contrib-watch": "^0.6.1",
61-
"grunt-postcss": "^0.5.5",
59+
"grunt-postcss": "^0.7.1",
6260
"grunt-retinafy": "^0.1.5",
63-
"grunt-spritesmith": "^5.1.1",
64-
"grunt-webpack": "^1.0.11",
65-
"imports-loader": "^0.6.4",
66-
"mocha": "^2.2.5",
67-
"regenerator": "^0.8.41",
68-
"semantic-release": "^4.3.5",
69-
"webpack": "^1.12.2",
70-
"webpack-dev-server": "^1.12.0",
71-
"whatwg-fetch": "^0.9.0"
61+
"grunt-rollup": "^0.5.0",
62+
"grunt-spritesmith": "^6.1.0",
63+
"mocha": "^2.3.4",
64+
"promise": "^7.0.4",
65+
"rollup": "^0.21.0",
66+
"rollup-plugin-babel": "^2.x",
67+
"rollup-plugin-commonjs": "^1.4.0",
68+
"rollup-plugin-npm": "^1.1.0",
69+
"rollup-plugin-replace": "^1.1.0",
70+
"semantic-release": "^4.3.5"
7271
},
7372
"scripts": {
7473
"commit": "git-cz",
75-
"test": "mocha --compilers js:babel/register test/index.test.js",
74+
"test": "rollup -c && mocha test/bundle.test.js",
7675
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
7776
},
7877
"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)