stepzen 0.9.36 → 0.9.38-beta.2
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 +2 -2
- package/lib/commands/import.js +6 -1
- package/lib/commands/init.js +8 -2
- package/lib/commands/start.js +8 -7
- package/lib/generate/dashboard-interface.js +7 -2
- package/lib/generate/helpers.js +11 -4
- package/lib/generate/index.js +4 -2
- package/lib/hooks/prerun/ensure-permissions.d.ts +3 -0
- package/lib/hooks/prerun/ensure-permissions.js +20 -0
- package/lib/shared/configuration.js +1 -1
- package/lib/shared/constants.d.ts +2 -1
- package/lib/shared/constants.js +7 -4
- package/lib/start/console.d.ts +1 -1
- package/lib/start/console.js +4 -11
- package/lib/start/deploy.js +30 -11
- package/lib/start/index.d.ts +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +22 -22
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ $ npm install -g stepzen
|
|
|
29
29
|
$ stepzen COMMAND
|
|
30
30
|
running command...
|
|
31
31
|
$ stepzen (-v|--version|version)
|
|
32
|
-
stepzen/0.9.
|
|
32
|
+
stepzen/0.9.38-beta.2 darwin-x64 node-v14.18.3
|
|
33
33
|
$ stepzen --help [COMMAND]
|
|
34
34
|
USAGE
|
|
35
35
|
$ stepzen COMMAND
|
|
@@ -136,7 +136,7 @@ OPTIONS
|
|
|
136
136
|
|
|
137
137
|
## `stepzen start`
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
upload and deploy your schema
|
|
140
140
|
|
|
141
141
|
```
|
|
142
142
|
USAGE
|
package/lib/commands/import.js
CHANGED
|
@@ -24,7 +24,12 @@ class Import extends command_1.Command {
|
|
|
24
24
|
workspace = await init_1.default.run([directory]);
|
|
25
25
|
}
|
|
26
26
|
// Make sure the user has latest Generator Schema
|
|
27
|
-
await deploy_1.default.run([
|
|
27
|
+
await deploy_1.default.run([
|
|
28
|
+
constants_1.STEPZEN_GENERATOR_ENGINES_ENDPOINT,
|
|
29
|
+
'--schema',
|
|
30
|
+
constants_1.STEPZEN_GENERATOR_ENGINES_SCHEMA,
|
|
31
|
+
'--silent',
|
|
32
|
+
]);
|
|
28
33
|
// Let's go!
|
|
29
34
|
const result = await generate_1.default(schemas, workspace.schema);
|
|
30
35
|
// Validate
|
package/lib/commands/init.js
CHANGED
|
@@ -29,8 +29,14 @@ class Init extends command_1.Command {
|
|
|
29
29
|
// See if we think there's a StepZen schema already
|
|
30
30
|
let root;
|
|
31
31
|
const existing = [
|
|
32
|
-
...glob.sync('*/**/config.yaml', {
|
|
33
|
-
|
|
32
|
+
...glob.sync('*/**/config.yaml', {
|
|
33
|
+
cwd: directory,
|
|
34
|
+
ignore: '**/node_modules/**',
|
|
35
|
+
}),
|
|
36
|
+
...glob.sync('*/**/index.graphql', {
|
|
37
|
+
cwd: directory,
|
|
38
|
+
ignore: '**/node_modules/**',
|
|
39
|
+
}),
|
|
34
40
|
];
|
|
35
41
|
if (existing.length > 0) {
|
|
36
42
|
root = existing[0]
|
package/lib/commands/start.js
CHANGED
|
@@ -51,19 +51,21 @@ class Start extends command_1.Command {
|
|
|
51
51
|
})
|
|
52
52
|
.on('change', throttle_debounce_1.debounce(500, async (path) => {
|
|
53
53
|
await utils_1.checkAuth();
|
|
54
|
-
|
|
55
|
-
start_1.deploy(path, workspace, flags);
|
|
54
|
+
utils_1.clearConsole();
|
|
55
|
+
await start_1.deploy(path, workspace, flags);
|
|
56
|
+
await start_1.console(workspace);
|
|
56
57
|
}));
|
|
57
58
|
}
|
|
58
59
|
// Start!
|
|
60
|
+
utils_1.clearConsole();
|
|
59
61
|
cli_ux_1.default.action.start('Starting...');
|
|
60
|
-
if (!flags['no-console']) {
|
|
61
|
-
start_1.console(workspace, flags);
|
|
62
|
-
}
|
|
63
62
|
// Unless explicitly disabled, auto-init
|
|
64
63
|
if (!flags['no-init']) {
|
|
65
64
|
await start_1.deploy(null, workspace, flags);
|
|
66
65
|
}
|
|
66
|
+
if (!flags['no-console']) {
|
|
67
|
+
start_1.console(workspace);
|
|
68
|
+
}
|
|
67
69
|
// Create the dashboard
|
|
68
70
|
if (!flags['no-dashboard']) {
|
|
69
71
|
const ui = await dashboard({
|
|
@@ -84,14 +86,13 @@ class Start extends command_1.Command {
|
|
|
84
86
|
workspace,
|
|
85
87
|
});
|
|
86
88
|
await ui.start();
|
|
87
|
-
await ui.open();
|
|
88
89
|
}
|
|
89
90
|
// Done
|
|
90
91
|
cli_ux_1.default.action.stop();
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
exports.default = Start;
|
|
94
|
-
Start.description = '
|
|
95
|
+
Start.description = 'upload and deploy your schema';
|
|
95
96
|
Start.flags = {
|
|
96
97
|
dir: command_1.flags.string({ description: 'working directory' }),
|
|
97
98
|
endpoint: command_1.flags.string({ description: 'Override workspace endpoint' }),
|
|
@@ -9,9 +9,14 @@ const deploy_1 = require("../commands/deploy");
|
|
|
9
9
|
const constants_1 = require("../shared/constants");
|
|
10
10
|
const { merge } = require('@stepzen/transpiler');
|
|
11
11
|
exports.createDashboardInterface = (workspace) => ({
|
|
12
|
-
endpoint: constants_1.
|
|
12
|
+
endpoint: constants_1.STEPZEN_GENERATOR_ENGINES_ENDPOINT,
|
|
13
13
|
onStart: async () => {
|
|
14
|
-
await deploy_1.default.run([
|
|
14
|
+
await deploy_1.default.run([
|
|
15
|
+
constants_1.STEPZEN_GENERATOR_ENGINES_ENDPOINT,
|
|
16
|
+
'--schema',
|
|
17
|
+
constants_1.STEPZEN_GENERATOR_ENGINES_SCHEMA,
|
|
18
|
+
'--silent',
|
|
19
|
+
]);
|
|
15
20
|
},
|
|
16
21
|
onImport: async (id, files) => {
|
|
17
22
|
const tmp = path.join(os.tmpdir(), `stepzen-generated-schema-${Date.now()}`);
|
package/lib/generate/helpers.js
CHANGED
|
@@ -15,7 +15,7 @@ const { version } = require('../../package.json');
|
|
|
15
15
|
exports.createGeneratorFiles = async (id, details) => {
|
|
16
16
|
const config = configuration_1.readConfiguration();
|
|
17
17
|
const domain = constants_1.STEPZEN_DOMAIN.replace('.io', '.net');
|
|
18
|
-
const url = `https://${config.account}.${domain}/${constants_1.
|
|
18
|
+
const url = `https://${config.account}.${domain}/${constants_1.STEPZEN_GENERATOR_ENGINES_ENDPOINT}/__graphql`;
|
|
19
19
|
const response = await node_fetch_1.default(url, {
|
|
20
20
|
body: JSON.stringify({
|
|
21
21
|
query: `
|
|
@@ -35,7 +35,7 @@ exports.createGeneratorFiles = async (id, details) => {
|
|
|
35
35
|
},
|
|
36
36
|
method: 'POST',
|
|
37
37
|
});
|
|
38
|
-
const { data: { create } } = await response.json();
|
|
38
|
+
const { data: { create }, } = await response.json();
|
|
39
39
|
const tmp = path.join(os.tmpdir(), `stepzen-generated-schema-${Date.now()}`);
|
|
40
40
|
fs.ensureDirSync(tmp);
|
|
41
41
|
for (const file of create) {
|
|
@@ -47,7 +47,7 @@ exports.createGeneratorFiles = async (id, details) => {
|
|
|
47
47
|
exports.getConfiguration = async (id, details = {}) => {
|
|
48
48
|
const config = configuration_1.readConfiguration();
|
|
49
49
|
const domain = constants_1.STEPZEN_DOMAIN.replace('.io', '.net');
|
|
50
|
-
const url = `https://${config.account}.${domain}/${constants_1.
|
|
50
|
+
const url = `https://${config.account}.${domain}/${constants_1.STEPZEN_GENERATOR_ENGINES_ENDPOINT}/__graphql`;
|
|
51
51
|
const response = await node_fetch_1.default(url, {
|
|
52
52
|
body: JSON.stringify({
|
|
53
53
|
query: `
|
|
@@ -81,7 +81,14 @@ exports.getSchemaList = (arg) => {
|
|
|
81
81
|
throw new Error(`You are trying to import "${schema}" more than once`);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
return schemas
|
|
84
|
+
return schemas.map(schema => {
|
|
85
|
+
// support `postgres` as an alias to `postgresql`
|
|
86
|
+
// https://github.com/steprz/stepzen-cli/issues/431
|
|
87
|
+
if (schema.toLowerCase() === 'postgres') {
|
|
88
|
+
return 'postgresql';
|
|
89
|
+
}
|
|
90
|
+
return schema;
|
|
91
|
+
});
|
|
85
92
|
};
|
|
86
93
|
exports.getTemplates = async () => {
|
|
87
94
|
const tmp = path.join(os.tmpdir(), `stepzen-api-templates-${Date.now()}`);
|
package/lib/generate/index.js
CHANGED
|
@@ -70,11 +70,13 @@ exports.default = async (schemas, source) => {
|
|
|
70
70
|
cli_ux_1.default.action.stop();
|
|
71
71
|
console.log();
|
|
72
72
|
// If you've tried to import non-existent templates, complain and exit
|
|
73
|
-
const notFound = Object.entries(generators)
|
|
73
|
+
const notFound = Object.entries(generators)
|
|
74
|
+
.map(([id, settings]) => {
|
|
74
75
|
if (!settings)
|
|
75
76
|
return id;
|
|
76
77
|
return null;
|
|
77
|
-
})
|
|
78
|
+
})
|
|
79
|
+
.filter(i => i);
|
|
78
80
|
if (notFound.length > 0) {
|
|
79
81
|
fs.removeSync(templates);
|
|
80
82
|
throw new Error(`Cannot find the schema ${notFound[0]}`);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2020,2021,2022, StepZen, Inc.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const constants_1 = require("../../shared/constants");
|
|
7
|
+
const constants_2 = require("../../shared/constants");
|
|
8
|
+
const hook = async function () {
|
|
9
|
+
// checking file existence and permissions (https://betterprogramming.pub/dbce0f2b373c)
|
|
10
|
+
const file = path.join(constants_2.STEPZEN_CONFIG_DIRECTORY, constants_1.STEPZEN_CONFIG_FILE);
|
|
11
|
+
try {
|
|
12
|
+
fs.accessSync(file, fs.constants.F_OK | fs.constants.R_OK | fs.constants.W_OK);
|
|
13
|
+
const mode = fs.statSync(file).mode;
|
|
14
|
+
// https://stackoverflow.com/questions/50839744/how-to-interpret-the-number-returned-from-statsync
|
|
15
|
+
if (mode & (fs.constants.S_IRWXG | fs.constants.S_IRWXG))
|
|
16
|
+
fs.chmodSync(file, fs.constants.S_IRWXU);
|
|
17
|
+
}
|
|
18
|
+
catch (error) { }
|
|
19
|
+
};
|
|
20
|
+
exports.default = hook;
|
|
@@ -85,6 +85,6 @@ exports.writeConfigurationToLoginFile = (configuration) => {
|
|
|
85
85
|
}
|
|
86
86
|
// Write the configuration file. Overwrites if it already exists.
|
|
87
87
|
const file = path.join(constants_1.STEPZEN_CONFIG_DIRECTORY, constants_1.STEPZEN_CONFIG_FILE);
|
|
88
|
-
fs.writeFileSync(file, content);
|
|
88
|
+
fs.writeFileSync(file, content, { mode: '600' });
|
|
89
89
|
return configuration;
|
|
90
90
|
};
|
|
@@ -3,7 +3,8 @@ export declare const STEPZEN_CONFIG_DIRECTORY: string;
|
|
|
3
3
|
export declare const STEPZEN_CONFIG_FILE: string;
|
|
4
4
|
export declare const STEPZEN_DOMAIN: string;
|
|
5
5
|
export declare const STEPZEN_SERVER_URL: string;
|
|
6
|
-
export declare const STEPZEN_GENERATOR_ENGINES_SCHEMA
|
|
6
|
+
export declare const STEPZEN_GENERATOR_ENGINES_SCHEMA: string;
|
|
7
|
+
export declare const STEPZEN_GENERATOR_ENGINES_ENDPOINT = "stepzen-generator/engines";
|
|
7
8
|
export declare const STEPZEN_API_TEMPLATES_REPOSITORY = "https://github.com/steprz/stepzen-schemas";
|
|
8
9
|
export declare const ADMIN_ACCOUNT_URL = "/cli/admin/account";
|
|
9
10
|
export declare const ADMIN_DEPLOY_URL = "/cli/admin/deploy";
|
package/lib/shared/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) 2020,2021,2022, StepZen, Inc.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ADMIN_VERIFY_URL = exports.ADMIN_UPLOAD_URL = exports.ADMIN_LIST_URL = exports.ADMIN_DEPLOY_URL = exports.ADMIN_ACCOUNT_URL = exports.STEPZEN_API_TEMPLATES_REPOSITORY = exports.STEPZEN_GENERATOR_ENGINES_SCHEMA = exports.STEPZEN_SERVER_URL = exports.STEPZEN_DOMAIN = exports.STEPZEN_CONFIG_FILE = exports.STEPZEN_CONFIG_DIRECTORY = exports.STEPZEN_CONFIG_CONTENT = void 0;
|
|
4
|
+
exports.ADMIN_VERIFY_URL = exports.ADMIN_UPLOAD_URL = exports.ADMIN_LIST_URL = exports.ADMIN_DEPLOY_URL = exports.ADMIN_ACCOUNT_URL = exports.STEPZEN_API_TEMPLATES_REPOSITORY = exports.STEPZEN_GENERATOR_ENGINES_ENDPOINT = exports.STEPZEN_GENERATOR_ENGINES_SCHEMA = exports.STEPZEN_SERVER_URL = exports.STEPZEN_DOMAIN = exports.STEPZEN_CONFIG_FILE = exports.STEPZEN_CONFIG_DIRECTORY = exports.STEPZEN_CONFIG_CONTENT = void 0;
|
|
5
5
|
// This file contains constants and all magic strings
|
|
6
6
|
const dotenv = require("dotenv");
|
|
7
7
|
const os = require("os");
|
|
@@ -9,7 +9,7 @@ const path = require("path");
|
|
|
9
9
|
// This allows you to set environment variables in a `.env` file.
|
|
10
10
|
// This file needs to be in your working directory.
|
|
11
11
|
dotenv.config();
|
|
12
|
-
const { STEPZEN_CONFIG_CONTENT: ENV_VAR_STEPZEN_CONFIG_CONTENT, STEPZEN_CONFIG_FILE: ENV_VAR_STEPZEN_CONFIG_FILE, STEPZEN_DOMAIN: ENV_VAR_STEPZEN_DOMAIN, STEPZEN_SERVER_URL: ENV_VAR_STEPZEN_SERVER_URL, } = process.env;
|
|
12
|
+
const { STEPZEN_CONFIG_CONTENT: ENV_VAR_STEPZEN_CONFIG_CONTENT, STEPZEN_CONFIG_FILE: ENV_VAR_STEPZEN_CONFIG_FILE, STEPZEN_DOMAIN: ENV_VAR_STEPZEN_DOMAIN, STEPZEN_GENERATOR_ENGINES_SCHEMA: ENV_VAR_STEPZEN_GENERATOR_ENGINES_SCHEMA, STEPZEN_SERVER_URL: ENV_VAR_STEPZEN_SERVER_URL, } = process.env;
|
|
13
13
|
// Where your authentication details are stored locally
|
|
14
14
|
exports.STEPZEN_CONFIG_CONTENT = ENV_VAR_STEPZEN_CONFIG_CONTENT;
|
|
15
15
|
exports.STEPZEN_CONFIG_DIRECTORY = path.join(os.homedir(), '.stepzen');
|
|
@@ -18,8 +18,11 @@ exports.STEPZEN_CONFIG_FILE = ENV_VAR_STEPZEN_CONFIG_FILE || 'stepzen-config.yam
|
|
|
18
18
|
exports.STEPZEN_DOMAIN = ENV_VAR_STEPZEN_DOMAIN || 'stepzen.io';
|
|
19
19
|
// The zenctl URL. Override with the env var `STEPZEN_SERVER_URL`
|
|
20
20
|
exports.STEPZEN_SERVER_URL = ENV_VAR_STEPZEN_SERVER_URL || 'https://{account}.stepzen.io';
|
|
21
|
-
// Generator Engines schema folder/name
|
|
22
|
-
|
|
21
|
+
// Generator Engines schema: folder/name
|
|
22
|
+
// Use 'stepzen/engines-dev' to test the dev instance of https://github.com/steprz/generator-engines
|
|
23
|
+
exports.STEPZEN_GENERATOR_ENGINES_SCHEMA = ENV_VAR_STEPZEN_GENERATOR_ENGINES_SCHEMA || 'stepzen/engines';
|
|
24
|
+
// Generator Engines schema: target API endpoint
|
|
25
|
+
exports.STEPZEN_GENERATOR_ENGINES_ENDPOINT = 'stepzen-generator/engines';
|
|
23
26
|
// API Templates repository
|
|
24
27
|
exports.STEPZEN_API_TEMPLATES_REPOSITORY = 'https://github.com/steprz/stepzen-schemas';
|
|
25
28
|
// Paths to the endpoints used
|
package/lib/start/console.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: (workspace: any
|
|
1
|
+
declare const _default: (workspace: any) => Promise<void>;
|
|
2
2
|
export default _default;
|
package/lib/start/console.js
CHANGED
|
@@ -2,22 +2,15 @@
|
|
|
2
2
|
// Copyright (c) 2020,2021,2022, StepZen, Inc.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const chalk = require("chalk");
|
|
5
|
-
const cli_ux_1 = require("cli-ux");
|
|
6
5
|
const fs = require("fs");
|
|
7
6
|
const os = require("os");
|
|
8
7
|
const path = require("path");
|
|
9
|
-
|
|
10
|
-
// eslint-disable-next-line max-params
|
|
11
|
-
exports.default = async (workspace, flags) => {
|
|
12
|
-
utils_1.clearConsole();
|
|
8
|
+
exports.default = async (workspace) => {
|
|
13
9
|
const cwd = workspace.schema.replace(os.homedir(), '~');
|
|
14
10
|
const config = path.join(cwd, 'config.yaml');
|
|
11
|
+
console.log();
|
|
15
12
|
if (fs.existsSync(config)) {
|
|
16
|
-
console.log(`Watching ${chalk.blue(config)} for configuration changes
|
|
17
|
-
}
|
|
18
|
-
console.log(`Watching ${chalk.blue(cwd)} for GraphQL changes`);
|
|
19
|
-
if (!flags['no-dashboard']) {
|
|
20
|
-
console.log();
|
|
21
|
-
cli_ux_1.default.url(`Running StepZen at http://localhost:${flags.port}/${workspace.endpoint}`, `http://localhost:${flags.port}/${workspace.endpoint}`);
|
|
13
|
+
console.log(`Watching ${chalk.blue(config)} for configuration changes...`);
|
|
22
14
|
}
|
|
15
|
+
console.log(`Watching ${chalk.blue(cwd)} for GraphQL changes...`);
|
|
23
16
|
};
|
package/lib/start/deploy.js
CHANGED
|
@@ -4,9 +4,9 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
// Copyright (c) 2020,2021,2022, StepZen, Inc.
|
|
5
5
|
const chalk = require("chalk");
|
|
6
6
|
const cli_ux_1 = require("cli-ux");
|
|
7
|
-
const date_fns_1 = require("date-fns");
|
|
8
7
|
const fs = require("fs-extra");
|
|
9
8
|
const path = require("path");
|
|
9
|
+
const prettyMilliseconds = require("pretty-ms");
|
|
10
10
|
const deploy_1 = require("../commands/deploy");
|
|
11
11
|
const configuration_1 = require("../shared/configuration");
|
|
12
12
|
const constants_1 = require("../shared/constants");
|
|
@@ -16,7 +16,6 @@ const dotenv = require('dotenv');
|
|
|
16
16
|
exports.default = async (file, workspace, flags) => {
|
|
17
17
|
var e_1, _a;
|
|
18
18
|
dotenv.config({ path: path.join(workspace.directory, '.env') });
|
|
19
|
-
console.log();
|
|
20
19
|
if (file) {
|
|
21
20
|
console.log(`File changed: ${chalk.blue(file)}`);
|
|
22
21
|
}
|
|
@@ -33,20 +32,32 @@ exports.default = async (file, workspace, flags) => {
|
|
|
33
32
|
return;
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
|
-
cli_ux_1.default.action.start(
|
|
35
|
+
cli_ux_1.default.action.start(`Deploying ${chalk.yellow(workspace.endpoint)} to StepZen`);
|
|
37
36
|
const deployArgs = [workspace.endpoint, '--silent'];
|
|
38
37
|
const uploadCmds = [];
|
|
39
38
|
const configPath = path.join(workspace.schema, 'config.yaml');
|
|
40
39
|
if (fs.existsSync(configPath)) {
|
|
41
40
|
deployArgs.push('--configurationsets', `${workspace.endpoint},stepzen/default`);
|
|
42
|
-
uploadCmds.push([
|
|
41
|
+
uploadCmds.push([
|
|
42
|
+
'configurationset',
|
|
43
|
+
workspace.endpoint,
|
|
44
|
+
'--file',
|
|
45
|
+
configPath,
|
|
46
|
+
'--silent',
|
|
47
|
+
]);
|
|
43
48
|
}
|
|
44
49
|
else {
|
|
45
50
|
deployArgs.push('--configurationsets', 'stepzen/default');
|
|
46
51
|
}
|
|
47
52
|
if (fs.existsSync(workspace.schema)) {
|
|
48
53
|
deployArgs.push('--schema', workspace.endpoint);
|
|
49
|
-
uploadCmds.push([
|
|
54
|
+
uploadCmds.push([
|
|
55
|
+
'schema',
|
|
56
|
+
workspace.endpoint,
|
|
57
|
+
'--dir',
|
|
58
|
+
workspace.schema,
|
|
59
|
+
'--silent',
|
|
60
|
+
]);
|
|
50
61
|
}
|
|
51
62
|
const logError = (error) => {
|
|
52
63
|
try {
|
|
@@ -60,6 +71,7 @@ exports.default = async (file, workspace, flags) => {
|
|
|
60
71
|
console.log(chalk.red(error));
|
|
61
72
|
}
|
|
62
73
|
};
|
|
74
|
+
const deployStart = new Date().getTime();
|
|
63
75
|
try {
|
|
64
76
|
for (var uploadCmds_1 = tslib_1.__asyncValues(uploadCmds), uploadCmds_1_1; uploadCmds_1_1 = await uploadCmds_1.next(), !uploadCmds_1_1.done;) {
|
|
65
77
|
const cmd = uploadCmds_1_1.value;
|
|
@@ -86,13 +98,20 @@ exports.default = async (file, workspace, flags) => {
|
|
|
86
98
|
logError(error);
|
|
87
99
|
return;
|
|
88
100
|
}
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
console.log();
|
|
93
|
-
console.log(chalk.green(`Successfully deployed ${what} at ${when}`));
|
|
101
|
+
const deployEnd = new Date().getTime();
|
|
102
|
+
const deployTime = deployEnd - deployStart;
|
|
103
|
+
cli_ux_1.default.action.stop(`${chalk.grey('done in')} ${prettyMilliseconds(deployTime)} 🚀`);
|
|
94
104
|
const domain = constants_1.STEPZEN_DOMAIN.replace('.io', '.net');
|
|
95
105
|
const endpoint = `https://${configuration.account}.${domain}/${workspace.endpoint}/__graphql`;
|
|
96
106
|
console.log();
|
|
97
|
-
console.log(chalk.grey(`Your
|
|
107
|
+
console.log(chalk.grey(`Your API url is`, chalk.green(` ${endpoint}`)));
|
|
108
|
+
console.log();
|
|
109
|
+
console.log(chalk.grey(`You can test your hosted API with cURL:`));
|
|
110
|
+
console.log();
|
|
111
|
+
console.log(`curl ${endpoint} \\`);
|
|
112
|
+
console.log(` --header "Authorization: Apikey {{insert yours from https://stepzen.com/account}}" \\`);
|
|
113
|
+
console.log(` --header "Content-Type: application/json" \\`);
|
|
114
|
+
console.log(` --data '{"query": "your graphql query"}'`);
|
|
115
|
+
console.log();
|
|
116
|
+
console.log(chalk.grey(`or explore it with GraphiQL at`), chalk.green(` http://localhost:${flags.port}/${workspace.endpoint}`));
|
|
98
117
|
};
|
package/lib/start/index.d.ts
CHANGED
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.9.
|
|
1
|
+
{"version":"0.9.38-beta.2","commands":{"deploy":{"id":"deploy","description":"deploy to stepzen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"configurationsets":{"name":"configurationsets","type":"option","description":"Configurationsets to use","default":""},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"schema":{"name":"schema","type":"option","description":"Schema to use","required":true},"silent":{"name":"silent","type":"boolean","allowNo":false}},"args":[{"name":"destination","description":"destination","required":true}]},"import":{"id":"import","description":"import schemas from stepzen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"dir":{"name":"dir","type":"option","description":"working directory"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"silent":{"name":"silent","type":"boolean","hidden":true,"allowNo":false}},"args":[{"name":"schemas","required":true}]},"init":{"id":"init","description":"stepzen init","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"endpoint":{"name":"endpoint","type":"option","hidden":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"yes":{"name":"yes","type":"boolean","hidden":true,"allowNo":false}},"args":[{"name":"directory","hidden":true}]},"lint":{"id":"lint","description":"stepzen lint","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"dir":{"name":"dir","type":"option","hidden":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"list":{"id":"list","description":"list your items","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"type","description":"type","required":true,"options":["configurationsets","schemas"]}]},"login":{"id":"login","description":"log in to stepzen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"account":{"name":"account","type":"option","char":"a","hidden":true},"adminkey":{"name":"adminkey","type":"option","char":"k","hidden":true},"config":{"name":"config","type":"option","hidden":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"logout":{"id":"logout","description":"log out of stepzen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"start":{"id":"start","description":"upload and deploy your schema","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"dir":{"name":"dir","type":"option","description":"working directory"},"endpoint":{"name":"endpoint","type":"option","description":"Override workspace endpoint"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"no-console":{"name":"no-console","type":"boolean","hidden":true,"allowNo":false},"no-dashboard":{"name":"no-dashboard","type":"boolean","hidden":true,"allowNo":false},"no-init":{"name":"no-init","type":"boolean","hidden":true,"allowNo":false},"no-server":{"name":"no-server","type":"boolean","hidden":true,"allowNo":false},"no-validate":{"name":"no-validate","type":"boolean","hidden":true,"allowNo":false},"no-watcher":{"name":"no-watcher","type":"boolean","hidden":true,"allowNo":false},"port":{"name":"port","type":"option","default":5001}},"args":[]},"transpile":{"id":"transpile","description":"transpile a graphql schema","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"config":{"name":"config","type":"option","hidden":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"hide-output":{"name":"hide-output","type":"boolean","hidden":true,"allowNo":false},"inspect":{"name":"inspect","type":"boolean","char":"i","hidden":true,"allowNo":false},"inspect-after":{"name":"inspect-after","type":"boolean","hidden":true,"allowNo":false},"output-configuration":{"name":"output-configuration","type":"boolean","allowNo":false},"silent":{"name":"silent","type":"boolean","allowNo":false}},"args":[{"name":"folder","required":true}]},"upload":{"id":"upload","description":"upload to stepzen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"dir":{"name":"dir","type":"option","description":"A directory to upload"},"file":{"name":"file","type":"option","description":"A file to upload"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"silent":{"name":"silent","type":"boolean","allowNo":false}},"args":[{"name":"type","description":"type","required":true,"options":["configurationset","schema"]},{"name":"destination","description":"destination","required":true}]},"validate":{"id":"validate","description":"validate a graphql schema","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"folder","required":true}]},"whoami":{"id":"whoami","description":"stepzen whoami","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"showkeys":{"name":"showkeys","type":"boolean","allowNo":false}},"args":[]}}}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stepzen",
|
|
3
3
|
"description": "The StepZen CLI",
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.38-beta.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Darren Waddell <darren@stepzen.com>",
|
|
7
7
|
"contributors": [
|
|
@@ -29,37 +29,26 @@
|
|
|
29
29
|
"@oclif/command": "^1.8.0",
|
|
30
30
|
"@oclif/config": "^1.17.1",
|
|
31
31
|
"@oclif/plugin-help": "^5.1.10",
|
|
32
|
-
"@stepzen/dashboard": "0.1.
|
|
32
|
+
"@stepzen/dashboard": "0.1.36",
|
|
33
33
|
"@stepzen/sdk": "0.9.42",
|
|
34
34
|
"@stepzen/transpiler": "0.0.34",
|
|
35
|
-
"@types/archiver": "^3.1.1",
|
|
36
|
-
"@types/debug": "^4.1.6",
|
|
37
|
-
"@types/node-fetch": "^2.5.7",
|
|
38
|
-
"archiver": "^5.0.2",
|
|
39
35
|
"chalk": "^4.1.1",
|
|
40
36
|
"chokidar": "^3.5.2",
|
|
41
37
|
"cli-ux": "^6.0.8",
|
|
42
38
|
"compare-versions": "^3.6.0",
|
|
43
|
-
"cors": "^2.8.5",
|
|
44
|
-
"cross-spawn": "^7.0.3",
|
|
45
39
|
"date-fns": "^2.26.0",
|
|
46
40
|
"debug": "^4.3.0",
|
|
47
41
|
"detect-port": "^1.3.0",
|
|
48
42
|
"dotenv": "^8.6.0",
|
|
49
|
-
"express": "^4.17.1",
|
|
50
|
-
"form-data": "^3.0.0",
|
|
51
43
|
"fs-extra": "^9.1.0",
|
|
52
44
|
"glob": "^7.1.7",
|
|
53
|
-
"graphql": "^15.7.2",
|
|
54
45
|
"inquirer": "^7.3.3",
|
|
55
46
|
"lodash": "^4.17.21",
|
|
56
47
|
"node-fetch": "^2.6.6",
|
|
57
|
-
"open": "^7.3.0",
|
|
58
48
|
"prettier": "^2.4.1",
|
|
49
|
+
"pretty-ms": "^7.0.1",
|
|
59
50
|
"shelljs": "^0.8.5",
|
|
60
51
|
"throttle-debounce": "^3.0.1",
|
|
61
|
-
"tslib": "^1.14.1",
|
|
62
|
-
"unzipper": "^0.10.11",
|
|
63
52
|
"yaml": "^1.10.0"
|
|
64
53
|
},
|
|
65
54
|
"devDependencies": {
|
|
@@ -68,6 +57,7 @@
|
|
|
68
57
|
"@types/chai": "^4.2.12",
|
|
69
58
|
"@types/cors": "^2.8.10",
|
|
70
59
|
"@types/cross-spawn": "^6.0.2",
|
|
60
|
+
"@types/debug": "^4.1.6",
|
|
71
61
|
"@types/detect-port": "^1.3.0",
|
|
72
62
|
"@types/express": "^4.17.9",
|
|
73
63
|
"@types/fs-extra": "^9.0.7",
|
|
@@ -79,6 +69,7 @@
|
|
|
79
69
|
"@types/mocha": "^5.2.7",
|
|
80
70
|
"@types/mock-fs": "^4.13.0",
|
|
81
71
|
"@types/node": "^12.20.7",
|
|
72
|
+
"@types/node-fetch": "^2.5.7",
|
|
82
73
|
"@types/prettier": "^2.1.6",
|
|
83
74
|
"@types/rimraf": "^3.0.0",
|
|
84
75
|
"@types/shelljs": "^0.8.8",
|
|
@@ -87,10 +78,13 @@
|
|
|
87
78
|
"chai": "^4.2.0",
|
|
88
79
|
"copyfiles": "^2.4.1",
|
|
89
80
|
"eslint": "7.11.0",
|
|
90
|
-
"eslint-config-oclif": "
|
|
91
|
-
"eslint-config-oclif-typescript": "
|
|
92
|
-
"eslint-
|
|
81
|
+
"eslint-config-oclif": "3.1.0",
|
|
82
|
+
"eslint-config-oclif-typescript": "0.1.0",
|
|
83
|
+
"eslint-config-prettier": "8.3.0",
|
|
84
|
+
"eslint-plugin-prettier": "3.3.1",
|
|
85
|
+
"husky": "^7.0.4",
|
|
93
86
|
"license-checker": "^25.0.1",
|
|
87
|
+
"lint-staged": "^12.3.2",
|
|
94
88
|
"mocha": "^5.2.0",
|
|
95
89
|
"mock-fs": "^4.13.0",
|
|
96
90
|
"nock": "^13.0.4",
|
|
@@ -109,17 +103,23 @@
|
|
|
109
103
|
"prerun": [
|
|
110
104
|
"./lib/hooks/prerun/check-account",
|
|
111
105
|
"./lib/hooks/prerun/check-upgrade",
|
|
112
|
-
"./lib/hooks/prerun/ensure-api-key"
|
|
106
|
+
"./lib/hooks/prerun/ensure-api-key",
|
|
107
|
+
"./lib/hooks/prerun/ensure-permissions"
|
|
113
108
|
]
|
|
114
109
|
}
|
|
115
110
|
},
|
|
116
111
|
"scripts": {
|
|
117
|
-
"dev": "nodemon
|
|
112
|
+
"dev:login": "nodemon -e ts bin/run login",
|
|
113
|
+
"dev:start": "nodemon -e ts bin/run start --dir ~/Downloads/hello-stepzen",
|
|
118
114
|
"postpack": "rm -f oclif.manifest.json",
|
|
119
|
-
"posttest": "eslint . --
|
|
115
|
+
"posttest": "eslint . --ignore-path .prettierignore",
|
|
120
116
|
"prepack": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
|
|
121
117
|
"test": "tsc -b && STEPZEN_DOMAIN=steprz.io STEPZEN_SERVER_URL=http://localhost nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
|
|
122
|
-
"version": "oclif-dev readme && git add README.md"
|
|
118
|
+
"version": "oclif-dev readme && git add README.md",
|
|
119
|
+
"prepare": "husky install"
|
|
123
120
|
},
|
|
124
|
-
"types": "lib/index.d.ts"
|
|
121
|
+
"types": "lib/index.d.ts",
|
|
122
|
+
"lint-staged": {
|
|
123
|
+
"*.{ts,js,css,md,yaml,json}": "prettier --write"
|
|
124
|
+
}
|
|
125
125
|
}
|