@bouygues-telecom/staticjs 0.0.6 β†’ 0.0.8

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.
Files changed (2) hide show
  1. package/README.md +151 -18
  2. package/package.json +3 -2
package/README.md CHANGED
@@ -1,31 +1,164 @@
1
- <div align='center'>
1
+ <div align="center">
2
2
 
3
- # React-power-static
3
+ # πŸš€ StaticJS
4
4
 
5
- **To build react static project**
5
+ **A modern boilerplate for creating static projects**
6
+
7
+ [![npm version](https://badge.fury.io/js/%40bouygues-telecom%2Fstaticjs.svg)](https://badge.fury.io/js/%40bouygues-telecom%2Fstaticjs)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+ [![Node.js Version](https://img.shields.io/badge/node-%3E%3D16.0.0-brightgreen.svg)](https://nodejs.org/)
10
+
11
+ _Start your static projects in seconds with an optimized architecture_
12
+
13
+ [Installation](#-installation) β€’ [Usage](#-usage) β€’ [Features](#-features) β€’ [Examples](#-examples)
6
14
 
7
15
  </div>
8
16
 
9
- ---
17
+ ## πŸ“– Table of Contents
18
+
19
+ - [🎯 About](#-about)
20
+ - [✨ Features](#-features)
21
+ - [πŸš€ Installation](#-installation)
22
+ - [πŸ“˜ Usage](#-usage)
23
+ - [πŸ”„ Revalidation](#-revalidation)
24
+ - [βš™οΈ Configuration](#️-configuration)
25
+ - [πŸ“š Examples](#-examples)
26
+ - [πŸ“„ License](#-license)
27
+
28
+ ## 🎯 About
29
+
30
+ **StaticJS** is a powerful and modern boilerplate designed for creating static projects. It integrates development best practices and offers advanced features like specific page revalidation.
31
+
32
+ ### Why StaticJS?
33
+
34
+ - ⚑ **Ultra-fast startup** - Initialize your project in seconds
35
+ - πŸ”„ **Smart revalidation** - Rebuild specific pages on demand
36
+ - πŸ—οΈ **Modern architecture** - Optimized and maintainable project structure
37
+ - πŸš€ **Production ready** - Production-ready configuration
38
+ - πŸ“± **Responsive** - Native support for all devices
39
+
40
+ ## ✨ Features
41
+
42
+ | Feature | Description |
43
+ | ----------------------------- | ---------------------------------------------- |
44
+ | πŸš€ **Fast generation** | Project creation with a single command |
45
+ | πŸ”„ **Hot Reloading** | Automatic reload during development |
46
+ | πŸ“¦ **Optimized build** | Production-optimized bundle |
47
+ | 🎯 **Targeted revalidation** | Specific page reconstruction via API |
48
+ | πŸ› οΈ **Flexible configuration** | Advanced customization according to your needs |
49
+ | πŸ“Š **Performance** | Automatic performance optimizations |
50
+
51
+ ## πŸš€ Installation
52
+
53
+ ### Prerequisites
54
+
55
+ - Node.js >= 16.0.0
56
+ - npm >= 7.0.0
57
+
58
+ ### Global installation
59
+
60
+ ```bash
61
+ npm i @bouygues-telecom/staticjs -g
62
+ ```
63
+
64
+ > πŸ’‘ **Tip**: Global installation allows you to use the `create-staticjs-app` command from anywhere on your system.
65
+
66
+ ## πŸ“˜ Usage
67
+
68
+ ### 1. Create a new project
69
+
70
+ ```bash
71
+ create-staticjs-app
72
+ ```
73
+
74
+ This command will:
75
+
76
+ - πŸ“ Create the folder structure
77
+ - βš™οΈ Configure base files
78
+ - πŸ“¦ Prepare the development environment
79
+
80
+ ### 2. Install dependencies
81
+
82
+ ```bash
83
+ cd your-project
84
+ npm i
85
+ ```
86
+
87
+ ### 3. Build the project
10
88
 
11
- ## Utilisation du package
89
+ ```bash
90
+ npm run build
91
+ ```
92
+
93
+ ### 4. Start the server
94
+
95
+ ```bash
96
+ npm run start
97
+ ```
98
+
99
+ πŸŽ‰ **Your project is now accessible at** `http://localhost:3000`
100
+
101
+ ## πŸ”„ Revalidation
102
+
103
+ StaticJS offers a unique **targeted revalidation** feature that allows rebuilding specific pages without rebuilding the entire project.
12
104
 
13
- ```shell
14
- npm install -g @bytel/react-power-static
15
- # DΓ©marrage
16
- create-react-power-static
105
+ ### Basic syntax
106
+
107
+ ```bash
108
+ curl -X POST http://localhost:3000/revalidate \
109
+ -H "Content-Type: application/json" \
110
+ -d '{ "paths": ["page.tsx"] }'
17
111
  ```
18
112
 
19
- - npm i
20
- - npm run build
21
- - try => test.html (navigator)
113
+ ## πŸ“š Examples
22
114
 
23
- ## Revalidate
115
+ #### Revalidate a single page
24
116
 
25
- curl -X POST http://localhost:3000/revalidate
117
+ ```bash
118
+ curl -X POST http://localhost:3000/revalidate \
119
+ -H "Content-Type: application/json" \
120
+ -d '{ "paths": ["home.tsx"] }'
121
+ ```
26
122
 
123
+ #### Revalidate multiple pages
124
+
125
+ ```bash
27
126
  curl -X POST http://localhost:3000/revalidate \
28
- -H "Content-Type: application/json" \
29
- -d '{
30
- "paths": ["page3/page3.tsx"]
31
- }'
127
+ -H "Content-Type: application/json" \
128
+ -d '{ "paths": ["home.tsx", "about.tsx", "contact.tsx"] }'
129
+ ```
130
+
131
+ ## βš™οΈ Configuration
132
+
133
+ ### Project structure
134
+
135
+ ```
136
+ your-project/
137
+ β”œβ”€β”€ πŸ“ src/
138
+ β”‚ β”œβ”€β”€ πŸ“ pages/ # Your pages
139
+ β”‚ β”œβ”€β”€ πŸ“ components/ # Reusable components
140
+ β”‚ β”œβ”€β”€ πŸ“ styles/ # Style files
141
+ β”‚ └── πŸ“ utils/ # Utilities
142
+ β”œβ”€β”€ πŸ“ public/ # Static assets
143
+ β”œβ”€β”€ πŸ“„ package.json
144
+ └── πŸ“„ server.js # StaticJS server
145
+ ```
146
+
147
+ ## πŸ› οΈ Available scripts
148
+
149
+ | Script | Description |
150
+ | --------------- | -------------------------------- |
151
+ | `npm run build` | Build the project for production |
152
+ | `npm run start` | Start the production server |
153
+
154
+ ## πŸ“„ License
155
+
156
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
157
+
158
+ ---
159
+
160
+ <div align="center">
161
+
162
+ **Developed with ❀️ by the Bouygues Telecom team**
163
+
164
+ </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bouygues-telecom/staticjs",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "config",
@@ -15,12 +15,13 @@
15
15
  },
16
16
  "scripts": {
17
17
  "build": "cd templates/react && rimraf dist && rimraf cache && node ../../helpers/cachePages.js && vite build --config ../../vite.config.js && tsx ../../scripts/build-html.js",
18
- "start": "node templates/react/server.js"
18
+ "start": "cd templates/react && node server.js"
19
19
  },
20
20
  "dependencies": {
21
21
  "cli-spinner": "^0.2.10",
22
22
  "commander": "^14.0.0",
23
23
  "giget": "^2.0.0",
24
+ "nodemon": "^3.1.10",
24
25
  "path": "^0.12.7",
25
26
  "readline": "^1.3.0",
26
27
  "rimraf": "^6.0.1",