@faststore/cli 3.0.79 → 3.0.82

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.
Files changed (38) hide show
  1. package/README.md +43 -25
  2. package/dist/commands/build.d.ts +4 -0
  3. package/dist/commands/build.js +24 -13
  4. package/dist/commands/build.js.map +1 -1
  5. package/dist/commands/cms-sync.d.ts +4 -0
  6. package/dist/commands/cms-sync.js +12 -4
  7. package/dist/commands/cms-sync.js.map +1 -1
  8. package/dist/commands/dev.d.ts +4 -0
  9. package/dist/commands/dev.js +16 -8
  10. package/dist/commands/dev.js.map +1 -1
  11. package/dist/commands/generate-graphql.d.ts +4 -0
  12. package/dist/commands/generate-graphql.js +15 -7
  13. package/dist/commands/generate-graphql.js.map +1 -1
  14. package/dist/commands/start.d.ts +4 -0
  15. package/dist/commands/start.js +11 -2
  16. package/dist/commands/start.js.map +1 -1
  17. package/dist/commands/test.d.ts +4 -0
  18. package/dist/commands/test.js +14 -5
  19. package/dist/commands/test.js.map +1 -1
  20. package/dist/utils/directory.d.ts +17 -25
  21. package/dist/utils/directory.js +54 -59
  22. package/dist/utils/directory.js.map +1 -1
  23. package/dist/utils/directory.test.d.ts +1 -0
  24. package/dist/utils/directory.test.js +155 -0
  25. package/dist/utils/directory.test.js.map +1 -0
  26. package/dist/utils/generate.d.ts +2 -1
  27. package/dist/utils/generate.js +53 -45
  28. package/dist/utils/generate.js.map +1 -1
  29. package/dist/utils/hcms.d.ts +2 -2
  30. package/dist/utils/hcms.js +8 -7
  31. package/dist/utils/hcms.js.map +1 -1
  32. package/dist/utils/hcms.test.js +5 -4
  33. package/dist/utils/hcms.test.js.map +1 -1
  34. package/oclif.manifest.json +1 -1
  35. package/package.json +2 -2
  36. package/dist/utils/contentFromPath.d.ts +0 -10
  37. package/dist/utils/contentFromPath.js +0 -17
  38. package/dist/utils/contentFromPath.js.map +0 -1
package/README.md CHANGED
@@ -30,7 +30,7 @@ $ npm install -g @faststore/cli
30
30
  $ faststore COMMAND
31
31
  running command...
32
32
  $ faststore (--version)
33
- @faststore/cli/3.0.79 linux-x64 node-v18.20.3
33
+ @faststore/cli/3.0.82 linux-x64 node-v18.20.3
34
34
  $ faststore --help [COMMAND]
35
35
  USAGE
36
36
  $ faststore COMMAND
@@ -41,55 +41,67 @@ USAGE
41
41
  ## Commands
42
42
 
43
43
  <!-- commands -->
