Skip to content

Commit 518f67c

Browse files
authored
Merge pull request #77 from js-accounts/feat/umd
chore(build): added support for UMD build along with ES6 build
2 parents 0564a19 + eeae236 commit 518f67c

File tree

9 files changed

+295
-29
lines changed

9 files changed

+295
-29
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
lib/
2+
lib-es6/
23
node_modules/
34
coverage/
45
npm-debug.log

packages/client/package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
{
22
"name": "@accounts/client",
3-
"version": "0.0.8",
3+
"version": "0.0.8-alpha.840bab8d",
44
"description": "Fullstack authentication and accounts-management",
55
"main": "lib/index.js",
6+
"jsnext:main": "lib-es6/index.js",
67
"publishConfig": {
78
"access": "public"
89
},
910
"scripts": {
1011
"start": "webpack -p --config --progress --watch",
11-
"compile": "babel ./src --out-dir ./lib",
12+
"compile": "npm run compile:es6 && npm run compile:umd",
13+
"compile:es6": "babel ./src --out-dir ./lib-es6",
14+
"compile:umd": "webpack",
1215
"postcompile": "npm run flow:prepublish",
1316
"prepublish": "npm run compile",
1417
"test": "npm run testonly",
1518
"test-ci": "npm lint && npm coverage",
1619
"testonly": "jest",
1720
"flow:check": "flow check",
1821
"flow:gen": "flow gen-flow-files ./src/index.js > ./lib/index.js.flow",
19-
"flow:prepublish": "for i in `ls ./src/*.js`; do cp $i `echo $i | sed \"s/src/lib/g\" | sed \"s/js/js\\.flow/g\"`; done",
22+
"flow:prepublish": "for i in `ls ./src/*.js`; do cp $i `echo $i | sed \"s/src/lib-es6/g\" | sed \"s/js/js\\.flow/g\"`; done",
2023
"coverage": "npm run testonly -- --coverage",
2124
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
2225
},
@@ -52,8 +55,10 @@
5255
"babel-plugin-transform-flow-strip-types": "^6.21.0",
5356
"babel-plugin-transform-object-rest-spread": "^6.16.0",
5457
"babel-plugin-transform-regenerator": "^6.16.1",
58+
"babel-plugin-transform-runtime": "^6.23.0",
5559
"babel-preset-es2015": "^6.18.0",
5660
"babel-preset-es2015-node4": "^2.1.0",
61+
"babel-preset-stage-0": "^6.22.0",
5762
"coveralls": "^2.11.14",
5863
"flow-bin": "^0.39.0",
5964
"jest": "^18.0.0",
@@ -64,7 +69,7 @@
6469
"webpack-node-externals": "^1.5.4"
6570
},
6671
"dependencies": {
67-
"@accounts/common": "^0.0.7",
72+
"@accounts/common": "^0.0.8-alpha.840bab8d",
6873
"immutable": "^3.8.1",
6974
"jwt-decode": "^2.1.0",
7075
"lodash": "^4.16.4",

packages/client/src/AccountsClient.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,14 @@ export class AccountsClient {
204204
this.store.dispatch(setUser(res.user));
205205
this.options.onSignedInHook();
206206
if (callback && isFunction(callback)) {
207-
callback();
207+
callback(null, res);
208208
}
209+
210+
return res;
209211
} catch (err) {
210212
this.store.dispatch(loggingIn(false));
211213
if (callback && isFunction(callback)) {
212-
callback(err);
214+
callback(err, null);
213215
}
214216
throw new AccountsError(err.message);
215217
}

packages/client/webpack.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ module.exports = {
2121
test: /\.js$/,
2222
loader: 'babel',
2323
exclude: /node_modules/,
24+
query: {
25+
babelrc: false,
26+
presets: ['es2015', 'stage-0'],
27+
plugins: [
28+
'transform-flow-strip-types',
29+
'transform-runtime',
30+
],
31+
}
2432
},
2533
],
2634
},

