edgeone 1.0.33 → 1.1.0
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 +25 -43
- package/edgeone-bin/edgeone.js +6 -4011
- package/edgeone-dist/cli.js +1944 -176193
- package/edgeone-dist/pages/dev/runner-worker.js +1488 -0
- package/package.json +18 -5
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ After successful login, execute the initialization command to initialize the bas
|
|
|
56
56
|
edgeone pages init
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
After initialization,
|
|
59
|
+
After initialization, an `edge-functions` or `node-functions` folder and sample functions will be generated in the root directory of the project. You can continue to add and develop functions in this folder.
|
|
60
60
|
|
|
61
61
|
### 4. Local Development
|
|
62
62
|
|
|
@@ -66,35 +66,22 @@ After completing initialization, enter the local development stage:
|
|
|
66
66
|
edgeone pages dev
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
Executing the command will start a service on the local port 8088 by default.
|
|
69
|
+
Executing the command will start a service on the local port 8088 by default. The Pages Functions service and the Pages project run on the same port.
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
```javascript
|
|
74
|
-
module.exports = {
|
|
75
|
-
devServer: {
|
|
76
|
-
proxy: {
|
|
77
|
-
'/api': {
|
|
78
|
-
target: 'http://localhost:8088', // Local Development Service Address for Pages Function
|
|
79
|
-
chagneOrigin: true,
|
|
80
|
-
pathRewrite: {
|
|
81
|
-
'^/api': '',
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
In this way, use the Fetch API in the Pages project:
|
|
71
|
+
Visit the frontend at `http://localhost:8088/`, and call your functions directly using their file paths under `edge-functions` or `node-functions`.
|
|
90
72
|
|
|
91
73
|
```javascript
|
|
74
|
+
// ./node-functions/api/my-functions.js
|
|
92
75
|
fetch('/api/my-functions', {
|
|
93
76
|
method: 'POST',
|
|
94
77
|
body: JSON.stringify({ data: 'example' }),
|
|
95
78
|
});
|
|
96
79
|
```
|
|
97
80
|
|
|
81
|
+
Note:
|
|
82
|
+
- The dev service will read `devCommand` from `edgeone.json` to start your dev server. If absent, it will read the `dev` script from your project's `package.json`.
|
|
83
|
+
- Edge Functions debug service has a start count limit. Avoid frequently stopping and restarting the dev service. Hot reloads do not increase the count.
|
|
84
|
+
|
|
98
85
|
### 5. Associated Project
|
|
99
86
|
|
|
100
87
|
If you need to use the Key-Value Storage capability or synchronize the environment variables set in the console to local debugging, you can execute the Associated Project commands, enter the project name as required. The project name here is the one created in the Preparation Work of the Pages project.
|
|
@@ -111,12 +98,23 @@ After local development and debugging are completed, you can deploy your project
|
|
|
111
98
|
edgeone pages deploy <directoryOrZip> -n <projectName>
|
|
112
99
|
```
|
|
113
100
|
|
|
101
|
+
Starting from version v1.1.0, direct deployment within the project is supported:
|
|
102
|
+
|
|
103
|
+
```plaintext
|
|
104
|
+
edgeone pages deploy -n <projectName>
|
|
105
|
+
```
|
|
106
|
+
The CLI will automatically build and initiate deployment based on the project configuration.
|
|
107
|
+
|
|
114
108
|
#### Parameters
|
|
115
109
|
|
|
116
110
|
- `<directoryOrZip>`: Path of folder or ZIP package to deploy (required)
|
|
117
111
|
- `-n, --name`: Project name for deployment (creates new or updates existing project) (required)
|
|
118
112
|
- `-e, --env`: Environment to deploy to, choices: 'production' or 'preview' (default: 'production')
|
|
119
113
|
|
|
114
|
+
Note:
|
|
115
|
+
- If you specify a deploy folder (e.g., `dist`), you need to manually copy the `node-functions` and/or `edge-functions` folders, as well as your project's `package.json`, into that folder before running `deploy`.
|
|
116
|
+
- If you do not specify a deploy folder, the CLI will automatically bundle your frontend code and function code into the `.edgeone` directory, from which you can deploy using the `deploy` command.
|
|
117
|
+
|
|
120
118
|
#### Usage Examples
|
|
121
119
|
|
|
122
120
|
```plaintext
|
|
@@ -139,26 +137,6 @@ If you need to switch to another Tencent Cloud account, you can execute the foll
|
|
|
139
137
|
edgeone switch
|
|
140
138
|
```
|
|
141
139
|
|
|
142
|
-
### 8. Combine with front end
|
|
143
|
-
|
|
144
|
-
EdgeOne Pages CLI supports local development and debugging of EdgeOne Pages functions. If your project contains frontend code, you need to manually start the corresponding development service.
|
|
145
|
-
|
|
146
|
-
For frontend applications that need to access local functions, currently you need to distinguish function access paths through environment variables in your frontend code:
|
|
147
|
-
|
|
148
|
-
```
|
|
149
|
-
// when start dev server
|
|
150
|
-
ENV=dev npm run build
|
|
151
|
-
|
|
152
|
-
//In your code
|
|
153
|
-
const REQUEST_API = process.env.ENV === 'dev' ? 'https://localhost:8088/' : '/'
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
For functions involving cross-origin validation scenarios like login and authentication, you can specify the `--fePort` parameter when starting the development server.
|
|
157
|
-
|
|
158
|
-
```
|
|
159
|
-
edgeone pages dev --fePort=8000 // your front dev server port
|
|
160
|
-
```
|
|
161
|
-
|
|
162
140
|
<br/>
|
|
163
141
|
|
|
164
142
|
## 3. CI/CD Integration
|
|
@@ -170,7 +148,7 @@ This section provides guidance on integrating EdgeOne CLI into your CI/CD pipeli
|
|
|
170
148
|
For CI/CD pipelines, you can use the same deploy command with an API Token for authentication:
|
|
171
149
|
|
|
172
150
|
```plaintext
|
|
173
|
-
edgeone pages deploy <directoryOrZip> -n <projectName> -t <token>
|
|
151
|
+
edgeone pages deploy <directoryOrZip> -n <projectName> -t <token> [-e <env>]
|
|
174
152
|
```
|
|
175
153
|
|
|
176
154
|
#### Parameters
|
|
@@ -180,6 +158,10 @@ edgeone pages deploy <directoryOrZip> -n <projectName> -t <token>
|
|
|
180
158
|
- `-e, --env`: Environment to deploy to, choices: 'production' or 'preview' (default: 'production')
|
|
181
159
|
- `-t, --token`: API Token for CI/CD pipelines (required for automated deployments)
|
|
182
160
|
|
|
161
|
+
Note:
|
|
162
|
+
- If you specify a deploy folder (e.g., `dist`), you need to manually copy the `node-functions` and/or `edge-functions` folders, as well as your project's `package.json`, into that folder before running `deploy`.
|
|
163
|
+
- If you do not specify a deploy folder, the CLI will automatically bundle your frontend code and function code into the `.edgeone` directory, from which you can deploy using the `deploy` command.
|
|
164
|
+
|
|
183
165
|
#### CI/CD Pipeline Examples
|
|
184
166
|
|
|
185
167
|
```plaintext
|
|
@@ -214,4 +196,4 @@ _To access the China site documentation, please click [here](https://edgeone.clo
|
|
|
214
196
|
|
|
215
197
|
## Contact
|
|
216
198
|
|
|
217
|
-
If you need technical support, please [contact us](https://edgeone.ai/contact?source=edgeone-cli).
|
|
199
|
+
If you need technical support, please [contact us](https://edgeone.ai/contact?source=edgeone-cli).
|