@nzz/q-cli 1.5.4 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- package/.vscode/settings.json +5 -0
- package/README.md +16 -1
- package/bin/commands/bootstrap.js +6 -0
- package/dev-server/routes/rendering-info.js +0 -1
- package/dev-server/routes/tool-default.js +0 -2
- package/package.json +1 -1
- package/skeletons/custom-code-skeleton/.nvmrc +1 -1
- package/skeletons/custom-code-skeleton/.vscode/settings.json +5 -0
- package/skeletons/custom-code-skeleton/package-lock.json +5335 -627
- package/skeletons/custom-code-skeleton/package.json +10 -7
- package/skeletons/custom-code-skeleton/rollup.config.js +63 -17
- package/skeletons/custom-code-skeleton/src/App.scss +3 -0
- package/skeletons/custom-code-skeleton/src/App.svelte +1 -7
- package/skeletons/custom-code-skeleton/src/main-prod.js +1 -0
- package/skeletons/custom-code-skeleton/src/main.js +1 -0
- package/skeletons/custom-code-skeleton/src/main.scss +1 -0
- package/skeletons/server-skeleton/auth/routes.js +0 -9
- package/skeletons/server-skeleton/index.js +1 -3
- package/skeletons/tool-skeleton/.nvmrc +1 -1
- package/skeletons/tool-skeleton/.travis.yml +26 -0
- package/skeletons/tool-skeleton/.vscode/settings.json +5 -0
- package/skeletons/tool-skeleton/Dockerfile +1 -1
- package/skeletons/tool-skeleton/LICENSE +20 -0
- package/skeletons/tool-skeleton/README.md +1 -1
- package/skeletons/tool-skeleton/index.js +1 -6
- package/skeletons/tool-skeleton/package-lock.json +8540 -2741
- package/skeletons/tool-skeleton/package.json +24 -12
- package/skeletons/tool-skeleton/rollup.config.js +75 -0
- package/skeletons/tool-skeleton/routes/fixtures/data.js +1 -3
- package/skeletons/tool-skeleton/routes/rendering-info/web.js +43 -20
- package/skeletons/tool-skeleton/routes/routes.js +1 -1
- package/skeletons/tool-skeleton/routes/script.js +4 -5
- package/skeletons/tool-skeleton/routes/stylesheet.js +4 -5
- package/skeletons/tool-skeleton/sass.config.js +66 -0
- package/skeletons/tool-skeleton/scripts_src/default.js +3 -0
- package/skeletons/tool-skeleton/styles_src/_variables.scss +1 -0
- package/skeletons/tool-skeleton/styles_src/main.scss +2 -0
- package/skeletons/tool-skeleton/test/e2e-tests.js +4 -6
- package/skeletons/tool-skeleton/views/dynamic/YourTool.scss +5 -0
- package/skeletons/tool-skeleton/views/dynamic/YourTool.svelte +19 -0
- package/skeletons/tool-skeleton/views/static/App.scss +5 -0
- package/skeletons/tool-skeleton/views/static/App.svelte +21 -0
- package/skeletons/tool-skeleton/views/static/components/Footer.svelte +31 -0
- package/skeletons/tool-skeleton/views/static/components/Header.svelte +7 -0
- package/skeletons/tool-skeleton/styles_src/default.scss +0 -4
- package/skeletons/tool-skeleton/tasks/build.js +0 -98
@@ -3,20 +3,23 @@
|
|
3
3
|
"version": "1.0.0",
|
4
4
|
"devDependencies": {
|
5
5
|
"@nzz/q-cli": "^1.4.11",
|
6
|
-
"@rollup/plugin-
|
7
|
-
"@rollup/plugin-
|
8
|
-
"@rollup/plugin-html": "^0.2.3",
|
6
|
+
"@rollup/plugin-commonjs": "^21.0.0",
|
7
|
+
"@rollup/plugin-html": "^0.2.4",
|
9
8
|
"@rollup/plugin-json": "^4.1.0",
|
10
|
-
"@rollup/plugin-node-resolve": "^
|
9
|
+
"@rollup/plugin-node-resolve": "^13.0.5",
|
10
|
+
"autoprefixer": "^10.4.0",
|
11
|
+
"cssnano": "^5.0.10",
|
11
12
|
"npm-run-all": "^4.1.5",
|
13
|
+
"postcss": "^8.3.11",
|
12
14
|
"rollup": "^2.50.1",
|
13
|
-
"rollup-plugin-
|
14
|
-
"rollup-plugin-
|
15
|
+
"rollup-plugin-livereload": "^2.0.5",
|
16
|
+
"rollup-plugin-scss": "^3.0.0",
|
15
17
|
"rollup-plugin-svelte": "^7.1.0",
|
16
18
|
"rollup-plugin-svg": "^2.0.0",
|
17
19
|
"rollup-plugin-terser": "^7.0.2",
|
20
|
+
"sass": "^1.43.4",
|
18
21
|
"sirv-cli": "^1.0.12",
|
19
|
-
"svelte": "^3.
|
22
|
+
"svelte": "^3.43.1"
|
20
23
|
},
|
21
24
|
"scripts": {
|
22
25
|
"update-all": "npm run build && Q update-item",
|
@@ -1,13 +1,17 @@
|
|
1
|
-
import
|
1
|
+
import * as fs from "fs";
|
2
|
+
import * as path from "path";
|
3
|
+
import nodeResolve from "@rollup/plugin-node-resolve";
|
2
4
|
import commonjs from "@rollup/plugin-commonjs";
|
3
|
-
import buble from "@rollup/plugin-buble";
|
4
5
|
import json from "@rollup/plugin-json";
|
5
6
|
import svg from "rollup-plugin-svg";
|
6
7
|
import html from "@rollup/plugin-html";
|
7
8
|
import svelte from "rollup-plugin-svelte";
|
8
9
|
import { terser } from "rollup-plugin-terser";
|
9
|
-
import css from "rollup-plugin-css-only";
|
10
10
|
import livereload from "rollup-plugin-livereload";
|
11
|
+
import scss from "rollup-plugin-scss";
|
12
|
+
import postcss from "postcss";
|
13
|
+
import cssnano from "cssnano";
|
14
|
+
import autoprefixer from "autoprefixer";
|
11
15
|
import packageConfig from "./package.json";
|
12
16
|
import qConfig from "./q.config.json";
|
13
17
|
|
@@ -85,6 +89,54 @@ function getHtmlOptions() {
|
|
85
89
|
};
|
86
90
|
}
|
87
91
|
|
92
|
+
function getPostcssPlugins(isProduction) {
|
93
|
+
const postcssPlugins = [autoprefixer];
|
94
|
+
|
95
|
+
if (isProduction) {
|
96
|
+
postcssPlugins.push(cssnano);
|
97
|
+
}
|
98
|
+
|
99
|
+
return postcssPlugins;
|
100
|
+
}
|
101
|
+
|
102
|
+
function createOutputCssFunction() {
|
103
|
+
const outputCssFunction = (styles, styleNodes) => {
|
104
|
+
const publicDir = "public";
|
105
|
+
|
106
|
+
if (!fs.existsSync(publicDir)) {
|
107
|
+
fs.mkdirSync(publicDir);
|
108
|
+
}
|
109
|
+
|
110
|
+
fs.writeFileSync(`${publicDir}/bundle.css`, styles);
|
111
|
+
};
|
112
|
+
|
113
|
+
return outputCssFunction;
|
114
|
+
}
|
115
|
+
|
116
|
+
function getSassConfig(isProduction) {
|
117
|
+
const config = {
|
118
|
+
outputStyle: isProduction ? "compressed" : "expanded",
|
119
|
+
// Sourcemap generation (specifically writing the file to system) is currently not supported by rollup-plugin-sass (but soon!)
|
120
|
+
// See: https://github.com/thgh/rollup-plugin-scss/issues/7
|
121
|
+
// outFile: path.join(__dirname, "/public/default.css"), // <- Uncomment after: https://github.com/thgh/rollup-plugin-scss/issues/7
|
122
|
+
sourceMap: !isProduction,
|
123
|
+
sourceMapEmbed: !isProduction, // Remove after: https://github.com/thgh/rollup-plugin-scss/issues/7
|
124
|
+
failOnError: !isProduction,
|
125
|
+
watch: [path.join(__dirname, "/src")],
|
126
|
+
processor: (css) =>
|
127
|
+
postcss(getPostcssPlugins(isProduction))
|
128
|
+
.process(css, {
|
129
|
+
from: path.join(__dirname, "/public/bundle.css"),
|
130
|
+
to: path.join(__dirname, "/public/bundle.css"),
|
131
|
+
map: isProduction ? false : { inline: true }, // Set to false after: https://github.com/thgh/rollup-plugin-scss/issues/7
|
132
|
+
})
|
133
|
+
.then((result) => result.css),
|
134
|
+
output: createOutputCssFunction(),
|
135
|
+
};
|
136
|
+
|
137
|
+
return config;
|
138
|
+
}
|
139
|
+
|
88
140
|
export default {
|
89
141
|
input: production ? "src/main-prod.js" : "src/main.js",
|
90
142
|
output: getOutputConfigs(),
|
@@ -97,16 +149,19 @@ export default {
|
|
97
149
|
dev: !production,
|
98
150
|
},
|
99
151
|
}),
|
100
|
-
|
101
|
-
//
|
102
|
-
|
152
|
+
|
153
|
+
// All styles have to be written in .scss files (inside '/src')
|
154
|
+
// Sass files (except partials) have to be imported in main.scss file (Use '@use' instead of '@import')
|
155
|
+
// Partials are placed in '/src/styles' (e.g. _variables.scss, _helpers.scss)
|
156
|
+
// Partials are imported directly in other sass files (e.g. _variables.scss -> '@use "variables"')
|
157
|
+
scss({ ...getSassConfig(production) }),
|
103
158
|
|
104
159
|
// If you have external dependencies installed from
|
105
160
|
// npm, you'll most likely need these plugins. In
|
106
161
|
// some cases you'll need additional configuration —
|
107
162
|
// consult the documentation for details:
|
108
163
|
// https://github.com/rollup/rollup-plugin-commonjs
|
109
|
-
|
164
|
+
nodeResolve({ browser: true }),
|
110
165
|
commonjs(),
|
111
166
|
|
112
167
|
// Generate a index.html file when not building for production
|
@@ -114,16 +169,7 @@ export default {
|
|
114
169
|
|
115
170
|
// Watch the `public` directory and refresh the
|
116
171
|
// browser on changes when not in production
|
117
|
-
!production && livereload("public"),
|
118
|
-
|
119
|
-
// If we're building for production (npm run build
|
120
|
-
// instead of npm run dev), transpile and minify
|
121
|
-
production &&
|
122
|
-
buble({
|
123
|
-
transforms: {
|
124
|
-
dangerousForOf: true,
|
125
|
-
},
|
126
|
-
}),
|
172
|
+
!production && livereload({ watch: ["public"], delay: 800 }),
|
127
173
|
production && terser(),
|
128
174
|
],
|
129
175
|
watch: {
|
@@ -0,0 +1 @@
|
|
1
|
+
@use "App.scss";
|
@@ -12,9 +12,6 @@ module.exports = [
|
|
12
12
|
password: Joi.string().required(),
|
13
13
|
},
|
14
14
|
},
|
15
|
-
cors: {
|
16
|
-
credentials: true,
|
17
|
-
},
|
18
15
|
},
|
19
16
|
handler: async (request, h) => {
|
20
17
|
if (
|
@@ -33,9 +30,6 @@ module.exports = [
|
|
33
30
|
method: "GET",
|
34
31
|
config: {
|
35
32
|
auth: "q-auth",
|
36
|
-
cors: {
|
37
|
-
credentials: true,
|
38
|
-
},
|
39
33
|
},
|
40
34
|
handler: (request, h) => {
|
41
35
|
if (!request.auth.isAuthenticated) {
|
@@ -83,9 +77,6 @@ module.exports = [
|
|
83
77
|
allowUnknown: true,
|
84
78
|
},
|
85
79
|
},
|
86
|
-
cors: {
|
87
|
-
credentials: true,
|
88
|
-
},
|
89
80
|
},
|
90
81
|
handler: async (request, h) => {
|
91
82
|
return "ok";
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
16
|
@@ -0,0 +1,26 @@
|
|
1
|
+
dist: trusty
|
2
|
+
sudo: true
|
3
|
+
services:
|
4
|
+
- docker
|
5
|
+
language: node_js
|
6
|
+
node_js:
|
7
|
+
- "16"
|
8
|
+
cache:
|
9
|
+
directories:
|
10
|
+
- node_modules
|
11
|
+
install:
|
12
|
+
- npm install
|
13
|
+
before_script:
|
14
|
+
# TODO: Rename 'q-your-tool' to 'q-<tool-name>'
|
15
|
+
- DOCKER_IMAGE_NAME="q-your-tool"
|
16
|
+
- DOCKER_TAG=${TRAVIS_BRANCH//[^a-zA-Z0-9\_\-\.]/_}
|
17
|
+
script:
|
18
|
+
- npm run build
|
19
|
+
- npm run test
|
20
|
+
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then docker build -t $DOCKER_IMAGE_NAME:$DOCKER_TAG .; fi'
|
21
|
+
after_success:
|
22
|
+
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then echo $DOCKER_PASSWORD | docker login -u="$DOCKER_USERNAME" --password-stdin; docker tag $DOCKER_IMAGE_NAME:$DOCKER_TAG nzzonline/$DOCKER_IMAGE_NAME:$DOCKER_TAG; docker push nzzonline/$DOCKER_IMAGE_NAME:$DOCKER_TAG; fi'
|
23
|
+
# TODO: Create token for slack notifications with the slack bot, then insert below & uncomment lines
|
24
|
+
# notifications:
|
25
|
+
# slack:
|
26
|
+
# secure: <Slack-Token>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 NZZ
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,12 +1,7 @@
|
|
1
1
|
const Hapi = require("@hapi/hapi");
|
2
2
|
const Joi = require("joi");
|
3
3
|
|
4
|
-
const server = Hapi.server({
|
5
|
-
port: process.env.PORT || 3000,
|
6
|
-
routes: {
|
7
|
-
cors: true,
|
8
|
-
},
|
9
|
-
});
|
4
|
+
const server = Hapi.server({ port: process.env.PORT || 3000 });
|
10
5
|
server.validator(Joi);
|
11
6
|
|
12
7
|
const routes = require("./routes/routes.js");
|