@faststore/cli 3.0.82 → 3.0.87

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/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.82 linux-x64 node-v18.20.3
33
+ @faststore/cli/3.0.87 linux-x64 node-v18.20.4
34
34
  $ faststore --help [COMMAND]
35
35
  USAGE
36
36
  $ faststore COMMAND
@@ -44,8 +44,8 @@ USAGE
44
44
  * [`faststore build [PATH]`](#faststore-build-path)
45
45
  * [`faststore cms-sync [PATH]`](#faststore-cms-sync-path)
46
46
  * [`faststore dev [PATH]`](#faststore-dev-path)
47
- * [`faststore generate-graphql [PATH]`](#faststore-generate-graphql-path)
48
47
  * [`faststore help [COMMAND]`](#faststore-help-command)
48
+ * [`faststore init [PATH]`](#faststore-init-path)
49
49
  * [`faststore start [PATH]`](#faststore-start-path)
50
50
  * [`faststore test [PATH]`](#faststore-test-path)
51
51
 
@@ -59,7 +59,7 @@ ARGUMENTS
59
59
  PATH The path where the FastStore being built is. Defaults to cwd.
60
60
  ```
61
61
 
62
- _See code: [dist/commands/build.ts](https://github.com/vtex/faststore/blob/v3.0.82/dist/commands/build.ts)_
62
+ _See code: [dist/commands/build.ts](https://github.com/vtex/faststore/blob/v3.0.87/dist/commands/build.ts)_
63
63
 
64
64
  ## `faststore cms-sync [PATH]`
65
65
 
@@ -74,7 +74,7 @@ FLAGS
74
74
  -d, --dry-run
75
75
  ```
76
76
 
77
- _See code: [dist/commands/cms-sync.ts](https://github.com/vtex/faststore/blob/v3.0.82/dist/commands/cms-sync.ts)_
77
+ _See code: [dist/commands/cms-sync.ts](https://github.com/vtex/faststore/blob/v3.0.87/dist/commands/cms-sync.ts)_
78
78
 
79
79
  ## `faststore dev [PATH]`
80
80
 
@@ -86,42 +86,47 @@ ARGUMENTS
86
86
  PATH The path where the FastStore being run is. Defaults to cwd.
87
87
  ```
88
88
 
89
- _See code: [dist/commands/dev.ts](https://github.com/vtex/faststore/blob/v3.0.82/dist/commands/dev.ts)_
89
+ _See code: [dist/commands/dev.ts](https://github.com/vtex/faststore/blob/v3.0.87/dist/commands/dev.ts)_
90
90
 
91
- ## `faststore generate-graphql [PATH]`
91
+ ## `faststore help [COMMAND]`
92
+
93
+ Display help for faststore.
92
94
 
93
95
  ```
94
96
  USAGE
95
- $ faststore generate-graphql [PATH] [-d]
97
+ $ faststore help [COMMAND] [-n]
96
98
 
97
99
  ARGUMENTS
98
- PATH The path where the FastStore GraphQL customization is. Defaults to cwd.
100
+ COMMAND Command to show help for.
99
101
 
100
102
  FLAGS
101
- -d, --debug
103
+ -n, --nested-commands Include all nested commands in the output.
104
+
105
+ DESCRIPTION
106
+ Display help for faststore.
102
107
  ```
103
108
 
104
- _See code: [dist/commands/generate-graphql.ts](https://github.com/vtex/faststore/blob/v3.0.82/dist/commands/generate-graphql.ts)_
109
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.22/src/commands/help.ts)_
105
110
 
106
- ## `faststore help [COMMAND]`
111
+ ## `faststore init [PATH]`
107
112
 
108
- Display help for faststore.
113
+ Creates a discovery folder based on the starter.store template.
109
114
 
110
115
  ```
111
116
  USAGE
112
- $ faststore help [COMMAND] [-n]
117
+ $ faststore init [PATH]
113
118
 
114
119
  ARGUMENTS
115
- COMMAND Command to show help for.
116
-
117
- FLAGS
118
- -n, --nested-commands Include all nested commands in the output.
120
+ PATH The path where the Discovery folder will be created. Defaults to ./discovery.
119
121
 
120
122
  DESCRIPTION
121
- Display help for faststore.
123
+ Creates a discovery folder based on the starter.store template.
124
+
125
+ EXAMPLES
126
+ $ yarn faststore init discovery
122
127
  ```
123
128
 
124
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.22/src/commands/help.ts)_
129
+ _See code: [dist/commands/init.ts](https://github.com/vtex/faststore/blob/v3.0.87/dist/commands/init.ts)_
125
130
 
126
131
  ## `faststore start [PATH]`
127
132
 
@@ -133,7 +138,7 @@ ARGUMENTS
133
138
  PATH The path where the FastStore being run is. Defaults to cwd.
134
139
  ```
135
140
 
136
- _See code: [dist/commands/start.ts](https://github.com/vtex/faststore/blob/v3.0.82/dist/commands/start.ts)_
141
+ _See code: [dist/commands/start.ts](https://github.com/vtex/faststore/blob/v3.0.87/dist/commands/start.ts)_
137
142
 
138
143
  ## `faststore test [PATH]`
139
144
 
@@ -145,5 +150,5 @@ ARGUMENTS
145
150
  PATH The path where the FastStore being tested is. Defaults to cwd.
146
151
  ```
147
152
 
148
- _See code: [dist/commands/test.ts](https://github.com/vtex/faststore/blob/v3.0.82/dist/commands/test.ts)_
153
+ _See code: [dist/commands/test.ts](https://github.com/vtex/faststore/blob/v3.0.87/dist/commands/test.ts)_
149
154
  <!-- commandsstop -->
@@ -9,6 +9,8 @@ const fs_1 = require("fs");
9
9
  const path_1 = tslib_1.__importDefault(require("path"));
10
10
  const directory_1 = require("../utils/directory");
11
11
  const generate_1 = require("../utils/generate");
12
+ const runCommandSync_1 = require("../utils/runCommandSync");
13
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
12
14
  /**
13
15
  * Taken from toolbelt
14
16
  *
@@ -28,9 +30,21 @@ const defaultIgnored = [
28
30
  '**/.faststore/**',
29
31
  ];
30
32
  const devAbortController = new AbortController();
31
- async function storeDev(rootDir, tmpDir) {
33
+ async function storeDev(rootDir, tmpDir, coreDir) {
32
34
  const envVars = dotenv_1.default.parse((0, fs_1.readFileSync)(path_1.default.join(rootDir, 'vtex.env')));
33
- const devProcess = (0, child_process_1.spawn)('yarn dev', {
35
+ (0, runCommandSync_1.runCommandSync)({
36
+ cmd: 'yarn predev',
37
+ errorMessage: 'GraphQL was not optimized and TS files were not updated. Changes in the GraphQL layer did not take effect',
38
+ throws: 'error',
39
+ debug: true,
40
+ cwd: tmpDir,
41
+ });
42
+ const { success } = copyGenerated(path_1.default.join(tmpDir, '@generated'), path_1.default.join(coreDir, '@generated'));
43
+ if (!success) {
44
+ console.log(`${chalk_1.default.yellow('warn')} - Failed to copy @generated schema back to node_modules, autocomplete and DX might be impacted.`);
45
+ console.log(`Attempted to copy from ${path_1.default.join(tmpDir, '@generated')} to ${path_1.default.join(coreDir, '@generated')}`);
46
+ }
47
+ const devProcess = (0, child_process_1.spawn)('yarn dev-only', {
34
48
  shell: true,
35
49
  cwd: tmpDir,
36
50
  signal: devAbortController.signal,
@@ -44,6 +58,15 @@ async function storeDev(rootDir, tmpDir) {
44
58
  devAbortController.abort();
45
59
  });
46
60
  }
61
+ function copyGenerated(from, to) {
62
+ try {
63
+ (0, fs_1.cpSync)(from, to, { recursive: true, force: true });
64
+ return { success: true };
65
+ }
66
+ catch (err) {
67
+ return { success: false };
68
+ }
69
+ }
47
70
  class Dev extends core_1.Command {
48
71
  static args = [
49
72
  {
@@ -54,7 +77,7 @@ class Dev extends core_1.Command {
54
77
  async run() {
55
78
  const { args } = await this.parse(Dev);
56
79
  const basePath = args.path ?? process.cwd();
57
- const { getRoot, tmpDir } = (0, directory_1.withBasePath)(basePath);
80
+ const { getRoot, tmpDir, coreDir } = (0, directory_1.withBasePath)(basePath);
58
81
  const queueChange = ( /* path: string, remove: boolean */) => {
59
82
  (0, generate_1.generate)({ basePath });
60
83
  };
@@ -73,7 +96,7 @@ class Dev extends core_1.Command {
73
96
  watcher.close();
74
97
  });
75
98
  await (0, generate_1.generate)({ setup: true, basePath });
76
- storeDev(getRoot(), tmpDir);
99
+ storeDev(getRoot(), tmpDir, coreDir);
77
100
  return await new Promise((resolve, reject) => {
78
101
  watcher
79
102
  .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,wDAA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E,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"}
@@ -0,0 +1,10 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class Init extends Command {
3
+ static args: {
4
+ name: string;
5
+ description: string;
6
+ }[];
7
+ static description: string;
8
+ static examples: string[];
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
5
+ const degit_1 = tslib_1.__importDefault(require("degit"));
6
+ const core_1 = require("@oclif/core");
7
+ const prompts_1 = require("@inquirer/prompts");
8
+ class Init extends core_1.Command {
9
+ static args = [
10
+ {
11
+ name: 'path',
12
+ description: 'The path where the Discovery folder will be created. Defaults to ./discovery.',
13
+ },
14
+ ];
15
+ static description = 'Creates a discovery folder based on the starter.store template.';
16
+ static examples = ['$ yarn faststore init discovery'];
17
+ async run() {
18
+ const { args } = await this.parse(Init);
19
+ const discoveryPath = args.path ?? './discovery';
20
+ const discoveryFolderExists = node_fs_1.default.existsSync(discoveryPath);
21
+ if (discoveryFolderExists) {
22
+ const confirmOverride = await (0, prompts_1.confirm)({
23
+ message: `It looks like you already have a discovery folder named "${discoveryPath}" in your store. Do you want to override it?`,
24
+ });
25
+ if (!confirmOverride)
26
+ return this.log('🛑 Interrupted initializing discovery');
27
+ }
28
+ const discoveryEmitter = (0, degit_1.default)('vtex-sites/starter.store', {
29
+ force: true,
30
+ });
31
+ this.log('Pulling starter.store template...');
32
+ discoveryEmitter.clone(discoveryPath).then(() => {
33
+ this.log(`Discovery created successfully! You can find it at ${discoveryPath}`);
34
+ });
35
+ }
36
+ }
37
+ exports.default = Init;
38
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":";;;AAAA,8DAAwB;AACxB,0DAAyB;AACzB,sCAAqC;AACrC,+CAA2C;AAE3C,MAAqB,IAAK,SAAQ,cAAO;IACvC,MAAM,CAAC,IAAI,GAAG;QACZ;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EACT,+EAA+E;SAClF;KACF,CAAA;IAED,MAAM,CAAC,WAAW,GAChB,iEAAiE,CAAA;IAEnE,MAAM,CAAC,QAAQ,GAAG,CAAC,iCAAiC,CAAC,CAAA;IAErD,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAEvC,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,IAAI,aAAa,CAAA;QAChD,MAAM,qBAAqB,GAAG,iBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;QAE1D,IAAI,qBAAqB,EAAE;YACzB,MAAM,eAAe,GAAG,MAAM,IAAA,iBAAO,EAAC;gBACpC,OAAO,EAAE,4DAA4D,aAAa,8CAA8C;aACjI,CAAC,CAAA;YAEF,IAAI,CAAC,eAAe;gBAClB,OAAO,IAAI,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAA;SAC3D;QAED,MAAM,gBAAgB,GAAG,IAAA,eAAK,EAAC,0BAA0B,EAAE;YACzD,KAAK,EAAE,IAAI;SACZ,CAAC,CAAA;QAEF,IAAI,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAA;QAE7C,gBAAgB,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YAC9C,IAAI,CAAC,GAAG,CACN,sDAAsD,aAAa,EAAE,CACtE,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;;AAxCH,uBAyCC"}
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  export { run } from '@oclif/core';
2
+ import { default as Init } from './commands/init';
2
3
  import { default as Dev } from './commands/dev';
3
4
  import { default as Build } from './commands/build';
4
5
  import { default as Serve } from './commands/start';
5
6
  import { default as CmsSync } from './commands/cms-sync';
6
- import { default as GenerateGraphql } from './commands/generate-graphql';
7
7
  import { default as Test } from './commands/test';
8
8
  export declare const commands: {
9
+ init: typeof Init;
9
10
  dev: typeof Dev;
10
11
  build: typeof Build;
11
12
  serve: typeof Serve;
12
13
  'cms-sync': typeof CmsSync;
13
- 'generate-graphql': typeof GenerateGraphql;
14
14
  test: typeof Test;
15
15
  };
package/dist/index.js CHANGED
@@ -4,18 +4,18 @@ exports.commands = exports.run = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  var core_1 = require("@oclif/core");
6
6
  Object.defineProperty(exports, "run", { enumerable: true, get: function () { return core_1.run; } });
7
+ const init_1 = tslib_1.__importDefault(require("./commands/init"));
7
8
  const dev_1 = tslib_1.__importDefault(require("./commands/dev"));
8
9
  const build_1 = tslib_1.__importDefault(require("./commands/build"));
9
10
  const start_1 = tslib_1.__importDefault(require("./commands/start"));
10
11
  const cms_sync_1 = tslib_1.__importDefault(require("./commands/cms-sync"));
11
- const generate_graphql_1 = tslib_1.__importDefault(require("./commands/generate-graphql"));
12
12
  const test_1 = tslib_1.__importDefault(require("./commands/test"));
13
13
  exports.commands = {
14
+ init: init_1.default,
14
15
  dev: dev_1.default,
15
16
  build: build_1.default,
16
17
  serve: start_1.default,
17
18
  'cms-sync': cms_sync_1.default,
18
- 'generate-graphql': generate_graphql_1.default,
19
19
  test: test_1.default,
20
20
  };
21
21
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,oCAAiC;AAAxB,2FAAA,GAAG,OAAA;AAEZ,iEAA+C;AAC/C,qEAAmD;AACnD,qEAAmD;AACnD,2EAAwD;AACxD,2FAAwE;AACxE,mEAAiD;AAEpC,QAAA,QAAQ,GAAG;IACtB,GAAG,EAAE,aAAG;IACR,KAAK,EAAE,eAAK;IACZ,KAAK,EAAE,eAAK;IACZ,UAAU,EAAE,kBAAO;IACnB,kBAAkB,EAAE,0BAAe;IACnC,IAAI,EAAE,cAAI;CACX,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,oCAAiC;AAAxB,2FAAA,GAAG,OAAA;AAEZ,mEAAiD;AACjD,iEAA+C;AAC/C,qEAAmD;AACnD,qEAAmD;AACnD,2EAAwD;AACxD,mEAAiD;AAEpC,QAAA,QAAQ,GAAG;IACtB,IAAI,EAAE,cAAI;IACV,GAAG,EAAE,aAAG;IACR,KAAK,EAAE,eAAK;IACZ,KAAK,EAAE,eAAK;IACZ,UAAU,EAAE,kBAAO;IACnB,IAAI,EAAE,cAAI;CACX,CAAA"}
@@ -1 +1 @@
1
- {"version":"3.0.82","commands":{"build":{"id":"build","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"The path where the FastStore being built is. Defaults to cwd."}]},"cms-sync":{"id":"cms-sync","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{"dry-run":{"name":"dry-run","type":"boolean","char":"d","allowNo":false}},"args":[{"name":"path","description":"The path where the FastStore being synched with the CMS is. Defaults to cwd."}]},"dev":{"id":"dev","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"The path where the FastStore being run is. Defaults to cwd."}]},"generate-graphql":{"id":"generate-graphql","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{"debug":{"name":"debug","type":"boolean","char":"d","allowNo":false},"core":{"name":"core","type":"boolean","char":"c","hidden":true,"allowNo":false}},"args":[{"name":"path","description":"The path where the FastStore GraphQL customization is. Defaults to cwd."}]},"start":{"id":"start","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"The path where the FastStore being run is. Defaults to cwd."}]},"test":{"id":"test","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"The path where the FastStore being tested is. Defaults to cwd."}]}}}
1
+ {"version":"3.0.87","commands":{"build":{"id":"build","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"The path where the FastStore being built is. Defaults to cwd."}]},"cms-sync":{"id":"cms-sync","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{"dry-run":{"name":"dry-run","type":"boolean","char":"d","allowNo":false}},"args":[{"name":"path","description":"The path where the FastStore being synched with the CMS is. Defaults to cwd."}]},"dev":{"id":"dev","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"The path where the FastStore being run is. Defaults to cwd."}]},"init":{"id":"init","description":"Creates a discovery folder based on the starter.store template.","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"examples":["$ yarn faststore init discovery"],"flags":{},"args":[{"name":"path","description":"The path where the Discovery folder will be created. Defaults to ./discovery."}]},"start":{"id":"start","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"The path where the FastStore being run is. Defaults to cwd."}]},"test":{"id":"test","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"The path where the FastStore being tested is. Defaults to cwd."}]}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/cli",
3
- "version": "3.0.82",
3
+ "version": "3.0.87",
4
4
  "description": "FastStore CLI",
5
5
  "author": "Emerson Laurentino @emersonlaurentino",
6
6
  "bin": {
@@ -17,11 +17,14 @@
17
17
  "/oclif.manifest.json"
18
18
  ],
19
19
  "dependencies": {
20
+ "@faststore/core": "^3.0.87",
21
+ "@inquirer/prompts": "^5.1.2",
20
22
  "@oclif/core": "^1.16.4",
21
23
  "@oclif/plugin-help": "^5",
22
24
  "@oclif/plugin-not-found": "^2.3.3",
23
25
  "chalk": "~4.1.2",
24
26
  "chokidar": "^3.5.3",
27
+ "degit": "^2.8.4",
25
28
  "dotenv": "^16.4.5",
26
29
  "fs-extra": "^10.1.0",
27
30
  "path": "^0.12.7"
@@ -30,6 +33,7 @@
30
33
  "@faststore/eslint-config": "^3.0.68",
31
34
  "@faststore/shared": "^3.0.68",
32
35
  "@types/chai": "^4",
36
+ "@types/degit": "^2.8.6",
33
37
  "@types/fs-extra": "^9.0.13",
34
38
  "@types/node": "^16.11.63",
35
39
  "chai": "^4",
@@ -69,5 +73,5 @@
69
73
  "oclif"
70
74
  ],
71
75
  "types": "dist/index.d.ts",
72
- "gitHead": "1fad72c2407848819a84644178257e250ea8cb5f"
76
+ "gitHead": "a064f7d04aee2582099a1a22d77b202653a0f746"
73
77
  }
@@ -1,12 +0,0 @@
1
- import { Command } from '@oclif/core';
2
- export default class GenerateGraphql extends Command {
3
- static flags: {
4
- debug: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
5
- core: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
- };
7
- static args: {
8
- name: string;
9
- description: string;
10
- }[];
11
- run(): Promise<void>;
12
- }
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const core_1 = require("@oclif/core");
5
- const fs_extra_1 = require("fs-extra");
6
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
- const directory_1 = require("../utils/directory");
8
- const runCommandSync_1 = require("../utils/runCommandSync");
9
- class GenerateGraphql extends core_1.Command {
10
- static flags = {
11
- debug: core_1.Flags.boolean({ char: 'd' }),
12
- core: core_1.Flags.boolean({ char: 'c', hidden: true }),
13
- };
14
- static args = [
15
- {
16
- name: 'path',
17
- description: 'The path where the FastStore GraphQL customization is. Defaults to cwd.',
18
- }
19
- ];
20
- async run() {
21
- const { flags, args } = await this.parse(GenerateGraphql);
22
- const basePath = args.path ?? process.cwd();
23
- const { tmpDir, coreDir } = (0, directory_1.withBasePath)(basePath);
24
- const debug = flags.debug ?? false;
25
- const isCore = flags.core ?? false;
26
- if (!isCore && !(0, fs_extra_1.existsSync)(tmpDir)) {
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.`);
28
- process.exit(1);
29
- }
30
- (0, runCommandSync_1.runCommandSync)({
31
- cmd: 'yarn generate:schema',
32
- errorMessage: "Failed to run 'yarn generate:schema'. Please check your setup.",
33
- throws: 'error',
34
- debug,
35
- cwd: isCore ? undefined : tmpDir,
36
- });
37
- (0, runCommandSync_1.runCommandSync)({
38
- cmd: 'yarn generate:codegen',
39
- errorMessage: 'GraphQL was not optimized and TS files were not updated. Changes in the GraphQL layer did not take effect',
40
- throws: 'error',
41
- debug,
42
- cwd: isCore ? undefined : tmpDir,
43
- });
44
- (0, runCommandSync_1.runCommandSync)({
45
- cmd: 'yarn format:generated',
46
- errorMessage: "Failed to format generated files. 'yarn format:generated' thrown errors",
47
- throws: 'warning',
48
- debug,
49
- cwd: isCore ? undefined : tmpDir,
50
- });
51
- // yarn generate:copy-back expects the DESTINATION var to be present so it can copy the files to the correct directory
52
- (0, runCommandSync_1.runCommandSync)({
53
- cmd: `DESTINATION=${coreDir} yarn generate:copy-back`,
54
- errorMessage: "Failed to copy back typings files. 'yarn generate:copy-back' thrown errors",
55
- throws: 'warning',
56
- debug,
57
- cwd: isCore ? undefined : tmpDir,
58
- });
59
- console.log(`${chalk_1.default.green('success')} - GraphQL schema, types, and optimizations successfully generated 🎉`);
60
- }
61
- }
62
- exports.default = GenerateGraphql;
63
- //# sourceMappingURL=generate-graphql.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-graphql.js","sourceRoot":"","sources":["../../src/commands/generate-graphql.ts"],"names":[],"mappings":";;;AAAA,sCAA4C;AAC5C,uCAAqC;AACrC,0DAAyB;AAEzB,kDAAiD;AACjD,4DAAwD;AAExD,MAAqB,eAAgB,SAAQ,cAAO;IAClD,MAAM,CAAC,KAAK,GAAG;QACb,KAAK,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QACnC,IAAI,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;KACjD,CAAA;IAED,MAAM,CAAC,IAAI,GAAG;QACZ;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,yEAAyE;SACvF;KACF,CAAA;IAED,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;QAEzD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAA;QAC3C,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,wBAAY,EAAC,QAAQ,CAAC,CAAA;QAElD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,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