@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 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
- - Visit the [website](https://www.nutin.org)
52
- - [Project repository](https://github.com/LoisKOUNINEF/nutin)
51
+ ## 📄 Docs
52
+
53
+ - Docs on [website](https://www.nutin.org).
54
+ - Docs on [Project repository](https://github.com/LoisKOUNINEF/nutin/tree/main/docs).
@@ -55,7 +55,7 @@ export class ProjectGenerator {
55
55
  await this.processFeatureTemplates(projectPath, context);
56
56
  }
57
57
 
58
- buildContext(answers) {
58
+ buildContext(answers) {
59
59
  const version = packageVersion;
60
60
  const ciCommand = getCiCommand(answers.packageManager);
61
61
 
@@ -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 = {
@@ -84,7 +84,7 @@ export async function promptUser(initialName, cliOptions = {}) {
84
84
  type: 'confirm',
85
85
  name: 'testinNutin',
86
86
  message: 'Use testin-nutin toolkit?',
87
- default: false
87
+ default: true
88
88
  });
89
89
  }
90
90
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nutin/cli",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Build SPAs by understanding SPAs. A minimal frontend toolkit crafted for learning and lean applications.",
5
5
  "preferGlobal": true,
6
6
  "main": "lib/index.mjs",
@@ -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.');
@@ -19,7 +19,6 @@ async function build() {
19
19
  if (isVerbose) print.boldInfo(`ESBuild complete.\n`);
20
20
  }
21
21
 
22
-
23
22
  build().catch((err) => {
24
23
  print.boldError(`ESBuild failed: ${err.message}`);
25
24
  exit(1);
@@ -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('npm', ['run', 'serve:only']),
13
+ runCommand('{{packageManager}}', ['run', 'serve:only']),
14
14
  runCommand('node', ['tools/dev/watcher.js'])
15
15
  ]);
16
16
 
@@ -7,4 +7,4 @@ export * from './export-flags.js';
7
7
  export * from './prompt-boolean.js';
8
8
  {{#if i18n}}
9
9
  export * from './languages.js';
10
- {{/if}}
10
+ {{/if}}
@@ -0,0 +1,3 @@
1
+ // global components style export
2
+
3
+ // @forward "my-component";
@@ -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');
@@ -1,7 +0,0 @@
1
- // Used in src/core/services/i18n.ts
2
-
3
- export const LANGUAGES = ['en', 'fr'] as const;
4
- export const DEFAULT_LANGUAGE: Language = 'en' as const;
5
-
6
- export type Language = typeof LANGUAGES[number];
7
- export type Translations = Record<string, any>;