* Fix #604: cli for buidling JSON image from folder * Allow passing --filer to specify a filer module to use (different version) * Deal with fs.chown not existing on older versions of Filer * Tidy up some loose ends * Make fs-image.js executable
This commit is contained in:
parent
0e75661b4b
commit
97a6004091
|
@ -299,6 +299,12 @@
|
||||||
"integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=",
|
"integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"array-find-index": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"array-slice": {
|
"array-slice": {
|
||||||
"version": "0.2.3",
|
"version": "0.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz",
|
||||||
|
@ -1577,6 +1583,12 @@
|
||||||
"integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=",
|
"integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"builtin-modules": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
|
||||||
|
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"builtin-status-codes": {
|
"builtin-status-codes": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz",
|
||||||
|
@ -1633,6 +1645,23 @@
|
||||||
"integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=",
|
"integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"camelcase": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
|
||||||
|
"integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"camelcase-keys": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz",
|
||||||
|
"integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"camelcase": "^4.1.0",
|
||||||
|
"map-obj": "^2.0.0",
|
||||||
|
"quick-lru": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"caniuse-api": {
|
"caniuse-api": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz",
|
||||||
|
@ -2346,6 +2375,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"currently-unhandled": {
|
||||||
|
"version": "0.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz",
|
||||||
|
"integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"array-find-index": "^1.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"custom-event": {
|
"custom-event": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz",
|
||||||
|
@ -2389,6 +2427,24 @@
|
||||||
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
|
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"decamelize-keys": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz",
|
||||||
|
"integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"decamelize": "^1.1.0",
|
||||||
|
"map-obj": "^1.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"map-obj": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz",
|
||||||
|
"integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"decode-uri-component": {
|
"decode-uri-component": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
|
||||||
|
@ -3322,6 +3378,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"find-up": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
|
||||||
|
"integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"locate-path": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flat-cache": {
|
"flat-cache": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz",
|
||||||
|
@ -3361,6 +3426,12 @@
|
||||||
"integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=",
|
"integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"foreachasync": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/foreachasync/-/foreachasync-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-VQKYfchxS+M5IJfzLgBxyd7gfPY=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"fragment-cache": {
|
"fragment-cache": {
|
||||||
"version": "0.2.1",
|
"version": "0.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz",
|
||||||
|
@ -4180,6 +4251,12 @@
|
||||||
"os-tmpdir": "^1.0.1"
|
"os-tmpdir": "^1.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"hosted-git-info": {
|
||||||
|
"version": "2.7.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz",
|
||||||
|
"integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"hsl-regex": {
|
"hsl-regex": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/hsl-regex/-/hsl-regex-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/hsl-regex/-/hsl-regex-1.0.0.tgz",
|
||||||
|
@ -4708,6 +4785,12 @@
|
||||||
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
|
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"indent-string": {
|
||||||
|
"version": "3.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz",
|
||||||
|
"integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"indexes-of": {
|
"indexes-of": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz",
|
||||||
|
@ -4819,6 +4902,15 @@
|
||||||
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
|
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"is-builtin-module": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"builtin-modules": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"is-callable": {
|
"is-callable": {
|
||||||
"version": "1.1.4",
|
"version": "1.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",
|
||||||
|
@ -5286,6 +5378,36 @@
|
||||||
"type-check": "~0.3.2"
|
"type-check": "~0.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"load-json-file": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",
|
||||||
|
"integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"graceful-fs": "^4.1.2",
|
||||||
|
"parse-json": "^4.0.0",
|
||||||
|
"pify": "^3.0.0",
|
||||||
|
"strip-bom": "^3.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"pify": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"locate-path": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"p-locate": "^2.0.0",
|
||||||
|
"path-exists": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"lodash": {
|
"lodash": {
|
||||||
"version": "4.17.10",
|
"version": "4.17.10",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz",
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz",
|
||||||
|
@ -5355,6 +5477,16 @@
|
||||||
"js-tokens": "^3.0.0 || ^4.0.0"
|
"js-tokens": "^3.0.0 || ^4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"loud-rejection": {
|
||||||
|
"version": "1.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz",
|
||||||
|
"integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"currently-unhandled": "^0.4.1",
|
||||||
|
"signal-exit": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"lru-cache": {
|
"lru-cache": {
|
||||||
"version": "3.2.0",
|
"version": "3.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-3.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-3.2.0.tgz",
|
||||||
|
@ -5379,6 +5511,12 @@
|
||||||
"integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=",
|
"integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"map-obj": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"map-visit": {
|
"map-visit": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz",
|
||||||
|
@ -5416,6 +5554,23 @@
|
||||||
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=",
|
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"meow": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/meow/-/meow-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"camelcase-keys": "^4.0.0",
|
||||||
|
"decamelize-keys": "^1.0.0",
|
||||||
|
"loud-rejection": "^1.0.0",
|
||||||
|
"minimist-options": "^3.0.1",
|
||||||
|
"normalize-package-data": "^2.3.4",
|
||||||
|
"read-pkg-up": "^3.0.0",
|
||||||
|
"redent": "^2.0.0",
|
||||||
|
"trim-newlines": "^2.0.0",
|
||||||
|
"yargs-parser": "^10.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"merge-source-map": {
|
"merge-source-map": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.0.4.tgz",
|
||||||
|
@ -5523,6 +5678,16 @@
|
||||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"minimist-options": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"arrify": "^1.0.1",
|
||||||
|
"is-plain-obj": "^1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"mixin-deep": {
|
"mixin-deep": {
|
||||||
"version": "1.3.1",
|
"version": "1.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz",
|
||||||
|
@ -5583,6 +5748,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"modify-filename": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/modify-filename/-/modify-filename-1.1.0.tgz",
|
||||||
|
"integrity": "sha1-mi3sg4Bvuy2XXyK+7IWcoms5OqE=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"ms": {
|
"ms": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||||
|
@ -5701,6 +5872,18 @@
|
||||||
"abbrev": "1"
|
"abbrev": "1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"normalize-package-data": {
|
||||||
|
"version": "2.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz",
|
||||||
|
"integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"hosted-git-info": "^2.1.4",
|
||||||
|
"is-builtin-module": "^1.0.0",
|
||||||
|
"semver": "2 || 3 || 4 || 5",
|
||||||
|
"validate-npm-package-license": "^3.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"normalize-path": {
|
"normalize-path": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",
|
||||||
|
@ -7083,6 +7266,30 @@
|
||||||
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
|
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"p-limit": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"p-try": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"p-locate": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"p-limit": "^1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"p-try": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"pako": {
|
"pako": {
|
||||||
"version": "0.2.9",
|
"version": "0.2.9",
|
||||||
"resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz",
|
||||||
|
@ -7216,6 +7423,12 @@
|
||||||
"integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=",
|
"integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"path-exists": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"path-is-absolute": {
|
"path-is-absolute": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||||
|
@ -7240,6 +7453,23 @@
|
||||||
"integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=",
|
"integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"path-type": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"pify": "^3.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"pify": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"pathval": {
|
"pathval": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz",
|
||||||
|
@ -8142,6 +8372,12 @@
|
||||||
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=",
|
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"pretty-bytes": {
|
||||||
|
"version": "5.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.1.0.tgz",
|
||||||
|
"integrity": "sha512-wa5+qGVg9Yt7PB6rYm3kXlKzgzgivYTLRandezh43jjRqgyDyP+9YxfJpJiLs9yKD1WeU8/OvtToWpW7255FtA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"private": {
|
"private": {
|
||||||
"version": "0.1.8",
|
"version": "0.1.8",
|
||||||
"resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz",
|
"resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz",
|
||||||
|
@ -8237,6 +8473,12 @@
|
||||||
"integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=",
|
"integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"quick-lru": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz",
|
||||||
|
"integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"quote-stream": {
|
"quote-stream": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/quote-stream/-/quote-stream-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/quote-stream/-/quote-stream-1.0.2.tgz",
|
||||||
|
@ -8293,6 +8535,27 @@
|
||||||
"unpipe": "1.0.0"
|
"unpipe": "1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"read-pkg": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"load-json-file": "^4.0.0",
|
||||||
|
"normalize-package-data": "^2.3.2",
|
||||||
|
"path-type": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"read-pkg-up": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"find-up": "^2.0.0",
|
||||||
|
"read-pkg": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"readable-stream": {
|
"readable-stream": {
|
||||||
"version": "2.3.6",
|
"version": "2.3.6",
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
|
||||||
|
@ -8320,6 +8583,16 @@
|
||||||
"set-immediate-shim": "^1.0.1"
|
"set-immediate-shim": "^1.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"redent": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"indent-string": "^3.0.0",
|
||||||
|
"strip-indent": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"reduce-css-calc": {
|
"reduce-css-calc": {
|
||||||
"version": "2.1.4",
|
"version": "2.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-2.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-2.1.4.tgz",
|
||||||
|
@ -9010,6 +9283,38 @@
|
||||||
"integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=",
|
"integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"spdx-correct": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-q9hedtzyXHr5S0A1vEPoK/7l8NpfkFYTq6iCY+Pno2ZbdZR6WexZFtqeVGkGxW3TEJMN914Z55EnAGMmenlIQQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"spdx-expression-parse": "^3.0.0",
|
||||||
|
"spdx-license-ids": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spdx-exceptions": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"spdx-expression-parse": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"spdx-exceptions": "^2.1.0",
|
||||||
|
"spdx-license-ids": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"spdx-license-ids": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-qky9CVt0lVIECkEsYbNILVnPvycuEBkXoMFLRWsREkomQLevYhtRKC+R91a5TOAQ3bCMjikRwhyaRqj1VYatYg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"split-string": {
|
"split-string": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
|
||||||
|
@ -9179,6 +9484,18 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"strip-bom": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"strip-indent": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"strip-json-comments": {
|
"strip-json-comments": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
|
||||||
|
@ -9433,6 +9750,12 @@
|
||||||
"integrity": "sha512-2Ulkc8T7mXJ2l0W476YC/A209PR38Nw8PuaCNtk9uI3t1zzFdGQeWYGQvmj2PZkVvRC/Yoi4xQKMRnWc/N29tQ==",
|
"integrity": "sha512-2Ulkc8T7mXJ2l0W476YC/A209PR38Nw8PuaCNtk9uI3t1zzFdGQeWYGQvmj2PZkVvRC/Yoi4xQKMRnWc/N29tQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"trim-newlines": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"trim-right": {
|
"trim-right": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz",
|
||||||
|
@ -9609,6 +9932,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"unused-filename": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/unused-filename/-/unused-filename-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-00CID3GuIRXrqhMlvvBcxmhEacY=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"modify-filename": "^1.1.0",
|
||||||
|
"path-exists": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"upath": {
|
"upath": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz",
|
||||||
|
@ -9709,6 +10042,16 @@
|
||||||
"integrity": "sha512-qNdTUMaCjPs4eEnM3W9H94R3sU70YCuT+/ST7nUf+id1bVOrdjrpUaeZLqPBPRph3hsgn4a4BvwpxhHZx+oSDg==",
|
"integrity": "sha512-qNdTUMaCjPs4eEnM3W9H94R3sU70YCuT+/ST7nUf+id1bVOrdjrpUaeZLqPBPRph3hsgn4a4BvwpxhHZx+oSDg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"validate-npm-package-license": {
|
||||||
|
"version": "3.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
|
||||||
|
"integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"spdx-correct": "^3.0.0",
|
||||||
|
"spdx-expression-parse": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"vendors": {
|
"vendors": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/vendors/-/vendors-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/vendors/-/vendors-1.0.2.tgz",
|
||||||
|
@ -9736,6 +10079,15 @@
|
||||||
"integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=",
|
"integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"walk": {
|
||||||
|
"version": "2.3.14",
|
||||||
|
"resolved": "https://registry.npmjs.org/walk/-/walk-2.3.14.tgz",
|
||||||
|
"integrity": "sha512-5skcWAUmySj6hkBdH6B6+3ddMjVQYH5Qy9QGbPmN8kVmLteXk+yVXg+yfk1nbX30EYakahLrr8iPcCxJQSCBeg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"foreachasync": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"wcwidth": {
|
"wcwidth": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",
|
||||||
|
@ -9802,6 +10154,15 @@
|
||||||
"integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=",
|
"integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"yargs-parser": {
|
||||||
|
"version": "10.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz",
|
||||||
|
"integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"camelcase": "^4.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"yeast": {
|
"yeast": {
|
||||||
"version": "0.1.2",
|
"version": "0.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz",
|
||||||
|
|
|
@ -54,9 +54,13 @@
|
||||||
"karma-mocha": "^1.3.0",
|
"karma-mocha": "^1.3.0",
|
||||||
"karma-mocha-reporter": "^2.2.5",
|
"karma-mocha-reporter": "^2.2.5",
|
||||||
"karma-summary-reporter": "^1.5.1",
|
"karma-summary-reporter": "^1.5.1",
|
||||||
|
"meow": "^5.0.0",
|
||||||
"mocha": "^5.2.0",
|
"mocha": "^5.2.0",
|
||||||
"nyc": "^13.1.0",
|
"nyc": "^13.1.0",
|
||||||
"parcel-bundler": "^1.9.6"
|
"parcel-bundler": "^1.9.6",
|
||||||
|
"pretty-bytes": "^5.1.0",
|
||||||
|
"unused-filename": "^1.0.0",
|
||||||
|
"walk": "^2.3.14"
|
||||||
},
|
},
|
||||||
"main": "./src/index.js",
|
"main": "./src/index.js",
|
||||||
"browser": "./dist/filer.min.js",
|
"browser": "./dist/filer.min.js",
|
||||||
|
|
|
@ -18,6 +18,12 @@ class SerializableMemoryProvider extends MemoryProvider {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we don't have an image to import, leave db as is
|
||||||
|
if(!this.unparsedJSONImage) {
|
||||||
|
return callback();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to import the fs image from JSON
|
||||||
try {
|
try {
|
||||||
this.db = parseBJSON(this.unparsedJSONImage);
|
this.db = parseBJSON(this.unparsedJSONImage);
|
||||||
this.unparsedJSONImage = null;
|
this.unparsedJSONImage = null;
|
||||||
|
|
|
@ -0,0 +1,181 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
/* eslint-disable no-console */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
// Filer's path messes with process.cwd(), cache the real one
|
||||||
|
const cwd = process.cwd();
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
const SerializableMemoryProvider = require('../tests/lib/serializable-memory-provider');
|
||||||
|
const unusedFilename = require('unused-filename');
|
||||||
|
const prettyBytes = require('pretty-bytes');
|
||||||
|
const walk = require('walk');
|
||||||
|
const meow = require('meow');
|
||||||
|
|
||||||
|
const cli = meow(`
|
||||||
|
Usage
|
||||||
|
$ fs-image <input-dir> [<output-filename>] [--verbose] [--filer path/to/filer.js]
|
||||||
|
|
||||||
|
Options
|
||||||
|
--filer, -f Specify a Filer module path to use. Defaults to current.
|
||||||
|
--verbose, -v Verbose logging
|
||||||
|
|
||||||
|
Examples
|
||||||
|
$ fs-image files/ files.json
|
||||||
|
$ fs-image files/
|
||||||
|
$ fs-image files/ existing.json --verbose
|
||||||
|
$ fs-image files/ --filer ./versions/filer-0.44.js
|
||||||
|
`, {
|
||||||
|
description: 'Create a Filer Filesystem Image from a directory',
|
||||||
|
flags: {
|
||||||
|
verbose: {
|
||||||
|
type: 'boolean',
|
||||||
|
alias: 'v',
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
filer: {
|
||||||
|
type: 'string',
|
||||||
|
alias: 'f'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Get arg list, make sure we get a dir path argument
|
||||||
|
cli.flags.app = cli.input.slice(1);
|
||||||
|
if(!(cli.input && cli.input.length >= 1)) {
|
||||||
|
console.error('Specify a directory path to use as the image source');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
const dirPath = path.normalize(cli.input[0]);
|
||||||
|
const exportFilePath = cli.input[1] ? path.normalize(cli.input[1]) : null;
|
||||||
|
|
||||||
|
const log = msg => {
|
||||||
|
if(cli.flags.verbose) {
|
||||||
|
console.log(msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Load the version of Filer specified, or use current version in tree (default).
|
||||||
|
let filerModulePath = cli.flags.filer ? path.resolve(cwd, cli.flags.filer) : '../';
|
||||||
|
|
||||||
|
// Make sure we have an existing dir as our root
|
||||||
|
fs.stat(dirPath, (err, stats) => {
|
||||||
|
if(err || !(stats && stats.isDirectory())) {
|
||||||
|
console.error(`Expected existing directory for dirpath: ${dirPath}`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
let Filer;
|
||||||
|
try {
|
||||||
|
Filer = require(filerModulePath);
|
||||||
|
log(`Using Filer module at path ${filerModulePath}`);
|
||||||
|
} catch(e) {
|
||||||
|
console.error(`Unable to load Filer module at ${filerModulePath}: ${e.message}`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a filer instance with serializable provider, and start walking dir path
|
||||||
|
const provider = new SerializableMemoryProvider();
|
||||||
|
const filer = new Filer.FileSystem({provider: provider});
|
||||||
|
const walker = walk.walk(dirPath);
|
||||||
|
|
||||||
|
// Convert a filesystem path into a Filer path, rooted in /
|
||||||
|
const toFilerPath = fsPath => path.join('/', fsPath.replace(dirPath, ''));
|
||||||
|
|
||||||
|
// Write a file to Filer, including various metadata from the file node
|
||||||
|
const filerWriteFile = (filerPath, stats, data, callback) => {
|
||||||
|
const error = err => console.error(`[Filer] ${err}`);
|
||||||
|
// Convert date to ms
|
||||||
|
const toDateMS = d => (new Date(d)).getTime();
|
||||||
|
|
||||||
|
const mode = stats.mode;
|
||||||
|
const atime = toDateMS(stats.atime);
|
||||||
|
const mtime = toDateMS(stats.mtime);
|
||||||
|
const uid = stats.uid;
|
||||||
|
const gid = stats.gid;
|
||||||
|
|
||||||
|
filer.writeFile(filerPath, data, { mode }, (err) => {
|
||||||
|
if(err) {
|
||||||
|
error(`Error writing ${filerPath}: ${err.message}`);
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
filer.utimes(filerPath, atime, mtime, err => {
|
||||||
|
if(err) {
|
||||||
|
error(`Error writing ${filerPath}: ${err.message}`);
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not all shipped versions of Filer had chown(), bail if not present
|
||||||
|
if(typeof filer.chown !== 'function') {
|
||||||
|
log(` File Node: mode=${mode} atime=${atime} mtime=${mtime}`);
|
||||||
|
return callback();
|
||||||
|
}
|
||||||
|
|
||||||
|
filer.chown(filerPath, stats.uid, stats.gid, err => {
|
||||||
|
if(err) {
|
||||||
|
error(`Error writing ${filerPath}: ${err.message}`);
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
log(` File Node: mode=${mode} uid=${uid} gid=${gid} atime=${atime} mtime=${mtime}`);
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Process every file we find in dirpath
|
||||||
|
walker.on('file', (root, fileStats, next) => {
|
||||||
|
const filePath = path.join(root, fileStats.name);
|
||||||
|
const filerPath = toFilerPath(filePath);
|
||||||
|
log(`Writing file ${filePath} to ${filerPath} [${prettyBytes(fileStats.size)}]`);
|
||||||
|
|
||||||
|
fs.readFile(filePath, null, (err, data) => {
|
||||||
|
if(err) {
|
||||||
|
console.error(`Error reading file ${filePath}: ${err.message}`);
|
||||||
|
return next(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
filerWriteFile(filerPath, stats, data, next);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Process every dir we find in dirpath
|
||||||
|
walker.on('directory', (root, dirStats, next) => {
|
||||||
|
const dirPath = path.join(root, dirStats.name);
|
||||||
|
const filerPath = toFilerPath(dirPath);
|
||||||
|
|
||||||
|
log(`Creating dir ${dirPath} in ${filerPath}`);
|
||||||
|
filer.mkdir(filerPath, err => {
|
||||||
|
if(err && err.code !== 'EEXIST') {
|
||||||
|
console.error(`[Filer] Unable to create dir ${filerPath}: ${err.message}`);
|
||||||
|
return next(err);
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// When we're done processing entries, serialize filesystem to .json
|
||||||
|
walker.on('end', () => {
|
||||||
|
const writeFile = filename => {
|
||||||
|
fs.writeFile(filename, provider.export(), err => {
|
||||||
|
if(err) {
|
||||||
|
console.error(`Error writing exported filesystem: ${err.message}`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
console.log(`Wrote filesystem JSON to ${filename}`);
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// If we have an explicit filename to use, use it. Otherwise
|
||||||
|
// generate a new one like `filesystem (2).json`
|
||||||
|
if(exportFilePath) {
|
||||||
|
writeFile(exportFilePath);
|
||||||
|
} else {
|
||||||
|
unusedFilename('filesystem.json').then(filename => writeFile(filename));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue