@hahnpro/flow-cli 2.14.2 → 2.14.3
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/lib/auth.mjs +1 -1
- package/lib/cli.mjs +18 -13
- package/package.json +14 -15
package/lib/auth.mjs
CHANGED
package/lib/cli.mjs
CHANGED
|
@@ -15,6 +15,7 @@ import fs from 'node:fs';
|
|
|
15
15
|
import { createRequire } from 'node:module';
|
|
16
16
|
import path from 'node:path';
|
|
17
17
|
import ora from 'ora';
|
|
18
|
+
import { fileURLToPath } from 'node:url';
|
|
18
19
|
|
|
19
20
|
import { getAccessToken, login, logout } from './auth.mjs';
|
|
20
21
|
import { handleApiError, handleConvertedOutput, logger, prepareTsFile } from './utils.mjs';
|
|
@@ -23,6 +24,9 @@ const require = createRequire(import.meta.url);
|
|
|
23
24
|
const BASE_URL = process.env.BASE_URL || process.env.PLATFORM_URL;
|
|
24
25
|
const BUILD_DIR = process.env.BUILD_DIR || 'dist';
|
|
25
26
|
|
|
27
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
28
|
+
const __dirname = path.dirname(__filename);
|
|
29
|
+
|
|
26
30
|
let axios = Axios;
|
|
27
31
|
if (process.env.https_proxy || process.env.http_proxy) {
|
|
28
32
|
const httpsAgent = HttpsProxyAgent(process.env.https_proxy || process.env.http_proxy);
|
|
@@ -32,6 +36,8 @@ if (process.env.https_proxy || process.env.http_proxy) {
|
|
|
32
36
|
let apiToken;
|
|
33
37
|
let projectsRoot = 'modules';
|
|
34
38
|
|
|
39
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json')));
|
|
40
|
+
|
|
35
41
|
const CMD = {
|
|
36
42
|
AUDIT: 'audit',
|
|
37
43
|
BUILD: 'build',
|
|
@@ -46,7 +52,7 @@ const CMD = {
|
|
|
46
52
|
const program = new Command();
|
|
47
53
|
|
|
48
54
|
program
|
|
49
|
-
.version(
|
|
55
|
+
.version(packageJson.version, '-v, --version')
|
|
50
56
|
.usage('[command] [options]')
|
|
51
57
|
.description('Flow Module Management Tool')
|
|
52
58
|
.on('--help', () => {});
|
|
@@ -112,11 +118,7 @@ program
|
|
|
112
118
|
.description('Lint project files')
|
|
113
119
|
.action(async (projectName) => {
|
|
114
120
|
try {
|
|
115
|
-
|
|
116
|
-
if (projectName === 'all') {
|
|
117
|
-
project = { location: '.' };
|
|
118
|
-
}
|
|
119
|
-
project = await findProject(projectName);
|
|
121
|
+
const project = await findProject(projectName);
|
|
120
122
|
await exec(CMD.LINT, project);
|
|
121
123
|
} catch (error) {
|
|
122
124
|
if (error) logger.log(error);
|
|
@@ -124,10 +126,11 @@ program
|
|
|
124
126
|
}
|
|
125
127
|
});
|
|
126
128
|
|
|
129
|
+
// if BASE_URL is not given and --url is not specified this correctly throws an error
|
|
127
130
|
program
|
|
128
131
|
.command('login')
|
|
129
|
-
.
|
|
130
|
-
.
|
|
132
|
+
.requiredOption('--url <url>', 'URL of target platform', process.env.BASE_URL)
|
|
133
|
+
.requiredOption('-r, --realm <realm>', 'Auth realm of target platform', process.env.REALM)
|
|
131
134
|
.description('Authenticate against platform')
|
|
132
135
|
.action(async (options) => {
|
|
133
136
|
try {
|
|
@@ -141,7 +144,7 @@ program
|
|
|
141
144
|
|
|
142
145
|
program
|
|
143
146
|
.command('logout')
|
|
144
|
-
.
|
|
147
|
+
.requiredOption('--url <url>', 'URL of target platform', process.env.BASE_URL)
|
|
145
148
|
.description('Remove authentication data')
|
|
146
149
|
.action(async (options) => {
|
|
147
150
|
try {
|
|
@@ -186,8 +189,8 @@ program
|
|
|
186
189
|
|
|
187
190
|
program
|
|
188
191
|
.command('publish-module [projectName]')
|
|
189
|
-
.
|
|
190
|
-
.
|
|
192
|
+
.requiredOption('--url <url>', 'URL of target platform', process.env.BASE_URL)
|
|
193
|
+
.requiredOption('-r, --realm <realm>', 'Auth realm of target platform', process.env.REALM)
|
|
191
194
|
.option('-f, --functions', 'publish flow functions')
|
|
192
195
|
.option('-u, --update', 'update existing flow functions')
|
|
193
196
|
.option('-s, --skip', 'skip modules that already exists with the current version')
|
|
@@ -240,8 +243,8 @@ program
|
|
|
240
243
|
|
|
241
244
|
program
|
|
242
245
|
.command('publish-functions [projectName]')
|
|
243
|
-
.
|
|
244
|
-
.
|
|
246
|
+
.requiredOption('--url <url>', 'URL of target platform', process.env.BASE_URL)
|
|
247
|
+
.requiredOption('-r, --realm <realm>', 'Auth realm of target platform', process.env.REALM)
|
|
245
248
|
.option('-u, --update', 'update existing flow functions')
|
|
246
249
|
.description('Publishes all Flow Functions inside specified Module to Cloud Platform')
|
|
247
250
|
.action(async (projectName, options) => {
|
|
@@ -530,6 +533,8 @@ async function publishModule(project, baseUrl = BASE_URL) {
|
|
|
530
533
|
...form.getHeaders(),
|
|
531
534
|
Authorization: `Bearer ${apiToken}`,
|
|
532
535
|
},
|
|
536
|
+
maxBodyLength: Number.POSITIVE_INFINITY,
|
|
537
|
+
maxContentLength: Number.POSITIVE_INFINITY,
|
|
533
538
|
});
|
|
534
539
|
|
|
535
540
|
logger.ok(`Module "${project.name}" published!`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hahnpro/flow-cli",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.3",
|
|
4
4
|
"description": "CLI for managing Flow Modules",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,38 +27,38 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"archiver": "^5.3.1",
|
|
30
|
-
"axios": "
|
|
30
|
+
"axios": "~0.27.2",
|
|
31
31
|
"chalk": "^5.0.1",
|
|
32
32
|
"class-transformer": "0.5.1",
|
|
33
33
|
"class-validator": "~0.13.2",
|
|
34
34
|
"class-validator-jsonschema": "^3.1.0",
|
|
35
35
|
"commander": "^9.2.0",
|
|
36
36
|
"copyfiles": "^2.4.1",
|
|
37
|
-
"dotenv": "^16.0.
|
|
38
|
-
"ejs": "^3.1.
|
|
37
|
+
"dotenv": "^16.0.1",
|
|
38
|
+
"ejs": "^3.1.8",
|
|
39
39
|
"execa": "^6.1.0",
|
|
40
|
-
"express": "^4.
|
|
40
|
+
"express": "^4.18.1",
|
|
41
41
|
"form-data": "^4.0.0",
|
|
42
42
|
"get-port": "^6.1.2",
|
|
43
|
-
"glob": "^8.0.
|
|
43
|
+
"glob": "^8.0.3",
|
|
44
44
|
"https-proxy-agent": "^5.0.1",
|
|
45
45
|
"nconf": "^0.12.0",
|
|
46
46
|
"open": "^8.4.0",
|
|
47
|
-
"openid-client": "^5.1.
|
|
47
|
+
"openid-client": "^5.1.6",
|
|
48
48
|
"ora": "^6.1.0",
|
|
49
49
|
"reflect-metadata": "^0.1.13",
|
|
50
|
-
"ts-node": "^10.
|
|
50
|
+
"ts-node": "^10.8.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/express": "^4.17.13",
|
|
54
|
-
"@types/jest": "^27.
|
|
54
|
+
"@types/jest": "^27.5.1",
|
|
55
55
|
"@types/nconf": "^0.10.2",
|
|
56
|
-
"@types/node": "^16.11.
|
|
57
|
-
"eslint": "^8.
|
|
56
|
+
"@types/node": "^16.11.36",
|
|
57
|
+
"eslint": "^8.16.0",
|
|
58
58
|
"eslint-plugin-unicorn": "^42.0.0",
|
|
59
|
-
"jest": "^
|
|
59
|
+
"jest": "^28.1.0",
|
|
60
60
|
"prettier": "^2.6.2",
|
|
61
|
-
"typescript": "^4.
|
|
61
|
+
"typescript": "^4.7.2"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": "^14.13.1 || >=16.0.0"
|
|
@@ -83,6 +83,5 @@
|
|
|
83
83
|
"format": "prettier --write .",
|
|
84
84
|
"lint": "eslint '**/*.{js,mjs}'",
|
|
85
85
|
"test": "jest"
|
|
86
|
-
}
|
|
87
|
-
"readme": "# `@hahnpro/flow-cli`\n\nhttps://github.com/hahnprojects/flow\n\n```shell\nflow-cli --help\nflow-cli [command] --help\n```\n\n# Commands\n\n## `build [projectName]`\n\nBuilds specified Project.\n\n## `install [projectName]`\n\nInstalls the dependencies of the specified Project.\n\n## `format`\n\nFormats all typescript files according to prettier configuration.\n\n## `name [projectName]`\n\nInstalls Dependencies and Builds the specified Project.\n\n## `package [projectName]`\n\nBuilds specified Module and packages it as .zip File for manual upload to the platform.\n\n## `publish-module [projectName]`\n\nPublishes specified Module to Cloud Platform.\n\n- `-f`, `--functions` Publish flow functions.\n- `-u`, `--update` Update existing flow functions.\n\n## `publish-functions [projectName]`\n\nPublishes all Flow Functions inside specified Module to Cloud Platform.\n\n- `-u`, `--update` Update existing flow functions.\n\n## `serve [projectName]`\n\nBuilds and serves your Project. Rebuilding on file changes.\n\n## `start [projectName]`\n\nRuns your project.\n\n## `test [projectName]`\n\nRuns tests for your Project.\n\n## `generate-schemas [projectName]`\n\nGenerates Input, Output and Properties-Schemas for the specified project.\n\n- `--verbose` Output more information about what is being done.\n- `-h`, `--hide` Hide warnings if Input/OutputProperties classes can´t be found.\n This command generates the schemas and puts them in the `inputStreams` and `outputStreams`\n fields in the json-files of each Flow-Function. It always assumes the properties defined\n in the `Input/OutPutProperties` classes are meant for the default input/output streams.\n If your Function uses different streams you may have to change stream name manually.\n"
|
|
86
|
+
}
|
|
88
87
|
}
|