nsbp-cli 0.2.3 → 0.2.4
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 +105 -98
- package/package.json +1 -1
- package/templates/basic/Makefile +8 -1
package/README.md
CHANGED
|
@@ -4,149 +4,156 @@ Command-line interface for creating NSBP (Node React SSR by Webpack) projects.
|
|
|
4
4
|
|
|
5
5
|
📦 **Published on npm**: [https://www.npmjs.com/package/nsbp-cli](https://www.npmjs.com/package/nsbp-cli)
|
|
6
6
|
|
|
7
|
-
## Installation
|
|
7
|
+
## Installation
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
\`\`\`bash
|
|
12
|
-
# Install globally
|
|
9
|
+
### Global Installation (npm)
|
|
10
|
+
```bash
|
|
13
11
|
npm install -g nsbp-cli
|
|
12
|
+
```
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
### Using npx (No Installation)
|
|
15
|
+
```bash
|
|
16
16
|
npx nsbp-cli create my-app
|
|
17
|
+
```
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## Local Usage
|
|
23
|
-
|
|
24
|
-
The CLI is also located in \`cli/\` directory of the NSBP project. Run it locally for development:
|
|
25
|
-
|
|
26
|
-
\`\`\`bash
|
|
27
|
-
# Navigate to CLI directory
|
|
28
|
-
cd cli
|
|
29
|
-
|
|
30
|
-
# Show help
|
|
31
|
-
node ./bin/nsbp-cli.js --help
|
|
19
|
+
### Verify Installation
|
|
20
|
+
```bash
|
|
21
|
+
nsbp --version
|
|
22
|
+
```
|
|
32
23
|
|
|
33
|
-
|
|
34
|
-
node ./bin/nsbp-cli.js info
|
|
24
|
+
## Quick Start
|
|
35
25
|
|
|
36
|
-
|
|
37
|
-
node ./bin/nsbp-cli.js create my-app
|
|
26
|
+
Create a new NSBP project with a single command:
|
|
38
27
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
```bash
|
|
29
|
+
nsbp create my-app
|
|
30
|
+
cd my-app
|
|
31
|
+
npm install
|
|
32
|
+
npm run dev
|
|
33
|
+
```
|
|
42
34
|
|
|
43
|
-
|
|
35
|
+
For development with Docker (recommended):
|
|
36
|
+
```bash
|
|
37
|
+
cd my-app
|
|
38
|
+
make dev # Starts development environment with hot reload
|
|
39
|
+
```
|
|
44
40
|
|
|
45
|
-
|
|
41
|
+
## Command Reference
|
|
46
42
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
nsbp
|
|
43
|
+
### Create a New Project
|
|
44
|
+
```bash
|
|
45
|
+
nsbp create <app-name> [options]
|
|
50
46
|
|
|
51
|
-
#
|
|
52
|
-
|
|
47
|
+
# Examples
|
|
48
|
+
nsbp create my-app
|
|
49
|
+
nsbp create my-app --skip-install # Skip npm install
|
|
50
|
+
nsbp create my-app --template basic # Specify template (basic is default)
|
|
51
|
+
```
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
### Display Framework Information
|
|
54
|
+
```bash
|
|
55
|
+
nsbp info
|
|
56
|
+
```
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
### Help
|
|
59
|
+
```bash
|
|
60
|
+
nsbp --help # Show all commands
|
|
61
|
+
nsbp create --help # Show create command options
|
|
62
|
+
```
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
nsbp-cli create my-app --template basic
|
|
62
|
-
\`\`\`
|
|
64
|
+
## Templates
|
|
63
65
|
|
|
64
|
-
|
|
66
|
+
The CLI provides project templates to get started quickly:
|
|
65
67
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
- **basic** (default) - Complete NSBP stack with React SSR, TypeScript, and Webpack
|
|
69
|
+
- Includes full Docker support for development and production
|
|
70
|
+
- Pre-configured with Makefile for easy Docker operations
|
|
71
|
+
- Ready-to-use project structure
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
- **blog** - Blog-focused template with article layouts (coming soon)
|
|
74
|
+
- **ecommerce** - E-commerce template with product pages (coming soon)
|
|
72
75
|
|
|
73
|
-
|
|
74
|
-
# Show all commands
|
|
75
|
-
nsbp-cli --help
|
|
76
|
+
## Docker Support
|
|
76
77
|
|
|
77
|
-
|
|
78
|
-
nsbp-cli create --help
|
|
79
|
-
\`\`\`
|
|
78
|
+
The **basic** template includes comprehensive Docker configuration:
|
|
80
79
|
|
|
81
|
-
|
|
80
|
+
### Docker Files Included
|
|
81
|
+
- `.dockerignore` - Docker build ignore rules
|
|
82
|
+
- `docker-compose.yml` - Production environment configuration
|
|
83
|
+
- `docker-compose.dev.yml` - Development environment with hot reload
|
|
84
|
+
- `Dockerfile` - Multi-stage production build
|
|
85
|
+
- `Dockerfile.dev` - Development build
|
|
86
|
+
- `Makefile` - Convenient Docker commands
|
|
82
87
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
### Available Make Commands
|
|
89
|
+
```bash
|
|
90
|
+
make dev # Start development environment (hot reload)
|
|
91
|
+
make prod # Start production environment
|
|
92
|
+
make rebuild # Rebuild and restart production containers
|
|
93
|
+
make logs # View container logs
|
|
94
|
+
make down # Stop and remove containers
|
|
95
|
+
make shell # Open shell in production container
|
|
96
|
+
make shell-dev # Open shell in development container
|
|
97
|
+
```
|
|
86
98
|
|
|
87
|
-
## How
|
|
99
|
+
## How It Works
|
|
88
100
|
|
|
89
|
-
The CLI copies NSBP project structure from
|
|
101
|
+
The CLI copies the NSBP project structure from `templates/basic/` to your target directory and creates a new `package.json` with appropriate dependencies. You get a fully functional NSBP project ready for development, including complete Docker support.
|
|
90
102
|
|
|
91
103
|
## Template Synchronization
|
|
92
104
|
|
|
93
105
|
The CLI includes a synchronization script that keeps built-in templates up-to-date with the main NSBP project code.
|
|
94
106
|
|
|
95
107
|
### Sync Script
|
|
96
|
-
Location:
|
|
108
|
+
Location: `cli/scripts/sync-template.js`
|
|
97
109
|
|
|
98
110
|
### Usage
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
# Run sync script
|
|
104
|
-
pnpm run sync-template
|
|
105
|
-
# or
|
|
106
|
-
npm run sync-template
|
|
107
|
-
|
|
108
|
-
# Or use to update shortcut
|
|
109
|
-
pnpm run update
|
|
110
|
-
# or
|
|
111
|
-
npm run update
|
|
112
|
-
\`\`\`
|
|
111
|
+
```bash
|
|
112
|
+
cd cli
|
|
113
|
+
npm run update # Runs sync-template script
|
|
114
|
+
```
|
|
113
115
|
|
|
114
116
|
### Features
|
|
115
|
-
- **Smart copying
|
|
116
|
-
- **Build artifact filtering
|
|
117
|
-
- **Template transformation
|
|
118
|
-
- **Integrity verification
|
|
119
|
-
|
|
120
|
-
###
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
117
|
+
- **Smart copying** - Copies only source code and configuration files
|
|
118
|
+
- **Build artifact filtering** - Automatically excludes build artifacts from the public directory
|
|
119
|
+
- **Template transformation** - Converts main project's package.json to template format
|
|
120
|
+
- **Integrity verification** - Checks for required files before synchronization
|
|
121
|
+
|
|
122
|
+
### Synchronized Files
|
|
123
|
+
- `src/` - React components and routing
|
|
124
|
+
- `public/` - Static assets
|
|
125
|
+
- `scripts/` - Startup and utility scripts
|
|
126
|
+
- `webpack.*.js` - Webpack configuration
|
|
127
|
+
- `tsconfig.json` - TypeScript configuration
|
|
128
|
+
- `postcss.config.js` - PostCSS configuration
|
|
129
|
+
- `package.json` - Project configuration (templatized)
|
|
130
|
+
- `.gitignore`, `.prettierrc`, `.prettierignore`, `README.md`
|
|
131
|
+
- **Docker files**: `.dockerignore`, `docker-compose.yml`, `docker-compose.dev.yml`, `Dockerfile`, `Dockerfile.dev`, `Makefile`
|
|
129
132
|
|
|
130
133
|
## Development
|
|
131
134
|
|
|
132
135
|
To work on the CLI locally:
|
|
133
136
|
|
|
134
|
-
|
|
137
|
+
```bash
|
|
135
138
|
cd cli
|
|
136
|
-
pnpm install
|
|
137
|
-
# or
|
|
138
139
|
npm install
|
|
139
|
-
node ./bin/nsbp
|
|
140
|
-
|
|
140
|
+
node ./bin/nsbp.js --help # Test CLI locally
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Publishing Updates
|
|
144
|
+
From the NSBP project root:
|
|
145
|
+
```bash
|
|
146
|
+
make publish-cli # Syncs templates, updates version, publishes to npm
|
|
147
|
+
```
|
|
141
148
|
|
|
142
149
|
## Package Information
|
|
143
150
|
|
|
144
|
-
- **Package Name**:
|
|
145
|
-
- **Bin Command**:
|
|
146
|
-
- **Version**:
|
|
151
|
+
- **Package Name**: `nsbp-cli`
|
|
152
|
+
- **Bin Command**: `nsbp` (install globally and run `nsbp --help`)
|
|
153
|
+
- **Version**: `0.2.3`
|
|
147
154
|
- **Dependencies**: chalk, commander, fs-extra, inquirer
|
|
148
|
-
- **
|
|
155
|
+
- **Node Version**: >=16.0.0
|
|
149
156
|
|
|
150
157
|
## License
|
|
151
158
|
|
|
152
|
-
ISC
|
|
159
|
+
ISC
|
package/package.json
CHANGED
package/templates/basic/Makefile
CHANGED
|
@@ -59,7 +59,14 @@ publish-cli: ## Publish CLI to npm registry
|
|
|
59
59
|
@echo "📦 Template updated, committing changes..."
|
|
60
60
|
git add .
|
|
61
61
|
git diff --quiet && git diff --cached --quiet || git commit -m "chore: update cli template"
|
|
62
|
-
|
|
62
|
+
@echo "🔖 Updating version..."
|
|
63
|
+
cd cli && npm version patch --no-git-tag-version
|
|
64
|
+
@echo "📝 Committing version bump..."
|
|
65
|
+
git add cli/package.json
|
|
66
|
+
git commit -m "chore: bump version to v$$(cd cli && node -p "require('./package.json').version")"
|
|
67
|
+
@echo "🏷️ Creating git tag..."
|
|
68
|
+
git tag -a "v$$(cd cli && node -p "require('./package.json').version")" -m "Version $$(cd cli && node -p "require('./package.json').version")"
|
|
69
|
+
@echo "📤 Publishing to npm..."
|
|
63
70
|
cd cli && npm publish
|
|
64
71
|
@echo "📤 Pushing to git repository..."
|
|
65
72
|
git push --follow-tags
|