@x-tech-laboratories/x-app 0.99.0 → 0.100.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 -2
- package/dist/app_new.js +18 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -209,10 +209,11 @@ A change an app needs in the base goes into the base, so no app keeps a copy of
|
|
|
209
209
|
|
|
210
210
|
The rest of an app's files are short calls into X-App too:
|
|
211
211
|
|
|
212
|
-
- **Configs
|
|
212
|
+
- **Configs** sit in the app's `config/` folder: `tsconfig.<target>.json` extends `tsconfig.base.json` and
|
|
213
213
|
`@x-tech-laboratories/x-app/config/tsconfig/<target>.json`; `vite.config.ts`, `electron.vite.config.ts` and
|
|
214
214
|
`vite.android.config.ts` export a preset from `config/vite` or `config/electron_vite`; `vitest.config.ts` merges
|
|
215
|
-
`vitest_config()` with the app's coverage floor.
|
|
215
|
+
`vitest_config()` with the app's coverage floor. The npm scripts pass each with `-c` or `--config`; only
|
|
216
|
+
`tsconfig.json` (its references), `package.json` and `capacitor.config.json` stay at the root, where the tools look.
|
|
216
217
|
- **Nix**: X-App's flake has a `lib` with `package`, `desktop_package`, `module`, `shell` and `android_shell`, each
|
|
217
218
|
taking the app's package set and its `nix/app.nix` (name, display name, variables' prefix, port, database file and
|
|
218
219
|
words); the app's `nix/flake.nix` takes `github:x-tech-laboratories/X-App` as an input and calls them.
|
package/dist/app_new.js
CHANGED
|
@@ -36,16 +36,16 @@ function package_json(names, options) {
|
|
|
36
36
|
const prefix = names.env_prefix;
|
|
37
37
|
const scripts = {
|
|
38
38
|
"dev:server": `${prefix}_CONFIG=\${${prefix}_CONFIG:-config.example.json} ${prefix}_PASSWORD_HASH_FILE=\${${prefix}_PASSWORD_HASH_FILE:-dev-data/password.hash} node --watch src/server/main.ts`,
|
|
39
|
-
"dev:web": "vite",
|
|
40
|
-
...(options.desktop ? { dev: `${prefix}_USER_DATA=\${${prefix}_USER_DATA:-dev-data/desktop} electron-vite dev` } : {}),
|
|
41
|
-
build: "tsc -b && vite build",
|
|
42
|
-
...(options.desktop ? { "build:desktop": "tsc -b && electron-vite build" } : {}),
|
|
43
|
-
...(options.android ? { "build:android": "tsc -b && vite build -c vite.android.config.ts && cap sync android" } : {}),
|
|
39
|
+
"dev:web": "vite -c config/vite.config.ts",
|
|
40
|
+
...(options.desktop ? { dev: `${prefix}_USER_DATA=\${${prefix}_USER_DATA:-dev-data/desktop} electron-vite dev -c config/electron.vite.config.ts` } : {}),
|
|
41
|
+
build: "tsc -b && vite build -c config/vite.config.ts",
|
|
42
|
+
...(options.desktop ? { "build:desktop": "tsc -b && electron-vite build -c config/electron.vite.config.ts" } : {}),
|
|
43
|
+
...(options.android ? { "build:android": "tsc -b && vite build -c config/vite.android.config.ts && cap sync android" } : {}),
|
|
44
44
|
start: "NODE_ENV=production node src/server/main.ts",
|
|
45
|
-
...(options.desktop ? { "start:desktop": "electron-vite preview" } : {}),
|
|
45
|
+
...(options.desktop ? { "start:desktop": "electron-vite preview -c config/electron.vite.config.ts" } : {}),
|
|
46
46
|
typecheck: "tsc -b",
|
|
47
|
-
test: "vitest run",
|
|
48
|
-
coverage: "vitest run --coverage",
|
|
47
|
+
test: "vitest run --config config/vitest.config.ts",
|
|
48
|
+
coverage: "vitest run --coverage --config config/vitest.config.ts",
|
|
49
49
|
lint: "oxlint",
|
|
50
50
|
"hash-password": "node src/server/hash_password.ts",
|
|
51
51
|
icons: "x-app-icons",
|
|
@@ -293,22 +293,22 @@ export function NotesView() {
|
|
|
293
293
|
}
|
|
294
294
|
function config_files(names, options) {
|
|
295
295
|
const preset = "@x-tech-laboratories/x-app/config/tsconfig";
|
|
296
|
-
const node_include = ["../src/app.ts", "../src/server", ...(options.desktop ? ["../src/daemon", "../src/main", "../src/preload"] : []), "../src/shared", "
|
|
296
|
+
const node_include = ["../src/app.ts", "../src/server", ...(options.desktop ? ["../src/daemon", "../src/main", "../src/preload"] : []), "../src/shared", "vite.config.ts", ...(options.android ? ["vite.android.config.ts"] : []), ...(options.desktop ? ["electron.vite.config.ts"] : []), "vitest.config.ts"];
|
|
297
297
|
const target = (name, include) => json({ extends: ["./tsconfig.base.json", `${preset}/${name}.json`], include, compilerOptions: { tsBuildInfoFile: `../node_modules/.tmp/tsconfig.${name}.tsbuildinfo` } });
|
|
298
298
|
return {
|
|
299
|
-
"tsconfig.json": json({ files: [], references: ["node", "web", "tests"].map((name) => ({ path: `./
|
|
300
|
-
"
|
|
301
|
-
"
|
|
302
|
-
"
|
|
303
|
-
"
|
|
304
|
-
"vite.config.ts": `// The page for a browser, from X-App's preset.
|
|
299
|
+
"tsconfig.json": json({ files: [], references: ["node", "web", "tests"].map((name) => ({ path: `./config/tsconfig.${name}.json` })) }),
|
|
300
|
+
"config/tsconfig.base.json": json({ extends: `${preset}/base.json` }),
|
|
301
|
+
"config/tsconfig.node.json": target("node", node_include),
|
|
302
|
+
"config/tsconfig.web.json": target("web", ["../src/app.ts", "../src/web", "../src/shared"]),
|
|
303
|
+
"config/tsconfig.tests.json": target("tests", ["../tests", "../src"]),
|
|
304
|
+
"config/vite.config.ts": `// The page for a browser, from X-App's preset.
|
|
305
305
|
|
|
306
306
|
import { defineConfig } from "vite";
|
|
307
307
|
import { web_vite_config } from "@x-tech-laboratories/x-app/config/vite";
|
|
308
308
|
|
|
309
309
|
export default defineConfig(web_vite_config({ port: ${options.port} }));
|
|
310
310
|
`,
|
|
311
|
-
"vitest.config.ts": `// X-App's test preset, with this app's coverage floor, which only rises.
|
|
311
|
+
"config/vitest.config.ts": `// X-App's test preset, with this app's coverage floor, which only rises.
|
|
312
312
|
|
|
313
313
|
import { defineConfig, mergeConfig } from "vitest/config";
|
|
314
314
|
import { vitest_config } from "@x-tech-laboratories/x-app/config/vitest";
|
|
@@ -332,7 +332,7 @@ export default mergeConfig(
|
|
|
332
332
|
`,
|
|
333
333
|
...(options.desktop
|
|
334
334
|
? {
|
|
335
|
-
"electron.vite.config.ts": `// The desktop app's window, daemon, preload and page, from X-App's preset.
|
|
335
|
+
"config/electron.vite.config.ts": `// The desktop app's window, daemon, preload and page, from X-App's preset.
|
|
336
336
|
|
|
337
337
|
import { defineConfig } from "electron-vite";
|
|
338
338
|
import { desktop_vite_config } from "@x-tech-laboratories/x-app/config/electron_vite";
|
|
@@ -343,7 +343,7 @@ export default defineConfig(desktop_vite_config());
|
|
|
343
343
|
: {}),
|
|
344
344
|
...(options.android
|
|
345
345
|
? {
|
|
346
|
-
"vite.android.config.ts": `// The page for the Capacitor app, which keeps its database on the phone, from X-App's preset.
|
|
346
|
+
"config/vite.android.config.ts": `// The page for the Capacitor app, which keeps its database on the phone, from X-App's preset.
|
|
347
347
|
|
|
348
348
|
import { defineConfig } from "vite";
|
|
349
349
|
import { android_vite_config } from "@x-tech-laboratories/x-app/config/vite";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@x-tech-laboratories/x-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.100.0",
|
|
4
4
|
"description": "Code the X-apps share: agents and their long runs, passwords and sign-in, the Fastify server pieces, durations, and the web page's helpers and widgets",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"repository": {
|