@faststore/cli 2.2.0-alpha.1 → 2.2.0-alpha.12
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 +16 -6
- package/dist/commands/generate-graphql.d.ts +2 -2
- package/dist/commands/generate-graphql.js +31 -8
- package/dist/commands/generate-graphql.js.map +1 -1
- package/dist/commands/test.d.ts +4 -0
- package/dist/commands/test.js +68 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/utils/generate.d.ts +1 -0
- package/dist/utils/generate.js +16 -3
- package/dist/utils/generate.js.map +1 -1
- package/dist/utils/runCommandSync.d.ts +7 -0
- package/dist/utils/runCommandSync.js +40 -0
- package/dist/utils/runCommandSync.js.map +1 -0
- package/oclif.manifest.json +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ $ npm install -g @faststore/cli
|
|
|
14
14
|
$ faststore COMMAND
|
|
15
15
|
running command...
|
|
16
16
|
$ faststore (--version)
|
|
17
|
-
@faststore/cli/2.2.0-alpha.
|
|
17
|
+
@faststore/cli/2.2.0-alpha.12 linux-x64 node-v16.20.2
|
|
18
18
|
$ faststore --help [COMMAND]
|
|
19
19
|
USAGE
|
|
20
20
|
$ faststore COMMAND
|
|
@@ -31,6 +31,7 @@ USAGE
|
|
|
31
31
|
* [`faststore generate-graphql`](#faststore-generate-graphql)
|
|
32
32
|
* [`faststore help [COMMAND]`](#faststore-help-command)
|
|
33
33
|
* [`faststore start`](#faststore-start)
|
|
34
|
+
* [`faststore test`](#faststore-test)
|
|
34
35
|
|
|
35
36
|
## `faststore build`
|
|
36
37
|
|
|
@@ -39,7 +40,7 @@ USAGE
|
|
|
39
40
|
$ faststore build
|
|
40
41
|
```
|
|
41
42
|
|
|
42
|
-
_See code: [dist/commands/build.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.
|
|
43
|
+
_See code: [dist/commands/build.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.12/dist/commands/build.ts)_
|
|
43
44
|
|
|
44
45
|
## `faststore cms-sync`
|
|
45
46
|
|
|
@@ -48,7 +49,7 @@ USAGE
|
|
|
48
49
|
$ faststore cms-sync
|
|
49
50
|
```
|
|
50
51
|
|
|
51
|
-
_See code: [dist/commands/cms-sync.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.
|
|
52
|
+
_See code: [dist/commands/cms-sync.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.12/dist/commands/cms-sync.ts)_
|
|
52
53
|
|
|
53
54
|
## `faststore dev`
|
|
54
55
|
|
|
@@ -57,7 +58,7 @@ USAGE
|
|
|
57
58
|
$ faststore dev
|
|
58
59
|
```
|
|
59
60
|
|
|
60
|
-
_See code: [dist/commands/dev.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.
|
|
61
|
+
_See code: [dist/commands/dev.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.12/dist/commands/dev.ts)_
|
|
61
62
|
|
|
62
63
|
## `faststore generate-graphql`
|
|
63
64
|
|
|
@@ -69,7 +70,7 @@ FLAGS
|
|
|
69
70
|
-d, --debug
|
|
70
71
|
```
|
|
71
72
|
|
|
72
|
-
_See code: [dist/commands/generate-graphql.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.
|
|
73
|
+
_See code: [dist/commands/generate-graphql.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.12/dist/commands/generate-graphql.ts)_
|
|
73
74
|
|
|
74
75
|
## `faststore help [COMMAND]`
|
|
75
76
|
|
|
@@ -98,5 +99,14 @@ USAGE
|
|
|
98
99
|
$ faststore start
|
|
99
100
|
```
|
|
100
101
|
|
|
101
|
-
_See code: [dist/commands/start.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.
|
|
102
|
+
_See code: [dist/commands/start.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.12/dist/commands/start.ts)_
|
|
103
|
+
|
|
104
|
+
## `faststore test`
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
USAGE
|
|
108
|
+
$ faststore test
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
_See code: [dist/commands/test.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.12/dist/commands/test.ts)_
|
|
102
112
|
<!-- commandsstop -->
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Command } from '@oclif/core';
|
|
3
2
|
export default class GenerateGraphql extends Command {
|
|
4
3
|
static flags: {
|
|
5
4
|
debug: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
5
|
+
core: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
6
6
|
};
|
|
7
|
-
run(): Promise<
|
|
7
|
+
run(): Promise<void>;
|
|
8
8
|
}
|
|
@@ -1,23 +1,46 @@
|
|
|
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");
|
|
4
|
-
const child_process_1 = require("child_process");
|
|
5
5
|
const fs_extra_1 = require("fs-extra");
|
|
6
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
7
|
const directory_1 = require("../utils/directory");
|
|
8
|
+
const runCommandSync_1 = require("../utils/runCommandSync");
|
|
7
9
|
class GenerateGraphql extends core_1.Command {
|
|
8
10
|
static flags = {
|
|
9
11
|
debug: core_1.Flags.boolean({ char: 'd' }),
|
|
12
|
+
core: core_1.Flags.boolean({ char: 'c', hidden: true }),
|
|
10
13
|
};
|
|
11
14
|
async run() {
|
|
12
|
-
if (!(0, fs_extra_1.existsSync)(directory_1.tmpDir)) {
|
|
13
|
-
throw Error('The ".faststore" directory could not be found. When running faststore dev or faststore build, the generate-graphql command is automatically executed.');
|
|
14
|
-
}
|
|
15
15
|
const { flags } = await this.parse(GenerateGraphql);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const debug = flags.debug ?? false;
|
|
17
|
+
const isCore = flags.core ?? false;
|
|
18
|
+
if (!isCore && !(0, fs_extra_1.existsSync)(directory_1.tmpDir)) {
|
|
19
|
+
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
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
(0, runCommandSync_1.runCommandSync)({
|
|
23
|
+
cmd: 'yarn generate:schema',
|
|
24
|
+
errorMessage: "Failed to run 'yarn generate:schema'. Please check your setup.",
|
|
25
|
+
throws: 'error',
|
|
26
|
+
debug,
|
|
27
|
+
cwd: isCore ? undefined : directory_1.tmpDir,
|
|
28
|
+
});
|
|
29
|
+
(0, runCommandSync_1.runCommandSync)({
|
|
30
|
+
cmd: 'yarn generate:codegen',
|
|
31
|
+
errorMessage: 'GraphQL was not optimized and TS files were not updated. Changes in the GraphQL layer did not take effect',
|
|
32
|
+
throws: 'error',
|
|
33
|
+
debug,
|
|
34
|
+
cwd: isCore ? undefined : directory_1.tmpDir,
|
|
35
|
+
});
|
|
36
|
+
(0, runCommandSync_1.runCommandSync)({
|
|
37
|
+
cmd: 'yarn format:generated',
|
|
38
|
+
errorMessage: "Failed to format generated files. 'yarn format:generated' thrown errors",
|
|
39
|
+
throws: 'warning',
|
|
40
|
+
debug,
|
|
41
|
+
cwd: isCore ? undefined : directory_1.tmpDir,
|
|
20
42
|
});
|
|
43
|
+
console.log(`${chalk_1.default.green('success')} - GraphQL schema, types, and optimizations successfully generated 🎉`);
|
|
21
44
|
}
|
|
22
45
|
}
|
|
23
46
|
exports.default = GenerateGraphql;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-graphql.js","sourceRoot":"","sources":["../../src/commands/generate-graphql.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-graphql.js","sourceRoot":"","sources":["../../src/commands/generate-graphql.ts"],"names":[],"mappings":";;;AAAA,sCA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Y,EACV,yEAAyE;YAC3E,MAAM,EAAE,SAAS;YACjB,KAAK;YACL,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAM;SACjC,CAAC,CAAA;QAEF,OAAO,CAAC,GAAG,CACT,GAAG,eAAK,CAAC,KAAK,CACZ,SAAS,CACV,uEAAuE,CACzE,CAAA;IACH,CAAC;;AAtDH,kCAuDC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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 child_process_1 = require("child_process");
|
|
6
|
+
const chokidar_1 = tslib_1.__importDefault(require("chokidar"));
|
|
7
|
+
const directory_1 = require("../utils/directory");
|
|
8
|
+
const generate_1 = require("../utils/generate");
|
|
9
|
+
/**
|
|
10
|
+
* Taken from toolbelt
|
|
11
|
+
*
|
|
12
|
+
* https://github.com/vtex/toolbelt/pull/442
|
|
13
|
+
*/
|
|
14
|
+
const stabilityThreshold = process.platform === 'darwin' ? 100 : 200;
|
|
15
|
+
const defaultPatterns = ['*/**', '**'];
|
|
16
|
+
const defaultIgnored = [
|
|
17
|
+
'.DS_Store',
|
|
18
|
+
'README.md',
|
|
19
|
+
'.gitignore',
|
|
20
|
+
'package.json',
|
|
21
|
+
'node_modules/**',
|
|
22
|
+
'**/node_modules/**',
|
|
23
|
+
'.git/**',
|
|
24
|
+
'.faststore/**',
|
|
25
|
+
'**/.faststore/**',
|
|
26
|
+
];
|
|
27
|
+
const testAbortController = new AbortController();
|
|
28
|
+
async function storeTest() {
|
|
29
|
+
const testProcess = (0, child_process_1.spawn)('yarn test', {
|
|
30
|
+
shell: true,
|
|
31
|
+
cwd: directory_1.tmpDir,
|
|
32
|
+
signal: testAbortController.signal,
|
|
33
|
+
stdio: 'inherit',
|
|
34
|
+
});
|
|
35
|
+
testProcess.on('close', () => {
|
|
36
|
+
testAbortController.abort();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
class Test extends core_1.Command {
|
|
40
|
+
async run() {
|
|
41
|
+
const watcher = chokidar_1.default.watch([...defaultPatterns], {
|
|
42
|
+
atomic: stabilityThreshold,
|
|
43
|
+
awaitWriteFinish: {
|
|
44
|
+
stabilityThreshold,
|
|
45
|
+
},
|
|
46
|
+
cwd: (0, directory_1.getRoot)(),
|
|
47
|
+
ignoreInitial: true,
|
|
48
|
+
ignored: defaultIgnored,
|
|
49
|
+
persistent: true,
|
|
50
|
+
usePolling: process.platform === 'win32',
|
|
51
|
+
});
|
|
52
|
+
testAbortController.signal.addEventListener('abort', () => {
|
|
53
|
+
watcher.close();
|
|
54
|
+
});
|
|
55
|
+
await (0, generate_1.generate)({ test: true });
|
|
56
|
+
storeTest();
|
|
57
|
+
return await new Promise((resolve, reject) => {
|
|
58
|
+
watcher
|
|
59
|
+
.on('error', () => {
|
|
60
|
+
testAbortController.abort();
|
|
61
|
+
reject();
|
|
62
|
+
})
|
|
63
|
+
.on('ready', resolve);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.default = Test;
|
|
68
|
+
//# sourceMappingURL=test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/commands/test.ts"],"names":[],"mappings":";;;AAAA,sCAAqC;AACrC,iDAAqC;AACrC,gEAA+B;AAE/B,kDAAoD;AACpD,gDAA4C;AAE5C;;;;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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AAE,CAAA;YACV,CAAC,CAAC;iBACD,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACzB,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AA/BD,uBA+BC"}
|
package/dist/utils/generate.d.ts
CHANGED
package/dist/utils/generate.js
CHANGED
|
@@ -8,7 +8,7 @@ const path_1 = tslib_1.__importDefault(require("path"));
|
|
|
8
8
|
const directory_1 = require("./directory");
|
|
9
9
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
10
10
|
const stringify_object_1 = tslib_1.__importDefault(require("stringify-object"));
|
|
11
|
-
const ignorePaths = ['node_modules'];
|
|
11
|
+
const ignorePaths = ['node_modules', 'cypress.config.ts'];
|
|
12
12
|
function createTmpFolder() {
|
|
13
13
|
try {
|
|
14
14
|
if ((0, fs_extra_1.existsSync)(directory_1.tmpDir)) {
|
|
@@ -41,9 +41,19 @@ function copyCoreFiles() {
|
|
|
41
41
|
async function copyCypressFiles() {
|
|
42
42
|
var _a;
|
|
43
43
|
try {
|
|
44
|
+
// Cypress 9.x config file
|
|
45
|
+
if ((0, fs_extra_1.existsSync)(`${directory_1.userDir}/cypress.json`)) {
|
|
46
|
+
(0, fs_extra_1.copySync)(`${directory_1.userDir}/cypress.json`, `${directory_1.tmpDir}/cypress.json`);
|
|
47
|
+
}
|
|
48
|
+
// Cypress 12.x config file
|
|
49
|
+
if ((0, fs_extra_1.existsSync)(`${directory_1.userDir}/cypress.config.ts`)) {
|
|
50
|
+
(0, fs_extra_1.copySync)(`${directory_1.userDir}/cypress.config.ts`, `${directory_1.tmpDir}/cypress.config.ts`);
|
|
51
|
+
}
|
|
44
52
|
const userStoreConfig = await (_a = directory_1.userStoreConfigFileDir, Promise.resolve().then(() => tslib_1.__importStar(require(_a))));
|
|
45
53
|
if (userStoreConfig?.experimental?.enableCypressExtension) {
|
|
46
|
-
(0, fs_extra_1.copySync)(`${directory_1.userDir}/cypress`, `${directory_1.tmpDir}/cypress/integration`, {
|
|
54
|
+
(0, fs_extra_1.copySync)(`${directory_1.userDir}/cypress`, `${directory_1.tmpDir}/cypress/integration`, {
|
|
55
|
+
overwrite: true,
|
|
56
|
+
});
|
|
47
57
|
console.log(`${chalk_1.default.green('success')} - Cypress test files copied`);
|
|
48
58
|
}
|
|
49
59
|
}
|
|
@@ -168,8 +178,11 @@ function createNodeModulesSymbolicLink() {
|
|
|
168
178
|
}
|
|
169
179
|
}
|
|
170
180
|
async function generate(options) {
|
|
171
|
-
const { setup = false } = options ?? {};
|
|
181
|
+
const { setup = false, test = false } = options ?? {};
|
|
172
182
|
let setupPromise = null;
|
|
183
|
+
if (test) {
|
|
184
|
+
return copyCypressFiles();
|
|
185
|
+
}
|
|
173
186
|
if (setup) {
|
|
174
187
|
setupPromise = Promise.all([
|
|
175
188
|
createTmpFolder(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/utils/generate.ts"],"names":[],"mappings":";;;;AAAA,kEAAiC;AACjC,uCAWiB;AAEjB,wDAAuB;AAEvB,2CAmBoB;AAEpB,0DAAyB;AACzB,gFAA8C;
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/utils/generate.ts"],"names":[],"mappings":";;;;AAAA,kEAAiC;AACjC,uCAWiB;AAEjB,wDAAuB;AAEvB,2CAmBoB;AAEpB,0DAAyB;AACzB,gFAA8C;AAO9C,MAAM,WAAW,GAAG,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAAA;AAEzD,SAAS,eAAe;IACtB,IAAI;QACF,IAAI,IAAA,qBAAU,EAAC,kBAAM,CAAC,EAAE;YACtB,IAAA,qBAAU,EAAC,kBAAM,CAAC,CAAA;SACnB;QAED,IAAA,qBAAU,EAAC,kBAAM,CAAC,CAAA;QAClB,OAAO,CAAC,GAAG,CACT,GAAG,eAAK,CAAC,KAAK,CAAC,SAAS,CAAC,uBAAuB,eAAK,CAAC,GAAG,CACvD,yBAAa,CACd,UAAU,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C,GAAG,CAAC,8BAAkB,CAAC,OAAO,eAAK,CAAC,GAAG,CAClE,6BAAiB,CAClB,EAAE,CACJ,CAAA;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,GAAG,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;KAChD;AACH,CAAC;AAEM,KAAK,UAAU,QAAQ,CAAC,OAAyB;IACtD,MAAM,EAAE,KAAK,GAAG,KAAK,EAAE,IAAI,GAAG,KAAK,EAAE,GAAG,OAAO,IAAI,EAAE,CAAA;IAErD,IAAI,YAAY,GAA4B,IAAI,CAAA;IAEhD,IAAI,IAAI,EAAE;QACR,OAAO,gBAAgB,EAAE,CAAA;KAC1B;IAED,IAAI,KAAK,EAAE;QACT,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC;YACzB,eAAe,EAAE;YACjB,aAAa,EAAE;YACf,gBAAgB,EAAE;YAClB,6BAA6B,EAAE;SAChC,CAAC,CAAA;KACH;IAED,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,YAAY;QACZ,2BAA2B,EAAE;QAC7B,SAAS,EAAE;QACX,4BAA4B,EAAE;QAC9B,aAAa,EAAE;QACf,eAAe,EAAE;KAClB,CAAC,CAAA;AACJ,CAAC;AA1BD,4BA0BC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runCommandSync = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
const showError = ({ message, cmd, error, debug, }) => {
|
|
8
|
+
console.log(`${chalk_1.default.red('error')} - ${message}`);
|
|
9
|
+
if (debug && cmd && error) {
|
|
10
|
+
console.log(`${chalk_1.default.magenta('DEBUG')} - $ ${cmd} error root ↓`);
|
|
11
|
+
console.log(error.stdout?.toString());
|
|
12
|
+
}
|
|
13
|
+
process.exit(1);
|
|
14
|
+
};
|
|
15
|
+
const showWarning = ({ message, cmd, error, debug, }) => {
|
|
16
|
+
console.log(`${chalk_1.default.yellow('warn')} - ${message}`);
|
|
17
|
+
if (debug && cmd && error) {
|
|
18
|
+
console.log(`${chalk_1.default.magenta('DEBUG')} - $ ${cmd} warn root ↓`);
|
|
19
|
+
console.log(error.stdout?.toString());
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const runCommandSync = ({ cmd, errorMessage, throws, debug, cwd }) => {
|
|
23
|
+
try {
|
|
24
|
+
(0, child_process_1.execSync)(debug ? `${cmd} --debug --verbose 2>&1` : `${cmd} 2>&1`, {
|
|
25
|
+
stdio: 'pipe',
|
|
26
|
+
cwd,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
const sanitizedError = debug ? error : undefined;
|
|
31
|
+
if (throws === 'warning') {
|
|
32
|
+
showWarning({ message: errorMessage, cmd, error: sanitizedError, debug });
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
showError({ message: errorMessage, cmd, error: sanitizedError, debug });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.runCommandSync = runCommandSync;
|
|
40
|
+
//# sourceMappingURL=runCommandSync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runCommandSync.js","sourceRoot":"","sources":["../../src/utils/runCommandSync.ts"],"names":[],"mappings":";;;;AAAA,0DAAyB;AAEzB,iDAAwC;AAIxC,MAAM,SAAS,GAAG,CAAC,EACjB,OAAO,EACP,GAAG,EACH,KAAK,EACL,KAAK,GAMN,EAAE,EAAE;IACH,OAAO,CAAC,GAAG,CAAC,GAAG,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,OAAO,EAAE,CAAC,CAAA;IAEjD,IAAI,KAAK,IAAI,GAAG,IAAI,K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AAK,EAAE,CAAC,CAAA;SAC1E;aAAM;YACL,SAAS,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAA;SACxE;KACF;AACH,CAAC,CAAA;AA3BY,QAAA,cAAc,kBA2B1B"}
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.2.0-alpha.
|
|
1
|
+
{"version":"2.2.0-alpha.12","commands":{"build":{"id":"build","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"cms-sync":{"id":"cms-sync","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"dev":{"id":"dev","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"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":[]},"start":{"id":"start","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"test":{"id":"test","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[]}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/cli",
|
|
3
|
-
"version": "2.2.0-alpha.
|
|
3
|
+
"version": "2.2.0-alpha.12",
|
|
4
4
|
"description": "FastStore CLI",
|
|
5
5
|
"author": "Emerson Laurentino @emersonlaurentino",
|
|
6
6
|
"bin": {
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"stringify-object": "^3.3.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@faststore/eslint-config": "^2.2.0-alpha.
|
|
32
|
-
"@faststore/shared": "^2.2.0-alpha.
|
|
31
|
+
"@faststore/eslint-config": "^2.2.0-alpha.12",
|
|
32
|
+
"@faststore/shared": "^2.2.0-alpha.12",
|
|
33
33
|
"@types/chai": "^4",
|
|
34
34
|
"@types/fs-extra": "^9.0.13",
|
|
35
35
|
"@types/node": "^16.11.63",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"oclif"
|
|
70
70
|
],
|
|
71
71
|
"types": "dist/index.d.ts",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "7f27647c52ad0690389e72db639562b167a09c49"
|
|
73
73
|
}
|