@nzz/q-cli 1.9.1 → 1.9.3
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/commands/qItem/itemService.js +12 -4
- package/package.json +10 -6
- package/skeletons/custom-code-skeleton/package.json +4 -2
- package/skeletons/custom-code-skeleton/rollup.config.js +59 -52
- package/skeletons/custom-code-skeleton/src/enums.ts +0 -0
- package/skeletons/custom-code-skeleton/src/main-prod.ts +2 -2
- package/skeletons/custom-code-skeleton/src/main.scss +1 -1
- package/skeletons/custom-code-skeleton/src/main.ts +6 -6
- package/skeletons/custom-code-skeleton/tsconfig.json +2 -1
@@ -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,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nzz/q-cli",
|
3
|
-
"version": "1.9.
|
3
|
+
"version": "1.9.3",
|
4
|
+
"prettier": "@nzz/et-utils-config-prettier",
|
4
5
|
"description": "Cli tool to setup new Q tools, new Q server implementations and start Q dev server to test developing Q tools",
|
5
6
|
"main": "index.js",
|
6
7
|
"scripts": {
|
@@ -21,7 +22,7 @@
|
|
21
22
|
"homepage": "https://github.com/nzzdev/Q-cli#readme",
|
22
23
|
"dependencies": {
|
23
24
|
"@hapi/boom": "^9.1.1",
|
24
|
-
"@hapi/hapi": "^20.
|
25
|
+
"@hapi/hapi": "^20.3.0",
|
25
26
|
"@hapi/inert": "^6.0.3",
|
26
27
|
"@hapi/mimos": "^5.0.0",
|
27
28
|
"@hapi/vision": "^6.1.0",
|
@@ -30,14 +31,17 @@
|
|
30
31
|
"chalk": "^4.1.1",
|
31
32
|
"commander": "^5.1.0",
|
32
33
|
"configstore": "^5.0.1",
|
33
|
-
"deepmerge": "^4.
|
34
|
+
"deepmerge": "^4.3.1",
|
34
35
|
"form-data": "^3.0.0",
|
35
36
|
"fs-extra": "^9.0.1",
|
36
37
|
"image-size": "^0.8.3",
|
37
|
-
"joi": "^17.
|
38
|
-
"node-fetch": "^2.6.
|
38
|
+
"joi": "^17.9.1",
|
39
|
+
"node-fetch": "^2.6.9",
|
39
40
|
"nunjucks": "^3.2.2",
|
40
41
|
"promptly": "^3.2.0",
|
41
42
|
"replace-in-file": "^3.4.4"
|
43
|
+
},
|
44
|
+
"devDependencies": {
|
45
|
+
"@nzz/et-utils-config-prettier": "^1.0.6"
|
42
46
|
}
|
43
|
-
}
|
47
|
+
}
|
@@ -1,7 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "custom-code-skeleton",
|
3
3
|
"version": "1.0.0",
|
4
|
+
"prettier": "@nzz/et-utils-config-prettier",
|
4
5
|
"devDependencies": {
|
6
|
+
"@nzz/et-utils-config-prettier": "^1.0.6",
|
5
7
|
"@nzz/nzz.ch-static": "github:nzzdev/ed-tech-nzz.ch-static#v1.0.0",
|
6
8
|
"@nzz/q-cli": "^1.4.11",
|
7
9
|
"@rollup/plugin-alias": "^3.1.9",
|
@@ -23,7 +25,7 @@
|
|
23
25
|
"rollup-plugin-terser": "^7.0.2",
|
24
26
|
"sass": "^1.43.4",
|
25
27
|
"sirv-cli": "^1.0.12",
|
26
|
-
"svelte": "^3.
|
28
|
+
"svelte": "^3.57.0",
|
27
29
|
"svelte-preprocess": "^4.10.7",
|
28
30
|
"typescript": "^4.6.4"
|
29
31
|
},
|
@@ -40,4 +42,4 @@
|
|
40
42
|
"rollup": "rollup -c -w",
|
41
43
|
"serve": "sirv public --dev --port 5555 --host 0.0.0.0"
|
42
44
|
}
|
43
|
-
}
|
45
|
+
}
|
@@ -1,22 +1,28 @@
|
|
1
|
-
import * as fs from
|
2
|
-
import * as path from
|
3
|
-
import nodeResolve from
|
4
|
-
import commonjs from
|
5
|
-
import json from
|
6
|
-
import html from
|
7
|
-
import svelte from
|
8
|
-
import { terser } from
|
9
|
-
import livereload from
|
10
|
-
import scss from
|
11
|
-
import postcss from
|
12
|
-
import cssnano from
|
13
|
-
import autoprefixer from
|
14
|
-
import qConfig from
|
1
|
+
import * as fs from 'fs';
|
2
|
+
import * as path from 'path';
|
3
|
+
import nodeResolve from '@rollup/plugin-node-resolve';
|
4
|
+
import commonjs from '@rollup/plugin-commonjs';
|
5
|
+
import json from '@rollup/plugin-json';
|
6
|
+
import html from '@rollup/plugin-html';
|
7
|
+
import svelte from 'rollup-plugin-svelte';
|
8
|
+
import { terser } from 'rollup-plugin-terser';
|
9
|
+
import livereload from 'rollup-plugin-livereload';
|
10
|
+
import scss from 'rollup-plugin-scss';
|
11
|
+
import postcss from 'postcss';
|
12
|
+
import cssnano from 'cssnano';
|
13
|
+
import autoprefixer from 'autoprefixer';
|
14
|
+
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
18
|
import sveltePreprocess from 'svelte-preprocess';
|
19
|
-
import {
|
19
|
+
import {
|
20
|
+
createContentWidthQElement,
|
21
|
+
createFullwidthQElement,
|
22
|
+
getHtml,
|
23
|
+
createSubtitle,
|
24
|
+
createParagraph,
|
25
|
+
} from '@nzz/nzz.ch-static';
|
20
26
|
|
21
27
|
// Which nzz layout to use?
|
22
28
|
const LAYOUT = process.env.LAYOUT;
|
@@ -29,10 +35,10 @@ function getOutputConfigs() {
|
|
29
35
|
const outputConfigs = [];
|
30
36
|
for (let item of qConfig.items) {
|
31
37
|
for (let environment of item.environments) {
|
32
|
-
if (environment.id !==
|
38
|
+
if (environment.id !== '') {
|
33
39
|
outputConfigs.push({
|
34
40
|
sourcemap: production ? false : true,
|
35
|
-
format:
|
41
|
+
format: 'iife',
|
36
42
|
name: `window._q_custom_code_${environment.id}.App`,
|
37
43
|
file: `public/bundle-${environment.id}.js`,
|
38
44
|
});
|
@@ -45,40 +51,40 @@ function getOutputConfigs() {
|
|
45
51
|
|
46
52
|
function getHtmlOptions() {
|
47
53
|
return {
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
fileName: 'index.html',
|
55
|
+
template: function (options) {
|
56
|
+
return getHtml({
|
57
|
+
// These 3 options are the most important. Without them the static website will not function.
|
58
|
+
layout: LAYOUT, // Type of layout.
|
59
|
+
builtCssFilename, // Will be appended at the end of <head>.
|
60
|
+
builtJsFilename: options.files.js[0].fileName, // Will appended to the end of <body>.
|
61
|
+
|
62
|
+
// Create mock elements to simulate your article.
|
63
|
+
content: `
|
58
64
|
${createSubtitle('Test Subtitle')}
|
59
65
|
${createParagraph('Test paragraph')}
|
60
66
|
${createFullwidthQElement('custom-code-fw')}
|
61
67
|
${createContentWidthQElement('custom-code-cw')}
|
62
68
|
`,
|
63
69
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
70
|
+
// Other options.
|
71
|
+
author: 'Max Musterman',
|
72
|
+
lead: 'Test lead.',
|
73
|
+
title: 'Test title',
|
74
|
+
|
75
|
+
// Links to other css files that need to be loaded.
|
76
|
+
// Will be appended to <head> but before the bundled css file of your app.
|
77
|
+
customCssLinks: [
|
78
|
+
'https://service.sophie.nzz.ch/bundle/sophie-q@^1,sophie-input@^1,sophie-font@^1,sophie-color@^1,sophie-viz-color@^1,sophie-legend@^1.css',
|
79
|
+
],
|
80
|
+
|
81
|
+
// Links to other js filed that need to be loaded.
|
82
|
+
// Will be appended at the end of the body, but before the built js file for the app.
|
83
|
+
customJsLinks: [
|
84
|
+
'https://cdn.polyfill.io/v2/polyfill.min.js?features=Map,URL,Promise,fetch,URLSearchParams,Array.prototype.find,Array.prototype.findIndex,Object.entries,Array.prototype.includes,CustomEvent,Array.from,String.prototype.startsWith&flags=gated&unknown=polyfill',
|
85
|
+
],
|
86
|
+
});
|
87
|
+
},
|
82
88
|
};
|
83
89
|
}
|
84
90
|
|
@@ -94,7 +100,7 @@ function getPostcssPlugins(isProduction) {
|
|
94
100
|
|
95
101
|
function createOutputCssFunction() {
|
96
102
|
const outputCssFunction = (styles, styleNodes) => {
|
97
|
-
const publicDir =
|
103
|
+
const publicDir = 'public';
|
98
104
|
|
99
105
|
if (!fs.existsSync(publicDir)) {
|
100
106
|
fs.mkdirSync(publicDir);
|
@@ -108,14 +114,14 @@ function createOutputCssFunction() {
|
|
108
114
|
|
109
115
|
function getSassConfig(isProduction) {
|
110
116
|
const config = {
|
111
|
-
outputStyle: isProduction ?
|
117
|
+
outputStyle: isProduction ? 'compressed' : 'expanded',
|
112
118
|
// Sourcemap generation (specifically writing the file to system) is currently not supported by rollup-plugin-sass (but soon!)
|
113
119
|
// See: https://github.com/thgh/rollup-plugin-scss/issues/7
|
114
120
|
// outFile: path.join(__dirname, "/public/default.css"), // <- Uncomment after: https://github.com/thgh/rollup-plugin-scss/issues/7
|
115
121
|
sourceMap: !isProduction,
|
116
122
|
sourceMapEmbed: !isProduction, // Remove after: https://github.com/thgh/rollup-plugin-scss/issues/7
|
117
123
|
failOnError: !isProduction,
|
118
|
-
watch: [path.join(__dirname,
|
124
|
+
watch: [path.join(__dirname, '/src')],
|
119
125
|
processor: (css) =>
|
120
126
|
postcss(getPostcssPlugins(isProduction))
|
121
127
|
.process(css, {
|
@@ -131,14 +137,15 @@ function getSassConfig(isProduction) {
|
|
131
137
|
}
|
132
138
|
|
133
139
|
export default {
|
134
|
-
input: production ?
|
140
|
+
input: production ? 'src/main-prod.ts' : 'src/main.ts',
|
135
141
|
output: getOutputConfigs(),
|
136
142
|
plugins: [
|
137
143
|
alias({
|
138
144
|
entries: [
|
139
145
|
{ find: '@src', replacement: path.resolve(projectRootDir, 'src') },
|
140
146
|
{ find: '@interfaces', replacement: path.resolve(projectRootDir, 'src/interfaces.ts') },
|
141
|
-
|
147
|
+
{ find: '@enums', replacement: path.resolve(projectRootDir, 'src/enums.ts') },
|
148
|
+
],
|
142
149
|
}),
|
143
150
|
|
144
151
|
typescript({ sourceMap: !production }),
|
@@ -171,14 +178,14 @@ export default {
|
|
171
178
|
|
172
179
|
// Watch the `public` directory and refresh the
|
173
180
|
// browser on changes when not in production
|
174
|
-
!production && livereload({ watch: [
|
181
|
+
!production && livereload({ watch: ['public'], delay: 800 }),
|
175
182
|
production && terser(),
|
176
183
|
],
|
177
184
|
watch: {
|
178
185
|
clearScreen: false,
|
179
186
|
},
|
180
187
|
onwarn: function (warning, warn) {
|
181
|
-
if (warning.code ===
|
188
|
+
if (warning.code === 'CIRCULAR_DEPENDENCY') return;
|
182
189
|
warn(warning);
|
183
190
|
},
|
184
191
|
};
|
File without changes
|
@@ -1 +1 @@
|
|
1
|
-
@use
|
1
|
+
@use 'App.scss';
|
@@ -1,17 +1,17 @@
|
|
1
|
-
import App from
|
2
|
-
import
|
1
|
+
import App from './App.svelte';
|
2
|
+
import './main.scss';
|
3
3
|
|
4
4
|
const app = new App({
|
5
|
-
target: document.querySelector(
|
5
|
+
target: document.querySelector('#custom-code-fw'),
|
6
6
|
props: {
|
7
|
-
name:
|
7
|
+
name: 'custom-code-skeleton - Fullwidth',
|
8
8
|
},
|
9
9
|
});
|
10
10
|
|
11
11
|
new App({
|
12
|
-
target: document.querySelector(
|
12
|
+
target: document.querySelector('#custom-code-cw'),
|
13
13
|
props: {
|
14
|
-
name:
|
14
|
+
name: 'custom-code-skeleton - Content Width',
|
15
15
|
},
|
16
16
|
});
|
17
17
|
|