stepzen 0.9.38-beta.0 → 0.9.38-beta.1
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 +1 -1
- package/lib/commands/start.js +9 -8
- package/lib/start/console.d.ts +1 -1
- package/lib/start/console.js +4 -11
- package/lib/start/deploy.js +17 -37
- package/oclif.manifest.json +1 -1
- package/package.json +2 -1
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.38-beta.
|
|
32
|
+
stepzen/0.9.38-beta.1 darwin-x64 node-v14.18.0
|
|
33
33
|
$ stepzen --help [COMMAND]
|
|
34
34
|
USAGE
|
|
35
35
|
$ stepzen COMMAND
|
package/lib/commands/start.js
CHANGED
|
@@ -51,21 +51,23 @@ 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
|
-
if (flags['
|
|
70
|
+
if (!flags['no-dashboard']) {
|
|
69
71
|
const ui = await dashboard({
|
|
70
72
|
account: configuration.account,
|
|
71
73
|
adminkey: configuration.adminkey,
|
|
@@ -84,7 +86,6 @@ 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();
|
|
@@ -97,7 +98,7 @@ Start.flags = {
|
|
|
97
98
|
endpoint: command_1.flags.string({ description: 'Override workspace endpoint' }),
|
|
98
99
|
help: command_1.flags.help({ char: 'h' }),
|
|
99
100
|
'no-console': command_1.flags.boolean({ hidden: true }),
|
|
100
|
-
'
|
|
101
|
+
'no-dashboard': command_1.flags.boolean({ hidden: true }),
|
|
101
102
|
'no-init': command_1.flags.boolean({ hidden: true }),
|
|
102
103
|
'no-server': command_1.flags.boolean({ hidden: true }),
|
|
103
104
|
'no-validate': command_1.flags.boolean({ hidden: true }),
|
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['local-proxy']) {
|
|
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,7 +32,7 @@ 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');
|
|
@@ -72,6 +71,7 @@ exports.default = async (file, workspace, flags) => {
|
|
|
72
71
|
console.log(chalk.red(error));
|
|
73
72
|
}
|
|
74
73
|
};
|
|
74
|
+
const deployStart = new Date().getTime();
|
|
75
75
|
try {
|
|
76
76
|
for (var uploadCmds_1 = tslib_1.__asyncValues(uploadCmds), uploadCmds_1_1; uploadCmds_1_1 = await uploadCmds_1.next(), !uploadCmds_1_1.done;) {
|
|
77
77
|
const cmd = uploadCmds_1_1.value;
|
|
@@ -98,40 +98,20 @@ exports.default = async (file, workspace, flags) => {
|
|
|
98
98
|
logError(error);
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
console.log();
|
|
105
|
-
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)} 🚀`);
|
|
106
104
|
const domain = constants_1.STEPZEN_DOMAIN.replace('.io', '.net');
|
|
107
105
|
const endpoint = `https://${configuration.account}.${domain}/${workspace.endpoint}/__graphql`;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const parts = configuration.apikey.split('::');
|
|
120
|
-
const key = parts[2];
|
|
121
|
-
const firstTwoChars = key.substring(0, 2);
|
|
122
|
-
const lastTwoChars = key.slice(-2);
|
|
123
|
-
const masked = `${firstTwoChars}***${lastTwoChars}`;
|
|
124
|
-
const masked_apikey = `${parts[0]}::${parts[1]}::${masked}`;
|
|
125
|
-
console.log();
|
|
126
|
-
console.log(chalk.grey(`Your GraphQL schema is deployed to`, chalk.green(` ${endpoint}`)));
|
|
127
|
-
console.log();
|
|
128
|
-
console.log(chalk.grey(`You can test your endpoint with cURL:`));
|
|
129
|
-
console.log();
|
|
130
|
-
console.log(`curl ${endpoint} \\`);
|
|
131
|
-
console.log(` --header "Authorization: Apikey ${masked_apikey}" \\`);
|
|
132
|
-
console.log(` --header "Content-Type: application/json" \\`);
|
|
133
|
-
console.log(` --data '{"query": "your graphql query"}' \\`);
|
|
134
|
-
console.log();
|
|
135
|
-
console.log(chalk.grey(firstProxyLine), chalk.green(secondProxyLine));
|
|
136
|
-
}
|
|
106
|
+
console.log();
|
|
107
|
+
console.log(chalk.grey(`Your API url is`, chalk.green(` ${endpoint}`)));
|
|
108
|
+
console.log();
|
|
109
|
+
console.log(chalk.grey(`You can test your 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}`));
|
|
137
117
|
};
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.9.38-beta.
|
|
1
|
+
{"version":"0.9.38-beta.1","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.38-beta.
|
|
4
|
+
"version": "0.9.38-beta.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Darren Waddell <darren@stepzen.com>",
|
|
7
7
|
"contributors": [
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"lodash": "^4.17.21",
|
|
47
47
|
"node-fetch": "^2.6.6",
|
|
48
48
|
"prettier": "^2.4.1",
|
|
49
|
+
"pretty-ms": "^7.0.1",
|
|
49
50
|
"shelljs": "^0.8.5",
|
|
50
51
|
"throttle-debounce": "^3.0.1",
|
|
51
52
|
"yaml": "^1.10.0"
|