create-ones-app 0.0.5 → 0.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ones-app",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -1 +1,104 @@
1
1
  # AGENTS.md
2
+
3
+ This is the ONES application code directory
4
+
5
+ Next, you can deploy the ONES application
6
+
7
+ Before deployment, you need to:
8
+
9
+ ## 1. Check if netlify cli is installed
10
+
11
+ Check command:
12
+
13
+ ```bash
14
+ netlify -v
15
+ ```
16
+
17
+ If the command is missing, you can install it with the following command:
18
+
19
+ ```bash
20
+ npm i -g netlify-cli
21
+ ```
22
+
23
+ If you get an `Error: EACCES: permission denied` error
24
+
25
+ You need to request `sudo` permissions and retry with the following command:
26
+
27
+ ```bash
28
+ sudo npm i -g netlify-cli
29
+ ```
30
+
31
+ If you get other errors
32
+
33
+ Please check your network and proxy configuration, then retry
34
+
35
+ If multiple retries fail, prompt the user to install manually
36
+
37
+ If the check passes, proceed to the next step
38
+
39
+ ## 2. Check if netlify cli is logged in
40
+
41
+ Check command:
42
+
43
+ ```bash
44
+ netlify status
45
+ ```
46
+
47
+ If the user is not logged in
48
+
49
+ You can guide the user to register or log in based on the `netlify --help` prompt
50
+
51
+ If the check passes, proceed to the next step
52
+
53
+ ## 3. Deploy ONES application
54
+
55
+ Deployment command:
56
+
57
+ ```bash
58
+ netlify deploy --create-site --prod
59
+ ```
60
+
61
+ If deployment fails
62
+
63
+ Please check your network and proxy configuration, then retry
64
+
65
+ If multiple retries fail, prompt the user to install manually
66
+
67
+ If deployment is successful, proceed to the next step
68
+
69
+ ## 4. Return key information
70
+
71
+ In the previous step, `netlify` will output the application deployment URL in the command line
72
+
73
+ The application deployment URL will immediately follow the "Deployed to production URL" statement
74
+
75
+ We extract two key pieces of information to tell the user:
76
+
77
+ - Application deployment URL: `${url}`
78
+ - Application installation URL: `${url}/api/app_manifest`
79
+
80
+ The application installation URL is actually concatenated based on the application deployment URL
81
+
82
+ The concatenated path defaults to `/api/app_manifest`
83
+
84
+ Corresponding to the `netlify/functions/app_manifest.js` file
85
+
86
+ If the user has moved this file, please replace it with the actual filename
87
+
88
+ ## 5. Iteration and development
89
+
90
+ If the user needs secondary development
91
+
92
+ You can perform secondary development based on the current ONES application code
93
+
94
+ Regarding ONES application capabilities, you need to understand relevant information from the following documentation:
95
+
96
+ - events: [https://p8205-k3s-9-submodule-opendocs2.k3s-dev.myones.net/docs/abilities/events/]
97
+ - extensions: [https://p8205-k3s-9-submodule-opendocs2.k3s-dev.myones.net/docs/abilities/extensions/]
98
+ - openapi: [https://p8205-k3s-9-submodule-opendocs2.k3s-dev.myones.net/docs/abilities/openapi/]
99
+ - web-sdk: [https://p8205-k3s-9-submodule-opendocs2.k3s-dev.myones.net/docs/abilities/web-sdk/]
100
+
101
+ Regarding ONES application description files, you need to understand relevant information from the following documentation:
102
+
103
+ - app_manifest: [https://p8205-k3s-9-submodule-opendocs2.k3s-dev.myones.net/docs/guide/getting-started/quick-start-guide#build-your-app-manifest]
104
+ - app_schema_validator: [https://p8205-k3s-9-submodule-opendocs2.k3s-dev.myones.net/docs/app_schema_validator/]
@@ -1 +1,84 @@
1
1
  # README.md
2
+
3
+ 这是 ONES 应用代码目录
4
+
5
+ 下一步,你可以部署 ONES 应用
6
+
7
+ 在部署之前你需要:
8
+
9
+ ## 1. 检查 netlify cli 是否已安装
10
+
11
+ 检查命令:
12
+
13
+ ```bash
14
+ netlify -v
15
+ ```
16
+
17
+ 如果提示缺少命令,你可以用以下命令安装:
18
+
19
+ ```bash
20
+ npm i -g netlify-cli
21
+ ```
22
+
23
+ 如果提示 `Error: EACCES: permission denied` 错误时
24
+
25
+ 你需要申请 `sudo` 权限,用以下命令重试:
26
+
27
+ ```bash
28
+ sudo npm i -g netlify-cli
29
+ ```
30
+
31
+ 如果提示其他错误时
32
+
33
+ 请检查网络和代理配置,然后重试
34
+
35
+ ## 2. 检查 netlify cli 是否已登录
36
+
37
+ 检查命令:
38
+
39
+ ```bash
40
+ netlify status
41
+ ```
42
+
43
+ 如果你未登录
44
+
45
+ 可以根据 `netlify --help` 的提示进行注册或者登录
46
+
47
+ ## 3. 部署 ONES 应用
48
+
49
+ 部署命令:
50
+
51
+ ```bash
52
+ netlify deploy --create-site --prod
53
+ ```
54
+
55
+ 如果部署失败时
56
+
57
+ 请检查网络和代理配置,然后重试
58
+
59
+ ## 4. 获取应用信息
60
+
61
+ 在上一步,`netlify` 会在命令行输出应用的部署地址
62
+
63
+ 应用的部署地址会紧跟在 Deployed to production URL 的声明后面
64
+
65
+ - 应用的部署地址: `${url}`
66
+ - 应用的安装地址:`${url}/api/app_manifest`
67
+
68
+ 应用的安装地址,其实是根据应用的部署地址拼接的
69
+
70
+ 拼接的路径,默认为 `/api/app_manifest`
71
+
72
+ 对应 `netlify/functions/app_manifest.js` 这个文件
73
+
74
+ 如果移动过这个文件,请替换为实际的文件名
75
+
76
+ 当你拿到应用的安装地址时,可以去 ONES 的应用中心进行安装
77
+
78
+ ## 5. 迭代和开发
79
+
80
+ 当你需要二次开发时,请浏览开发者文档
81
+
82
+ 开发者文档地址如下:
83
+
84
+ [https://p8205-k3s-9-submodule-opendocs2.k3s-dev.myones.net/]
@@ -1,7 +1,7 @@
1
1
  /** @type { import("../../types/app_manifest.d.ts").AppManifest } */
2
2
  const example = {
3
3
  // Required fields
4
- id: 'app_01234567890abcdef',
4
+ id: 'app_0123456789abcdef',
5
5
  name: 'ONES App',
6
6
  version: 'v1.0.0',
7
7
  base_url: 'https://your-domain',
@@ -41,7 +41,7 @@ const example = {
41
41
  },
42
42
  }
43
43
 
44
- exports.handler = (req) => {
44
+ exports.handler = async (req) => {
45
45
  // Set CORS headers to allow cross-origin requests
46
46
  const headers = {
47
47
  'Access-Control-Allow-Origin': '*',
@@ -8,7 +8,7 @@ const example = {
8
8
  ],
9
9
  }
10
10
 
11
- exports.handler = (req) => {
11
+ exports.handler = async (req) => {
12
12
  // Set CORS headers to allow cross-origin requests
13
13
  const headers = {
14
14
  'Access-Control-Allow-Origin': '*',
@@ -1,4 +1,4 @@
1
- exports.handler = (req) => {
1
+ exports.handler = async (req) => {
2
2
  // Set CORS headers to allow cross-origin requests
3
3
  const headers = {
4
4
  'Access-Control-Allow-Origin': '*',
@@ -1,4 +1,4 @@
1
- exports.handler = (req) => {
1
+ exports.handler = async (req) => {
2
2
  // Set CORS headers to allow cross-origin requests
3
3
  const headers = {
4
4
  'Access-Control-Allow-Origin': '*',
@@ -1,4 +1,4 @@
1
- exports.handler = (req) => {
1
+ exports.handler = async (req) => {
2
2
  // Set CORS headers to allow cross-origin requests
3
3
  const headers = {
4
4
  'Access-Control-Allow-Origin': '*',
@@ -1,13 +1,18 @@
1
1
  [build]
2
2
  # Publish directory
3
3
  publish = "public"
4
-
5
- # Functions directory
6
- functions = "netlify/functions"
4
+
5
+ # Build command
6
+ command = "echo 'Static site - no build required'"
7
7
 
8
8
  [build.environment]
9
9
  # Node.js version
10
- NODE_VERSION = "18"
10
+ NODE_VERSION = "20"
11
+
12
+ # Functions
13
+ [functions]
14
+ directory = "netlify/functions"
15
+ node_bundler = "esbuild"
11
16
 
12
17
  # Redirect rules (optional)
13
18
  [[redirects]]
@@ -15,7 +20,15 @@
15
20
  to = "/.netlify/functions/:splat"
16
21
  status = 200
17
22
 
18
- # Header settings
23
+ # CORS headers for all static assets
24
+ [[headers]]
25
+ for = "/*"
26
+ [headers.values]
27
+ Access-Control-Allow-Origin = "*"
28
+ Access-Control-Allow-Methods = "GET, POST, PUT, DELETE, OPTIONS"
29
+ Access-Control-Allow-Headers = "Content-Type, Authorization, X-Requested-With"
30
+
31
+ # Security headers for all files
19
32
  [[headers]]
20
33
  for = "/*"
21
34
  [headers.values]
@@ -3,13 +3,13 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Hello World - Vercel</title>
6
+ <title>Hello World - Netlify</title>
7
7
  <link rel="stylesheet" href="style.css" />
8
8
  </head>
9
9
  <body>
10
10
  <div class="container">
11
11
  <h1>Hello World!</h1>
12
- <p>欢迎来到Vercel部署的Hello World应用</p>
12
+ <p>欢迎来到 Netlify 部署的 ONES 应用</p>
13
13
  <button id="app-api-button" class="api-button">调用 App API 接口</button>
14
14
  <button id="open-api-button" class="api-button">使用 Open API 接口</button>
15
15
  <div id="result" class="result" style="display: none"></div>