nsbp-cli 0.2.9 → 0.2.13
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 +3 -1
- package/package.json +2 -2
- package/templates/basic/Dockerfile +2 -2
- package/templates/basic/Dockerfile.dev +3 -3
- package/templates/basic/Makefile +20 -17
- package/templates/basic/README.md +7 -1
- package/templates/basic/docker-compose.yml +1 -1
- package/templates/basic/package.json +1 -0
- package/templates/basic/src/containers/Home.tsx +16 -2
- package/templates/basic/src/styled/home.ts +61 -0
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Command-line interface for creating NSBP (Node React SSR by Webpack) projects.
|
|
4
4
|
|
|
5
|
+
🌐 **Online Demo**: [https://nsbp.erishen.cn/](https://nsbp.erishen.cn/)
|
|
6
|
+
|
|
5
7
|
📦 **Published on npm**: [https://www.npmjs.com/package/nsbp-cli](https://www.npmjs.com/package/nsbp-cli)
|
|
6
8
|
|
|
7
9
|
## Installation
|
|
@@ -145,7 +147,7 @@ node ./bin/nsbp.js --help # Test CLI locally
|
|
|
145
147
|
|
|
146
148
|
- **Package Name**: `nsbp-cli`
|
|
147
149
|
- **Bin Command**: `nsbp` (install globally and run `nsbp --help`)
|
|
148
|
-
- **Version**: `0.2.
|
|
150
|
+
- **Version**: `0.2.13`
|
|
149
151
|
- **Dependencies**: chalk, commander, fs-extra, inquirer
|
|
150
152
|
- **Package Manager**: Uses pnpm (also compatible with npm)
|
|
151
153
|
- **Node Version**: >=16.0.0
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nsbp-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"description": "CLI tool for creating NSBP (Node React SSR by Webpack) projects",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"homepage": "https://nsbp.erishen.cn/",
|
|
6
7
|
"files": [
|
|
7
8
|
"bin/**/*",
|
|
8
9
|
"templates/**/*",
|
|
@@ -37,7 +38,6 @@
|
|
|
37
38
|
"bugs": {
|
|
38
39
|
"url": "https://github.com/erishen/nsbp/issues"
|
|
39
40
|
},
|
|
40
|
-
"homepage": "https://github.com/erishen/nsbp#readme",
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"chalk": "^4.1.2",
|
|
43
43
|
"commander": "^11.0.0",
|
|
@@ -21,8 +21,8 @@ RUN npm run build
|
|
|
21
21
|
# Stage 2: Production
|
|
22
22
|
FROM node:20-alpine AS production
|
|
23
23
|
|
|
24
|
-
#
|
|
25
|
-
RUN apk add
|
|
24
|
+
# Update apk cache and install dumb-init for proper signal handling
|
|
25
|
+
RUN apk update && apk add dumb-init
|
|
26
26
|
|
|
27
27
|
# Create non-root user
|
|
28
28
|
RUN addgroup -g 1001 -S nodejs && \
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
FROM node:20-alpine
|
|
4
4
|
|
|
5
|
-
#
|
|
6
|
-
RUN apk add
|
|
5
|
+
# Update apk cache and install dumb-init for proper signal handling
|
|
6
|
+
RUN apk update && apk add dumb-init
|
|
7
7
|
|
|
8
8
|
# Create non-root user
|
|
9
9
|
RUN addgroup -g 1001 -S nodejs && \
|
|
@@ -40,7 +40,7 @@ exec su-exec nodejs:nodejs "$@"\n' > /entrypoint.sh && \
|
|
|
40
40
|
chmod +x /entrypoint.sh
|
|
41
41
|
|
|
42
42
|
# Install su-exec for user switching
|
|
43
|
-
RUN apk add
|
|
43
|
+
RUN apk add su-exec
|
|
44
44
|
|
|
45
45
|
# Expose port
|
|
46
46
|
EXPOSE 3001
|
package/templates/basic/Makefile
CHANGED
|
@@ -9,6 +9,9 @@ else
|
|
|
9
9
|
PM := pnpm
|
|
10
10
|
endif
|
|
11
11
|
|
|
12
|
+
# Docker compose detection
|
|
13
|
+
COMPOSE := $(shell docker compose version >/dev/null 2>&1 && echo "docker compose" || echo "docker-compose")
|
|
14
|
+
|
|
12
15
|
help: ## Show this help message
|
|
13
16
|
@echo 'Usage: make [target]'
|
|
14
17
|
@echo ''
|
|
@@ -16,48 +19,48 @@ help: ## Show this help message
|
|
|
16
19
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
|
17
20
|
|
|
18
21
|
build: ## Build Docker images for production
|
|
19
|
-
|
|
22
|
+
$(COMPOSE) build
|
|
20
23
|
|
|
21
24
|
build-dev: ## Build Docker images for development
|
|
22
|
-
|
|
25
|
+
$(COMPOSE) -f docker-compose.dev.yml build
|
|
23
26
|
|
|
24
27
|
dev: ## Start development environment (removes orphan containers)
|
|
25
|
-
|
|
28
|
+
$(COMPOSE) -f docker-compose.dev.yml up --build --remove-orphans
|
|
26
29
|
|
|
27
30
|
prod: ## Start production environment (removes orphan containers)
|
|
28
|
-
|
|
31
|
+
$(COMPOSE) up -d --remove-orphans
|
|
29
32
|
|
|
30
33
|
down: ## Stop and remove containers (including orphan containers)
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
$(COMPOSE) down --remove-orphans
|
|
35
|
+
$(COMPOSE) -f docker-compose.dev.yml down --remove-orphans
|
|
33
36
|
|
|
34
37
|
clean: ## Stop containers, remove images and volumes (including orphan containers)
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
$(COMPOSE) down -v --rmi all --remove-orphans
|
|
39
|
+
$(COMPOSE) -f docker-compose.dev.yml down -v --rmi all --remove-orphans
|
|
37
40
|
|
|
38
41
|
logs: ## View logs
|
|
39
|
-
|
|
42
|
+
$(COMPOSE) logs -f
|
|
40
43
|
|
|
41
44
|
logs-dev: ## View development logs
|
|
42
|
-
|
|
45
|
+
$(COMPOSE) -f docker-compose.dev.yml logs -f
|
|
43
46
|
|
|
44
47
|
restart: ## Restart production containers
|
|
45
|
-
|
|
48
|
+
$(COMPOSE) restart
|
|
46
49
|
|
|
47
50
|
restart-dev: ## Restart development containers
|
|
48
|
-
|
|
51
|
+
$(COMPOSE) -f docker-compose.dev.yml restart
|
|
49
52
|
|
|
50
53
|
rebuild: ## Rebuild and restart production containers (removes orphan containers)
|
|
51
|
-
|
|
54
|
+
$(COMPOSE) up -d --build --remove-orphans
|
|
52
55
|
|
|
53
56
|
rebuild-dev: ## Rebuild and restart development containers (removes orphan containers)
|
|
54
|
-
|
|
57
|
+
$(COMPOSE) -f docker-compose.dev.yml up -d --build --remove-orphans
|
|
55
58
|
|
|
56
59
|
shell: ## Open shell in production container
|
|
57
|
-
|
|
60
|
+
$(COMPOSE) exec app sh
|
|
58
61
|
|
|
59
62
|
shell-dev: ## Open shell in development container
|
|
60
|
-
|
|
63
|
+
$(COMPOSE) -f docker-compose.dev.yml exec app sh
|
|
61
64
|
|
|
62
65
|
test: ## Run tests (if configured)
|
|
63
|
-
|
|
66
|
+
$(COMPOSE) exec app npm test
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"description": "node react ssr by webpack",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"homepage": "https://nsbp.erishen.cn/",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"dev": "npm-run-all -l -s dev:init -p dev:build:*",
|
|
8
9
|
"dev:init": "cross-env INIT=1 webpack --config webpack.server.js --mode development",
|
|
@@ -52,6 +52,8 @@ import {
|
|
|
52
52
|
QuickStartTitle,
|
|
53
53
|
QuickStartCode,
|
|
54
54
|
QuickStartDescription,
|
|
55
|
+
DemoButtonLink,
|
|
56
|
+
DemoButtonIcon,
|
|
55
57
|
Footer
|
|
56
58
|
} from '../styled/home'
|
|
57
59
|
|
|
@@ -124,10 +126,11 @@ const Home: React.FC = () => {
|
|
|
124
126
|
}} />
|
|
125
127
|
<Helmet>
|
|
126
128
|
<title>Nsbp.js - 轻量级 React SSR 框架</title>
|
|
127
|
-
<meta name="description" content="Nsbp.js - 一个轻量级 React SSR 框架,专为低资源部署与高度可定制场景而生。与 Next.js
|
|
129
|
+
<meta name="description" content="Nsbp.js - 一个轻量级 React SSR 框架,专为低资源部署与高度可定制场景而生。与 Next.js 相比,更节省资源,更灵活配置。查看线上演示:https://nsbp.erishen.cn/" />
|
|
128
130
|
<meta name="keywords" content="Nsbp.js, React SSR, 轻量级, SSR, TypeScript, React 19" />
|
|
129
131
|
<meta property="og:title" content="Nsbp.js - 轻量级 React SSR 框架" />
|
|
130
|
-
<meta property="og:description" content="与 Next.js 相比,Nsbp.js
|
|
132
|
+
<meta property="og:description" content="与 Next.js 相比,Nsbp.js 更轻量、更灵活、更可控。查看线上演示:https://nsbp.erishen.cn/" />
|
|
133
|
+
<meta property="og:url" content="https://nsbp.erishen.cn/" />
|
|
131
134
|
</Helmet>
|
|
132
135
|
|
|
133
136
|
<Layout query={{}}>
|
|
@@ -148,6 +151,17 @@ const Home: React.FC = () => {
|
|
|
148
151
|
完全掌控 Webpack 配置,无黑盒限制
|
|
149
152
|
</HeroSubtitle>
|
|
150
153
|
|
|
154
|
+
<DemoButtonLink
|
|
155
|
+
href="https://nsbp.erishen.cn/"
|
|
156
|
+
target="_blank"
|
|
157
|
+
rel="noopener noreferrer"
|
|
158
|
+
className="fade-in"
|
|
159
|
+
style={{animationDelay: '0.4s'}}
|
|
160
|
+
>
|
|
161
|
+
<DemoButtonIcon>🌐</DemoButtonIcon>
|
|
162
|
+
查看线上演示
|
|
163
|
+
</DemoButtonLink>
|
|
164
|
+
|
|
151
165
|
<HeroStats>
|
|
152
166
|
<StatCard>
|
|
153
167
|
<StatValue>~60%</StatValue>
|
|
@@ -776,6 +776,67 @@ export const QuickStartDescription = styled.p`
|
|
|
776
776
|
margin-top: 1rem;
|
|
777
777
|
`
|
|
778
778
|
|
|
779
|
+
// ============================================
|
|
780
|
+
// Demo Button(线上演示按钮)
|
|
781
|
+
// ============================================
|
|
782
|
+
|
|
783
|
+
export const DemoButtonLink = styled.a`
|
|
784
|
+
display: inline-flex;
|
|
785
|
+
align-items: center;
|
|
786
|
+
justify-content: center;
|
|
787
|
+
gap: 0.5rem;
|
|
788
|
+
padding: 1rem 2rem;
|
|
789
|
+
background: rgba(255, 255, 255, 0.15);
|
|
790
|
+
backdrop-filter: blur(10px);
|
|
791
|
+
border: 2px solid rgba(255, 255, 255, 0.3);
|
|
792
|
+
border-radius: 12px;
|
|
793
|
+
color: #ffffff;
|
|
794
|
+
font-size: 1.1rem;
|
|
795
|
+
font-weight: 600;
|
|
796
|
+
text-decoration: none;
|
|
797
|
+
transition: all 0.3s ease;
|
|
798
|
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
|
799
|
+
position: relative;
|
|
800
|
+
overflow: hidden;
|
|
801
|
+
|
|
802
|
+
&::before {
|
|
803
|
+
content: '';
|
|
804
|
+
position: absolute;
|
|
805
|
+
top: 0;
|
|
806
|
+
left: -100%;
|
|
807
|
+
width: 100%;
|
|
808
|
+
height: 100%;
|
|
809
|
+
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
|
|
810
|
+
animation: shine 2s infinite;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
@keyframes shine {
|
|
814
|
+
0% { left: -100%; }
|
|
815
|
+
100% { left: 100%; }
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
&:hover {
|
|
819
|
+
background: rgba(255, 255, 255, 0.25);
|
|
820
|
+
border-color: rgba(255, 255, 255, 0.5);
|
|
821
|
+
transform: translateY(-2px);
|
|
822
|
+
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
&:active {
|
|
826
|
+
transform: translateY(0);
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
@media (max-width: 768px) {
|
|
830
|
+
padding: 0.75rem 1.5rem;
|
|
831
|
+
font-size: 1rem;
|
|
832
|
+
}
|
|
833
|
+
`
|
|
834
|
+
|
|
835
|
+
export const DemoButtonIcon = styled.span`
|
|
836
|
+
font-size: 1.2rem;
|
|
837
|
+
display: inline-block;
|
|
838
|
+
`
|
|
839
|
+
|
|
779
840
|
// ============================================
|
|
780
841
|
// Footer
|
|
781
842
|
// ============================================
|