@nutin/cli 1.2.1 → 1.2.2

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## V1.2.2
4
+
5
+ - Fixed Nginx security headers in child location blocks.
6
+
7
+ - Fixed package manager variable in `dev-serve.js.hbs` runCommand
8
+
9
+ - Removed ghost files
10
+
3
11
  ## V1.2.1
4
12
 
5
13
  - Builder
@@ -24,8 +32,6 @@
24
32
  - Moved Dockerfile and deployment config files (`nginx.conf`, `gzip.conf`) into their own folder `tools/deployment`.
25
33
  - Added `docker:build` and `docker:run` scripts in package.json.
26
34
 
27
- See [DEPLOYMENT.md file](../../docs/DEPLOYMENT_HELPERS.md) for details.
28
-
29
35
  - Moved dev tools (`serve.js`, `dev-serve.js`, `watcher.js`) into their own `tools/dev` folder.
30
36
 
31
37
  - Added explicit chokidar devDependency (sass & live-server transitive).
@@ -58,8 +64,6 @@
58
64
 
59
65
  - Improved deployment tools Dockerfile (nginx conf + gzip)
60
66
 
61
- See [DEPLOYMENT.md file](../../docs/DEPLOYMENT_HELPERS.md) for details.
62
-
63
67
  - stylin-nutin (generator)
64
68
  - When generating a component, prompts (boolean) to generate a `_component-name.scss` file in `styles/components` (forwarded by `stymes/components/_index.scss`).
65
69
 
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.2",
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,45 @@
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'; \
26
+ script-src 'self'; \
27
+ style-src 'self' 'unsafe-inline'; \
28
+ img-src 'self' data: https:; \
29
+ font-src 'self'; \
30
+ connect-src 'self'; \
31
+ object-src 'none'; \
32
+ base-uri 'self'; \
33
+ form-action 'self'; \
34
+ frame-ancestors 'none';";
35
+ }
36
+
1
37
  server {
2
38
  # ---------------------------
3
39
  # LISTEN PORTS
4
40
  # ---------------------------
5
41
  listen 9090;
42
+ listen 9091;
6
43
  server_name _;
7
44
 
8
45
  # ---------------------------
@@ -11,45 +48,22 @@ server {
11
48
  root /usr/share/nginx/html;
12
49
  index index.html;
13
50
 
51
+ # Hide nginx version
52
+ server_tokens off;
53
+
14
54
  # SPA routing: serve index.html for unknown paths
15
55
  location / {
16
56
  try_files $uri $uri/ /index.html;
57
+
58
+ # Security headers
59
+ add_header X-Frame-Options $frame_options always;
60
+ add_header X-Content-Type-Options $content_type_options always;
61
+ add_header X-XSS-Protection $xss_protection always;
62
+ add_header Referrer-Policy $referrer_policy always;
63
+ add_header Permissions-Policy $permissions_policy always;
64
+ add_header Content-Security-Policy $csp_policy always;
17
65
  }
18
66
 
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
67
  # ---------------------------
54
68
  # STATIC ASSETS CACHING
55
69
  # ---------------------------
@@ -57,14 +71,30 @@ server {
57
71
  # Immutable cache for static assets
58
72
  location ~* \.(js|css|png|jpg|jpeg|gif|avif|ico|svg|woff|woff2|ttf|eot)$ {
59
73
  expires 1y;
60
- add_header Cache-Control "public, immutable";
74
+ add_header Cache-Control "public, immutable" always;
75
+
76
+ # Security headers
77
+ add_header X-Frame-Options $frame_options always;
78
+ add_header X-Content-Type-Options $content_type_options always;
79
+ add_header X-XSS-Protection $xss_protection always;
80
+ add_header Referrer-Policy $referrer_policy always;
81
+ add_header Permissions-Policy $permissions_policy always;
82
+ add_header Content-Security-Policy $csp_policy always;
61
83
  }
62
84
 
63
85
  # No caching for HTML files (SPA shell)
64
86
  location ~* \.html$ {
65
87
  expires -1;
66
- add_header Cache-Control "no-cache, no-store, must-revalidate";
67
- add_header Pragma "no-cache";
88
+ add_header Cache-Control "no-cache, no-store, must-revalidate" always;
89
+ add_header Pragma "no-cache" always;
90
+
91
+ # Security headers
92
+ add_header X-Frame-Options $frame_options always;
93
+ add_header X-Content-Type-Options $content_type_options always;
94
+ add_header X-XSS-Protection $xss_protection always;
95
+ add_header Referrer-Policy $referrer_policy always;
96
+ add_header Permissions-Policy $permissions_policy always;
97
+ add_header Content-Security-Policy $csp_policy always;
68
98
  }
69
99
 
70
100
  # ---------------------------
@@ -72,7 +102,7 @@ server {
72
102
  # ---------------------------
73
103
  location /health {
74
104
  access_log off;
75
- add_header Content-Type text/plain;
105
+ add_header Content-Type text/plain always;
76
106
  return 200 "healthy\n";
77
107
  }
78
108
  }
@@ -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>;