Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
demiazz committed May 4, 2017
1 parent e04695e commit ac1a402
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 52 deletions.
5 changes: 3 additions & 2 deletions build/bundle/commonjs.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
const { writeFileSync } = require("fs");
const { dirname } = require("path");
const { sync: makeDirectory } = require("mkdirp");
const { transform } = require("./babel");
const banner = require("./banner");
const { prettify } = require("./prettify");
const sources = require("./sources");

function build() {
makeDirectory("lib");

Object.keys(sources).forEach(file => {
const dest = `lib/${file}`;
const code = transform(sources[file], "commonjs");
const prettified = prettify(code).replace(/\/\* @flow \*\/\n/, "");
const bannered = `${banner.base}${prettified}`;

makeDirectory(dirname(dest));

writeFileSync(dest, bannered);
});
}
Expand Down
5 changes: 3 additions & 2 deletions build/bundle/es.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
const { writeFileSync } = require("fs");
const { dirname } = require("path");
const { sync: makeDirectory } = require("mkdirp");
const banner = require("./banner");
const { prettify } = require("./prettify");
const sources = require("./sources");

function build() {
makeDirectory("lib");

Object.keys(sources).forEach(file => {
const dest = `lib/${file}.flow`;
const code = prettify(sources[file]).replace(/\/\* @flow \*\/\n/, "");
const bannered = `${banner.flow}${code}`;

makeDirectory(dirname(dest));

writeFileSync(dest, bannered);
});
}
Expand Down
13 changes: 10 additions & 3 deletions build/bundle/sources.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
const { readdirSync, readFileSync } = require("fs");
const { readFileSync } = require("fs");
const { relative, resolve } = require("path");
const walkSync = require("klaw-sync");

