nsbp-cli 0.2.29 → 0.2.30

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/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.30`
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.30",
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/",
@@ -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
+ }
@@ -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
+ ]