44
- * [`faststore build`](#faststore-build)
45
- * [`faststore cms-sync`](#faststore-cms-sync)
46
- * [`faststore dev`](#faststore-dev)
47
- * [`faststore generate-graphql`](#faststore-generate-graphql)
44
+ * [`faststore build [PATH]`](#faststore-build-path)
45
+ * [`faststore cms-sync [PATH]`](#faststore-cms-sync-path)
46
+ * [`faststore dev [PATH]`](#faststore-dev-path)
47
+ * [`faststore generate-graphql [PATH]`](#faststore-generate-graphql-path)
48
48
  * [`faststore help [COMMAND]`](#faststore-help-command)
49
- * [`faststore start`](#faststore-start)
50
- * [`faststore test`](#faststore-test)
49
+ * [`faststore start [PATH]`](#faststore-start-path)
50
+ * [`faststore test [PATH]`](#faststore-test-path)
51
51
 
52
- ## `faststore build`
52
+ ## `faststore build [PATH]`
53
53
 
54
54
  ```
55
55
  USAGE
56
- $ faststore build
56
+ $ faststore build [PATH]
57
+
58
+ ARGUMENTS
59
+ PATH The path where the FastStore being built is. Defaults to cwd.
57
60
  ```
58
61
 
59
- _See code: [dist/commands/build.ts](https://github.com/vtex/faststore/blob/v3.0.79/dist/commands/build.ts)_
62
+ _See code: [dist/commands/build.ts](https://github.com/vtex/faststore/blob/v3.0.82/dist/commands/build.ts)_
60
63
 
61
- ## `faststore cms-sync`
64
+ ## `faststore cms-sync [PATH]`
62
65
 
63
66
  ```
64
67
  USAGE
65
- $ faststore cms-sync [-d]
68
+ $ faststore cms-sync [PATH] [-d]
69
+
70
+ ARGUMENTS
71
+ PATH The path where the FastStore being synched with the CMS is. Defaults to cwd.
66
72
 
67
73
  FLAGS
68
74
  -d, --dry-run
69
75
  ```
70
76
 
71
- _See code: [dist/commands/cms-sync.ts](https://github.com/vtex/faststore/blob/v3.0.79/dist/commands/cms-sync.ts)_
77
+ _See code: [dist/commands/cms-sync.ts](https://github.com/vtex/faststore/blob/v3.0.82/dist/commands/cms-sync.ts)_
72
78
 
73
- ## `faststore dev`
79
+ ## `faststore dev [PATH]`
74
80
 
75
81
  ```
76
82
  USAGE
77
- $ faststore dev
83
+ $ faststore dev [PATH]
84
+
85
+ ARGUMENTS
86
+ PATH The path where the FastStore being run is. Defaults to cwd.
78
87
  ```
79
88
 
80
- _See code: [dist/commands/dev.ts](https://github.com/vtex/faststore/blob/v3.0.79/dist/commands/dev.ts)_
89
+ _See code: [dist/commands/dev.ts](https://github.com/vtex/faststore/blob/v3.0.82/dist/commands/dev.ts)_
81
90
 
82
- ## `faststore generate-graphql`
91
+ ## `faststore generate-graphql [PATH]`
83
92
 
84
93
  ```
85
94
  USAGE
86
- $ faststore generate-graphql [-d]
95
+ $ faststore generate-graphql [PATH] [-d]
96
+
97
+ ARGUMENTS
98
+ PATH The path where the FastStore GraphQL customization is. Defaults to cwd.
87
99
 
88
100
  FLAGS
89
101
  -d, --debug
90
102
  ```
91
103
 
92
- _See code: [dist/commands/generate-graphql.ts](https://github.com/vtex/faststore/blob/v3.0.79/dist/commands/generate-graphql.ts)_
104
+ _See code: [dist/commands/generate-graphql.ts](https://github.com/vtex/faststore/blob/v3.0.82/dist/commands/generate-graphql.ts)_
93
105
 
94
106
  ## `faststore help [COMMAND]`
95
107
 
@@ -111,21 +123,27 @@ DESCRIPTION
111
123
 
112
124
  _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.22/src/commands/help.ts)_
113
125
 
114
- ## `faststore start`
126
+ ## `faststore start [PATH]`
115
127
 
116
128
  ```
117
129
  USAGE
118
- $ faststore start
130
+ $ faststore start [PATH]
131
+
132
+ ARGUMENTS
133
+ PATH The path where the FastStore being run is. Defaults to cwd.
119
134
  ```
120
135
 
121
- _See code: [dist/commands/start.ts](https://github.com/vtex/faststore/blob/v3.0.79/dist/commands/start.ts)_
136
+ _See code: [dist/commands/start.ts](https://github.com/vtex/faststore/blob/v3.0.82/dist/commands/start.ts)_
122
137
 
123
- ## `faststore test`
138
+ ## `faststore test [PATH]`
124
139
 
125
140
  ```
126
141
  USAGE
127
- $ faststore test
142
+ $ faststore test [PATH]
143
+
144
+ ARGUMENTS
145
+ PATH The path where the FastStore being tested is. Defaults to cwd.
128
146
  ```
129
147
 
130
- _See code: [dist/commands/test.ts](https://github.com/vtex/faststore/blob/v3.0.79/dist/commands/test.ts)_
148
+ _See code: [dist/commands/test.ts](https://github.com/vtex/faststore/blob/v3.0.82/dist/commands/test.ts)_
131
149
  <!-- commandsstop -->
@@ -1,4 +1,8 @@
1
1
  import { Command } from '@oclif/core';
2
2
  export default class Build extends Command {
3
+ static args: {
4
+ name: string;
5
+ description: string;
6
+ }[];
3
7
  run(): Promise<void>;
4
8
  }
@@ -9,18 +9,27 @@ const fs_extra_1 = require("fs-extra");
9
9
  const directory_1 = require("../utils/directory");
10
10
  const generate_1 = require("../utils/generate");
11
11
  class Build extends core_1.Command {
12
+ static args = [
13
+ {
14
+ name: 'path',
15
+ description: 'The path where the FastStore being built is. Defaults to cwd.',
16
+ }
17
+ ];
12
18
  async run() {
13
- await (0, generate_1.generate)({ setup: true });
19
+ const { args } = await this.parse(Build);
20
+ const basePath = args.path ?? process.cwd();
21
+ const { tmpDir } = (0, directory_1.withBasePath)(basePath);
22
+ await (0, generate_1.generate)({ setup: true, basePath });
14
23
  const yarnBuildResult = (0, child_process_1.spawnSync)(`yarn build`, {
15
24
  shell: true,
16
- cwd: directory_1.tmpDir,
25
+ cwd: tmpDir,
17
26
  stdio: 'inherit',
18
27
  });
19
28
  if (yarnBuildResult.status && yarnBuildResult.status !== 0) {
20
29
  process.exit(yarnBuildResult.status);
21
30
  }
22
- await normalizeStandaloneBuildDir();
23
- await copyResources();
31
+ await normalizeStandaloneBuildDir(basePath);
32
+ await copyResources(basePath);
24
33
  }
25
34
  }
26
35
  exports.default = Build;
@@ -36,17 +45,19 @@ async function copyResource(from, to) {
36
45
  console.error(`${chalk_1.default.red('error')} - ${err}`);
37
46
  }
38
47
  }
39
- async function normalizeStandaloneBuildDir() {
48
+ async function normalizeStandaloneBuildDir(basePath) {
49
+ const { tmpDir } = (0, directory_1.withBasePath)(basePath);
40
50
  // Fix Next.js v13+ standalone build output directory
41
- if ((0, fs_1.existsSync)(`${directory_1.tmpDir}/.next/standalone/.faststore`)) {
42
- const standaloneBuildFiles = (0, fs_extra_1.readdirSync)(`${directory_1.tmpDir}/.next/standalone/.faststore`);
43
- await Promise.all(standaloneBuildFiles.map((file) => (0, fs_extra_1.moveSync)(`${directory_1.tmpDir}/.next/standalone/.faststore/${file}`, `${directory_1.tmpDir}/.next/standalone/${file}`, { overwrite: true })));
44
- (0, fs_extra_1.removeSync)(`${directory_1.tmpDir}/.next/standalone/.faststore`);
51
+ if ((0, fs_1.existsSync)(`${tmpDir}/.next/standalone/.faststore`)) {
52
+ const standaloneBuildFiles = (0, fs_extra_1.readdirSync)(`${tmpDir}/.next/standalone/.faststore`);
53
+ await Promise.all(standaloneBuildFiles.map((file) => (0, fs_extra_1.moveSync)(`${tmpDir}/.next/standalone/.faststore/${file}`, `${tmpDir}/.next/standalone/${file}`, { overwrite: true })));
54
+ (0, fs_extra_1.removeSync)(`${tmpDir}/.next/standalone/.faststore`);
45
55
  }
46
56
  }
47
- async function copyResources() {
48
- await copyResource(`${directory_1.tmpDir}/.next`, `${directory_1.userDir}/.next`);
49
- await copyResource(`${directory_1.tmpDir}/lighthouserc.js`, `${directory_1.userDir}/lighthouserc.js`);
50
- await copyResource(`${directory_1.tmpDir}/public`, `${directory_1.userDir}/public`);
57
+ async function copyResources(basePath) {
58
+ const { tmpDir, userDir } = (0, directory_1.withBasePath)(basePath);
59
+ await copyResource(`${tmpDir}/.next`, `${userDir}/.next`);
60
+ await copyResource(`${tmpDir}/lighthouserc.js`, `${userDir}/lighthouserc.js`);
61
+ await copyResource(`${tmpDir}/public`, `${userDir}/public`);
51
62
  }
52
63
  //# sourceMappingURL=build.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":";;;AAAA,sCAAqC;AACrC,0DAAyB;AACzB,iDAAyC;AACzC,2BAA+B;AAC/B,uCAAsE;AACtE,kDAAoD;AACpD,gDAA4C;AAE5C,MAAqB,KAAM,SAAQ,cAAO;IACxC,KAAK,CAAC,GAAG;QACP,MAAM,IAAA,mBAAQ,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QAE/B,MAAM,eAAe,GAAG,IAAA,yBAAS,EAAC,YAAY,EAAE;YAC9C,KAAK,EAAE,IAAI;YACX,GAAG,EAAE,kBAAM;YACX,KAAK,EAAE,SAAS;SACjB,CAAC,CAAA;QAEF,IAAI,eAAe,CAAC,MAAM,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE;YAC1D,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;SACrC;QAED,MAAM,2BAA2B,EAAE,CAAA;QACnC,MAAM,aAAa,EAAE,CAAA;IACvB,CAAC;CACF;AAjBD,wBAiBC;AAED,KAAK,UAAU,YAAY,CAAC,IAAY,EAAE,EAAU;IAClD,IAAI;QACF,IAAI,IAAA,eAAU,EAAC,EAAE,CAAC,EAAE;YAClB,IAAA,qBAAU,EAAC,EAAE,CAAC,CAAA;SACf;QAED,IAAA,mBAAQ,EAAC,IAAI,EAAE,EAAE,CAAC,CAAA;QAClB,OAAO,CAAC,GAAG,CACT,GAAG,eAAK,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,eAAK,CAAC,GAAG,CACnE,EAAE,CACH,EAAE,CACJ,CAAA;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,GAAG,eAA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,KAAK,UAAU,2BAA2B,CAAC,QAAgB;IACzD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,wBAAY,EAAC,QAAQ,CAAC,CAAA;IAEzC,qDAAqD;IACrD,IAAI,IAAA,eAAU,EAAC,GAAG,MAAM,8BAA8B,CAAC,EAAE;QACvD,MAAM,oBAAoB,GAAG,IAAA,sBAAW,EACtC,GAAG,MAAM,8BAA8B,CACxC,CAAA;QAED,MAAM,OAAO,CAAC,GAAG,CACf,oBAAoB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAChC,IAAA,mBAAQ,EACN,GAAG,MAAM,gCAAgC,IAAI,EAAE,EAC/C,GAAG,MAAM,qBAAqB,IAAI,EAAE,EACpC,EAAE,SAAS,EAAE,IAAI,EAAE,CACpB,CACF,CACF,CAAA;QACD,IAAA,qBAAU,EAAC,GAAG,MAAM,8BAA8B,CAAC,CAAA;KACpD;AACH,CAAC;AAED,KAAK,UAAU,aAAa,CAAC,QAAgB;IAC3C,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,wBAAY,EAAC,QAAQ,CAAC,CAAA;IAElD,MAAM,YAAY,CAAC,GAAG,MAAM,QAAQ,EAAE,GAAG,OAAO,QAAQ,CAAC,CAAA;IACzD,MAAM,YAAY,CAAC,GAAG,MAAM,kBAAkB,EAAE,GAAG,OAAO,kBAAkB,CAAC,CAAA;IAC7E,MAAM,YAAY,CAAC,GAAG,MAAM,SAAS,EAAE,GAAG,OAAO,SAAS,CAAC,CAAA;AAC7D,CAAC"}
@@ -4,5 +4,9 @@ export default class CmsSync extends Command {
4
4
  static flags: {
5
5
  "dry-run": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
6
  };
7
+ static args: {
8
+ name: string;
9
+ description: string;
10
+ }[];
7
11
  run(): Promise<import("child_process").ChildProcess | undefined>;
8
12
  }
@@ -9,16 +9,24 @@ class CmsSync extends core_1.Command {
9
9
  static flags = {
10
10
  ['dry-run']: core_1.Flags.boolean({ char: 'd' }),
11
11
  };
12
+ static args = [
13
+ {
14
+ name: 'path',
15
+ description: 'The path where the FastStore being synched with the CMS is. Defaults to cwd.',
16
+ }
17
+ ];
12
18
  async run() {
13
- const { flags } = await this.parse(CmsSync);
14
- await (0, generate_1.generate)({ setup: true });
15
- await (0, hcms_1.mergeCMSFiles)();
19
+ const { flags, args } = await this.parse(CmsSync);
20
+ const basePath = args.path ?? process.cwd();
21
+ const { tmpDir } = (0, directory_1.withBasePath)(basePath);
22
+ await (0, generate_1.generate)({ setup: true, basePath });
23
+ await (0, hcms_1.mergeCMSFiles)(basePath);
16
24
  if (flags['dry-run']) {
17
25
  return;
18
26
  }
19
27
  return (0, child_process_1.spawn)(`vtex cms sync faststore`, {
20
28
  shell: true,
21
- cwd: directory_1.tmpDir,
29
+ cwd: tmpDir,
22
30
  stdio: 'inherit',
23
31
  });
24
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cms-sync.js","sourceRoot":"","sources":["../../src/commands/cms-sync.ts"],"names":[],"mappings":";;AAAA,sCAA4C;AAC5C,iDAAqC;AACrC,kDAA2C;AAC3C,gDAA4C;AAC5C,wCAA6C;AAE7C,MAAqB,OAAQ,SAAQ,cAAO;IAC1C,MAAM,CAAC,KAAK,GAAG;QACb,CAAC,SAAS,CAAC,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;KAC1C,CAAA;IAED,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAE3C,MAAM,IAAA,mBAAQ,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QAC/B,MAAM,IAAA,oBAAa,GAAE,CAAA;QAErB,IAAI,KAAK,CAAC,SAAS,CAAC,EAAE;YACpB,OAAM;SACP;QAED,OAAO,IAAA,qBAAK,EAAC,yBAAyB,EAAE;YACtC,KAAK,EAAE,IAAI;YACX,GAAG,EAAE,kBAAM;YACX,KAAK,EAAE,SAAS;SACjB,CAAC,CAAA;IACJ,CAAC;;AApBH,0BAqBC"}
1
+ {"version":3,"file":"cms-sync.js","sourceRoot":"","sources":["../../src/commands/cms-sync.ts"],"names":[],"mappings":";;AAAA,sCAA4C;AAC5C,iDAAqC;AACrC,kDAAiD;AACjD,gDAA4C;AAC5C,wCAA6C;AAE7C,MAAqB,OAAQ,SAAQ,cAAO;IAC1C,MAAM,CAAC,KAAK,GAAG;QACb,CAAC,SAAS,CAAC,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;KAC1C,CAAA;IAED,MAAM,CAAC,IAAI,GAAG;QACZ;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,8EAA8E;SAC5F;KACF,CAAA;IAGD,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAEjD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAA;QAC3C,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,wBAAY,EAAC,QAAQ,CAAC,CAAA;QAEzC,MAAM,IAAA,mBAAQ,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;QACzC,MAAM,IAAA,oBAAa,EAAC,QAAQ,CAAC,CAAA;QAE7B,IAAI,KAAK,CAAC,SAAS,CAAC,EAAE;YACpB,OAAM;SACP;QAED,OAAO,IAAA,qBAAK,EAAC,yBAAyB,EAAE;YACtC,KAAK,EAAE,IAAI;YACX,GAAG,EAAE,MAAM;YACX,KAAK,EAAE,SAAS;SACjB,CAAC,CAAA;IACJ,CAAC;;AA/BH,0BAgCC"}
@@ -1,4 +1,8 @@
1
1
  import { Command } from '@oclif/core';
2
2
  export default class Dev extends Command {
3
+ static args: {
4
+ name: string;
5
+ description: string;
6
+ }[];
3
7
  run(): Promise<unknown>;
4
8
  }
@@ -28,11 +28,11 @@ const defaultIgnored = [
28
28
  '**/.faststore/**',
29
29
  ];
30
30
  const devAbortController = new AbortController();
31
- async function storeDev() {
32
- const envVars = dotenv_1.default.parse((0, fs_1.readFileSync)(path_1.default.join((0, directory_1.getRoot)(), 'vtex.env')));
31
+ async function storeDev(rootDir, tmpDir) {
32
+ const envVars = dotenv_1.default.parse((0, fs_1.readFileSync)(path_1.default.join(rootDir, 'vtex.env')));
33
33
  const devProcess = (0, child_process_1.spawn)('yarn dev', {
34
34
  shell: true,
35
- cwd: directory_1.tmpDir,
35
+ cwd: tmpDir,
36
36
  signal: devAbortController.signal,
37
37
  stdio: 'inherit',
38
38
  env: {
@@ -45,17 +45,25 @@ async function storeDev() {
45
45
  });
46
46
  }
47
47
  class Dev extends core_1.Command {
48
+ static args = [
49
+ {
50
+ name: 'path',
51
+ description: 'The path where the FastStore being run is. Defaults to cwd.',
52
+ }
53
+ ];
48
54
  async run() {
55
+ const { args } = await this.parse(Dev);
56
+ const basePath = args.path ?? process.cwd();
57
+ const { getRoot, tmpDir } = (0, directory_1.withBasePath)(basePath);
49
58
  const queueChange = ( /* path: string, remove: boolean */) => {
50
- // getContentFromPath(path, remove)
51
- (0, generate_1.generate)();
59
+ (0, generate_1.generate)({ basePath });
52
60
  };
53
61
  const watcher = chokidar_1.default.watch([...defaultPatterns], {
54
62
  atomic: stabilityThreshold,
55
63
  awaitWriteFinish: {
56
64
  stabilityThreshold,
57
65
  },
58
- cwd: (0, directory_1.getRoot)(),
66
+ cwd: getRoot(),
59
67
  ignoreInitial: true,
60
68
  ignored: defaultIgnored,
61
69
  persistent: true,
@@ -64,8 +72,8 @@ class Dev extends core_1.Command {
64
72
  devAbortController.signal.addEventListener('abort', () => {
65
73
  watcher.close();
66
74
  });
67
- await (0, generate_1.generate)({ setup: true });
68
- storeDev();
75
+ await (0, generate_1.generate)({ setup: true, basePath });
76
+ storeDev(getRoot(), tmpDir);
69
77
  return await new Promise((resolve, reject) => {
70
78
  watcher
71
79
  .on('add', ( /*file*/) => queueChange( /*file, false*/))
@@ -1 +1 @@
1
- {"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACtC,iDAAsC;AACtC,gEAAgC;AAChC,4DAA4B;AAE5B,2BAAkC;AAClC,wDAAwB;AACxB,kDAAqD;AACrD,gDAA6C;AAE7C;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;AAEpE,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AAEtC,MAAM,cAAc,GAAG;IACrB,WAAW;IACX,WAAW;IACX,YAAY;IACZ,cAAc;IACd,iBAAiB;IACjB,oBAAoB;IACpB,SAAS;IACT,eAAe;IACf,kBAAkB;CACnB,CAAA;AAED,MAAM,kBAAkB,GAAG,IAAI,eAAe,EAAE,CAAA;AAEhD,KAAK,UAAU,QAAQ;IACrB,MAAM,OAAO,GAAG,gBAAM,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,cAAI,CAAC,IAAI,CAAC,IAAA,mBAAO,GAAE,EAAE,UAAU,CAAC,CAAC,CAAC,CAAA;IAE5E,MAAM,UAAU,GAAG,IAAA,qBAAK,EAAC,UAAU,EAAE;QACnC,KAAK,EAAE,IAAI;QACX,GAAG,EAAE,kBAAM;QACX,MAAM,EAAE,kBAAkB,CAAC,MAAM;QACjC,KAAK,EAAE,SAAS;QAChB,GAAG,EAAE;YACH,GAAG,OAAO,CAAC,GAAG;YACd,GAAG,OAAO;SACX;KACF,CAAC,CAAA;IAEF,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QAC1B,kBAAkB,CAAC,KAAK,EAAE,CAAA;IAC5B,CAAC,CAAC,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AO;iBACJ,EAAE,CAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,EAAC,eAAe,CAAC,CAAC;iBACrD,EAAE,CAAC,QAAQ,EAAE,EAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,EAAC,eAAe,CAAC,CAAC;iBACxD,EAAE,CAAC,QAAQ,EAAE,EAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,EAAC,cAAc,CAAC,CAAC;iBACvD,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;gBAChB,kBAAkB,CAAC,KAAK,EAAE,CAAA;gBAC1B,MAAM,EAAE,CAAA;YACV,CAAC,CAAC;iBACD,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACzB,CAAC,CAAC,CAAA;IACJ,CAAC;;AAjDH,sBAkDC"}
@@ -4,5 +4,9 @@ export default class GenerateGraphql extends Command {
4
4
  debug: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
5
5
  core: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
6
  };
7
+ static args: {
8
+ name: string;
9
+ description: string;
10
+ }[];
7
11
  run(): Promise<void>;
8
12
  }
@@ -11,11 +11,19 @@ class GenerateGraphql extends core_1.Command {
11
11
  debug: core_1.Flags.boolean({ char: 'd' }),
12
12
  core: core_1.Flags.boolean({ char: 'c', hidden: true }),
13
13
  };
14
+ static args = [
15
+ {
16
+ name: 'path',
17
+ description: 'The path where the FastStore GraphQL customization is. Defaults to cwd.',
18
+ }
19
+ ];
14
20
  async run() {
15
- const { flags } = await this.parse(GenerateGraphql);
21
+ const { flags, args } = await this.parse(GenerateGraphql);
22
+ const basePath = args.path ?? process.cwd();
23
+ const { tmpDir, coreDir } = (0, directory_1.withBasePath)(basePath);
16
24
  const debug = flags.debug ?? false;
17
25
  const isCore = flags.core ?? false;
18
- if (!isCore && !(0, fs_extra_1.existsSync)(directory_1.tmpDir)) {
26
+ if (!isCore && !(0, fs_extra_1.existsSync)(tmpDir)) {
19
27
  console.log(`${chalk_1.default.red('error')} - The ".faststore" directory could not be found. When running faststore dev or faststore build, the generate-graphql command is automatically executed.`);
20
28
  process.exit(1);
21
29
  }
@@ -24,29 +32,29 @@ class GenerateGraphql extends core_1.Command {
24
32
  errorMessage: "Failed to run 'yarn generate:schema'. Please check your setup.",
25
33
  throws: 'error',
26
34
  debug,
27
- cwd: isCore ? undefined : directory_1.tmpDir,
35
+ cwd: isCore ? undefined : tmpDir,
28
36
  });
29
37
  (0, runCommandSync_1.runCommandSync)({
30
38
  cmd: 'yarn generate:codegen',
31
39
  errorMessage: 'GraphQL was not optimized and TS files were not updated. Changes in the GraphQL layer did not take effect',
32
40
  throws: 'error',
33
41
  debug,
34
- cwd: isCore ? undefined : directory_1.tmpDir,
42
+ cwd: isCore ? undefined : tmpDir,
35
43
  });
36
44
  (0, runCommandSync_1.runCommandSync)({
37
45
  cmd: 'yarn format:generated',
38
46
  errorMessage: "Failed to format generated files. 'yarn format:generated' thrown errors",
39
47
  throws: 'warning',
40
48
  debug,
41
- cwd: isCore ? undefined : directory_1.tmpDir,
49
+ cwd: isCore ? undefined : tmpDir,
42
50
  });
43
51
  // yarn generate:copy-back expects the DESTINATION var to be present so it can copy the files to the correct directory
44
52
  (0, runCommandSync_1.runCommandSync)({
45
- cmd: `DESTINATION=${directory_1.coreDir} yarn generate:copy-back`,
53
+ cmd: `DESTINATION=${coreDir} yarn generate:copy-back`,
46
54
  errorMessage: "Failed to copy back typings files. 'yarn generate:copy-back' thrown errors",
47
55
  throws: 'warning',
48
56
  debug,
49
- cwd: isCore ? undefined : directory_1.tmpDir,
57
+ cwd: isCore ? undefined : tmpDir,
50
58
  });
51
59
  console.log(`${chalk_1.default.green('success')} - GraphQL schema, types, and optimizations successfully generated 🎉`);
52
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generate-graphql.js","sourceRoot":"","sources":["../../src/commands/generate-graphql.ts"],"names":[],"mappings":";;;AAAA,sCAA4C;AAC5C,uCAAqC;AAC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ACT,GAAG,eAAK,CAAC,KAAK,CACZ,SAAS,CACV,uEAAuE,CACzE,CAAA;IACH,CAAC;;AA1EH,kCA2EC"}
@@ -1,5 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  import { Command } from '@oclif/core';
3
3
  export default class Start extends Command {
4
+ static args: {
5
+ name: string;
6
+ description: string;
7
+ }[];
4
8
  run(): Promise<import("child_process").ChildProcess>;
5
9
  }
@@ -5,13 +5,22 @@ const child_process_1 = require("child_process");
5
5
  const fs_extra_1 = require("fs-extra");
6
6
  const directory_1 = require("../utils/directory");
7
7
  class Start extends core_1.Command {
8
+ static args = [
9
+ {
10
+ name: 'path',
11
+ description: 'The path where the FastStore being run is. Defaults to cwd.',
12
+ }
13
+ ];
8
14
  async run() {
9
- if (!(0, fs_extra_1.existsSync)(directory_1.tmpDir)) {
15
+ const { args } = await this.parse(Start);
16
+ const basePath = args.path ?? process.cwd();
17
+ const { tmpDir } = (0, directory_1.withBasePath)(basePath);
18
+ if (!(0, fs_extra_1.existsSync)(tmpDir)) {
10
19
  throw Error('The ".faststore" directory could not be found. If you are trying to serve your store, run "faststore build" first.');
11
20
  }
12
21
  return (0, child_process_1.spawn)(`yarn serve`, {
13
22
  shell: true,
14
- cwd: directory_1.tmpDir,
23
+ cwd: tmpDir,
15
24
  stdio: 'inherit',
16
25
  });
17
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":";;AAAA,sCAAqC;AACrC,iDAAqC;AACrC,uCAAqC;AACrC,kDAA2C;AAE3C,MAAqB,KAAM,SAAQ,cAAO;IACxC,KAAK,CAAC,GAAG;QACP,IAAI,CAAC,IAAA,qBAAU,EAAC,kBAAM,CAAC,EAAE;YACvB,MAAM,KAAK,CACT,oHAAoH,CACrH,CAAA;SACF;QAED,OAAO,IAAA,qBAAK,EAAC,YAAY,EAAE;YACzB,KAAK,EAAE,IAAI;YACX,GAAG,EAAE,kBAAM;YACX,KAAK,EAAE,SAAS;SACjB,CAAC,CAAA;IACJ,CAAC;CACF;AAdD,wBAcC"}
1
+ {"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":";;AAAA,sCAAqC;AACrC,iDAAqC;AACrC,uCAAqC;AACrC,kDAAiD;AAEjD,MAAqB,KAAM,SAAQ,cAAO;IACxC,MAAM,CAAC,IAAI,GAAG;QACZ;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,6DAA6D;SAC3E;KACF,CAAA;IAED,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAA;QAC3C,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,wBAAY,EAAC,QAAQ,CAAC,CAAA;QAEzC,IAAI,CAAC,IAAA,qBAAU,EAAC,MAAM,CAAC,EAAE;YACvB,MAAM,KAAK,CACT,oHAAoH,CACrH,CAAA;SACF;QAED,OAAO,IAAA,qBAAK,EAAC,YAAY,EAAE;YACzB,KAAK,EAAE,IAAI;YACX,GAAG,EAAE,MAAM;YACX,KAAK,EAAE,SAAS;SACjB,CAAC,CAAA;IACJ,CAAC;;AAxBH,wBAyBC"}
@@ -1,4 +1,8 @@
1
1
  import { Command } from '@oclif/core';
2
2
  export default class Test extends Command {
3
+ static args: {
4
+ name: string;
5
+ description: string;
6
+ }[];
3
7
  run(): Promise<unknown>;
4
8
  }
@@ -25,10 +25,10 @@ const defaultIgnored = [
25
25
  '**/.faststore/**',
26
26
  ];
27
27
  const testAbortController = new AbortController();
28
- async function storeTest() {
28
+ async function storeTest(tmpDir) {
29
29
  const testProcess = (0, child_process_1.spawn)('yarn test:e2e', {
30
30
  shell: true,
31
- cwd: directory_1.tmpDir,
31
+ cwd: tmpDir,
32
32
  signal: testAbortController.signal,
33
33
  stdio: 'inherit',
34
34
  });
@@ -37,13 +37,22 @@ async function storeTest() {
37
37
  });
38
38
  }
39
39
  class Test extends core_1.Command {
40
+ static args = [
41
+ {
42
+ name: 'path',
43
+ description: 'The path where the FastStore being tested is. Defaults to cwd.',
44
+ }
45
+ ];
40
46
  async run() {
47
+ const { args } = await this.parse(Test);
48
+ const basePath = args.path ?? process.cwd();
49
+ const { getRoot, tmpDir } = (0, directory_1.withBasePath)(basePath);
41
50
  const watcher = chokidar_1.default.watch([...defaultPatterns], {
42
51
  atomic: stabilityThreshold,
43
52
  awaitWriteFinish: {
44
53
  stabilityThreshold,
45
54
  },
46
- cwd: (0, directory_1.getRoot)(),
55
+ cwd: getRoot(),
47
56
  ignoreInitial: true,
48
57
  ignored: defaultIgnored,
49
58
  persistent: true,
@@ -52,8 +61,8 @@ class Test extends core_1.Command {
52
61
  testAbortController.signal.addEventListener('abort', () => {
53
62
  watcher.close();
54
63
  });
55
- await (0, generate_1.generate)({ setup: true });
56
- storeTest();
64
+ await (0, generate_1.generate)({ setup: true, basePath });
65
+ storeTest(tmpDir);
57
66
  return await new Promise((resolve, reject) => {
58
67
  watcher
59
68
  .on('error', () => {
@@ -1 +1 @@
1
- {"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/commands/test.ts"],"names":[],"mappings":";;;AAAA,sCAAqC;AACrC,iDAAqC;AACrC,gEAA+B;AAE/B,gDAA4C;AAC5C,kDAAoD;AAEpD;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;AAEpE,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AAEtC,MAAM,cAAc,GAAG;IACrB,WAAW;IACX,WAAW;IACX,YAAY;IACZ,cAAc;IACd,iBAAiB;IACjB,oBAAoB;IACpB,SAAS;IACT,eAAe;IACf,kBAAkB;CACnB,CAAA;AAED,M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AAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAA;QAC3C,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAA,wBAAY,EAAC,QAAQ,CAAC,CAAA;QAElD,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,OAAO,EAAE;YACd,aAAa,EAAE,IAAI;YACnB,OAAO,EAAE,cAAc;YACvB,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO;SACzC,CAAC,CAAA;QAEF,mBAAmB,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;YACxD,OAAO,CAAC,KAAK,EAAE,CAAA;QACjB,CAAC,CAAC,CAAA;QAEF,MAAM,IAAA,mBAAQ,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;QAEzC,SAAS,CAAC,MAAM,CAAC,CAAA;QAEjB,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,OAAO;iBACJ,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;gBAChB,mBAAmB,CAAC,KAAK,EAAE,CAAA;gBAC3B,MAAM,EAAE,CAAA;YACV,CAAC,CAAC;iBACD,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACzB,CAAC,CAAC,CAAA;IACJ,CAAC;;AAzCH,uBA0CC"}
@@ -1,25 +1,17 @@
1
- export declare const tmpFolderName = ".faststore";
2
- export declare const getRoot: () => string;
3
- export declare const userDir: string;
4
- export declare const faststoreDir: string;
5
- export declare const tmpDir: string;
6
- export declare const coreFolderName = "core";
7
- export declare const coreDir: string;
8
- export declare const srcFolderName = "src";
9
- export declare const userSrcDir: string;
10
- export declare const customizationsFolderName = "customizations";
11
- export declare const tmpCustomizationsDir: string;
12
- export declare const tmpCustomizationsSrcDir: string;
13
- export declare const userThemesFileDir: string;
14
- export declare const tmpThemesCustomizationsFileDir: string;
15
- export declare const cmsFolderName: string;
16
- export declare const tmpCMSDir: string;
17
- export declare const coreCMSDir: string;
18
- export declare const userCMSDir: string;
19
- export declare const configFileName = "faststore.config.js";
20
- export declare const userStoreConfigFileDir: string;
21
- export declare const tmpStoreConfigFileDir: string;
22
- export declare const userNodeModulesDir: string;
23
- export declare const tmpNodeModulesDir: string;
24
- export declare const cmsWebhookUrlsFileName = "cms-webhook-urls.json";
25
- export declare const tmpCmsWebhookUrlsFileDir: string;
1
+ export declare const withBasePath: (basepath: string) => {
2
+ getRoot: () => string;
3
+ userDir: string;
4
+ userSrcDir: string;
5
+ userThemesFileDir: string;
6
+ userCMSDir: string;
7
+ userStoreConfigFile: string;
8
+ tmpFolderName: string;
9
+ tmpDir: string;
10
+ tmpCustomizationsSrcDir: string;
11
+ tmpThemesCustomizationsFile: string;
12
+ tmpCMSDir: string;
13
+ tmpCMSWebhookUrlsFile: string;
14
+ tmpStoreConfigFile: string;
15
+ coreDir: string;
16
+ coreCMSDir: string;
17
+ };