@faststore/cli 1.12.17 → 1.12.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 1.12.20 (2022-10-26)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add watch capability to cli dev command ([#1483](https://github.com/vtex/faststore/issues/1483)) ([ac34aad](https://github.com/vtex/faststore/commit/ac34aad74411118b73a53329978810083856fcaa))
12
+
13
+
14
+ ### Chores
15
+
16
+ * git blame ignore modification by data-fs ([#1494](https://github.com/vtex/faststore/issues/1494)) ([783079e](https://github.com/vtex/faststore/commit/783079e7095b39270bbb60e79063b774056dc5d4))
17
+
18
+
19
+
20
+ ## 1.12.19 (2022-10-25)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * add shared tsconfig on cli ([#1492](https://github.com/vtex/faststore/issues/1492)) ([2f0a852](https://github.com/vtex/faststore/commit/2f0a8521bf4da351eee474912ed04f3dde090306)), closes [#1493](https://github.com/vtex/faststore/issues/1493)
26
+ * yarn ([#1490](https://github.com/vtex/faststore/issues/1490)) ([52756b1](https://github.com/vtex/faststore/commit/52756b1ec66d9b70ae4899ed373a180749f8e5cd))
27
+
28
+
29
+
6
30
  ## [1.12.17](https://github.com/vtex/faststore/compare/v1.12.16...v1.12.17) (2022-10-20)
7
31
 
8
32
 
@@ -1,4 +1,12 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
1
4
  import { Command } from '@oclif/core';
5
+ import { Readable } from 'stream';
6
+ export interface ChangeToCopy {
7
+ path: string | null;
8
+ content: string | Readable | Buffer | NodeJS.ReadableStream;
9
+ }
2
10
  export default class Dev extends Command {
3
11
  run(): Promise<void>;
4
12
  }
@@ -1,9 +1,62 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
3
4
  const core_1 = require("@oclif/core");
5
+ const fs_1 = require("fs");
6
+ const path_1 = require("path");
7
+ const chokidar_1 = tslib_1.__importDefault(require("chokidar"));
8
+ const root_1 = require("../utils/root");
9
+ const stabilityThreshold = process.platform === 'darwin' ? 100 : 200;
10
+ const defaultPatterns = ['*/**', '**'];
11
+ const defaultIgnored = [
12
+ '.DS_Store',
13
+ 'README.md',
14
+ '.gitignore',
15
+ 'package.json',
16
+ 'node_modules/**',
17
+ '**/node_modules/**',
18
+ '.git/**',
19
+ '.faststore/**',
20
+ '**/.faststore/**',
21
+ ];
4
22
  class Dev extends core_1.Command {
5
23
  async run() {
6
- console.log('running dev command');
24
+ const root = (0, root_1.getRoot)();
25
+ const pathToChange = (path, remove) => {
26
+ const content = remove
27
+ ? ''
28
+ : (0, fs_1.readFileSync)((0, path_1.resolve)(root, path)).toString('base64');
29
+ return {
30
+ content,
31
+ path: path.split(path_1.sep).join('/'),
32
+ };
33
+ };
34
+ const queueChange = (path, remove) => {
35
+ pathToChange(path, remove);
36
+ copyChanges();
37
+ };
38
+ const copyChanges = () => {
39
+ /** copy changes to .faststore */
40
+ };
41
+ const watcher = chokidar_1.default.watch([...defaultPatterns], {
42
+ atomic: stabilityThreshold,
43
+ awaitWriteFinish: {
44
+ stabilityThreshold,
45
+ },
46
+ cwd: root,
47
+ ignoreInitial: true,
48
+ ignored: defaultIgnored,
49
+ persistent: true,
50
+ usePolling: process.platform === 'win32',
51
+ });
52
+ await new Promise((resolve, reject) => {
53
+ watcher
54
+ .on('add', (file) => queueChange(file))
55
+ .on('change', (file) => queueChange(file))
56
+ .on('unlink', (file) => queueChange(file, true))
57
+ .on('error', reject)
58
+ .on('ready', resolve);
59
+ });
7
60
  }
8
61
  }
9
62
  exports.default = Dev;
@@ -1 +1 @@
1
- {"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":";;AAAA,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;QACf,CAAC,CAAA;QAED,MAAM,WAAW,GAAG,GAAG,EAAE;YACvB,iCAAiC;QACnC,CAAC,CAAA;QAED,MAAM,OAAO,GAAG,kBAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,eAAe,CAAC,EAAE;YACnD,MAAM,EAAE,kBAAkB;YAC1B,gBAAgB,EAAE;gBAChB,kBAAkB;aACnB;YACD,GAAG,EAAE,IAAI;YACT,aAAa,EAAE,IAAI;YACnB,OAAO,EAAE,cAAc;YACvB,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO;SACzC,CAAC,CAAA;QAEF,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACpC,OAAO;iBACJ,EAAE,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;iBACtC,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;iBACzC,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;iBAC/C,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;iBACnB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACzB,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AA9CD,sBA8CC"}
@@ -0,0 +1 @@
1
+ export declare const getRoot: () => string;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRoot = void 0;
4
+ const getRoot = () => {
5
+ if (process.env.OCLIF_COMPILATION) {
6
+ return '';
7
+ }
8
+ return process.cwd();
9
+ };
10
+ exports.getRoot = getRoot;
11
+ //# sourceMappingURL=root.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root.js","sourceRoot":"","sources":["../../src/utils/root.ts"],"names":[],"mappings":";;;AAAO,MAAM,OAAO,GAAG,GAAG,EAAE;IAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;QACjC,OAAO,EAAE,CAAA;KACV;IAED,OAAO,OAAO,CAAC,GAAG,EAAE,CAAA;AACtB,CAAC,CAAA;AANY,QAAA,OAAO,WAMnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/cli",
3
- "version": "1.12.17",
3
+ "version": "1.12.20",
4
4
  "description": "FastStore CLI",
5
5
  "author": "Emerson Laurentino @emersonlaurentino",
6
6
  "bin": {
@@ -19,9 +19,12 @@
19
19
  "dependencies": {
20
20
  "@oclif/core": "^1.16.4",
21
21
  "@oclif/plugin-help": "^5",
22
- "@oclif/plugin-not-found": "^2.3.3"
22
+ "@oclif/plugin-not-found": "^2.3.3",
23
+ "chokidar": "^3.5.3",
24
+ "path": "^0.12.7"
23
25
  },
24
26
  "devDependencies": {
27
+ "@faststore/shared": "^1.12.20",
25
28
  "@types/chai": "^4",
26
29
  "@types/node": "^16.11.63",
27
30
  "chai": "^4",
@@ -57,5 +60,5 @@
57
60
  "oclif"
58
61
  ],
59
62
  "types": "dist/index.d.ts",
60
- "gitHead": "8b06f995e92dcaff8023ca4c095f0f82758ae589"
63
+ "gitHead": "829d49bfc8d8ce7e37a0fdd9233ac68c8a3cf7b9"
61
64
  }