@nzz/q-cli 1.9.0 → 1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.history/bin/commands/qItem/itemService_20220627113036.js +302 -0
- package/.history/bin/commands/qItem/itemService_20221105174223.js +304 -0
- package/.history/bin/commands/qItem/itemService_20221105174236.js +304 -0
- package/.history/bin/commands/qItem/itemService_20221105174311.js +304 -0
- package/.history/bin/commands/qItem/itemService_20221105174605.js +306 -0
- package/.history/bin/commands/qItem/itemService_20221105174809.js +309 -0
- package/.history/bin/commands/qItem/itemService_20221107071956.js +317 -0
- package/.history/bin/commands/qItem/itemService_20221107072130.js +310 -0
- package/.history/bin/commands/qItem/itemService_20221107072222.js +312 -0
- package/.history/bin/commands/qItem/itemService_20221107072621.js +316 -0
- package/.history/bin/commands/qItem/itemService_20221107072850.js +315 -0
- package/.history/bin/commands/qItem/itemService_20221107073051.js +315 -0
- package/.history/bin/commands/qItem/itemService_20221107073244.js +315 -0
- package/.history/bin/commands/qItem/itemService_20221107075352.js +323 -0
- package/.history/bin/commands/qItem/itemService_20221107075536.js +316 -0
- package/.history/bin/commands/qItem/itemService_20221107075700.js +312 -0
- package/.history/bin/commands/qItem/itemService_20221107111951.js +312 -0
- package/.history/bin/commands/qItem/itemService_20221107113745.js +310 -0
- package/.history/bin/commands/qItem/itemService_20221107113901.js +310 -0
- package/.history/bin/commands/qItem/updateItem/updateItem_20220627113036.js +64 -0
- package/.history/bin/commands/qItem/updateItem/updateItem_20221105173137.js +66 -0
- package/.history/bin/commands/qItem/updateItem/updateItem_20221105173239.js +68 -0
- package/.history/bin/commands/qItem/updateItem/updateItem_20221105173610.js +69 -0
- package/.history/bin/commands/qItem/updateItem/updateItem_20221105173646.js +74 -0
- package/.history/bin/commands/qItem/updateItem/updateItem_20221105174010.js +74 -0
- package/.history/bin/commands/qItem/updateItem/updateItem_20221105174054.js +75 -0
- package/.history/package_20220808135115.json +43 -0
- package/.history/package_20221105171707.json +43 -0
- package/.history/package_20221105173355.json +43 -0
- package/.history/package_20221107112303.json +43 -0
- package/bin/commands/qItem/itemService.js +12 -4
- package/package.json +2 -2
- package/skeletons/custom-code-skeleton/package.json +2 -1
- package/skeletons/custom-code-skeleton/rollup.config.js +2 -0
@@ -0,0 +1,74 @@
|
|
1
|
+
const schemaService = require("./../schemaService.js");
|
2
|
+
const configStore = require("./../configStore.js");
|
3
|
+
const itemService = require("./../itemService.js");
|
4
|
+
const fs = require("fs");
|
5
|
+
const path = require("path");
|
6
|
+
const chalk = require("chalk");
|
7
|
+
const errorColor = chalk.red;
|
8
|
+
const successColor = chalk.green;
|
9
|
+
|
10
|
+
module.exports = async function (command) {
|
11
|
+
try {
|
12
|
+
const qConfigPath = path.resolve(command.config);
|
13
|
+
if (fs.existsSync(qConfigPath)) {
|
14
|
+
const qConfig = JSON.parse(fs.readFileSync(qConfigPath));
|
15
|
+
console.log("----------------")
|
16
|
+
console.log(JSON.stringify(qConfig))
|
17
|
+
const validationResult = schemaService.validateConfig(qConfig);
|
18
|
+
console.log(validationResult)
|
19
|
+
|
20
|
+
console.log("----------------")
|
21
|
+
if (validationResult.isValid) {
|
22
|
+
const config = await configStore.setupStore(
|
23
|
+
qConfig,
|
24
|
+
command.environment,
|
25
|
+
command.reset
|
26
|
+
);
|
27
|
+
|
28
|
+
for (const item of itemService.getItems(qConfig, command.environment)) {
|
29
|
+
for (const environment of item.environments) {
|
30
|
+
const result = await itemService.updateItem(
|
31
|
+
item.item,
|
32
|
+
environment,
|
33
|
+
config,
|
34
|
+
qConfigPath
|
35
|
+
);
|
36
|
+
|
37
|
+
if (result) {
|
38
|
+
console.log(
|
39
|
+
successColor(
|
40
|
+
`--------------------`
|
41
|
+
)
|
42
|
+
);
|
43
|
+
|
44
|
+
console.log(
|
45
|
+
successColor(
|
46
|
+
`Successfully updated item with id ${environment.id} on ${environment.name} environment`
|
47
|
+
)
|
48
|
+
);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
} else {
|
53
|
+
console.error(
|
54
|
+
errorColor(
|
55
|
+
`A problem occured while validating the config file: ${validationResult.errorsText}`
|
56
|
+
)
|
57
|
+
);
|
58
|
+
process.exit(1);
|
59
|
+
}
|
60
|
+
} else {
|
61
|
+
console.error(
|
62
|
+
errorColor(
|
63
|
+
"Couldn't find config file named q.config.json in the current directory. Create a config file in the current directory or pass the path to the config file with the option -c <path>"
|
64
|
+
)
|
65
|
+
);
|
66
|
+
}
|
67
|
+
} catch (error) {
|
68
|
+
console.error(
|
69
|
+
errorColor(
|
70
|
+
`A problem occured while parsing the config file at ${command.config}. Please make sure it is valid JSON.`
|
71
|
+
)
|
72
|
+
);
|
73
|
+
}
|
74
|
+
};
|
@@ -0,0 +1,75 @@
|
|
1
|
+
const schemaService = require("./../schemaService.js");
|
2
|
+
const configStore = require("./../configStore.js");
|
3
|
+
const itemService = require("./../itemService.js");
|
4
|
+
const fs = require("fs");
|
5
|
+
const path = require("path");
|
6
|
+
const chalk = require("chalk");
|
7
|
+
const errorColor = chalk.red;
|
8
|
+
const successColor = chalk.green;
|
9
|
+
|
10
|
+
module.exports = async function (command) {
|
11
|
+
try {
|
12
|
+
const qConfigPath = path.resolve(command.config);
|
13
|
+
if (fs.existsSync(qConfigPath)) {
|
14
|
+
const qConfig = JSON.parse(fs.readFileSync(qConfigPath));
|
15
|
+
console.log("----------------")
|
16
|
+
console.log(JSON.stringify(qConfig))
|
17
|
+
const validationResult = schemaService.validateConfig(qConfig);
|
18
|
+
console.log(validationResult)
|
19
|
+
|
20
|
+
console.log("----------------")
|
21
|
+
if (validationResult.isValid) {
|
22
|
+
const config = await configStore.setupStore(
|
23
|
+
qConfig,
|
24
|
+
command.environment,
|
25
|
+
command.reset
|
26
|
+
);
|
27
|
+
|
28
|
+
for (const item of itemService.getItems(qConfig, command.environment)) {
|
29
|
+
for (const environment of item.environments) {
|
30
|
+
const result = await itemService.updateItem(
|
31
|
+
item.item,
|
32
|
+
environment,
|
33
|
+
config,
|
34
|
+
qConfigPath
|
35
|
+
);
|
36
|
+
console.log(JSON.stringify(result))
|
37
|
+
|
38
|
+
if (result) {
|
39
|
+
console.log(
|
40
|
+
successColor(
|
41
|
+
`--------------------`
|
42
|
+
)
|
43
|
+
);
|
44
|
+
|
45
|
+
console.log(
|
46
|
+
successColor(
|
47
|
+
`Successfully updated item with id ${environment.id} on ${environment.name} environment`
|
48
|
+
)
|
49
|
+
);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
} else {
|
54
|
+
console.error(
|
55
|
+
errorColor(
|
56
|
+
`A problem occured while validating the config file: ${validationResult.errorsText}`
|
57
|
+
)
|
58
|
+
);
|
59
|
+
process.exit(1);
|
60
|
+
}
|
61
|
+
} else {
|
62
|
+
console.error(
|
63
|
+
errorColor(
|
64
|
+
"Couldn't find config file named q.config.json in the current directory. Create a config file in the current directory or pass the path to the config file with the option -c <path>"
|
65
|
+
)
|
66
|
+
);
|
67
|
+
}
|
68
|
+
} catch (error) {
|
69
|
+
console.error(
|
70
|
+
errorColor(
|
71
|
+
`A problem occured while parsing the config file at ${command.config}. Please make sure it is valid JSON.`
|
72
|
+
)
|
73
|
+
);
|
74
|
+
}
|
75
|
+
};
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
"name": "@nzz/q-cli",
|
3
|
+
"version": "1.9.0",
|
4
|
+
"description": "Cli tool to setup new Q tools, new Q server implementations and start Q dev server to test developing Q tools",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8
|
+
},
|
9
|
+
"repository": {
|
10
|
+
"type": "git",
|
11
|
+
"url": "git+https://github.com/nzzdev/Q-cli.git"
|
12
|
+
},
|
13
|
+
"bin": {
|
14
|
+
"Q": "bin/q.js"
|
15
|
+
},
|
16
|
+
"author": "",
|
17
|
+
"license": "MIT",
|
18
|
+
"bugs": {
|
19
|
+
"url": "https://github.com/nzzdev/Q-cli/issues"
|
20
|
+
},
|
21
|
+
"homepage": "https://github.com/nzzdev/Q-cli#readme",
|
22
|
+
"dependencies": {
|
23
|
+
"@hapi/boom": "^9.1.1",
|
24
|
+
"@hapi/hapi": "^20.1.3",
|
25
|
+
"@hapi/inert": "^6.0.3",
|
26
|
+
"@hapi/mimos": "^5.0.0",
|
27
|
+
"@hapi/vision": "^6.1.0",
|
28
|
+
"@hapi/wreck": "^17.1.0",
|
29
|
+
"ajv": "^6.12.6",
|
30
|
+
"chalk": "^4.1.1",
|
31
|
+
"commander": "^5.1.0",
|
32
|
+
"configstore": "^5.0.1",
|
33
|
+
"deepmerge": "^4.2.2",
|
34
|
+
"form-data": "^3.0.0",
|
35
|
+
"fs-extra": "^9.0.1",
|
36
|
+
"image-size": "^0.8.3",
|
37
|
+
"joi": "^17.4.0",
|
38
|
+
"node-fetch": "^2.6.1",
|
39
|
+
"nunjucks": "^3.2.2",
|
40
|
+
"promptly": "^3.2.0",
|
41
|
+
"replace-in-file": "^3.4.4"
|
42
|
+
}
|
43
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
"name": "@nzz/q-cli",
|
3
|
+
"version": "1.9.1",
|
4
|
+
"description": "Cli tool to setup new Q tools, new Q server implementations and start Q dev server to test developing Q tools",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8
|
+
},
|
9
|
+
"repository": {
|
10
|
+
"type": "git",
|
11
|
+
"url": "git+https://github.com/nzzdev/Q-cli.git"
|
12
|
+
},
|
13
|
+
"bin": {
|
14
|
+
"Q": "bin/q.js"
|
15
|
+
},
|
16
|
+
"author": "",
|
17
|
+
"license": "MIT",
|
18
|
+
"bugs": {
|
19
|
+
"url": "https://github.com/nzzdev/Q-cli/issues"
|
20
|
+
},
|
21
|
+
"homepage": "https://github.com/nzzdev/Q-cli#readme",
|
22
|
+
"dependencies": {
|
23
|
+
"@hapi/boom": "^9.1.1",
|
24
|
+
"@hapi/hapi": "^20.1.3",
|
25
|
+
"@hapi/inert": "^6.0.3",
|
26
|
+
"@hapi/mimos": "^5.0.0",
|
27
|
+
"@hapi/vision": "^6.1.0",
|
28
|
+
"@hapi/wreck": "^17.1.0",
|
29
|
+
"ajv": "^6.12.6",
|
30
|
+
"chalk": "^4.1.1",
|
31
|
+
"commander": "^5.1.0",
|
32
|
+
"configstore": "^5.0.1",
|
33
|
+
"deepmerge": "^4.2.2",
|
34
|
+
"form-data": "^3.0.0",
|
35
|
+
"fs-extra": "^9.0.1",
|
36
|
+
"image-size": "^0.8.3",
|
37
|
+
"joi": "^17.4.0",
|
38
|
+
"node-fetch": "^2.6.1",
|
39
|
+
"nunjucks": "^3.2.2",
|
40
|
+
"promptly": "^3.2.0",
|
41
|
+
"replace-in-file": "^3.4.4"
|
42
|
+
}
|
43
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
"name": "@nzz/q-cli",
|
3
|
+
"version": "333.9.1",
|
4
|
+
"description": "Cli tool to setup new Q tools, new Q server implementations and start Q dev server to test developing Q tools",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8
|
+
},
|
9
|
+
"repository": {
|
10
|
+
"type": "git",
|
11
|
+
"url": "git+https://github.com/nzzdev/Q-cli.git"
|
12
|
+
},
|
13
|
+
"bin": {
|
14
|
+
"Q": "bin/q.js"
|
15
|
+
},
|
16
|
+
"author": "",
|
17
|
+
"license": "MIT",
|
18
|
+
"bugs": {
|
19
|
+
"url": "https://github.com/nzzdev/Q-cli/issues"
|
20
|
+
},
|
21
|
+
"homepage": "https://github.com/nzzdev/Q-cli#readme",
|
22
|
+
"dependencies": {
|
23
|
+
"@hapi/boom": "^9.1.1",
|
24
|
+
"@hapi/hapi": "^20.1.3",
|
25
|
+
"@hapi/inert": "^6.0.3",
|
26
|
+
"@hapi/mimos": "^5.0.0",
|
27
|
+
"@hapi/vision": "^6.1.0",
|
28
|
+
"@hapi/wreck": "^17.1.0",
|
29
|
+
"ajv": "^6.12.6",
|
30
|
+
"chalk": "^4.1.1",
|
31
|
+
"commander": "^5.1.0",
|
32
|
+
"configstore": "^5.0.1",
|
33
|
+
"deepmerge": "^4.2.2",
|
34
|
+
"form-data": "^3.0.0",
|
35
|
+
"fs-extra": "^9.0.1",
|
36
|
+
"image-size": "^0.8.3",
|
37
|
+
"joi": "^17.4.0",
|
38
|
+
"node-fetch": "^2.6.1",
|
39
|
+
"nunjucks": "^3.2.2",
|
40
|
+
"promptly": "^3.2.0",
|
41
|
+
"replace-in-file": "^3.4.4"
|
42
|
+
}
|
43
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
"name": "@nzz/q-cli",
|
3
|
+
"version": "1.9.2",
|
4
|
+
"description": "Cli tool to setup new Q tools, new Q server implementations and start Q dev server to test developing Q tools",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8
|
+
},
|
9
|
+
"repository": {
|
10
|
+
"type": "git",
|
11
|
+
"url": "git+https://github.com/nzzdev/Q-cli.git"
|
12
|
+
},
|
13
|
+
"bin": {
|
14
|
+
"Q": "bin/q.js"
|
15
|
+
},
|
16
|
+
"author": "",
|
17
|
+
"license": "MIT",
|
18
|
+
"bugs": {
|
19
|
+
"url": "https://github.com/nzzdev/Q-cli/issues"
|
20
|
+
},
|
21
|
+
"homepage": "https://github.com/nzzdev/Q-cli#readme",
|
22
|
+
"dependencies": {
|
23
|
+
"@hapi/boom": "^9.1.1",
|
24
|
+
"@hapi/hapi": "^20.1.3",
|
25
|
+
"@hapi/inert": "^6.0.3",
|
26
|
+
"@hapi/mimos": "^5.0.0",
|
27
|
+
"@hapi/vision": "^6.1.0",
|
28
|
+
"@hapi/wreck": "^17.1.0",
|
29
|
+
"ajv": "^6.12.6",
|
30
|
+
"chalk": "^4.1.1",
|
31
|
+
"commander": "^5.1.0",
|
32
|
+
"configstore": "^5.0.1",
|
33
|
+
"deepmerge": "^4.2.2",
|
34
|
+
"form-data": "^3.0.0",
|
35
|
+
"fs-extra": "^9.0.1",
|
36
|
+
"image-size": "^0.8.3",
|
37
|
+
"joi": "^17.4.0",
|
38
|
+
"node-fetch": "^2.6.1",
|
39
|
+
"nunjucks": "^3.2.2",
|
40
|
+
"promptly": "^3.2.0",
|
41
|
+
"replace-in-file": "^3.4.4"
|
42
|
+
}
|
43
|
+
}
|
@@ -194,10 +194,18 @@ async function getUpdatedItem(
|
|
194
194
|
const toolSchema = await schemaService.getToolSchema(
|
195
195
|
qServer,
|
196
196
|
existingItem.tool
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
197
|
+
);
|
198
|
+
// Removes additional properties not defined in the schema on the top level object of the item
|
199
|
+
toolSchema.additionalProperties = false;
|
200
|
+
|
201
|
+
if(existingItem.customSchema) {
|
202
|
+
toolSchema.properties = {...toolSchema.properties, ...existingItem.customSchema}
|
203
|
+
}
|
204
|
+
|
205
|
+
if(existingItem.customSchemaDefinitions) {
|
206
|
+
toolSchema.definitions = {...toolSchema.definitions, ...existingItem.customSchemaDefinitions}
|
207
|
+
}
|
208
|
+
// If options object is available additional properties not defined in the schema are removed
|
201
209
|
if (toolSchema.properties && toolSchema.properties.options) {
|
202
210
|
toolSchema.properties.options.additionalProperties = false;
|
203
211
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nzz/q-cli",
|
3
|
-
"version": "1.9.
|
3
|
+
"version": "1.9.2",
|
4
4
|
"description": "Cli tool to setup new Q tools, new Q server implementations and start Q dev server to test developing Q tools",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
@@ -40,4 +40,4 @@
|
|
40
40
|
"promptly": "^3.2.0",
|
41
41
|
"replace-in-file": "^3.4.4"
|
42
42
|
}
|
43
|
-
}
|
43
|
+
}
|
@@ -24,6 +24,7 @@
|
|
24
24
|
"sass": "^1.43.4",
|
25
25
|
"sirv-cli": "^1.0.12",
|
26
26
|
"svelte": "^3.43.1",
|
27
|
+
"svelte-preprocess": "^4.10.7",
|
27
28
|
"typescript": "^4.6.4"
|
28
29
|
},
|
29
30
|
"scripts": {
|
@@ -39,4 +40,4 @@
|
|
39
40
|
"rollup": "rollup -c -w",
|
40
41
|
"serve": "sirv public --dev --port 5555 --host 0.0.0.0"
|
41
42
|
}
|
42
|
-
}
|
43
|
+
}
|
@@ -15,6 +15,7 @@ import qConfig from "./q.config.json";
|
|
15
15
|
import typescript from '@rollup/plugin-typescript';
|
16
16
|
import image from '@rollup/plugin-image';
|
17
17
|
import alias from '@rollup/plugin-alias';
|
18
|
+
import sveltePreprocess from 'svelte-preprocess';
|
18
19
|
import { createContentWidthQElement, createFullwidthQElement, getHtml, createSubtitle, createParagraph } from '@nzz/nzz.ch-static';
|
19
20
|
|
20
21
|
// Which nzz layout to use?
|
@@ -144,6 +145,7 @@ export default {
|
|
144
145
|
json(),
|
145
146
|
image(),
|
146
147
|
svelte({
|
148
|
+
preprocess: sveltePreprocess(),
|
147
149
|
compilerOptions: {
|
148
150
|
// enable run-time checks when not in production
|
149
151
|
dev: !production,
|