@dynamicweb/cli 1.1.1 → 2.0.0-beta.0
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 +401 -180
- package/bin/commands/command.js +6 -23
- package/bin/commands/env.js +143 -26
- package/bin/commands/files.js +248 -34
- package/bin/commands/install.js +98 -18
- package/bin/commands/login.js +383 -44
- package/bin/commands/query.js +16 -20
- package/bin/index.js +37 -8
- package/package.json +2 -2
package/bin/index.js
CHANGED
|
@@ -33,14 +33,30 @@ yargs(hideBin(process.argv))
|
|
|
33
33
|
description: 'Run with verbose logging'
|
|
34
34
|
})
|
|
35
35
|
.option('protocol', {
|
|
36
|
-
description: '
|
|
36
|
+
description: 'Set the protocol used with --host (defaults to https)'
|
|
37
37
|
})
|
|
38
38
|
.option('host', {
|
|
39
|
-
description: 'Allows setting the host used, only allowed if an --apiKey
|
|
39
|
+
description: 'Allows setting the host used, only allowed if an --apiKey or OAuth client credentials are specified'
|
|
40
40
|
})
|
|
41
41
|
.option('apiKey', {
|
|
42
42
|
description: 'Allows setting the apiKey for an environmentless execution of the CLI command'
|
|
43
43
|
})
|
|
44
|
+
.option('auth', {
|
|
45
|
+
choices: ['user', 'oauth'],
|
|
46
|
+
description: 'Overrides the authentication mode for the command'
|
|
47
|
+
})
|
|
48
|
+
.option('clientId', {
|
|
49
|
+
description: 'OAuth client ID used together with --auth oauth'
|
|
50
|
+
})
|
|
51
|
+
.option('clientSecret', {
|
|
52
|
+
description: 'OAuth client secret used together with --auth oauth. WARNING: passing this on the command line can expose the secret via shell history and process listings. Prefer using --clientSecretEnv to reference a secret stored in an environment variable instead.'
|
|
53
|
+
})
|
|
54
|
+
.option('clientIdEnv', {
|
|
55
|
+
description: 'Environment variable name that contains the OAuth client ID'
|
|
56
|
+
})
|
|
57
|
+
.option('clientSecretEnv', {
|
|
58
|
+
description: 'Environment variable name that contains the OAuth client secret'
|
|
59
|
+
})
|
|
44
60
|
.demandCommand()
|
|
45
61
|
.parse()
|
|
46
62
|
|
|
@@ -49,14 +65,27 @@ function baseCommand() {
|
|
|
49
65
|
command: '$0',
|
|
50
66
|
describe: 'Shows the current env and user being used',
|
|
51
67
|
handler: () => {
|
|
52
|
-
|
|
68
|
+
const cfg = getConfig();
|
|
69
|
+
if (Object.keys(cfg).length === 0) {
|
|
53
70
|
console.log('To login to a solution use `dw login`')
|
|
54
71
|
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
72
|
+
}
|
|
73
|
+
const currentEnv = cfg?.env?.[cfg?.current?.env];
|
|
74
|
+
if (!currentEnv) {
|
|
75
|
+
console.log(`Environment '${cfg?.current?.env}' is not configured.`);
|
|
76
|
+
console.log('To login to a solution use `dw login`');
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const authType = currentEnv?.current?.authType;
|
|
80
|
+
|
|
81
|
+
console.log(`Environment: ${cfg?.current?.env}`);
|
|
82
|
+
if (authType === 'oauth_client_credentials') {
|
|
83
|
+
console.log('Authentication: OAuth client credentials');
|
|
84
|
+
} else if (currentEnv?.current?.user) {
|
|
85
|
+
console.log(`User: ${currentEnv.current.user}`);
|
|
86
|
+
}
|
|
87
|
+
console.log(`Protocol: ${currentEnv.protocol}`);
|
|
88
|
+
console.log(`Host: ${currentEnv.host}`);
|
|
60
89
|
}
|
|
61
90
|
}
|
|
62
91
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@dynamicweb/cli",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "CLI for interacting with Dynamicweb 10 solutions from the command line.",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "2.0.0-beta.0",
|
|
6
6
|
"main": "bin/index.js",
|
|
7
7
|
"files": [
|
|
8
8
|
"bin/**"
|
|
@@ -48,4 +48,4 @@
|
|
|
48
48
|
"node-fetch": "^3.2.10",
|
|
49
49
|
"yargs": "^17.5.1"
|
|
50
50
|
}
|
|
51
|
-
}
|
|
51
|
+
}
|