const sources = readdirSync("src").reduce((result, file) => {
result[file] = readFileSync(`src/${file}`).toString();
const sourceRoot = resolve(__dirname, "../../src");

const sources = walkSync(sourceRoot, { nodir: true }).reduce((result, file) => {
const absolutePath = file.path;
const relativePath = relative(sourceRoot, absolutePath);

result[relativePath] = readFileSync(absolutePath).toString();

return result;
}, {});
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"karma-sauce-launcher": "^1.1.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.31",
"klaw-sync": "^2.1.0",
"lint-staged": "^3.4.1",
"mkdirp": "^0.5.1",
"phantomjs-prebuilt": "^2.1.13",
Expand Down
99 changes: 54 additions & 45 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ ajv-keywords@^1.0.0:
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c"

ajv@^4.7.0, ajv@^4.9.1:
version "4.11.7"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.7.tgz#8655a5d86d0824985cc471a1d913fb6729a0ec48"
version "4.11.8"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536"
dependencies:
co "^4.6.0"
json-stable-stringify "^1.0.1"
Expand Down Expand Up @@ -991,8 +991,8 @@ binary-extensions@^1.0.0:
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.8.0.tgz#48ec8d16df4377eae5fa5884682480af4d95c774"

bl@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.0.tgz#1397e7ec42c5f5dc387470c500e34a9f6be9ea98"
version "1.2.1"
resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.1.tgz#cac328f7bee45730d404b692203fcb590e172d5e"
dependencies:
readable-stream "^2.0.5"

Expand Down Expand Up @@ -1324,7 +1324,7 @@ [email protected]:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"

[email protected], concat-stream@~1.5.0:
[email protected]:
version "1.5.0"
resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.5.0.tgz#53f7d43c51c5e43f81c8fdd03321c631be68d611"
dependencies:
Expand All @@ -1340,6 +1340,14 @@ concat-stream@^1.4.7, concat-stream@^1.5.0, concat-stream@^1.5.2:
readable-stream "^2.2.2"
typedarray "^0.0.6"

concat-stream@~1.5.0:
version "1.5.2"
resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.5.2.tgz#708978624d856af41a5a741defdd261da752c266"
dependencies:
inherits "~2.0.1"
readable-stream "~2.0.0"
typedarray "~0.0.5"

connect@^3.6.0:
version "3.6.1"
resolved "https://registry.yarnpkg.com/connect/-/connect-3.6.1.tgz#b7760693a74f0454face1d9378edb3f885b43227"
Expand Down Expand Up @@ -1474,8 +1482,8 @@ [email protected]:
resolved "https://registry.yarnpkg.com/debug/-/debug-0.7.4.tgz#06e1ea8082c2cb14e39806e22e2f6f757f92af39"

debug@2, debug@^2.1.1, debug@^2.2.0:
version "2.6.5"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.5.tgz#7a76247781acd4ef2a85f0fb8abf763cd1af249e"
version "2.6.6"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.6.tgz#a9fa6fbe9ca43cf1e79f73b75c0189cbb7d6db5a"
dependencies:
ms "0.7.3"

Expand Down Expand Up @@ -2048,8 +2056,8 @@ extend-shallow@^2.0.1:
is-extendable "^0.1.0"

extend@3, extend@^3.0.0, extend@~3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.0.tgz#5a474353b9f3353ddd8176dfd37b91c83a46f1d4"
version "3.0.1"
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444"

extglob@^0.3.1:
version "0.3.2"
Expand Down Expand Up @@ -2101,8 +2109,8 @@ file-entry-cache@^2.0.0:
object-assign "^4.0.1"

filename-regex@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.0.tgz#996e3e80479b98b9897f15a8a58b3d084e926775"
version "2.0.1"
resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26"

fill-range@^2.1.0:
version "2.2.3"
Expand Down Expand Up @@ -2363,7 +2371,7 @@ globby@^5.0.0:
pify "^2.0.0"
pinkie-promise "^2.0.0"

graceful-fs@^4.0.0, graceful-fs@^4.1.0, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
graceful-fs@^4.0.0, graceful-fs@^4.1.0, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"

Expand All @@ -2382,8 +2390,8 @@ [email protected]:
vinyl "^1.0.0"

handlebars@^4.0.1:
version "4.0.6"
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.6.tgz#2ce4484850537f9c97a8026d5399b935c4ed4ed7"
version "4.0.8"
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.8.tgz#22b875cd3f0e6cbea30314f144e82bc7a72ff420"
dependencies:
async "^1.4.0"
optimist "^0.6.1"
Expand Down Expand Up @@ -2549,8 +2557,8 @@ [email protected]:
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb"

ignore@^3.2.0:
version "3.2.7"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.7.tgz#4810ca5f1d8eca5595213a34b94f2eb4ed926bbd"
version "3.3.0"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.0.tgz#3812d22cbe9125f2c2b4915755a1b8abd745a001"

imurmurhash@^0.1.4:
version "0.1.4"
Expand Down Expand Up @@ -2829,8 +2837,8 @@ is-windows@^0.2.0:
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-0.2.0.tgz#de1aa6d63ea29dd248737b69f1ff8b8002d2108c"

is-windows@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.0.tgz#c61d61020c3ebe99261b781bd3d1622395f547f8"
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.1.tgz#310db70f742d259a16a369202b51af84233310d9"

is-word-character@^1.0.0:
version "1.0.0"
Expand All @@ -2844,10 +2852,6 @@ [email protected], isarray@^1.0.0, isarray@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"

isarray@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.1.tgz#a37d94ed9cda2d59865c9f76fe596ee1f338741e"

isbinaryfile@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-3.0.2.tgz#4a3e974ec0cba9004d3fc6cde7209ea69368a621"
Expand Down Expand Up @@ -3091,6 +3095,12 @@ kind-of@^3.0.2:
dependencies:
is-buffer "^1.1.5"

klaw-sync@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/klaw-sync/-/klaw-sync-2.1.0.tgz#3d3bcd8600e7bfdef53231c739ff053aed560e44"
optionalDependencies:
graceful-fs "^4.1.11"

klaw@^1.0.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439"
Expand Down Expand Up @@ -3908,8 +3918,8 @@ preserve@^0.2.0:
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"

prettier@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.3.0.tgz#cb02314f1ae2a99e951c17acb77a4096a1060ac2"
version "1.3.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.3.1.tgz#fa0ea84b45ac0ba6de6a1e4cecdcff900d563151"
dependencies:
ast-types "0.9.8"
babel-code-frame "6.22.0"
Expand Down Expand Up @@ -3968,7 +3978,7 @@ qjobs@^1.1.4:
version "1.1.5"
resolved "https://registry.yarnpkg.com/qjobs/-/qjobs-1.1.5.tgz#659de9f2cf8dcc27a1481276f205377272382e73"

[email protected], qs@^6.2.0, qs@~6.4.0:
[email protected], qs@^6.4.0, qs@~6.4.0:
version "6.4.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233"

Expand Down Expand Up @@ -4120,8 +4130,8 @@ regenerate@^1.2.1:
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.2.tgz#d1941c67bad437e1be76433add5b385f95b19260"

regenerator-runtime@^0.10.0:
version "0.10.4"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.4.tgz#74cb6598d3ba2eb18694e968a40e2b3b4df9cf93"
version "0.10.5"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658"

[email protected]:
version "0.9.11"
Expand Down Expand Up @@ -4166,8 +4176,8 @@ [email protected]:
xtend "^4.0.1"

remark-parse@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-3.0.0.tgz#f078c8c9976efb0f2afd011c79f30708354593b1"
version "3.0.1"
resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-3.0.1.tgz#1b9f841a44d8f4fbf2246850265459a4eb354c80"
dependencies:
collapse-white-space "^1.0.2"
has "^1.0.1"
Expand Down Expand Up @@ -4195,8 +4205,8 @@ remark-slug@^4.0.0:
unist-util-visit "^1.0.0"

remark-stringify@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/remark-stringify/-/remark-stringify-3.0.0.tgz#f1720893a3e7c845824d95bb573d628d1346ba2a"
version "3.0.1"
resolved "https://registry.yarnpkg.com/remark-stringify/-/remark-stringify-3.0.1.tgz#79242bebe0a752081b5809516fa0c06edec069cf"
dependencies:
ccount "^1.0.0"
is-alphanumeric "^1.0.0"
Expand All @@ -4221,8 +4231,8 @@ remark-toc@^4.0.0:
remark-slug "^4.0.0"

remark@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/remark/-/remark-7.0.0.tgz#ce9c788c390d98d9a67cb7738e98246732e79144"
version "7.0.1"
resolved "https://registry.yarnpkg.com/remark/-/remark-7.0.1.tgz#a5de4dacfabf0f60a49826ef24c479807f904bfb"
dependencies:
remark-parse "^3.0.0"
remark-stringify "^3.0.0"
Expand Down Expand Up @@ -4460,8 +4470,8 @@ rx-lite@^3.1.2:
resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102"

rxjs@^5.0.0-beta.11:
version "5.3.0"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.3.0.tgz#d88ccbdd46af290cbdb97d5d8055e52453fabe2d"
version "5.3.1"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.3.1.tgz#9ecc9e722247e4f4490d30a878577a3740fd0cb7"
dependencies:
symbol-observable "^1.0.1"

Expand Down Expand Up @@ -4594,8 +4604,8 @@ [email protected]:
socket.io-parser "2.3.1"

source-map-support@^0.4.0, source-map-support@^0.4.2:
version "0.4.14"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.14.tgz#9d4463772598b86271b4f523f6c1f4e02a7d6aef"
version "0.4.15"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.15.tgz#03202df65c06d2bd8c7ec2362a193056fef8d3b1"
dependencies:
source-map "^0.5.6"

Expand Down Expand Up @@ -4869,15 +4879,15 @@ through2@^2.0.0, through2@^2.0.1, through2@~2.0.0:
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"

tiny-lr@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/tiny-lr/-/tiny-lr-1.0.3.tgz#386731170ce521263a9d337f769ee8f11e88eb04"
version "1.0.4"
resolved "https://registry.yarnpkg.com/tiny-lr/-/tiny-lr-1.0.4.tgz#d13becf37f8b7e963320f5743298e3e934c7329a"
dependencies:
body "^5.1.0"
debug "~2.2.0"
faye-websocket "~0.10.0"
livereload-js "^2.2.2"
object-assign "^4.1.0"
qs "^6.2.0"
qs "^6.4.0"

[email protected], [email protected]:
version "0.0.31"
Expand All @@ -4896,8 +4906,8 @@ [email protected]:
resolved "https://registry.yarnpkg.com/to-array/-/to-array-0.1.4.tgz#17e6c11f73dd4f3d74cda7a4ff3238e9ad9bf890"

to-fast-properties@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.2.tgz#f3f5c0c3ba7299a7ef99427e44633257ade43320"
version "1.0.3"
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47"

tough-cookie@~2.3.0:
version "2.3.2"
Expand Down Expand Up @@ -5008,14 +5018,13 @@ unherit@^1.0.4:
xtend "^4.0.1"

unified@^6.0.0:
version "6.1.2"
resolved "https://registry.yarnpkg.com/unified/-/unified-6.1.2.tgz#b3904c3254ffbea7ff6d806c5d5b6248838cecb6"
version "6.1.3"
resolved "https://registry.yarnpkg.com/unified/-/unified-6.1.3.tgz#c26a9df2c56f3def938309253928f37150c70c6e"
dependencies:
bail "^1.0.0"
extend "^3.0.0"
has "^1.0.1"
is-plain-obj "^1.1.0"
isarray "^2.0.1"
trough "^1.0.0"
vfile "^2.0.0"
x-is-function "^1.0.4"
Expand Down

0 comments on commit ac1a402

Please sign in to comment.