nsbp-cli 0.2.29 → 0.2.31

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Erishen Sun
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
21
+ SOFTWARE.
package/README.md CHANGED
@@ -147,7 +147,7 @@ node ./bin/nsbp.js --help # Test CLI locally
147
147
 
148
148
  - **Package Name**: `nsbp-cli`
149
149
  - **Bin Command**: `nsbp` (install globally and run `nsbp --help`)
150
- - **Version**: `0.2.29`
150
+ - **Version**: `0.2.31`
151
151
  - **Dependencies**: chalk, commander, fs-extra, inquirer
152
152
  - **Package Manager**: Uses pnpm (also compatible with npm)
153
153
  - **Node Version**: >=16.0.0
package/bin/nsbp.js CHANGED
@@ -68,6 +68,9 @@ program
68
68
  'tsconfig.json',
69
69
  '.prettierrc',
70
70
  '.prettierignore',
71
+ '.prettierrc.js',
72
+ 'eslint.config.js',
73
+ '.husky',
71
74
  'gitignore',
72
75
  'Makefile',
73
76
  'README.md'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nsbp-cli",
3
- "version": "0.2.29",
3
+ "version": "0.2.31",
4
4
  "description": "CLI tool for creating NSBP (Node React SSR by Webpack) projects",
5
5
  "main": "index.js",
6
6
  "homepage": "https://nsbp.erishen.cn/",
@@ -31,7 +31,7 @@
31
31
  "generator"
32
32
  ],
33
33
  "author": "Erishen Sun",
