From 98dea54164dd53c6d2d2c8ce43c97d47a2a5295f Mon Sep 17 00:00:00 2001 From: Peter T Bosse II Date: Thu, 19 Apr 2018 15:09:06 -0400 Subject: [PATCH] v2018.4.19-0 --- lerna.json | 2 +- packages/animated-transition/package.json | 2 +- packages/eslint-config/package.json | 2 +- packages/gatsby-image/package.json | 2 +- packages/gatsby-plugin-pug/package.json | 2 +- .../gatsby-plugin-react-helmet/package.json | 2 +- packages/gatsby-plugin-styletron/package.json | 2 +- .../gatsby-source-filesystem/package.json | 2 +- packages/gatsby/package.json | 2 +- packages/git-setup/package.json | 2 +- packages/http-server/package.json | 2 +- packages/merge-json/package.json | 2 +- packages/prettier-eslint/package.json | 2 +- packages/queue/index.js | 58 +++++++++++++++++++ packages/queue/package.json | 15 +++++ packages/sort-json/package.json | 2 +- packages/uncssstyle/package.json | 2 +- 17 files changed, 88 insertions(+), 15 deletions(-) create mode 100644 packages/queue/index.js create mode 100644 packages/queue/package.json diff --git a/lerna.json b/lerna.json index ac1f7803..cf038f32 100644 --- a/lerna.json +++ b/lerna.json @@ -4,5 +4,5 @@ "packages": [ "packages/*" ], - "version": "2018.4.18-3" + "version": "2018.4.19-0" } diff --git a/packages/animated-transition/package.json b/packages/animated-transition/package.json index 308c490b..644b353c 100644 --- a/packages/animated-transition/package.json +++ b/packages/animated-transition/package.json @@ -29,5 +29,5 @@ "build": "babel src --out-dir . --ignore __tests__", "watch": "babel -w src --out-dir . --ignore __tests__" }, - "version": "2018.4.18-3" + "version": "2018.4.19-0" } diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 04c19cce..41ea4f04 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -28,5 +28,5 @@ "postinstall": "npx npm-run-all 'postinstall:*'", "postinstall:merge": "find '.amory' -maxdepth 1 -name '*.json' -print0 | xargs -0 -I {} -n1 basename '{}' | xargs -I {} -n1 npx -p @ptb/merge-json -c 'merge-json ../../../{} .amory/{}'" }, - "version": "2018.4.18-3" + "version": "2018.4.19-0" } diff --git a/packages/gatsby-image/package.json b/packages/gatsby-image/package.json index c8130736..1b6a82b8 100644 --- a/packages/gatsby-image/package.json +++ b/packages/gatsby-image/package.json @@ -46,5 +46,5 @@ "prepare": "cross-env NODE_ENV=production npm run build", "watch": "babel -w src/index.js --out-file index.js --ignore __tests__" }, - "version": "2018.4.18-3" + "version": "2018.4.19-0" } diff --git a/packages/gatsby-plugin-pug/package.json b/packages/gatsby-plugin-pug/package.json index b4ca83d3..88ce7c03 100644 --- a/packages/gatsby-plugin-pug/package.json +++ b/packages/gatsby-plugin-pug/package.json @@ -16,5 +16,5 @@ "postinstall:merge": "find '.amory' -maxdepth 1 -name '*.json' -print0 | xargs -0 -I {} -n1 basename '{}' | xargs -I {} -n1 npx -p @ptb/merge-json -c 'merge-json ../../../{} .amory/{}'", "postinstall:setup": "find '.amory' -maxdepth 1 -not -name '.amory' -not -name '*.json' -exec cp -R '{}' '../../../' \\;" }, - "version": "2018.4.18-3" + "version": "2018.4.19-0" } diff --git a/packages/gatsby-plugin-react-helmet/package.json b/packages/gatsby-plugin-react-helmet/package.json index be2af34b..427c2b91 100644 --- a/packages/gatsby-plugin-react-helmet/package.json +++ b/packages/gatsby-plugin-react-helmet/package.json @@ -16,5 +16,5 @@ "postinstall:merge": "find '.amory' -maxdepth 1 -name '*.json' -print0 | xargs -0 -I {} -n1 basename '{}' | xargs -I {} -n1 npx -p @ptb/merge-json -c 'merge-json ../../../{} .amory/{}'", "postinstall:setup": "find '.amory' -maxdepth 1 -not -name '.amory' -not -name '*.json' -exec cp -R '{}' '../../../' \\;" }, - "version": "2018.4.18-3" + "version": "2018.4.19-0" } diff --git a/packages/gatsby-plugin-styletron/package.json b/packages/gatsby-plugin-styletron/package.json index 5b8d2a39..d3b361d9 100644 --- a/packages/gatsby-plugin-styletron/package.json +++ b/packages/gatsby-plugin-styletron/package.json @@ -30,5 +30,5 @@ "postinstall:merge": "find '.amory' -maxdepth 1 -name '*.json' -print0 | xargs -0 -I {} -n1 basename '{}' | xargs -I {} -n1 npx -p @ptb/merge-json -c 'merge-json ../../../{} .amory/{}'", "postinstall:setup": "find '.amory' -maxdepth 1 -not -name '.amory' -not -name '*.json' -exec cp -R '{}' '../../../' \\;" }, - "version": "2018.4.18-3" + "version": "2018.4.19-0" } diff --git a/packages/gatsby-source-filesystem/package.json b/packages/gatsby-source-filesystem/package.json index 5723b94b..009eda19 100644 --- a/packages/gatsby-source-filesystem/package.json +++ b/packages/gatsby-source-filesystem/package.json @@ -44,5 +44,5 @@ "prepare": "cross-env NODE_ENV=production npm run build", "watch": "babel -w src --out-dir . --ignore __tests__" }, - "version": "2018.4.18-3" + "version": "2018.4.19-0" } diff --git a/packages/gatsby/package.json b/packages/gatsby/package.json index 8d9955de..b47f3a63 100644 --- a/packages/gatsby/package.json +++ b/packages/gatsby/package.json @@ -18,5 +18,5 @@ "postinstall:merge": "find '.amory' -maxdepth 1 -name '*.json' -print0 | xargs -0 -I {} -n1 basename '{}' | xargs -I {} -n1 npx -p @ptb/merge-json -c 'merge-json ../../../{} .amory/{}'", "postinstall:setup": "find '.amory' -maxdepth 1 -not -name '.amory' -not -name '*.json' -exec cp -R '{}' '../../../' \\;" }, - "version": "2018.4.18-3" + "version": "2018.4.19-0" } diff --git a/packages/git-setup/package.json b/packages/git-setup/package.json index 695f54eb..ecc13554 100644 --- a/packages/git-setup/package.json +++ b/packages/git-setup/package.json @@ -10,5 +10,5 @@ "postinstall": "npx npm-run-all 'postinstall:*'", "postinstall:setup": "source autokeep.command 0 && cd ../../../ && autokeep" }, - "version": "2018.4.18-3" + "version": "2018.4.19-0" } diff --git a/packages/http-server/package.json b/packages/http-server/package.json index 8d3f1c14..73490e82 100644 --- a/packages/http-server/package.json +++ b/packages/http-server/package.json @@ -13,5 +13,5 @@ "postinstall": "npx npm-run-all 'postinstall:*'", "postinstall:merge": "find '.amory' -maxdepth 1 -name '*.json' -print0 | xargs -0 -I {} -n1 basename '{}' | xargs -I {} -n1 npx -p @ptb/merge-json -c 'merge-json ../../../{} .amory/{}'" }, - "version": "2018.4.18-3" + "version": "2018.4.19-0" } diff --git a/packages/merge-json/package.json b/packages/merge-json/package.json index cb2ea6a9..84343b43 100644 --- a/packages/merge-json/package.json +++ b/packages/merge-json/package.json @@ -15,5 +15,5 @@ "access": "public" }, "repository": "https://github.com/ptb/amory/tree/master/packages/merge-json", - "version": "2018.4.18-3" + "version": "2018.4.19-0" } diff --git a/packages/prettier-eslint/package.json b/packages/prettier-eslint/package.json index ae56194a..a651dac7 100644 --- a/packages/prettier-eslint/package.json +++ b/packages/prettier-eslint/package.json @@ -15,5 +15,5 @@ "postinstall": "npx npm-run-all 'postinstall:*'", "postinstall:merge": "find '.amory' -maxdepth 1 -name '*.json' -print0 | xargs -0 -I {} -n1 basename '{}' | xargs -I {} -n1 npx -p @ptb/merge-json -c 'merge-json ../../../{} .amory/{}'" }, - "version": "2018.4.18-3" + "version": "2018.4.19-0" } diff --git a/packages/queue/index.js b/packages/queue/index.js new file mode 100644 index 00000000..41b0b6fe --- /dev/null +++ b/packages/queue/index.js @@ -0,0 +1,58 @@ +const chokidar = require ("chokidar") +const dir = require ("path").dirname +const Queue = require ("better-queue") + +module.exports = (() => { + let queue + let ready = false + + const q = () => { + queue = + queue || + new Queue ( + (result, done) => { + done (result) + }, + { + "precondition": (done) => { + done (null, ready) + } + } + ) + return queue + } + + const watch = (opts, fn) => { + opts.ignored = Array.prototype + .concat (opts.ignored, "**/node_modules") + .filter (Boolean) + + return chokidar + .watch (opts.src, opts) + + .on ("add", (src) => + q ().push ({ "evt": "add", "obj": "file", src }, fn)) + .on ("change", (src) => + q ().push ({ "evt": "mod", "obj": "file", src }, fn)) + .on ("unlink", (src) => + q ().push ({ "evt": "del", "obj": "file", src }, fn)) + + .on ("addDir", (src) => + q ().push ({ "evt": "add", "obj": "dir", src }, fn)) + .on ("add", (src) => + q ().push ({ "evt": "mod", "obj": "dir", "src": dir (src) }, fn)) + .on ("unlink", (src) => + q ().push ({ "evt": "mod", "obj": "dir", "src": dir (src) }, fn)) + .on ("unlinkDir", (src) => + q ().push ({ "evt": "del", "obj": "dir", src }, fn)) + + .on ("ready", () => { + ready = true + }) + } + + return { + "queue": q (), + "watch": watch + } +}) () diff --git a/packages/queue/package.json b/packages/queue/package.json new file mode 100644 index 00000000..c32c92c0 --- /dev/null +++ b/packages/queue/package.json @@ -0,0 +1,15 @@ +{ + "author": "Peter T Bosse II (http://ptb2.me/)", + "dependencies": { + "better-queue": "^3", + "chokidar": "^1" + }, + "license": "Apache-2.0", + "main": "index.js", + "name": "@ptb/queue", + "publishConfig": { + "access": "public" + }, + "repository": "https://github.com/ptb/amory/tree/master/packages/queue", + "version": "2018.4.19-0" +} diff --git a/packages/sort-json/package.json b/packages/sort-json/package.json index 35719ae1..538d33a9 100644 --- a/packages/sort-json/package.json +++ b/packages/sort-json/package.json @@ -14,5 +14,5 @@ "postinstall": "npx npm-run-all 'postinstall:*'", "postinstall:merge": "find '.amory' -maxdepth 1 -name '*.json' -print0 | xargs -0 -I {} -n1 basename '{}' | xargs -I {} -n1 npx -p @ptb/merge-json -c 'merge-json ../../../{} .amory/{}'" }, - "version": "2018.4.18-3" + "version": "2018.4.19-0" } diff --git a/packages/uncssstyle/package.json b/packages/uncssstyle/package.json index 101b3d45..bd56b886 100644 --- a/packages/uncssstyle/package.json +++ b/packages/uncssstyle/package.json @@ -6,5 +6,5 @@ "access": "public" }, "repository": "https://github.com/ptb/amory/tree/master/packages/uncssstyle", - "version": "2018.4.18-3" + "version": "2018.4.19-0" }