@nutin/cli 1.2.1 → 1.2.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/CHANGELOG.md +12 -4
- package/README.md +4 -2
- package/lib/src/file-generator.mjs +1 -1
- package/lib/src/package-manager.mjs +4 -4
- package/lib/src/prompts.mjs +1 -1
- package/package.json +1 -1
- package/templates/base/tools/builder/builder.js.hbs +2 -0
- package/templates/base/tools/builder/core/esbuild.js.hbs +0 -1
- package/templates/base/tools/deployment/nginx.conf.hbs +59 -38
- package/templates/base/tools/dev/dev-serve.js.hbs +1 -1
- package/templates/base/tools/utils/index.js.hbs +1 -1
- package/templates/features/stylinNutin/src/styles/components/_index.scss.hbs +3 -0
- package/templates/features/i18n/src/app/languages.js.hbs +0 -10
- package/templates/features/i18n/src/app/languages.ts.hbs +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## V1.2.3
|
|
4
|
+
|
|
5
|
+
- `nginx.conf` : fixed multi-line CSP map warning (single line map)
|
|
6
|
+
|
|
7
|
+
## V1.2.2
|
|
8
|
+
|
|
9
|
+
- Fixed Nginx security headers in child location blocks.
|
|
10
|
+
|
|
11
|
+
- Fixed package manager variable in `dev-serve.js.hbs` runCommand
|
|
12
|
+
|
|
13
|
+
- Removed ghost files
|
|
14
|
+
|
|
3
15
|
## V1.2.1
|
|
4
16
|
|
|
5
17
|
- Builder
|
|
@@ -24,8 +36,6 @@
|
|
|
24
36
|
- Moved Dockerfile and deployment config files (`nginx.conf`, `gzip.conf`) into their own folder `tools/deployment`.
|
|
25
37
|
- Added `docker:build` and `docker:run` scripts in package.json.
|
|
26
38
|
|
|
27
|
-
See [DEPLOYMENT.md file](../../docs/DEPLOYMENT_HELPERS.md) for details.
|
|
28
|
-
|
|
29
39
|
- Moved dev tools (`serve.js`, `dev-serve.js`, `watcher.js`) into their own `tools/dev` folder.
|
|
30
40
|
|
|
31
41
|
- Added explicit chokidar devDependency (sass & live-server transitive).
|
|
@@ -58,8 +68,6 @@
|
|
|
58
68
|
|
|
59
69
|
- Improved deployment tools Dockerfile (nginx conf + gzip)
|
|
60
70
|
|
|
61
|
-
See [DEPLOYMENT.md file](../../docs/DEPLOYMENT_HELPERS.md) for details.
|
|
62
|
-
|
|
63
71
|
- stylin-nutin (generator)
|
|
64
72
|
- When generating a component, prompts (boolean) to generate a `_component-name.scss` file in `styles/components` (forwarded by `stymes/components/_index.scss`).
|
|
65
73
|
|
package/README.md
CHANGED
|
@@ -48,5 +48,7 @@ nutin-new
|
|
|
48
48
|
|
|
49
49
|
## [First app tutorial](https://www.nutin.org/tutorial)
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
## 📄 Docs
|
|
52
|
+
|
|
53
|
+
- Docs on [website](https://www.nutin.org).
|
|
54
|
+
- Docs on [Project repository](https://github.com/LoisKOUNINEF/nutin/tree/main/docs).
|
|
@@ -42,9 +42,6 @@ function getScripts(answers) {
|
|
|
42
42
|
const { testinNutin, packageManager, projectName } = answers;
|
|
43
43
|
|
|
44
44
|
const baseScripts = {
|
|
45
|
-
"patch": `${packageManager} version patch -m 'CI/CD: Bump version to %s'`,
|
|
46
|
-
"minor": `${packageManager} version minor -m 'CI/CD: Bump version to %s'`,
|
|
47
|
-
"major": `${packageManager} version major -m 'CI/CD: Bump version to %s'`,
|
|
48
45
|
"build": "node tools/builder/builder.js",
|
|
49
46
|
"build:prod": "NODE_ENV=production node tools/builder/builder.js",
|
|
50
47
|
"serve:only": "node tools/dev/serve.js",
|
|
@@ -52,7 +49,10 @@ function getScripts(answers) {
|
|
|
52
49
|
"dev": "node tools/dev/dev-serve.js",
|
|
53
50
|
"generate": "node tools/generator/generator.js",
|
|
54
51
|
"docker:build": `docker build -t ${projectName} -f tools/deployment/Dockerfile .`,
|
|
55
|
-
"docker:run": `docker run -p 9090:9090 ${projectName}:latest
|
|
52
|
+
"docker:run": `docker run -p 9090:9090 --name ${projectName}-container ${projectName}:latest`,
|
|
53
|
+
"patch": `${packageManager} version patch -m 'CI/CD: Bump version to %s'`,
|
|
54
|
+
"minor": `${packageManager} version minor -m 'CI/CD: Bump version to %s'`,
|
|
55
|
+
"major": `${packageManager} version major -m 'CI/CD: Bump version to %s'`
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
const testinNutinScripts = {
|
package/lib/src/prompts.mjs
CHANGED
package/package.json
CHANGED
|
@@ -28,3 +28,5 @@ if (isProd) runScript(path.join(scriptsDir, 'esbuild.js'), 'Running esbuild...')
|
|
|
28
28
|
runScript(path.join(scriptsDir, 'finalize-build.js'), 'Finalizing build...')
|
|
29
29
|
|
|
30
30
|
print.boldSuccess(`\nBuild successful!\n`);
|
|
31
|
+
|
|
32
|
+
if (!isProd) print.boldInfo('For production, use build:prod.');
|
|
@@ -1,8 +1,36 @@
|
|
|
1
|
+
# ---------------------------
|
|
2
|
+
# HEADER VARIABLES (define outside server block)
|
|
3
|
+
# ---------------------------
|
|
4
|
+
map $uri $frame_options {
|
|
5
|
+
default "SAMEORIGIN";
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
map $uri $content_type_options {
|
|
9
|
+
default "nosniff";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
map $uri $xss_protection {
|
|
13
|
+
default "1; mode=block";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
map $uri $referrer_policy {
|
|
17
|
+
default "strict-origin-when-cross-origin";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
map $uri $permissions_policy {
|
|
21
|
+
default "geolocation=(), microphone=(), camera=()";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
map $uri $csp_policy {
|
|
25
|
+
default "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none';";
|
|
26
|
+
}
|
|
27
|
+
|
|
1
28
|
server {
|
|
2
29
|
# ---------------------------
|
|
3
30
|
# LISTEN PORTS
|
|
4
31
|
# ---------------------------
|
|
5
32
|
listen 9090;
|
|
33
|
+
listen 9091;
|
|
6
34
|
server_name _;
|
|
7
35
|
|
|
8
36
|
# ---------------------------
|
|
@@ -11,45 +39,22 @@ server {
|
|
|
11
39
|
root /usr/share/nginx/html;
|
|
12
40
|
index index.html;
|
|
13
41
|
|
|
42
|
+
# Hide nginx version
|
|
43
|
+
server_tokens off;
|
|
44
|
+
|
|
14
45
|
# SPA routing: serve index.html for unknown paths
|
|
15
46
|
location / {
|
|
16
47
|
try_files $uri $uri/ /index.html;
|
|
48
|
+
|
|
49
|
+
# Security headers
|
|
50
|
+
add_header X-Frame-Options $frame_options always;
|
|
51
|
+
add_header X-Content-Type-Options $content_type_options always;
|
|
52
|
+
add_header X-XSS-Protection $xss_protection always;
|
|
53
|
+
add_header Referrer-Policy $referrer_policy always;
|
|
54
|
+
add_header Permissions-Policy $permissions_policy always;
|
|
55
|
+
add_header Content-Security-Policy $csp_policy always;
|
|
17
56
|
}
|
|
18
57
|
|
|
19
|
-
# ---------------------------
|
|
20
|
-
# SECURITY HEADERS
|
|
21
|
-
# ---------------------------
|
|
22
|
-
|
|
23
|
-
# Prevent clickjacking
|
|
24
|
-
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
25
|
-
|
|
26
|
-
# Block MIME type sniffing
|
|
27
|
-
add_header X-Content-Type-Options "nosniff" always;
|
|
28
|
-
|
|
29
|
-
# Legacy XSS filter
|
|
30
|
-
add_header X-XSS-Protection "1; mode=block" always;
|
|
31
|
-
|
|
32
|
-
# Limit referrer leakage
|
|
33
|
-
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
34
|
-
|
|
35
|
-
# Restrict powerful browser APIs
|
|
36
|
-
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
|
|
37
|
-
|
|
38
|
-
# Content Security Policy
|
|
39
|
-
add_header Content-Security-Policy "default-src 'self'; \
|
|
40
|
-
script-src 'self'; \
|
|
41
|
-
style-src 'self' 'unsafe-inline'; \
|
|
42
|
-
img-src 'self' data: https:; \
|
|
43
|
-
font-src 'self'; \
|
|
44
|
-
connect-src 'self'; \
|
|
45
|
-
object-src 'none'; \
|
|
46
|
-
base-uri 'self'; \
|
|
47
|
-
form-action 'self'; \
|
|
48
|
-
frame-ancestors 'none';" always;
|
|
49
|
-
|
|
50
|
-
# Hide nginx version
|
|
51
|
-
server_tokens off;
|
|
52
|
-
|
|
53
58
|
# ---------------------------
|
|
54
59
|
# STATIC ASSETS CACHING
|
|
55
60
|
# ---------------------------
|
|
@@ -57,14 +62,30 @@ server {
|
|
|
57
62
|
# Immutable cache for static assets
|
|
58
63
|
location ~* \.(js|css|png|jpg|jpeg|gif|avif|ico|svg|woff|woff2|ttf|eot)$ {
|
|
59
64
|
expires 1y;
|
|
60
|
-
add_header Cache-Control "public, immutable";
|
|
65
|
+
add_header Cache-Control "public, immutable" always;
|
|
66
|
+
|
|
67
|
+
# Security headers
|
|
68
|
+
add_header X-Frame-Options $frame_options always;
|
|
69
|
+
add_header X-Content-Type-Options $content_type_options always;
|
|
70
|
+
add_header X-XSS-Protection $xss_protection always;
|
|
71
|
+
add_header Referrer-Policy $referrer_policy always;
|
|
72
|
+
add_header Permissions-Policy $permissions_policy always;
|
|
73
|
+
add_header Content-Security-Policy $csp_policy always;
|
|
61
74
|
}
|
|
62
75
|
|
|
63
76
|
# No caching for HTML files (SPA shell)
|
|
64
77
|
location ~* \.html$ {
|
|
65
78
|
expires -1;
|
|
66
|
-
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
67
|
-
add_header Pragma "no-cache";
|
|
79
|
+
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
|
|
80
|
+
add_header Pragma "no-cache" always;
|
|
81
|
+
|
|
82
|
+
# Security headers
|
|
83
|
+
add_header X-Frame-Options $frame_options always;
|
|
84
|
+
add_header X-Content-Type-Options $content_type_options always;
|
|
85
|
+
add_header X-XSS-Protection $xss_protection always;
|
|
86
|
+
add_header Referrer-Policy $referrer_policy always;
|
|
87
|
+
add_header Permissions-Policy $permissions_policy always;
|
|
88
|
+
add_header Content-Security-Policy $csp_policy always;
|
|
68
89
|
}
|
|
69
90
|
|
|
70
91
|
# ---------------------------
|
|
@@ -72,7 +93,7 @@ server {
|
|
|
72
93
|
# ---------------------------
|
|
73
94
|
location /health {
|
|
74
95
|
access_log off;
|
|
75
|
-
add_header Content-Type text/plain;
|
|
96
|
+
add_header Content-Type text/plain always;
|
|
76
97
|
return 200 "healthy\n";
|
|
77
98
|
}
|
|
78
99
|
}
|
|
@@ -10,7 +10,7 @@ async function startDev() {
|
|
|
10
10
|
await runCommand('{{packageManager}}', ['run', 'build']);
|
|
11
11
|
|
|
12
12
|
const { serve, watcher } = await Promise.all([
|
|
13
|
-
runCommand('
|
|
13
|
+
runCommand('{{packageManager}}', ['run', 'serve:only']),
|
|
14
14
|
runCommand('node', ['tools/dev/watcher.js'])
|
|
15
15
|
]);
|
|
16
16
|
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// used in tools/generators to generate views/components JSON files
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @typedef {'en' | 'fr'} Language
|
|
5
|
-
*/
|
|
6
|
-
/** @type {readonly Language[]} */
|
|
7
|
-
export const LANGUAGES = /** @type {const} */ (['en', 'fr']);
|
|
8
|
-
|
|
9
|
-
/** @type {Language} */
|
|
10
|
-
export const DEFAULT_LANGUAGE = /** @type {const} */ ('en');
|