packages/common/package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
{
22
"name": "@accounts/common",
3-
"version": "0.0.7",
3+
"version": "0.0.8-alpha.840bab8d",
44
"description": "Fullstack authentication and accounts-management",
55
"main": "lib/index.js",
6+
"jsnext:main": "lib-es6/index.js",
67
"publishConfig": {
78
"access": "public"
89
},
910
"scripts": {
1011
"start": "webpack -p --config --progress --watch",
11-
"compile": "babel ./src --out-dir ./lib",
12+
"compile": "npm run compile:es6 && npm run compile:umd",
13+
"compile:es6": "babel ./src --out-dir ./lib-es6",
14+
"compile:umd": "webpack",
1215
"postcompile": "npm run flow:prepublish",
1316
"prepublish": "npm run compile",
1417
"test": "npm run testonly",
1518
"test-ci": "npm lint && npm coverage",
1619
"testonly": "jest",
1720
"flow:check": "flow check",
1821
"flow:gen": "flow gen-flow-files ./src/index.js > ./lib/index.js.flow",
19-
"flow:prepublish": "for i in `ls ./src/*.js`; do cp $i `echo $i | sed \"s/src/lib/g\" | sed \"s/js/js\\.flow/g\"`; done",
22+
"flow:prepublish": "for i in `ls ./src/*.js`; do cp $i `echo $i | sed \"s/src/lib-es6/g\" | sed \"s/js/js\\.flow/g\"`; done",
2023
"coverage": "npm run testonly -- --coverage",
2124
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
2225
},
@@ -53,8 +56,10 @@
5356
"babel-plugin-transform-flow-strip-types": "^6.21.0",
5457
"babel-plugin-transform-object-rest-spread": "^6.16.0",
5558
"babel-plugin-transform-regenerator": "^6.16.1",
59+
"babel-plugin-transform-runtime": "^6.23.0",
5660
"babel-preset-es2015": "^6.18.0",
5761
"babel-preset-es2015-node4": "^2.1.0",
62+
"babel-preset-stage-0": "^6.22.0",
5863
"coveralls": "^2.11.14",
5964
"flow-bin": "^0.39.0",
6065
"jest": "^18.0.0",

packages/common/webpack.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ module.exports = {
2121
test: /\.js$/,
2222
loader: 'babel',
2323
exclude: /node_modules/,
24+
query: {
25+
babelrc: false,
26+
presets: ['es2015', 'stage-0'],
27+
plugins: [
28+
'transform-flow-strip-types',
29+
'transform-runtime',
30+
],
31+
}
2432
},
2533
],
2634
},

packages/server/package.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
{
22
"name": "@accounts/server",
3-
"version": "0.0.8",
3+
"version": "0.0.8-alpha.840bab8d",
44
"description": "Fullstack authentication and accounts-management",
55
"main": "lib/index.js",
6+
"jsnext:main": "lib-es6/index.js",
67
"publishConfig": {
78
"access": "public"
89
},
910
"scripts": {
1011
"start": "webpack -p --config --progress --watch",
11-
"compile": "babel ./src --out-dir ./lib",
12+
"compile": "npm run compile:es6 && npm run compile:umd",
13+
"compile:es6": "babel ./src --out-dir ./lib-es6",
14+
"compile:umd": "webpack",
1215
"postcompile": "npm run flow:prepublish",
1316
"prepublish": "npm run compile",
1417
"test": "npm run testonly",
1518
"test-ci": "npm lint && npm coverage",
1619
"testonly": "jest",
1720
"flow:check": "flow check",
18-
"flow:prepublish": "for i in `ls ./src/*.js`; do cp $i `echo $i | sed \"s/src/lib/g\" | sed \"s/js/js\\.flow/g\"`; done",
21+
"flow:prepublish": "for i in `ls ./src/*.js`; do cp $i `echo $i | sed \"s/src/lib-es6/g\" | sed \"s/js/js\\.flow/g\"`; done",
1922
"coverage": "npm run testonly -- --coverage",
2023
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
2124
},
@@ -43,7 +46,8 @@
4346
"author": "Tim Mikeladze",
4447
"license": "MIT",
4548
"dependencies": {
46-
"@accounts/common": "^0.0.7",
49+
"@accounts/common": "^0.0.8-alpha.840bab8d",
50+
"babel-polyfill": "^6.23.0",
4751
"bcryptjs": "^2.4.0",
4852
"crypto": "^0.0.3",
4953
"emailjs": "^1.0.8",
@@ -60,8 +64,10 @@
6064
"babel-plugin-transform-flow-strip-types": "^6.21.0",
6165
"babel-plugin-transform-object-rest-spread": "^6.16.0",
6266
"babel-plugin-transform-regenerator": "^6.16.1",
67+
"babel-plugin-transform-runtime": "^6.23.0",
6368
"babel-preset-es2015": "^6.18.0",
6469
"babel-preset-es2015-node4": "^2.1.0",
70+
"babel-preset-stage-0": "^6.22.0",
6571
"coveralls": "^2.11.14",
6672
"flow-bin": "^0.39.0",
6773
"jest": "^18.0.0",

packages/server/webpack.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ module.exports = {
2121
test: /\.js$/,
2222
loader: 'babel',
2323
exclude: /node_modules/,
24+
query: {
25+
babelrc: false,
26+
presets: ['es2015', 'stage-0'],
27+
plugins: [
28+
'transform-flow-strip-types',
29+
'transform-runtime',
30+
],
31+
}
2432
},
2533
],
2634
},

0 commit comments

Comments
 (0)