@faststore/cli 3.0.83 → 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 +7 -23
- package/dist/commands/dev.js +27 -4
- package/dist/commands/dev.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +3 -2
- package/dist/commands/generate-graphql.d.ts +0 -12
- package/dist/commands/generate-graphql.js +0 -63
- package/dist/commands/generate-graphql.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.
|
|
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,7 +44,6 @@ 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)
|
|
49
48
|
* [`faststore init [PATH]`](#faststore-init-path)
|
|
50
49
|
* [`faststore start [PATH]`](#faststore-start-path)
|
|
@@ -60,7 +59,7 @@ ARGUMENTS
|
|
|
60
59
|
PATH The path where the FastStore being built is. Defaults to cwd.
|
|
61
60
|
```
|
|
62
61
|
|
|
63
|
-
_See code: [dist/commands/build.ts](https://github.com/vtex/faststore/blob/v3.0.
|
|
62
|
+
_See code: [dist/commands/build.ts](https://github.com/vtex/faststore/blob/v3.0.87/dist/commands/build.ts)_
|
|
64
63
|
|
|
65
64
|
## `faststore cms-sync [PATH]`
|
|
66
65
|
|
|
@@ -75,7 +74,7 @@ FLAGS
|
|
|
75
74
|
-d, --dry-run
|
|
76
75
|
```
|
|
77
76
|
|
|
78
|
-
_See code: [dist/commands/cms-sync.ts](https://github.com/vtex/faststore/blob/v3.0.
|
|
77
|
+
_See code: [dist/commands/cms-sync.ts](https://github.com/vtex/faststore/blob/v3.0.87/dist/commands/cms-sync.ts)_
|
|
79
78
|
|
|
80
79
|
## `faststore dev [PATH]`
|
|
81
80
|
|
|
@@ -87,22 +86,7 @@ ARGUMENTS
|
|
|
87
86
|
PATH The path where the FastStore being run is. Defaults to cwd.
|
|
88
87
|
```
|
|
89
88
|
|
|
90
|
-
_See code: [dist/commands/dev.ts](https://github.com/vtex/faststore/blob/v3.0.
|
|
91
|
-
|
|
92
|
-
## `faststore generate-graphql [PATH]`
|
|
93
|
-
|
|
94
|
-
```
|
|
95
|
-
USAGE
|
|
96
|
-
$ faststore generate-graphql [PATH] [-d]
|
|
97
|
-
|
|
98
|
-
ARGUMENTS
|
|
99
|
-
PATH The path where the FastStore GraphQL customization is. Defaults to cwd.
|
|
100
|
-
|
|
101
|
-
FLAGS
|
|
102
|
-
-d, --debug
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
_See code: [dist/commands/generate-graphql.ts](https://github.com/vtex/faststore/blob/v3.0.83/dist/commands/generate-graphql.ts)_
|
|
89
|
+
_See code: [dist/commands/dev.ts](https://github.com/vtex/faststore/blob/v3.0.87/dist/commands/dev.ts)_
|
|
106
90
|
|
|
107
91
|
## `faststore help [COMMAND]`
|
|
108
92
|
|
|
@@ -142,7 +126,7 @@ EXAMPLES
|
|
|
142
126
|
$ yarn faststore init discovery
|
|
143
127
|
```
|
|
144
128
|
|
|
145
|
-
_See code: [dist/commands/init.ts](https://github.com/vtex/faststore/blob/v3.0.
|
|
129
|
+
_See code: [dist/commands/init.ts](https://github.com/vtex/faststore/blob/v3.0.87/dist/commands/init.ts)_
|
|
146
130
|
|
|
147
131
|
## `faststore start [PATH]`
|
|
148
132
|
|
|
@@ -154,7 +138,7 @@ ARGUMENTS
|
|
|
154
138
|
PATH The path where the FastStore being run is. Defaults to cwd.
|
|
155
139
|
```
|
|
156
140
|
|
|
157
|
-
_See code: [dist/commands/start.ts](https://github.com/vtex/faststore/blob/v3.0.
|
|
141
|
+
_See code: [dist/commands/start.ts](https://github.com/vtex/faststore/blob/v3.0.87/dist/commands/start.ts)_
|
|
158
142
|
|
|
159
143
|
## `faststore test [PATH]`
|
|
160
144
|
|
|
@@ -166,5 +150,5 @@ ARGUMENTS
|
|
|
166
150
|
PATH The path where the FastStore being tested is. Defaults to cwd.
|
|
167
151
|
```
|
|
168
152
|
|
|
169
|
-
_See code: [dist/commands/test.ts](https://github.com/vtex/faststore/blob/v3.0.
|
|
153
|
+
_See code: [dist/commands/test.ts](https://github.com/vtex/faststore/blob/v3.0.87/dist/commands/test.ts)_
|
|
170
154
|
<!-- commandsstop -->
|
package/dist/commands/dev.js
CHANGED
|
@@ -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
|
-
|
|
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*/))
|
package/dist/commands/dev.js.map
CHANGED
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACtC,iDAAsC;AACtC,gEAAgC;AAChC,4DAA4B;AAE5B,2BAA0C;AAC1C,wDAAwB;AACxB,kDAAkD;AAClD,gDAA6C;AAC7C,4DAAyD;AACzD,0DAA0B;AAE1B;;;;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,CAAC,OAAe,EAAE,MAAc,EAAE,OAAe;IACtE,MAAM,OAAO,GAAG,gBAAM,CAAC,KAAK,CAAC,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AAC,CAAA;QAEzC,QAAQ,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QAEpC,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,OAAO;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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { default as Dev } from './commands/dev';
|
|
|
4
4
|
import { default as Build } from './commands/build';
|
|
5
5
|
import { default as Serve } from './commands/start';
|
|
6
6
|
import { default as CmsSync } from './commands/cms-sync';
|
|
7
|
-
import { default as GenerateGraphql } from './commands/generate-graphql';
|
|
8
7
|
import { default as Test } from './commands/test';
|
|
9
8
|
export declare const commands: {
|
|
10
9
|
init: typeof Init;
|
|
@@ -12,6 +11,5 @@ export declare const commands: {
|
|
|
12
11
|
build: typeof Build;
|
|
13
12
|
serve: typeof Serve;
|
|
14
13
|
'cms-sync': typeof CmsSync;
|
|
15
|
-
'generate-graphql': typeof GenerateGraphql;
|
|
16
14
|
test: typeof Test;
|
|
17
15
|
};
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,6 @@ const dev_1 = tslib_1.__importDefault(require("./commands/dev"));
|
|
|
9
9
|
const build_1 = tslib_1.__importDefault(require("./commands/build"));
|
|
10
10
|
const start_1 = tslib_1.__importDefault(require("./commands/start"));
|
|
11
11
|
const cms_sync_1 = tslib_1.__importDefault(require("./commands/cms-sync"));
|
|
12
|
-
const generate_graphql_1 = tslib_1.__importDefault(require("./commands/generate-graphql"));
|
|
13
12
|
const test_1 = tslib_1.__importDefault(require("./commands/test"));
|
|
14
13
|
exports.commands = {
|
|
15
14
|
init: init_1.default,
|
|
@@ -17,7 +16,6 @@ exports.commands = {
|
|
|
17
16
|
build: build_1.default,
|
|
18
17
|
serve: start_1.default,
|
|
19
18
|
'cms-sync': cms_sync_1.default,
|
|
20
|
-
'generate-graphql': generate_graphql_1.default,
|
|
21
19
|
test: test_1.default,
|
|
22
20
|
};
|
|
23
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,mEAAiD;AACjD,iEAA+C;AAC/C,qEAAmD;AACnD,qEAAmD;AACnD,2EAAwD;AACxD,
|
|
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"}
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"3.0.
|
|
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.
|
|
3
|
+
"version": "3.0.87",
|
|
4
4
|
"description": "FastStore CLI",
|
|
5
5
|
"author": "Emerson Laurentino @emersonlaurentino",
|
|
6
6
|
"bin": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"/oclif.manifest.json"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
+
"@faststore/core": "^3.0.87",
|
|
20
21
|
"@inquirer/prompts": "^5.1.2",
|
|
21
22
|
"@oclif/core": "^1.16.4",
|
|
22
23
|
"@oclif/plugin-help": "^5",
|
|
@@ -72,5 +73,5 @@
|
|
|
72
73
|
"oclif"
|
|
73
74
|
],
|
|
74
75
|
"types": "dist/index.d.ts",
|
|
75
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "a064f7d04aee2582099a1a22d77b202653a0f746"
|
|
76
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,IAAI,KAAK,CAAA;QAClC,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAA;QAElC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAA,qBAAU,EAAC,MA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