@faststore/cli
Advanced tools
Comparing version 2.2.0-alpha.1 to 2.2.0-alpha.3
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { Command } from '@oclif/core'; | ||
@@ -6,4 +5,5 @@ export default class GenerateGraphql extends Command { | ||
debug: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>; | ||
core: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>; | ||
}; | ||
run(): Promise<import("child_process").ChildProcess>; | ||
run(): Promise<void>; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const core_1 = require("@oclif/core"); | ||
const child_process_1 = require("child_process"); | ||
const fs_extra_1 = require("fs-extra"); | ||
const chalk_1 = tslib_1.__importDefault(require("chalk")); | ||
const directory_1 = require("../utils/directory"); | ||
const runCommandSync_1 = require("../utils/runCommandSync"); | ||
class GenerateGraphql extends core_1.Command { | ||
static flags = { | ||
debug: core_1.Flags.boolean({ char: 'd' }), | ||
core: core_1.Flags.boolean({ char: 'c', hidden: true }), | ||
}; | ||
async run() { | ||
if (!(0, fs_extra_1.existsSync)(directory_1.tmpDir)) { | ||
throw Error('The ".faststore" directory could not be found. When running faststore dev or faststore build, the generate-graphql command is automatically executed.'); | ||
const { flags } = await this.parse(GenerateGraphql); | ||
const debug = flags.debug ?? false; | ||
const isCore = flags.core ?? false; | ||
if (!isCore && !(0, fs_extra_1.existsSync)(directory_1.tmpDir)) { | ||
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.`); | ||
process.exit(1); | ||
} | ||
const { flags } = await this.parse(GenerateGraphql); | ||
return (0, child_process_1.spawn)(`yarn generate${flags.debug ? ' --debug' : ''}`, { | ||
shell: true, | ||
cwd: directory_1.tmpDir, | ||
stdio: 'inherit', | ||
(0, runCommandSync_1.runCommandSync)({ | ||
cmd: 'yarn generate:schema', | ||
errorMessage: "Failed to run 'yarn generate:schema'. Please check your setup.", | ||
throws: 'error', | ||
debug, | ||
cwd: isCore ? undefined : directory_1.tmpDir, | ||
}); | ||
(0, runCommandSync_1.runCommandSync)({ | ||
cmd: 'yarn generate:codegen', | ||
errorMessage: 'GraphQL was not optimized and TS files were not updated. Changes in the GraphQL layer did not take effect', | ||
throws: 'error', | ||
debug, | ||
cwd: isCore ? undefined : directory_1.tmpDir, | ||
}); | ||
(0, runCommandSync_1.runCommandSync)({ | ||
cmd: 'yarn format:generated', | ||
errorMessage: "Failed to format generated files. 'yarn format:generated' thrown errors", | ||
throws: 'warning', | ||
debug, | ||
cwd: isCore ? undefined : directory_1.tmpDir, | ||
}); | ||
console.log(`${chalk_1.default.green('success')} - GraphQL schema, types, and optimizations successfully generated 🎉`); | ||
} | ||
@@ -22,0 +45,0 @@ } |
@@ -1,1 +0,1 @@ | ||
{"version":"2.2.0-alpha.1","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}},"args":[]},"start":{"id":"start","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[]}}} | ||
{"version":"2.2.0-alpha.3","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":[]}}} |
{ | ||
"name": "@faststore/cli", | ||
"version": "2.2.0-alpha.1", | ||
"version": "2.2.0-alpha.3", | ||
"description": "FastStore CLI", | ||
@@ -72,3 +72,3 @@ "author": "Emerson Laurentino @emersonlaurentino", | ||
"types": "dist/index.d.ts", | ||
"gitHead": "6eff908883fa54cb72d548b12a610490df833804" | ||
"gitHead": "3f6a1bf0ab1c6cc7804c4f8752bf82457e8aad67" | ||
} |
@@ -17,3 +17,3 @@ # FastStore CLI | ||
$ faststore (--version) | ||
@faststore/cli/2.2.0-alpha.1 linux-x64 node-v16.20.2 | ||
@faststore/cli/2.2.0-alpha.3 linux-x64 node-v16.20.2 | ||
$ faststore --help [COMMAND] | ||
@@ -43,3 +43,3 @@ USAGE | ||
_See code: [dist/commands/build.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.1/dist/commands/build.ts)_ | ||
_See code: [dist/commands/build.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.3/dist/commands/build.ts)_ | ||
@@ -53,3 +53,3 @@ ## `faststore cms-sync` | ||
_See code: [dist/commands/cms-sync.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.1/dist/commands/cms-sync.ts)_ | ||
_See code: [dist/commands/cms-sync.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.3/dist/commands/cms-sync.ts)_ | ||
@@ -63,3 +63,3 @@ ## `faststore dev` | ||
_See code: [dist/commands/dev.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.1/dist/commands/dev.ts)_ | ||
_See code: [dist/commands/dev.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.3/dist/commands/dev.ts)_ | ||
@@ -76,3 +76,3 @@ ## `faststore generate-graphql` | ||
_See code: [dist/commands/generate-graphql.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.1/dist/commands/generate-graphql.ts)_ | ||
_See code: [dist/commands/generate-graphql.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.3/dist/commands/generate-graphql.ts)_ | ||
@@ -106,3 +106,3 @@ ## `faststore help [COMMAND]` | ||
_See code: [dist/commands/start.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.1/dist/commands/start.ts)_ | ||
_See code: [dist/commands/start.ts](https://github.com/vtex/faststore/blob/v2.2.0-alpha.3/dist/commands/start.ts)_ | ||
<!-- commandsstop --> |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46933
38
562