@antelopejs/dms-frontend 0.0.1 → 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/README.md +3 -3
- package/dist/commands/build.js +1 -1
- package/dist/commands/dev.js +1 -1
- package/dist/commands/prepare.js +1 -1
- package/dist/commands/start.js +2 -2
- package/dist/config.js +1 -1
- package/dist/discovery.js +1 -1
- package/dist/index.js +0 -0
- package/package.json +16 -14
- package/templates/vue/email-renderer.ts +2 -2
- package/templates/vue/email-runtime.ts +1 -1
- package/templates/vue/server/auth/backend.mjs +1 -1
- package/templates/vue/server/tester.mjs +1 -1
- package/templates/vue/server.mjs +3 -3
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ The generated application uses `@inertiajs/vue3`, `@nuxt/ui/vite` with `{ router
|
|
|
62
62
|
|
|
63
63
|
Vue modules use `dms.frontend.ts` and the `#dms-inertia/frontend-module` SDK alias, which replaces the former `#cms-inertia` alias and is the import path every DMS frontend module now uses. Email templates register separately through `dms.email.ts`.
|
|
64
64
|
|
|
65
|
-
An email entry exports `serverEmailTemplates` and may export a plain `appConfig` object, such as shared branding defaults. Email rendering merges these configurations in manifest-priority order and provides them to `useDmsAppConfig` per render. Public runtime options come from the module manifest; `
|
|
65
|
+
An email entry exports `serverEmailTemplates` and may export a plain `appConfig` object, such as shared branding defaults. Email rendering merges these configurations in manifest-priority order and provides them to `useDmsAppConfig` per render. Public runtime options come from the module manifest; `DMS_CLIENT_BASE_URL` overrides `public.dms.clientBaseUrl`. Email entries must not import the browser frontend module.
|
|
66
66
|
|
|
67
67
|
Email builds ship complete merged translation catalogs as JSON under `dist/server/locales/`, separate from executable JavaScript. Deploy the entire `dist/server` directory. Each render loads only its requested language and the English fallback; arbitrary translation keys and module overrides remain available. Unknown languages fall back to English, while missing or corrupt files for a supported language fail rendering rather than silently dropping translations. The source harness keeps the 256 KiB JavaScript ceiling and reports locale-data bytes separately.
|
|
68
68
|
|
|
@@ -89,7 +89,7 @@ The SDK also exposes `use` for Vue plugins. Entries execute by descending manife
|
|
|
89
89
|
|
|
90
90
|
## Discovery, caching, and security
|
|
91
91
|
|
|
92
|
-
In development, `ajs dms` discovers the backend from the nearest live `.antelope/dev.json`. It reads the local bootstrap credential from `.antelope/dms-dev.json` only when that discovered backend matches the destination URL. For production and CI, set `
|
|
92
|
+
In development, `ajs dms` discovers the backend from the nearest live `.antelope/dev.json`. It reads the local bootstrap credential from `.antelope/dms-dev.json` only when that discovered backend matches the destination URL. For production and CI, set `DMS_API_BASE_URL` and `DMS_BOOTSTRAP_SECRET` in the environment rather than passing credentials on the command line.
|
|
93
93
|
|
|
94
94
|
Each canonical backend URL gets an owner-only workspace under `~/.antelopejs/dms-frontend`. Manifest caches, private module configuration, and extracted archives retain restrictive permissions. `--offline` reuses the last successful manifest and archive; an authorization failure never falls back to privileged cached data.
|
|
95
95
|
|
|
@@ -105,7 +105,7 @@ frontend-module registry drives server and client entries.
|
|
|
105
105
|
|
|
106
106
|
| Option | Environment | Purpose |
|
|
107
107
|
| --- | --- | --- |
|
|
108
|
-
| `-b, --backend-url` | `
|
|
108
|
+
| `-b, --backend-url` | `DMS_API_BASE_URL` | DMS backend URL |
|
|
109
109
|
| `-p, --port` | `PORT` | Frontend port, default `3001` |
|
|
110
110
|
| `-f, --force` | | Reinstall workspace dependencies |
|
|
111
111
|
| `--offline` | `DMS_OFFLINE` | Reuse cached manifest and archives |
|
package/dist/commands/build.js
CHANGED
|
@@ -18,7 +18,7 @@ function cmdBuild() {
|
|
|
18
18
|
.addOption(common_1.Options.bootstrapSecret)
|
|
19
19
|
.action(async (options) => {
|
|
20
20
|
if (!options.backendUrl) {
|
|
21
|
-
(0, cli_ui_1.error)("Backend URL is required. Use -b <url> or set
|
|
21
|
+
(0, cli_ui_1.error)("Backend URL is required. Use -b <url> or set DMS_API_BASE_URL.");
|
|
22
22
|
process.exit(1);
|
|
23
23
|
}
|
|
24
24
|
const spinner = new cli_ui_1.Spinner("Setting up workspace...");
|
package/dist/commands/dev.js
CHANGED
|
@@ -99,7 +99,7 @@ function cmdDev() {
|
|
|
99
99
|
PORT: String(port),
|
|
100
100
|
DMS_DEV: "true",
|
|
101
101
|
DMS_COOKIE_SECURE: process.env.DMS_COOKIE_SECURE ?? "false",
|
|
102
|
-
|
|
102
|
+
DMS_API_BASE_URL: backendUrl,
|
|
103
103
|
DMS_BOOTSTRAP_SECRET: bootstrapSecret,
|
|
104
104
|
NODE_OPTIONS: "--max-old-space-size=4096",
|
|
105
105
|
NODE_PATH: nodeModulesDir,
|
package/dist/commands/prepare.js
CHANGED
|
@@ -17,7 +17,7 @@ function cmdPrepare() {
|
|
|
17
17
|
.addOption(common_1.Options.bootstrapSecret)
|
|
18
18
|
.action(async (options) => {
|
|
19
19
|
if (!options.backendUrl) {
|
|
20
|
-
(0, cli_ui_1.warning)("Backend URL not set; skipping prepare. Pass -b <url> or set
|
|
20
|
+
(0, cli_ui_1.warning)("Backend URL not set; skipping prepare. Pass -b <url> or set DMS_API_BASE_URL to generate types.");
|
|
21
21
|
process.exit(0);
|
|
22
22
|
}
|
|
23
23
|
const spinner = new cli_ui_1.Spinner("Setting up workspace...");
|
package/dist/commands/start.js
CHANGED
|
@@ -17,7 +17,7 @@ function cmdStart() {
|
|
|
17
17
|
.addOption(common_1.Options.port)
|
|
18
18
|
.action(async (options) => {
|
|
19
19
|
if (!options.backendUrl) {
|
|
20
|
-
(0, cli_ui_1.error)("Backend URL is required. Use -b <url> or set
|
|
20
|
+
(0, cli_ui_1.error)("Backend URL is required. Use -b <url> or set DMS_API_BASE_URL.");
|
|
21
21
|
process.exit(1);
|
|
22
22
|
}
|
|
23
23
|
const workspaceDir = (0, common_1.getWorkspaceDir)(options.backendUrl);
|
|
@@ -40,7 +40,7 @@ function cmdStart() {
|
|
|
40
40
|
env: {
|
|
41
41
|
...process.env,
|
|
42
42
|
PORT: options.port,
|
|
43
|
-
|
|
43
|
+
DMS_API_BASE_URL: options.backendUrl,
|
|
44
44
|
DMS_COOKIE_SECURE: process.env.DMS_COOKIE_SECURE ?? "true",
|
|
45
45
|
},
|
|
46
46
|
});
|
package/dist/config.js
CHANGED
|
@@ -83,7 +83,7 @@ function booleanFromEnv(name) {
|
|
|
83
83
|
return !["", "0", "false", "no", "off"].includes(value.trim().toLowerCase());
|
|
84
84
|
}
|
|
85
85
|
exports.Options = {
|
|
86
|
-
backendUrl: new commander_1.Option("-b, --backend-url <url>", "Backend DMS URL (when omitted, dev mode discovers it from the enclosing antelope project's .antelope/dev.json)").env("
|
|
86
|
+
backendUrl: new commander_1.Option("-b, --backend-url <url>", "Backend DMS URL (when omitted, dev mode discovers it from the enclosing antelope project's .antelope/dev.json)").env("DMS_API_BASE_URL"),
|
|
87
87
|
port: new commander_1.Option("-p, --port <port>", "Port to run on")
|
|
88
88
|
.default("3001")
|
|
89
89
|
.env("PORT"),
|
package/dist/discovery.js
CHANGED
|
@@ -82,7 +82,7 @@ function describeDiscoveryFailure(result) {
|
|
|
82
82
|
return ("No backend URL provided and no running antelope project found.\n" +
|
|
83
83
|
` Searched for ${exports.DEV_REGISTRY_RELATIVE_PATH} from the current directory upward.\n` +
|
|
84
84
|
" Either run this command inside an antelope project started with 'ajs project dev',\n" +
|
|
85
|
-
" or pass the backend explicitly with -b <url> (env:
|
|
85
|
+
" or pass the backend explicitly with -b <url> (env: DMS_API_BASE_URL).");
|
|
86
86
|
case "stale":
|
|
87
87
|
return (`Found ${(0, node_path_1.join)(result.projectDir, exports.DEV_REGISTRY_RELATIVE_PATH)} but its process (pid ${result.pid}) is no longer running.\n` +
|
|
88
88
|
" Start the backend with 'ajs project dev', or pass -b <url> explicitly.");
|
package/dist/index.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/dms-frontend",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Vue 3, Vite, and Inertia frontend loader for AntelopeJS DMS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelope",
|
|
@@ -31,6 +31,19 @@
|
|
|
31
31
|
"provenance": true,
|
|
32
32
|
"registry": "https://registry.npmjs.org/"
|
|
33
33
|
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "rimraf dist && tsc -p tsconfig.build.json",
|
|
36
|
+
"prepack": "pnpm run build",
|
|
37
|
+
"release": "pnpm run lint && pnpm run test && pnpm run prepack && release-it",
|
|
38
|
+
"test": "node --import tsx --test tests/*.test.ts tests/*.test.mts",
|
|
39
|
+
"test:real-source": "pnpm run build && node dist/verify-source-runner.js",
|
|
40
|
+
"format": "oxfmt .",
|
|
41
|
+
"lint": "oxlint && oxfmt --check .",
|
|
42
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
43
|
+
"lint:fix": "oxlint --fix --max-warnings=1000000 && oxfmt .",
|
|
44
|
+
"knip": "knip --dependencies",
|
|
45
|
+
"knip:all": "knip"
|
|
46
|
+
},
|
|
34
47
|
"dependencies": {
|
|
35
48
|
"boxen": "^5.1.2",
|
|
36
49
|
"chalk": "^4.1.2",
|
|
@@ -82,16 +95,5 @@
|
|
|
82
95
|
"@oxc-parser/binding-linux-x64-gnu": "^0.95.0",
|
|
83
96
|
"@oxc-parser/binding-win32-x64-msvc": "^0.95.0"
|
|
84
97
|
},
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
"release": "pnpm run lint && pnpm run test && pnpm run prepack && release-it",
|
|
88
|
-
"test": "node --import tsx --test tests/*.test.ts tests/*.test.mts",
|
|
89
|
-
"test:real-source": "pnpm run build && node dist/verify-source-runner.js",
|
|
90
|
-
"format": "oxfmt .",
|
|
91
|
-
"lint": "oxlint && oxfmt --check .",
|
|
92
|
-
"typecheck": "tsc -p tsconfig.json",
|
|
93
|
-
"lint:fix": "oxlint --fix --max-warnings=1000000 && oxfmt .",
|
|
94
|
-
"knip": "knip --dependencies",
|
|
95
|
-
"knip:all": "knip"
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
+
"packageManager": "pnpm@10.6.5"
|
|
99
|
+
}
|
|
@@ -147,8 +147,8 @@ export async function renderEmail(
|
|
|
147
147
|
);
|
|
148
148
|
app.provide("dmsEmailRuntimeConfig", {
|
|
149
149
|
public: defu(
|
|
150
|
-
process.env.
|
|
151
|
-
? { dms: { clientBaseUrl: process.env.
|
|
150
|
+
process.env.DMS_CLIENT_BASE_URL
|
|
151
|
+
? { dms: { clientBaseUrl: process.env.DMS_CLIENT_BASE_URL } }
|
|
152
152
|
: {},
|
|
153
153
|
publicConfig,
|
|
154
154
|
{ dms: { clientBaseUrl: "" } },
|
|
@@ -12,7 +12,7 @@ export function useDmsAppConfig(): Record<string, unknown> {
|
|
|
12
12
|
|
|
13
13
|
export function useDmsRuntimeConfig(): EmailRuntimeConfig {
|
|
14
14
|
return inject<EmailRuntimeConfig>("dmsEmailRuntimeConfig", {
|
|
15
|
-
public: { dms: { clientBaseUrl: process.env.
|
|
15
|
+
public: { dms: { clientBaseUrl: process.env.DMS_CLIENT_BASE_URL ?? "" } },
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -34,7 +34,7 @@ export async function backend(path, request, options = {}) {
|
|
|
34
34
|
if (options.relay)
|
|
35
35
|
headers["x-dms-oauth-relay"] = process.env.DMS_OAUTH_RELAY_SECRET ?? "";
|
|
36
36
|
if (options.body !== undefined) headers["content-type"] = "application/json";
|
|
37
|
-
const response = await fetch(new URL(path, process.env.
|
|
37
|
+
const response = await fetch(new URL(path, process.env.DMS_API_BASE_URL), {
|
|
38
38
|
method: options.method ?? "GET",
|
|
39
39
|
headers,
|
|
40
40
|
body: options.body === undefined ? undefined : JSON.stringify(options.body),
|
|
@@ -71,7 +71,7 @@ function targetUrl(path) {
|
|
|
71
71
|
)
|
|
72
72
|
return invalidInput();
|
|
73
73
|
path.split("?", 1)[0].split("/").forEach(validatePathSegment);
|
|
74
|
-
const base = new URL(process.env.
|
|
74
|
+
const base = new URL(process.env.DMS_API_BASE_URL);
|
|
75
75
|
if (
|
|
76
76
|
!["http:", "https:"].includes(base.protocol) ||
|
|
77
77
|
base.username ||
|
package/templates/vue/server.mjs
CHANGED
|
@@ -142,14 +142,14 @@ function serverComponentFetch(request) {
|
|
|
142
142
|
});
|
|
143
143
|
return ofetch(path, {
|
|
144
144
|
...options,
|
|
145
|
-
baseURL: process.env.
|
|
145
|
+
baseURL: process.env.DMS_API_BASE_URL,
|
|
146
146
|
headers,
|
|
147
147
|
});
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
async function backendJson(path, request) {
|
|
152
|
-
const response = await fetch(new URL(path, process.env.
|
|
152
|
+
const response = await fetch(new URL(path, process.env.DMS_API_BASE_URL), {
|
|
153
153
|
headers: backendHeaders(request),
|
|
154
154
|
});
|
|
155
155
|
if (!response.ok) {
|
|
@@ -245,7 +245,7 @@ async function proxy(request, response, fallbackOnNotFound = false) {
|
|
|
245
245
|
response.end(JSON.stringify({ error: "Forbidden" }));
|
|
246
246
|
return true;
|
|
247
247
|
}
|
|
248
|
-
const target = new URL(request.url, process.env.
|
|
248
|
+
const target = new URL(request.url, process.env.DMS_API_BASE_URL);
|
|
249
249
|
const upstream = await fetch(target, {
|
|
250
250
|
method: request.method,
|
|
251
251
|
headers: backendHeaders(request),
|