@nodegx/backend 0.0.0-stage → 0.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/LICENSE +674 -0
- package/README.md +56 -2
- package/bin/nodegx-online.js +123 -0
- package/dist/cloud-bundle.cjs +154357 -0
- package/dist/cloudflare-deploy.cjs +5120 -0
- package/dist/cloudflare-domain.cjs +504 -0
- package/dist/package.json +6 -0
- package/dist/scripts/build.js +2 -0
- package/dist/worker/LICENSE +21 -0
- package/dist/worker/worker.mjs +109100 -0
- package/package.json +40 -4
- package/src/prebuilt-worker.cjs +24 -0
package/package.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodegx/backend",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Put a NodeGX app online on your own Cloudflare account: its pages, its backend, its rules and its functions, on one Worker, the same address every time.",
|
|
5
|
+
"license": "GPL-3.0-only",
|
|
6
|
+
"homepage": "https://nodegx.io",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/The-Low-Code-Foundation/NodeGX.git",
|
|
10
|
+
"directory": "packages/nodegx-backend-npm"
|
|
11
|
+
},
|
|
12
|
+
"bin": {
|
|
13
|
+
"nodegx-online": "bin/nodegx-online.js"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"bin",
|
|
17
|
+
"dist/cloudflare-deploy.cjs",
|
|
18
|
+
"dist/cloudflare-domain.cjs",
|
|
19
|
+
"dist/cloud-bundle.cjs",
|
|
20
|
+
"dist/package.json",
|
|
21
|
+
"dist/scripts",
|
|
22
|
+
"dist/worker",
|
|
23
|
+
"src/prebuilt-worker.cjs",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=20"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@nodegx/export": "^0.2.6",
|
|
32
|
+
"@nodegx/preview": "^0.2.9"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "node build.mjs",
|
|
36
|
+
"prepack": "node build.mjs && node ../noodl-mcp/check-pack-paths.mjs",
|
|
37
|
+
"test": "node --test"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `require('esbuild')` is inside the INSTALLED deploy (`dist/cloudflare-deploy.cjs`; `build.mjs` aliases it).
|
|
3
|
+
*
|
|
4
|
+
* The deploy calls esbuild once, to bundle the Worker (`worker.ts` and the whole backend). Nothing in that bundle is
|
|
5
|
+
* the app's own (the app's two modules stay imports), so the pack built it already (`dist/worker/worker.mjs`), and
|
|
6
|
+
* this "build" copies it to where the deploy asked. Any other build is a refusal that names this file: an install
|
|
7
|
+
* has no esbuild and no backend source.
|
|
8
|
+
*/
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
|
|
14
|
+
exports.build = async function build(options) {
|
|
15
|
+
const entry = String((options && options.entryPoints && options.entryPoints[0]) || '');
|
|
16
|
+
const prebuilt = process.env.NODEGX_CLOUDFLARE_WORKER;
|
|
17
|
+
if (path.basename(entry) !== 'worker.ts' || !prebuilt) {
|
|
18
|
+
throw new Error(`@nodegx/backend bundles nothing at deploy time (asked for ${entry || 'no entry'}); see src/prebuilt-worker.cjs.`);
|
|
19
|
+
}
|
|
20
|
+
if (!fs.existsSync(prebuilt)) throw new Error(`The prebuilt Worker is not here (${prebuilt}): this install is incomplete.`);
|
|
21
|
+
fs.mkdirSync(path.dirname(options.outfile), { recursive: true });
|
|
22
|
+
fs.copyFileSync(prebuilt, options.outfile);
|
|
23
|
+
return { errors: [], warnings: [] };
|
|
24
|
+
};
|