Skip to content

Commit

Permalink
use exorcist and concat-stream
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouhanseng committed Oct 24, 2017
1 parent 2059d7b commit ec65da3
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 29 deletions.
2 changes: 1 addition & 1 deletion app/scribe/addPoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = ({x, y, uid}, state, emitter) => {
point.x = x
point.y = y
point.uid = uid

console.log(123)
cursurable(point, state)
movable(point, state, emitter)
removable(point, state, emitter)
Expand Down
25 changes: 16 additions & 9 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,35 @@ var mkdirp = require('mkdirp')
var browserify = require('browserify')
var html = require('bel')
var colors = require('colors')
var tinyify = require('tinyify')
// var tinyify = require('tinyify')
var exorcist = require('exorcist')
var minify = require('html-minifier').minify
var concat = require('concat-stream')

var b = browserify()
var b = browserify({debug: true})
var entry = 'index.js'
var basedir = path.dirname(entry)
var outdir = path.join(basedir, 'dist')
var mapfile = path.join(outdir, 'bundle.js.map')
var concatStream = concat(gotBundle)

function gotBundle (buf) {
fs.writeFile(path.join(outdir, 'bundle.js'), buf, () => {
console.log('create bundle.js'.green)
})
}

mkdirp(outdir, () => {
b.add(entry)
.transform('sheetify', { use: [ 'sheetify-inline', 'sheetify-cssnext' ] })
.plugin('tinyify')
.plugin('css-extract', { out: path.join(outdir, 'bundle.css') })
// .plugin('tinyify')
.bundle()
.pipe(exorcist(mapfile))
.pipe(concatStream)

console.log('create bundle.css'.green)

b.bundle((err, buf) => {
fs.writeFile(path.join(outdir, 'bundle.js'), buf, () => {
console.log('create bundle.js'.green)
})
})

var indexHtml = html`
<!doctype html>
<html lang="en" dir="ltr">
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
"author": "zhouhansen <z308114274@gmail.com>",
"license": "MIT",
"dependencies": {
"bootstrap": "4.0.0",
"bootstrap": "4.0.0-beta.2",
"choo": "^6.4.2",
"concat-stream": "^1.6.0",
"css-extract": "^1.2.0",
"exorcist": "^1.0.0",
"jquery": "^3.2.1",
"nanocomponent": "^6.4.2",
"sheetify": "^6.2.0",
Expand Down
112 changes: 94 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ boom@2.x.x:
dependencies:
hoek "2.x.x"

bootstrap@4.0.0:
bootstrap@4.0.0-beta.2:
version "4.0.0-beta.2"
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.0.0-beta.2.tgz#4d67d2aa2219f062cd90bc1247e6747b9e8fd051"

Expand Down Expand Up @@ -847,7 +847,7 @@ contains-path@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a"

convert-source-map@^1.1.1, convert-source-map@^1.5.0:
convert-source-map@^1.1.0, convert-source-map@^1.1.1, convert-source-map@^1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.0.tgz#9acd70851c6d5dfdd93d9282e5edf94a03ff46b5"

Expand Down Expand Up @@ -945,9 +945,11 @@ css-list@^0.1.0, css-list@^0.1.2:
version "0.1.3"
resolved "https://registry.yarnpkg.com/css-list/-/css-list-0.1.3.tgz#a7b33b4419f83d412320dde9133a0d1004948d70"

css-reurl@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/css-reurl/-/css-reurl-1.0.6.tgz#8abe01379607afe3a812249656e4eeec0eb0c74f"
css-reurl@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/css-reurl/-/css-reurl-1.0.7.tgz#e2ac750fdb22d72c01d63b62d6561346280c9545"
dependencies:
tape "^4.8.0"

cssnano@^2.6.1:
version "2.6.1"
Expand Down Expand Up @@ -1070,7 +1072,7 @@ decamelize@^1.0.0, decamelize@^1.1.2:
version "1.2.0"
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"

deep-equal@^1.0.0:
deep-equal@^1.0.0, deep-equal@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5"

Expand All @@ -1089,7 +1091,7 @@ define-properties@^1.1.2:
foreach "^2.0.5"
object-keys "^1.0.8"

defined@^1.0.0:
defined@^1.0.0, defined@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693"

Expand Down Expand Up @@ -1268,7 +1270,7 @@ error-ex@^1.2.0:
dependencies:
is-arrayish "^0.2.1"

es-abstract@^1.7.0:
es-abstract@^1.5.0, es-abstract@^1.7.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.9.0.tgz#690829a07cae36b222e7fd9b75c0d0573eb25227"
dependencies:
Expand Down Expand Up @@ -1587,6 +1589,15 @@ exit@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c"

exorcist@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/exorcist/-/exorcist-1.0.0.tgz#ac16ca162a0c55adee24b601f8b0e6e77bf34e8b"
dependencies:
is-stream "~1.1.0"
minimist "0.0.5"
mkdirp "~0.5.1"
mold-source-map "~0.4.0"

expand-brackets@^0.1.4:
version "0.1.5"
resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b"
Expand Down Expand Up @@ -1705,6 +1716,12 @@ flatten@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"

for-each@~0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.2.tgz#2c40450b9348e97f281322593ba96704b9abd4d4"
dependencies:
is-function "~1.0.0"

for-in@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
Expand Down Expand Up @@ -1793,7 +1810,7 @@ fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2:
mkdirp ">=0.5 0"
rimraf "2"

function-bind@^1.0.2, function-bind@^1.1.0, function-bind@^1.1.1:
function-bind@^1.0.2, function-bind@^1.1.0, function-bind@^1.1.1, function-bind@~1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"

Expand Down Expand Up @@ -1882,7 +1899,7 @@ glob@^5.0.1:
once "^1.3.0"
path-is-absolute "^1.0.0"

glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.0:
glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.0, glob@~7.1.2:
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
dependencies:
Expand Down Expand Up @@ -1958,7 +1975,7 @@ has-unicode@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9"

has@^1.0.0, has@^1.0.1:
has@^1.0.0, has@^1.0.1, has@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28"
dependencies:
Expand Down Expand Up @@ -2243,6 +2260,10 @@ is-fullwidth-code-point@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f"

is-function@~1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-function/-/is-function-1.0.1.tgz#12cfb98b65b57dd3d193a3121f5f6e2f437602b5"

is-glob@^2.0.0, is-glob@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863"
Expand Down Expand Up @@ -2314,6 +2335,10 @@ is-resolvable@^1.0.0:
dependencies:
tryit "^1.0.1"

is-stream@~1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"

is-symbol@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572"
Expand Down Expand Up @@ -2713,19 +2738,23 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1:
dependencies:
brace-expansion "^1.1.7"

minimist@0.0.5:
version "0.0.5"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.5.tgz#d7aa327bcecf518f9106ac6b8f003fa3bcea8566"

minimist@0.0.8:
version "0.0.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"

minimist@^1.1.0, minimist@^1.1.3, minimist@^1.2.0:
minimist@^1.1.0, minimist@^1.1.3, minimist@^1.2.0, minimist@~1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"

mkdirp@0.3.x:
version "0.3.5"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.3.5.tgz#de3e5f8961c88c787ee1368df849ac4413eca8d7"

"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1:
"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
dependencies:
Expand All @@ -2751,6 +2780,13 @@ module-deps@^4.0.8:
through2 "^2.0.0"
xtend "^4.0.0"

mold-source-map@~0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/mold-source-map/-/mold-source-map-0.4.0.tgz#cf67e0b31c47ab9badb5c9c25651862127bb8317"
dependencies:
convert-source-map "^1.1.0"
through "~2.2.7"

ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
Expand Down Expand Up @@ -2939,6 +2975,10 @@ object-inspect@~0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-0.4.0.tgz#f5157c116c1455b243b06ee97703392c5ad89fec"

object-inspect@~1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.3.0.tgz#5b1eb8e6742e2ee83342a637034d844928ba2f6d"

object-keys@^1.0.10, object-keys@^1.0.6, object-keys@^1.0.8:
version "1.0.11"
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d"
Expand Down Expand Up @@ -3893,7 +3933,7 @@ resolve@1.1.7:
version "1.1.7"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"

resolve@^1.0.0, resolve@^1.1.3, resolve@^1.1.4, resolve@^1.1.6, resolve@^1.1.7:
resolve@^1.0.0, resolve@^1.1.3, resolve@^1.1.4, resolve@^1.1.6, resolve@^1.1.7, resolve@~1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86"
dependencies:
Expand All @@ -3913,6 +3953,12 @@ restore-cursor@^1.0.1:
exit-hook "^1.0.0"
onetime "^1.0.0"

resumer@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759"
dependencies:
through "~2.3.4"

rgb@~0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/rgb/-/rgb-0.1.0.tgz#be27b291e8feffeac1bd99729721bfa40fc037b5"
Expand Down Expand Up @@ -4033,11 +4079,11 @@ sheetify-cssnext@^1.0.7:
xtend "^4.0.0"

sheetify-inline@^1.0.9:
version "1.0.8"
resolved "https://registry.yarnpkg.com/sheetify-inline/-/sheetify-inline-1.0.8.tgz#cca6feb1e07d0aa2907ed66de1e977840b320f46"
version "1.0.9"
resolved "https://registry.yarnpkg.com/sheetify-inline/-/sheetify-inline-1.0.9.tgz#d56c604660fa825353b24b8ed1e70870f656c1ea"
dependencies:
base64-img "^1.0.3"
css-reurl "^1.0.6"
css-reurl "^1.0.7"

sheetify@^6.2.0:
version "6.2.0"
Expand Down Expand Up @@ -4283,6 +4329,14 @@ string-width@^2.0.0:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^4.0.0"

string.prototype.trim@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea"
dependencies:
define-properties "^1.1.2"
es-abstract "^1.5.0"
function-bind "^1.0.2"

string_decoder@~0.10.x:
version "0.10.31"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94"
Expand Down Expand Up @@ -4383,6 +4437,24 @@ table@^3.7.8:
slice-ansi "0.0.4"
string-width "^2.0.0"

tape@^4.8.0:
version "4.8.0"
resolved "https://registry.yarnpkg.com/tape/-/tape-4.8.0.tgz#f6a9fec41cc50a1de50fa33603ab580991f6068e"
dependencies:
deep-equal "~1.0.1"
defined "~1.0.0"
for-each "~0.3.2"
function-bind "~1.1.0"
glob "~7.1.2"
has "~1.0.1"
inherits "~2.0.3"
minimist "~1.2.0"
object-inspect "~1.3.0"
resolve "~1.4.0"
resumer "~0.0.0"
string.prototype.trim "~1.1.2"
through "~2.3.8"

tar-pack@^3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.0.tgz#23be2d7f671a8339376cbdb0b8fe3fdebf317984"
Expand Down Expand Up @@ -4436,10 +4508,14 @@ through2@~0.6.1:
readable-stream ">=1.0.33-1 <1.1.0-0"
xtend ">=4.0.0 <4.1.0-0"

"through@>=2.2.7 <3", through@^2.3.6, through@^2.3.7, through@~2.3.4:
"through@>=2.2.7 <3", through@^2.3.6, through@^2.3.7, through@~2.3.4, through@~2.3.8:
version "2.3.8"
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"

through@~2.2.7:
version "2.2.7"
resolved "https://registry.yarnpkg.com/through/-/through-2.2.7.tgz#6e8e21200191d4eb6a99f6f010df46aa1c6eb2bd"

timers-browserify@^1.0.1:
version "1.4.2"
resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-1.4.2.tgz#c9c58b575be8407375cb5e2462dacee74359f41d"
Expand Down

0 comments on commit ec65da3

Please sign in to comment.