34
- "license": "ISC",
34
+ "license": "MIT",
35
35
  "repository": {
36
36
  "type": "git",
37
37
  "url": "https://github.com/erishen/nsbp"
@@ -0,0 +1,47 @@
1
+ # Husky Git Hooks
2
+
3
+ This directory contains Git hooks configured by Husky.
4
+
5
+ ## Available Hooks
6
+
7
+ - **pre-commit**: Runs linting on staged files before commit
8
+ - **pre-push**: Runs full lint check before pushing
9
+ - **commit-msg**: Validates commit message format
10
+
11
+ ## Commit Message Format
12
+
13
+ Follow the Conventional Commits specification:
14
+
15
+ ```
16
+ <type>(<scope>): <subject>
17
+
18
+ <body>
19
+
20
+ <footer>
21
+ ```
22
+
23
+ ### Types
24
+
25
+ - `feat`: A new feature
26
+ - `fix`: A bug fix
27
+ - `docs`: Documentation only changes
28
+ - `style`: Code style changes (formatting, etc.)
29
+ - `refactor`: Code change that neither fixes a bug nor adds a feature
30
+ - `test`: Adding missing tests or correcting existing tests
31
+ - `chore`: Maintenance tasks
32
+ - `build`: Changes that affect the build system
33
+ - `ci`: Changes to CI configuration files
34
+ - `perf`: Performance improvements
35
+ - `revert`: Reverts a previous commit
36
+
37
+ ### Example
38
+
39
+ ```
40
+ feat(core): add SSR data preloading support
41
+
42
+ - Implement loadData in route config
43
+ - Add server-side data fetching utilities
44
+ - Update hydration logic
45
+
46
+ Closes #123
47
+ ```
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ # Validate commit message format
5
+ commit_regex='^(feat|fix|docs|style|refactor|test|chore|build|ci|perf|revert|BREAKING CHANGE)(\(.+\))?: .{1,50}'
6
+
7
+ if ! grep -qE "$commit_regex" "$1"; then
8
+ echo ""
9
+ echo "❌ Invalid commit message format."
10
+ echo ""
11
+ echo "Valid format: <type>(<scope>): <subject>"
12
+ echo ""
13
+ echo "Types: feat, fix, docs, style, refactor, test, chore, build, ci, perf, revert"
14
+ echo "Example: feat(components): add new button component"
15
+ echo ""
16
+ exit 1
17
+ fi
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npx lint-staged
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ pnpm run lint
@@ -0,0 +1,13 @@
1
+ export default {
2
+ semi: false,
3
+ singleQuote: true,
4
+ tabWidth: 2,
5
+ trailingComma: 'es5',
6
+ printWidth: 100,
7
+ arrowParens: 'always',
8
+ endOfLine: 'lf',
9
+ plugins: ['prettier-plugin-organize-imports'],
10
+ importOrder: ['^react', '^@/(.*)$', '^[./]'],
11
+ importOrderSeparation: true,
12
+ importOrderSortSpecifiers: true
13
+ }
@@ -1,7 +1,21 @@
1
1
  # NSBP
2
2
 
3
+ <div align="center">
4
+
5
+ ![npm version](https://img.shields.io/npm/v/nsbp-cli?style=flat-square&logo=npm)
6
+ ![License](https://img.shields.io/github/license/erishen/nsbp?style=flat-square)
7
+ ![Node.js](https://img.shields.io/badge/Node.js->=18.0-brightgreen?style=flat-square&logo=node.js)
8
+ ![React](https://img.shields.io/badge/React-19.x-61DAFB?style=flat-square&logo=react)
9
+ ![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178C6?style=flat-square&logo=typescript)
10
+ ![Downloads](https://img.shields.io/npm/dm/nsbp-cli?style=flat-square)
11
+ ![GitHub Issues](https://img.shields.io/github/issues/erishen/nsbp?style=flat-square&logo=github)
12
+ ![Last Commit](https://img.shields.io/github/last-commit/erishen/nsbp?style=flat-square&logo=github)
13
+ ![Maintenance](https://img.shields.io/maintenance/yes/2025?style=flat-square)
14
+
3
15
  🌐 **Online Demo**: [https://nsbp.erishen.cn/](https://nsbp.erishen.cn/)
4
16
 
17
+ </div>
18
+
5
19
  ## 🚀 快速开始
6
20
 
7
21
  ```bash
@@ -0,0 +1,98 @@
1
+ const js = require('@eslint/js')
2
+ const typescriptEslint = require('@typescript-eslint/eslint-plugin')
3
+ const typescriptParser = require('@typescript-eslint/parser')
4
+ const reactPlugin = require('eslint-plugin-react')
5
+ const reactHooksPlugin = require('eslint-plugin-react-hooks')
6
+ const prettierPlugin = require('eslint-plugin-prettier')
7
+ const prettierConfig = require('eslint-config-prettier')
8
+
9
+ module.exports = [
10
+ js.configs.recommended,
11
+ {
12
+ ignores: [
13
+ 'node_modules/**',
14
+ 'build/**',
15
+ 'dist/**',
16
+ '.temp_cache/**',
17
+ 'public/js/**',
18
+ 'public/css/**',
19
+ 'public/*.js',
20
+ 'public/*.js.map',
21
+ 'public/*.css.map',
22
+ '*.bundle.js',
23
+ 'loadable-stats.json',
24
+ 'coverage/**',
25
+ '.nyc_output/**',
26
+ '*.config.js',
27
+ 'webpack.base.js',
28
+ 'webpack.client.js',
29
+ 'webpack.server.js',
30
+ '.prettierrc.js',
31
+ 'cli/**',
32
+ 'scripts/**'
33
+ ]
34
+ },
35
+ {
36
+ files: ['**/*.{ts,tsx,js,jsx}'],
37
+ languageOptions: {
38
+ parser: typescriptParser,
39
+ parserOptions: {
40
+ ecmaFeatures: {
41
+ jsx: true
42
+ },
43
+ ecmaVersion: 'latest',
44
+ sourceType: 'module',
45
+ project: './tsconfig.json',
46
+ tsconfigRootDir: __dirname
47
+ },
48
+ globals: {
49
+ window: 'readonly',
50
+ document: 'readonly',
51
+ console: 'readonly',
52
+ process: 'readonly',
53
+ module: 'readonly',
54
+ require: 'readonly',
55
+ __dirname: 'readonly',
56
+ __filename: 'readonly',
57
+ global: 'readonly',
58
+ setTimeout: 'readonly',
59
+ clearTimeout: 'readonly',
60
+ setInterval: 'readonly',
61
+ clearInterval: 'readonly',
62
+ fetch: 'readonly',
63
+ setTimeout: 'readonly'
64
+ }
65
+ },
66
+ plugins: {
67
+ '@typescript-eslint': typescriptEslint,
68
+ react: reactPlugin,
69
+ 'react-hooks': reactHooksPlugin,
70
+ prettier: prettierPlugin
71
+ },
72
+ settings: {
73
+ react: {
74
+ version: 'detect'
75
+ }
76
+ },
77
+ rules: {
78
+ ...typescriptEslint.configs.recommended.rules,
79
+ ...reactPlugin.configs.recommended.rules,
80
+ ...reactHooksPlugin.configs.recommended.rules,
81
+ ...prettierConfig.rules,
82
+ 'prettier/prettier': 'error',
83
+ 'react/react-in-jsx-scope': 'off',
84
+ 'react/prop-types': 'off',
85
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
86
+ '@typescript-eslint/no-explicit-any': 'warn',
87
+ '@typescript-eslint/no-unused-vars': [
88
+ 'warn',
89
+ { argsIgnorePattern: '^_' }
90
+ ],
91
+ '@typescript-eslint/no-unused-expressions': 'off',
92
+ 'react-hooks/rules-of-hooks': 'error',
93
+ 'react-hooks/exhaustive-deps': 'warn',
94
+ 'no-console': ['warn', { allow: ['warn', 'error'] }],
95
+ 'no-undef': 'off'
96
+ }
97
+ }
98
+ ]
@@ -31,7 +31,7 @@
31
31
  "styled-components"
32
32
  ],
33
33
  "author": "Erishen Sun",
34
- "license": "ISC",
34
+ "license": "MIT",
35
35
  "packageManager": "pnpm@10.28.0",
36
36
  "dependencies": {
37
37
  "@loadable/component": "^5.15.0",