@akanjs/cli 3.1.1 → 3.1.2-rc.1
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/.build-stamp +1 -1
- package/CodeAgent-dyc45f5w.js +11 -0
- package/{CodeAgentRpcHost-9g27hmer.js → CodeAgentRpcHost-6dzfkvsc.js} +1 -1
- package/CodeAgentRpcListener-tcwrdvst.js +182 -0
- package/{CodeTui-h6yz2kvq.js → CodeTui-q55b2zrn.js} +25 -8
- package/TunnelShare-hdq9h1hr.js +14 -0
- package/{agent.command-3r4jsck8.js → agent.command-20zaqe60.js} +18 -15
- package/akanCode.js +8 -7
- package/{application.command-g7xv6ad0.js → application.command-nd0fshsk.js} +11 -11
- package/{applicationBuildRunner-qvjnhr9j.js → applicationBuildRunner-s13x3zqb.js} +10 -9
- package/buildBatch.proc.js +6 -6
- package/{cloud.command-6ebygmhw.js → cloud.command-8kbddsz9.js} +25 -18
- package/cloud.script-hgvvajm3.js +27 -0
- package/code.command-625bg8s8.js +345 -0
- package/{context.command-svdh6b2w.js → context.command-p6haqjay.js} +19 -18
- package/context.runner-rsnqnk9j.js +27 -0
- package/{dependencyScanner-3afj2vt1.js → dependencyScanner-78sq8m4q.js} +2 -2
- package/{fileSys-wzzrntkw.js → fileSys-zpvt5gtf.js} +1 -1
- package/{guideline.command-qwp3tnjx.js → guideline.command-195g0h9a.js} +4 -4
- package/guidelines/agentRule/agentRule.instruction.md +22 -8
- package/guidelines/conventions/rules/auth.md +5 -4
- package/guidelines/conventions/rules/config.md +5 -1
- package/guidelines/conventions/rules/gates.md +2 -1
- package/guidelines/conventions/rules/module.md +1 -1
- package/guidelines/conventions/rules/server.md +8 -3
- package/guidelines/conventions/rules/ssr.md +2 -2
- package/guidelines/conventions/rules/tsx.md +2 -1
- package/guidelines/pageRule/pageRule.instruction.md +4 -4
- package/guidelines/runtimeRule/runtimeRule.instruction.md +35 -25
- package/guidelines/ssrRule/ssrRule.instruction.md +11 -10
- package/guidelines/transportRule/transportRule.instruction.md +5 -4
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +1 -1
- package/incrementalBuilder.proc.js +4 -4
- package/{index-w4k2ragk.js → index-00a7j05x.js} +7 -7
- package/{index-w7q6h97v.js → index-0j1t1h2b.js} +3 -1
- package/{index-payhwt51.js → index-1h2jc0x3.js} +141 -67
- package/{index-vxmy1p4f.js → index-1qsd8ft1.js} +63 -123
- package/{index-s6da8ta9.js → index-2mwjshz5.js} +158 -51
- package/index-2nxk8wgs.js +266 -0
- package/{index-k5jbcxyh.js → index-2phm56a1.js} +49 -8
- package/{index-jje9qzyq.js → index-35j83zkd.js} +37 -3
- package/{index-m5n3ka0p.js → index-4am4dvmf.js} +13 -2
- package/index-75y7bcz4.js +28 -0
- package/{index-b8c289dx.js → index-7apsdr5g.js} +55 -12
- package/{index-8559hsz4.js → index-84h43kg6.js} +6 -5
- package/{index-eja64h28.js → index-9zy8479y.js} +5 -3
- package/{index-96wzdhfh.js → index-a1vb3x7t.js} +209 -36
- package/{index-52w0fvh8.js → index-bns3wcpc.js} +15 -0
- package/{index-am36s3jh.js → index-cjmjvg4r.js} +157 -117
- package/{index-1p0qbq3m.js → index-defp4gmb.js} +1 -1
- package/{index-4pdts00b.js → index-ewbmfarf.js} +10 -8
- package/{index-9rvcs76p.js → index-fhw7yq2d.js} +10 -10
- package/{index-8scw1pjk.js → index-g500c5j9.js} +178 -82
- package/{index-qxzrp5xt.js → index-g841cap9.js} +4 -4
- package/{index-qkkdhjm6.js → index-gr9thy79.js} +5 -5
- package/{index-4pf8g7ff.js → index-h7hehkw6.js} +3 -0
- package/{index-4mj92tsh.js → index-hm0tn7qv.js} +73 -68
- package/{index-r2wedvqn.js → index-j6eeh5d7.js} +1 -1
- package/{index-tgt2fnd6.js → index-j7hwy56s.js} +3 -3
- package/{index-rnphv731.js → index-jc2zbwra.js} +2 -2
- package/{index-z4b84y6k.js → index-khk05tsf.js} +1 -1
- package/{index-tvehn2sp.js → index-qd7xn2bk.js} +1 -1
- package/{index-266dewjs.js → index-qw6814m4.js} +53 -15
- package/{index-zcf6k8a5.js → index-raz588b3.js} +47 -12
- package/{index-at7bz0xq.js → index-s4nvxpzm.js} +2 -0
- package/{index-3yz30c07.js → index-sp0qsr7a.js} +114 -12
- package/{index-1shvxzt0.js → index-sveq36gh.js} +39 -42
- package/{index-r2w2eh93.js → index-t1t9wq9a.js} +4 -4
- package/index-t78230d7.js +191 -0
- package/{index-r0k3ham2.js → index-tgqameyb.js} +4 -4
- package/{index-dd44g6vz.js → index-tp56652m.js} +5 -5
- package/index-w15mg3km.js +389 -0
- package/{index-xq543a5y.js → index-y4kcmbt2.js} +2 -2
- package/index-yf9wc28h.js +52 -0
- package/{index-xqgwjz7a.js → index-zbrwnmf1.js} +9 -7
- package/{index-xxfy1jp2.js → index-zttm13c3.js} +4 -4
- package/index.js +24 -24
- package/{library.command-2853y6mk.js → library.command-63hgt9te.js} +4 -4
- package/{localRegistry.command-76ds31p4.js → localRegistry.command-g3f8k25t.js} +43 -23
- package/{module.command-yfnb0abs.js → module.command-r4sa2khp.js} +7 -6
- package/{package.command-d9s86hp9.js → package.command-96eheyvd.js} +5 -5
- package/package.json +2 -2
- package/{page.command-6a8a8rd1.js → page.command-gs6d841d.js} +4 -4
- package/{pipeline.command-rt3rwd2z.js → pipeline.command-wdfvdbfj.js} +3 -3
- package/{primitive.command-emcebgrq.js → primitive.command-dfsv4mpe.js} +8 -7
- package/{projectTypecheck-51m7eh1f.js → projectTypecheck-kqj1t6hb.js} +1 -1
- package/{prompter-hgcta8pb.js → prompter-qrwx1p17.js} +2 -2
- package/{quality.command-xtrk0n3x.js → quality.command-webzxee2.js} +6 -4
- package/{repair.command-51szxnxx.js → repair.command-3r3j1xre.js} +7 -6
- package/{scalar.command-8qv27t82.js → scalar.command-e8y47j6d.js} +6 -5
- package/skills/akan-agent/SKILL.md +8 -1
- package/skills/akan-code/SKILL.md +37 -11
- package/skills/akan-debug/SKILL.md +2 -1
- package/skills/akan-err/SKILL.md +2 -1
- package/skills/akan-query/SKILL.md +3 -2
- package/skills/akan-runtime/SKILL.md +3 -0
- package/{subspace.command-pn56pnh8.js → subspace.command-a1sf9n5a.js} +12 -10
- package/templates/appSample/lib/task/task.signal.ts +14 -9
- package/templates/appSample/srvkit/guards.ts +11 -0
- package/templates/service/__model__.dictionary.ts +3 -5
- package/templates/workspaceRoot/.gitignore.template +1 -0
- package/{tunnel.command-q2h0j2en.js → tunnel.command-dcb0wg93.js} +25 -13
- package/{verify.command-z1dsbmrt.js → verify.command-yyepccbh.js} +13 -11
- package/{workflow.command-r3y67jeq.js → workflow.command-z5pg9ay0.js} +12 -11
- package/{workspace.command-t2f0xsrw.js → workspace.command-d7x5jttw.js} +74 -47
- package/CodeAgent-35wnb7w5.js +0 -9
- package/CodeAgentRpcListener-7p7z5dd7.js +0 -97
- package/TunnelShare-xyjpa7gx.js +0 -14
- package/cloud.script-0s1jybd5.js +0 -26
- package/code.command-mpkm2emr.js +0 -167
- package/context.runner-ch0z3a8g.js +0 -26
- package/index-c6eggbee.js +0 -123
- package/index-ksfgqq1x.js +0 -49
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getDirname2,
|
|
4
4
|
FileSys2
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-bns3wcpc.js";
|
|
6
6
|
|
|
7
7
|
// pkgs/@akanjs/devkit/executors.ts
|
|
8
8
|
import {
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
stat as stat2,
|
|
23
23
|
symlink
|
|
24
24
|
} from "fs/promises";
|
|
25
|
-
import
|
|
25
|
+
import path14 from "path";
|
|
26
26
|
import { pathToFileURL } from "url";
|
|
27
27
|
import {
|
|
28
28
|
capitalize,
|
|
@@ -49,7 +49,7 @@ ${block}`;
|
|
|
49
49
|
var extractBlockVersion = (content) => content.match(/<!-- akan:agent:version ([^\s]+) -->/)?.[1] ?? null;
|
|
50
50
|
var readDevkitVersion = async () => {
|
|
51
51
|
const { readFile } = await import("fs/promises");
|
|
52
|
-
const { getDirname } = await import("./fileSys-
|
|
52
|
+
const { getDirname } = await import("./fileSys-zpvt5gtf.js");
|
|
53
53
|
try {
|
|
54
54
|
const raw = await readFile(`${getDirname(import.meta.url)}/package.json`, "utf-8");
|
|
55
55
|
return JSON.parse(raw).version ?? null;
|
|
@@ -656,6 +656,7 @@ class AkanAppConfig {
|
|
|
656
656
|
this.i18n = resolveAkanI18nConfig(config?.i18n);
|
|
657
657
|
process.env.AKAN_PUBLIC_DEFAULT_LOCALE = this.i18n.defaultLocale;
|
|
658
658
|
process.env.AKAN_PUBLIC_LOCALES = this.i18n.locales.join(",");
|
|
659
|
+
process.env.AKAN_PUBLIC_LOCALE_PREFIX = this.i18n.localePrefix ?? "always";
|
|
659
660
|
this.api = {
|
|
660
661
|
prefix: normalizeRoutePrefix(config?.api?.prefix) ?? "/api",
|
|
661
662
|
websocketPrefix: normalizeRoutePrefix(config?.api?.websocketPrefix) ?? "/ws"
|
|
@@ -857,6 +858,8 @@ class AkanAppConfig {
|
|
|
857
858
|
"deepLinks",
|
|
858
859
|
"updates",
|
|
859
860
|
"devtools",
|
|
861
|
+
"csp",
|
|
862
|
+
"openUrls",
|
|
860
863
|
"ios",
|
|
861
864
|
"android",
|
|
862
865
|
"desktop"
|
|
@@ -988,6 +991,7 @@ class AkanAppConfig {
|
|
|
988
991
|
...this.basePaths.size ? { AKAN_PUBLIC_BASE_PATHS: [...this.basePaths].join(",") } : {},
|
|
989
992
|
AKAN_PUBLIC_DEFAULT_LOCALE: this.i18n.defaultLocale,
|
|
990
993
|
AKAN_PUBLIC_LOCALES: this.i18n.locales.join(","),
|
|
994
|
+
...this.i18n.localePrefix === "as-needed" ? { AKAN_PUBLIC_LOCALE_PREFIX: this.i18n.localePrefix } : {},
|
|
991
995
|
AKAN_PUBLIC_API_PREFIX: this.api.prefix,
|
|
992
996
|
AKAN_PUBLIC_WS_PREFIX: this.api.websocketPrefix,
|
|
993
997
|
AKAN_PUBLIC_OPERATION_MODE: "cloud",
|
|
@@ -997,6 +1001,11 @@ class AkanAppConfig {
|
|
|
997
1001
|
...this.web.csr ? {} : { AKAN_CSR: "false" }
|
|
998
1002
|
};
|
|
999
1003
|
}
|
|
1004
|
+
static localImageGuard = [
|
|
1005
|
+
"ARG AKAN_ALLOW_LOCAL_IMAGE",
|
|
1006
|
+
`RUN if [ "$AKAN_ALLOW_LOCAL_IMAGE" != "1" ]; then echo "This build ran with AKAN_PUBLIC_ENV=local, which serves the dev routes to every caller. Build with the environment it deploys to, or pass --build-arg AKAN_ALLOW_LOCAL_IMAGE=1." >&2; exit 1; fi`
|
|
1007
|
+
].join(`
|
|
1008
|
+
`);
|
|
1000
1009
|
dockerfileFor(environment, { lockfile = true } = {}) {
|
|
1001
1010
|
return this.#makeDockerfile(environment, lockfile);
|
|
1002
1011
|
}
|
|
@@ -1007,8 +1016,10 @@ class AkanAppConfig {
|
|
|
1007
1016
|
const preRunScripts = this.#getDockerRunScripts(preRuns);
|
|
1008
1017
|
const postRunScripts = this.#getDockerRunScripts(postRuns);
|
|
1009
1018
|
const imageScript = this.#getDockerImageScript(image, DEFAULT_DOCKER_IMAGE);
|
|
1019
|
+
const isLocal = (environment ?? this.baseDevEnv.env) === "local";
|
|
1010
1020
|
const envLines = Object.entries(this.getProductionEnv(environment)).map(([key, value]) => `ENV ${key}=${value}`);
|
|
1011
|
-
return `${imageScript}
|
|
1021
|
+
return `${imageScript}${isLocal ? `
|
|
1022
|
+
${AkanAppConfig.localImageGuard}` : ""}
|
|
1012
1023
|
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends ca-certificates tzdata && rm -rf /var/lib/apt/lists/*
|
|
1013
1024
|
RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
|
|
1014
1025
|
ARG TARGETARCH
|
|
@@ -1363,7 +1374,7 @@ async function writeGeneratedOverridesLayoutFile(opts) {
|
|
|
1363
1374
|
const filename = `${opts.key.replace(/^\.\//, "").replace(/[^a-zA-Z0-9]+/g, "_")}.tsx`;
|
|
1364
1375
|
const absPath = path6.join(path6.resolve(opts.appCwdPath), IMPLICIT_OVERRIDES_DIR, filename);
|
|
1365
1376
|
const source = `"use client";
|
|
1366
|
-
import { UiOverrideProvider } from "akanjs/ui";
|
|
1377
|
+
import { UiOverrideProvider } from "akanjs/ui/UiOverride/UiOverride.tsx";
|
|
1367
1378
|
import { createElement, type ReactNode } from "react";
|
|
1368
1379
|
import value from ${JSON.stringify(importSpecifier(absPath, opts.userAbsPath))};
|
|
1369
1380
|
|
|
@@ -1503,7 +1514,7 @@ ${layoutBinding} return `;
|
|
|
1503
1514
|
const source = opts.includeSystemProvider ? `import type { LayoutModule, LayoutProps, PageProps } from "akanjs/client";
|
|
1504
1515
|
import { assertGuardOnChain, loadFonts, RouteGuards, resolveRouteModule, RouteHead } from "akanjs/client";
|
|
1505
1516
|
import type { ReactNode } from "react";
|
|
1506
|
-
import { System } from "akanjs/ui";
|
|
1517
|
+
import { System } from "akanjs/ui/System/index.tsx";
|
|
1507
1518
|
import type { McpAppRootProps } from "akanjs/webkit";
|
|
1508
1519
|
import { env } from "@apps/${opts.appName}/env/env.client";
|
|
1509
1520
|
import { allDictionary } from ${JSON.stringify(dictMacroSpecifier)};
|
|
@@ -1725,14 +1736,69 @@ class CodegenLock {
|
|
|
1725
1736
|
}
|
|
1726
1737
|
}
|
|
1727
1738
|
|
|
1728
|
-
// pkgs/@akanjs/devkit/
|
|
1739
|
+
// pkgs/@akanjs/devkit/envSeed.ts
|
|
1729
1740
|
import path8 from "path";
|
|
1741
|
+
class EnvSeed {
|
|
1742
|
+
static #server = `import type { ModulesOptions } from "../lib/option";
|
|
1743
|
+
|
|
1744
|
+
export const env: ModulesOptions = {};
|
|
1745
|
+
`;
|
|
1746
|
+
static #testingServer = `import type { ModulesOptions } from "../lib/option";
|
|
1747
|
+
import { libEnv } from "./env.server.type";
|
|
1748
|
+
|
|
1749
|
+
export const env: ModulesOptions = {
|
|
1750
|
+
...libEnv,
|
|
1751
|
+
};
|
|
1752
|
+
`;
|
|
1753
|
+
static #client = `import type { AppClientEnv } from "./env.client.type";
|
|
1754
|
+
|
|
1755
|
+
export const env: AppClientEnv = {};
|
|
1756
|
+
`;
|
|
1757
|
+
static #untypedClient = `export const env = {};
|
|
1758
|
+
`;
|
|
1759
|
+
static #selectors = ["env.server.ts", "env.client.ts"];
|
|
1760
|
+
static #selectedPattern = /^\.\/(env\.(?:server|client)\.(?!(?:type|example)$)[\w-]+)$/;
|
|
1761
|
+
static #testing = "env.server.testing.ts";
|
|
1762
|
+
#envDir;
|
|
1763
|
+
constructor(envDir) {
|
|
1764
|
+
this.#envDir = envDir;
|
|
1765
|
+
}
|
|
1766
|
+
async missing() {
|
|
1767
|
+
const wanted = [...new Set([EnvSeed.#testing, ...await this.#selected()])].sort();
|
|
1768
|
+
const exists = await Promise.all(wanted.map((fileName) => FileSys2.fileExists(path8.join(this.#envDir, fileName))));
|
|
1769
|
+
const missing = wanted.filter((_, idx) => !exists[idx]);
|
|
1770
|
+
return await Promise.all(missing.map(async (fileName) => ({ fileName, content: await this.#contentOf(fileName) })));
|
|
1771
|
+
}
|
|
1772
|
+
async#selected() {
|
|
1773
|
+
const transpiler = new Bun.Transpiler({ loader: "ts" });
|
|
1774
|
+
const selected = await Promise.all(EnvSeed.#selectors.map(async (selector) => {
|
|
1775
|
+
const file = path8.join(this.#envDir, selector);
|
|
1776
|
+
if (!await FileSys2.fileExists(file))
|
|
1777
|
+
return [];
|
|
1778
|
+
return transpiler.scan(await FileSys2.readText(file)).imports.flatMap(({ path: specifier }) => specifier.match(EnvSeed.#selectedPattern)?.[1] ?? []).map((name) => `${name}.ts`);
|
|
1779
|
+
}));
|
|
1780
|
+
return selected.flat();
|
|
1781
|
+
}
|
|
1782
|
+
async#contentOf(fileName) {
|
|
1783
|
+
const side = fileName.startsWith("env.client.") ? "client" : "server";
|
|
1784
|
+
const example = path8.join(this.#envDir, `env.${side}.example.ts`);
|
|
1785
|
+
if (await FileSys2.fileExists(example))
|
|
1786
|
+
return await FileSys2.readText(example);
|
|
1787
|
+
if (side === "server")
|
|
1788
|
+
return fileName === EnvSeed.#testing ? EnvSeed.#testingServer : EnvSeed.#server;
|
|
1789
|
+
const typed = await FileSys2.fileExists(path8.join(this.#envDir, "env.client.type.ts"));
|
|
1790
|
+
return typed ? EnvSeed.#client : EnvSeed.#untypedClient;
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
// pkgs/@akanjs/devkit/jsonFormatter.ts
|
|
1795
|
+
import path9 from "path";
|
|
1730
1796
|
|
|
1731
1797
|
class JsonFormatter {
|
|
1732
1798
|
static lineWidth = 120;
|
|
1733
1799
|
static stringify(value, filePath) {
|
|
1734
1800
|
const json = JSON.stringify(value, null, 2);
|
|
1735
|
-
if (
|
|
1801
|
+
if (path9.basename(filePath) === "package.json")
|
|
1736
1802
|
return `${json}
|
|
1737
1803
|
`;
|
|
1738
1804
|
return `${JsonFormatter.#print(JSON.parse(json), 0, { column: 0, trailing: 0 })}
|
|
@@ -1803,7 +1869,7 @@ ${" ".repeat(depth)}]`;
|
|
|
1803
1869
|
// pkgs/@akanjs/devkit/linter.ts
|
|
1804
1870
|
import { spawn } from "child_process";
|
|
1805
1871
|
import { existsSync as existsSync2, readFileSync } from "fs";
|
|
1806
|
-
import
|
|
1872
|
+
import path10 from "path";
|
|
1807
1873
|
import chalk from "chalk";
|
|
1808
1874
|
var parseBiomeReport = (output) => {
|
|
1809
1875
|
for (let start = output.indexOf("{");start !== -1; start = output.indexOf("{", start + 1)) {
|
|
@@ -1864,7 +1930,7 @@ var emptyResult = (filePath) => ({
|
|
|
1864
1930
|
|
|
1865
1931
|
class Linter {
|
|
1866
1932
|
static biomeCommand(root) {
|
|
1867
|
-
const wrapper =
|
|
1933
|
+
const wrapper = path10.join(root, "node_modules", "@biomejs", "biome", "bin", "biome");
|
|
1868
1934
|
return existsSync2(wrapper) ? [process.execPath, wrapper] : ["biome"];
|
|
1869
1935
|
}
|
|
1870
1936
|
lintRoot;
|
|
@@ -1872,12 +1938,12 @@ class Linter {
|
|
|
1872
1938
|
#biomeCommand;
|
|
1873
1939
|
constructor(cwdPath) {
|
|
1874
1940
|
this.lintRoot = this.#findBiomeRootPath(cwdPath);
|
|
1875
|
-
this.configPath = Linter.#configPathIn(this.lintRoot) ??
|
|
1941
|
+
this.configPath = Linter.#configPathIn(this.lintRoot) ?? path10.join(this.lintRoot, "biome.json");
|
|
1876
1942
|
this.#biomeCommand = Linter.biomeCommand(this.lintRoot);
|
|
1877
1943
|
}
|
|
1878
1944
|
static #configPathIn(dir) {
|
|
1879
1945
|
for (const fileName of BIOME_CONFIG_FILES) {
|
|
1880
|
-
const configPath =
|
|
1946
|
+
const configPath = path10.join(dir, fileName);
|
|
1881
1947
|
if (existsSync2(configPath))
|
|
1882
1948
|
return configPath;
|
|
1883
1949
|
}
|
|
@@ -1886,19 +1952,19 @@ class Linter {
|
|
|
1886
1952
|
#findBiomeRootPath(dir) {
|
|
1887
1953
|
if (Linter.#configPathIn(dir))
|
|
1888
1954
|
return dir;
|
|
1889
|
-
const parentDir =
|
|
1955
|
+
const parentDir = path10.dirname(dir);
|
|
1890
1956
|
if (parentDir === dir)
|
|
1891
1957
|
throw new Error(`biome.json not found from ${dir}`);
|
|
1892
1958
|
return this.#findBiomeRootPath(parentDir);
|
|
1893
1959
|
}
|
|
1894
1960
|
#toBiomePath(filePath) {
|
|
1895
|
-
const relativePath =
|
|
1896
|
-
if (!relativePath.startsWith("..") && !
|
|
1961
|
+
const relativePath = path10.relative(this.lintRoot, filePath);
|
|
1962
|
+
if (!relativePath.startsWith("..") && !path10.isAbsolute(relativePath))
|
|
1897
1963
|
return relativePath;
|
|
1898
1964
|
return filePath;
|
|
1899
1965
|
}
|
|
1900
1966
|
#resolveFilePath(filePath) {
|
|
1901
|
-
return
|
|
1967
|
+
return path10.isAbsolute(filePath) ? filePath : path10.join(this.lintRoot, filePath);
|
|
1902
1968
|
}
|
|
1903
1969
|
async#runBiome(args, input) {
|
|
1904
1970
|
return await new Promise((resolve, reject) => {
|
|
@@ -1924,7 +1990,7 @@ class Linter {
|
|
|
1924
1990
|
const diagnosticPath = diagnostic.location?.path;
|
|
1925
1991
|
if (!diagnosticPath)
|
|
1926
1992
|
return fallbackFilePath;
|
|
1927
|
-
return
|
|
1993
|
+
return path10.isAbsolute(diagnosticPath) ? diagnosticPath : path10.join(this.lintRoot, diagnosticPath);
|
|
1928
1994
|
}
|
|
1929
1995
|
#createLintMessage(diagnostic) {
|
|
1930
1996
|
const start = diagnostic.location?.start;
|
|
@@ -2281,7 +2347,7 @@ class ManifestDependencies {
|
|
|
2281
2347
|
|
|
2282
2348
|
// pkgs/@akanjs/devkit/repoIdentity.ts
|
|
2283
2349
|
import { execFileSync } from "child_process";
|
|
2284
|
-
import
|
|
2350
|
+
import path11 from "path";
|
|
2285
2351
|
var resolved = new Map;
|
|
2286
2352
|
var readRemoteName = (workspaceRoot) => {
|
|
2287
2353
|
try {
|
|
@@ -2299,14 +2365,14 @@ var resolveRepoName = (workspaceRoot) => {
|
|
|
2299
2365
|
const cached = resolved.get(workspaceRoot);
|
|
2300
2366
|
if (cached)
|
|
2301
2367
|
return cached;
|
|
2302
|
-
const repoName = readRemoteName(workspaceRoot) ??
|
|
2368
|
+
const repoName = readRemoteName(workspaceRoot) ?? path11.basename(workspaceRoot);
|
|
2303
2369
|
resolved.set(workspaceRoot, repoName);
|
|
2304
2370
|
return repoName;
|
|
2305
2371
|
};
|
|
2306
2372
|
|
|
2307
2373
|
// pkgs/@akanjs/devkit/scanInfo.ts
|
|
2308
2374
|
import { createHash } from "crypto";
|
|
2309
|
-
import
|
|
2375
|
+
import path12 from "path";
|
|
2310
2376
|
|
|
2311
2377
|
// pkgs/@akanjs/devkit/workspaceLayout.ts
|
|
2312
2378
|
var appRootAllowedFiles = new Set([
|
|
@@ -2429,10 +2495,10 @@ var moduleUiFileTypes = {
|
|
|
2429
2495
|
service: new Set(["Util", "Zone"]),
|
|
2430
2496
|
scalar: new Set(["Template", "Unit"])
|
|
2431
2497
|
};
|
|
2432
|
-
var createDependencyScanner = async (exec) => (await import("./dependencyScanner-
|
|
2433
|
-
var getScanPath = (exec, relativePath) =>
|
|
2498
|
+
var createDependencyScanner = async (exec) => (await import("./dependencyScanner-78sq8m4q.js")).TypeScriptDependencyScanner.from(exec);
|
|
2499
|
+
var getScanPath = (exec, relativePath) => path12.posix.join(`${exec.type}s`, exec.name, relativePath.split(path12.sep).join("/"));
|
|
2434
2500
|
var getModuleNameFromPath = (kind, modulePath) => {
|
|
2435
|
-
const dirname =
|
|
2501
|
+
const dirname = path12.basename(modulePath);
|
|
2436
2502
|
return kind === "service" ? dirname.replace(/^_+/, "") : dirname;
|
|
2437
2503
|
};
|
|
2438
2504
|
async function assertScanConvention(exec, libRoot) {
|
|
@@ -2453,24 +2519,24 @@ async function assertScanConvention(exec, libRoot) {
|
|
|
2453
2519
|
for (const filename of await exec.readdir(facet)) {
|
|
2454
2520
|
const shadow = facetIndexShadowOf(`${facet}/${filename}`);
|
|
2455
2521
|
if (shadow)
|
|
2456
|
-
addViolation(
|
|
2522
|
+
addViolation(path12.join(facet, filename), shadow);
|
|
2457
2523
|
}
|
|
2458
2524
|
if (exec.type === "lib")
|
|
2459
2525
|
for (const { relativePath, reason } of await exec.getPageConventionViolations())
|
|
2460
2526
|
addViolation(relativePath, reason);
|
|
2461
2527
|
for (const filename of libRoot.files)
|
|
2462
2528
|
if (!isAllowedLibFacetRootFile(filename))
|
|
2463
|
-
addViolation(
|
|
2529
|
+
addViolation(path12.join("lib", filename), libFacetRootHintOf(filename) ?? "unsupported lib facet root file");
|
|
2464
2530
|
for (const dirname of libRoot.dirs)
|
|
2465
2531
|
if (dirname.startsWith("__") && !internalLibDirs.has(dirname))
|
|
2466
|
-
addViolation(
|
|
2532
|
+
addViolation(path12.join("lib", dirname), "unsupported internal lib folder");
|
|
2467
2533
|
const databaseDirs = libRoot.dirs.filter((dirname) => !dirname.startsWith("_"));
|
|
2468
2534
|
const serviceDirs = libRoot.dirs.filter((dirname) => dirname.startsWith("_") && !dirname.startsWith("__"));
|
|
2469
2535
|
const scalarDirs = await exec.readdir("lib/__scalar");
|
|
2470
2536
|
await Promise.all([
|
|
2471
|
-
...databaseDirs.map((dirname) => validateModuleFiles(exec, violations, "database",
|
|
2472
|
-
...serviceDirs.map((dirname) => validateModuleFiles(exec, violations, "service",
|
|
2473
|
-
...scalarDirs.map((dirname) => validateModuleFiles(exec, violations, "scalar",
|
|
2537
|
+
...databaseDirs.map((dirname) => validateModuleFiles(exec, violations, "database", path12.join("lib", dirname))),
|
|
2538
|
+
...serviceDirs.map((dirname) => validateModuleFiles(exec, violations, "service", path12.join("lib", dirname))),
|
|
2539
|
+
...scalarDirs.map((dirname) => validateModuleFiles(exec, violations, "scalar", path12.join("lib/__scalar", dirname)))
|
|
2474
2540
|
]);
|
|
2475
2541
|
if (violations.length > 0) {
|
|
2476
2542
|
throw new Error(`[scan-convention]
|
|
@@ -2482,11 +2548,11 @@ async function validateModuleFiles(exec, violations, kind, modulePath) {
|
|
|
2482
2548
|
const { files, dirs } = await exec.getFilesAndDirs(modulePath);
|
|
2483
2549
|
const moduleName = getModuleNameFromPath(kind, modulePath);
|
|
2484
2550
|
dirs.forEach((dirname) => {
|
|
2485
|
-
violations.push(`${getScanPath(exec,
|
|
2551
|
+
violations.push(`${getScanPath(exec, path12.join(modulePath, dirname))}: unsupported module folder`);
|
|
2486
2552
|
});
|
|
2487
2553
|
const uiModuleName = moduleName[0].toUpperCase() + moduleName.slice(1);
|
|
2488
2554
|
for (const filename of files) {
|
|
2489
|
-
const scanPath = getScanPath(exec,
|
|
2555
|
+
const scanPath = getScanPath(exec, path12.join(modulePath, filename));
|
|
2490
2556
|
if (filename === "index.ts" || filename === "index.tsx")
|
|
2491
2557
|
continue;
|
|
2492
2558
|
if (filename === `${moduleName}.abstract.md`)
|
|
@@ -2561,16 +2627,16 @@ class ScanInfo {
|
|
|
2561
2627
|
}
|
|
2562
2628
|
};
|
|
2563
2629
|
await Promise.all([
|
|
2564
|
-
...databaseDirs.map((name) => collect(
|
|
2565
|
-
...serviceDirs.map((dirname) => collect(
|
|
2566
|
-
...scalarDirs.map((name) => collect(
|
|
2630
|
+
...databaseDirs.map((name) => collect(path12.join("lib", name), name, "databases")),
|
|
2631
|
+
...serviceDirs.map((dirname) => collect(path12.join("lib", dirname), dirname.slice(1), "services")),
|
|
2632
|
+
...scalarDirs.map((name) => collect(path12.join("lib/__scalar", name), name, "scalars"))
|
|
2567
2633
|
]);
|
|
2568
2634
|
const routes = exec.type === "lib" ? [] : await exec.getPageKeys();
|
|
2569
2635
|
const common = {
|
|
2570
2636
|
name: exec.name,
|
|
2571
2637
|
type: exec.type,
|
|
2572
2638
|
repoName: exec.workspace.repoName,
|
|
2573
|
-
serveDomain: WorkspaceExecutor.getBaseDevEnv(
|
|
2639
|
+
serveDomain: WorkspaceExecutor.getBaseDevEnv(path12.join(exec.workspace.workspaceRoot, ".env")).serveDomain,
|
|
2574
2640
|
files,
|
|
2575
2641
|
libDeps,
|
|
2576
2642
|
pkgDeps,
|
|
@@ -2883,7 +2949,7 @@ class Spinner {
|
|
|
2883
2949
|
|
|
2884
2950
|
// pkgs/@akanjs/devkit/typecheck/projectTypecheck.ts
|
|
2885
2951
|
import { mkdir as mkdir2, rm as rm3 } from "fs/promises";
|
|
2886
|
-
import
|
|
2952
|
+
import path13 from "path";
|
|
2887
2953
|
|
|
2888
2954
|
// pkgs/@akanjs/devkit/typecheck/typecheckFailure.ts
|
|
2889
2955
|
class TypecheckFailure extends Error {
|
|
@@ -2909,7 +2975,7 @@ class ProjectTypecheck2 {
|
|
|
2909
2975
|
this.env = env;
|
|
2910
2976
|
}
|
|
2911
2977
|
get typecheckDir() {
|
|
2912
|
-
return
|
|
2978
|
+
return path13.join(this.projectDir, ".akan", "typecheck");
|
|
2913
2979
|
}
|
|
2914
2980
|
async run(entries, { clean = false, incremental = true, tests = false, report = "pretty" } = {}) {
|
|
2915
2981
|
const name = tests ? "tsconfig.tests" : "tsconfig";
|
|
@@ -2921,11 +2987,11 @@ class ProjectTypecheck2 {
|
|
|
2921
2987
|
...tests ? { exclude: ProjectTypecheck2.#excludes.map((glob) => `../../${glob}`) } : {},
|
|
2922
2988
|
references: []
|
|
2923
2989
|
};
|
|
2924
|
-
const tsconfigPath =
|
|
2990
|
+
const tsconfigPath = path13.join(this.typecheckDir, `${name}.json`);
|
|
2925
2991
|
await Bun.write(tsconfigPath, `${JSON.stringify(tsconfig, null, 2)}
|
|
2926
2992
|
`);
|
|
2927
2993
|
if (clean)
|
|
2928
|
-
await rm3(
|
|
2994
|
+
await rm3(path13.join(this.typecheckDir, `${name}.tsbuildinfo`), { force: true });
|
|
2929
2995
|
await this.check(tsconfigPath, report);
|
|
2930
2996
|
return tsconfigPath;
|
|
2931
2997
|
}
|
|
@@ -2963,11 +3029,11 @@ class ProjectTypecheck2 {
|
|
|
2963
3029
|
}
|
|
2964
3030
|
static async workerEntry(workspaceRoot) {
|
|
2965
3031
|
const candidates = [
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
3032
|
+
path13.join(workspaceRoot, "pkgs/@akanjs/devkit/typecheck/typecheck.proc.ts"),
|
|
3033
|
+
path13.join(workspaceRoot, "node_modules/@akanjs/devkit/typecheck/typecheck.proc.ts"),
|
|
3034
|
+
path13.join(import.meta.dir, "typecheck.proc.js"),
|
|
3035
|
+
path13.join(import.meta.dir, "typecheck.proc.ts"),
|
|
3036
|
+
path13.join(import.meta.dir, "..", "typecheck.proc.js")
|
|
2971
3037
|
];
|
|
2972
3038
|
for (const candidate of candidates)
|
|
2973
3039
|
if (await Bun.file(candidate).exists())
|
|
@@ -3135,10 +3201,10 @@ class Executor {
|
|
|
3135
3201
|
return this.#settle(proc, target, { redStderr: true }).then(({ code, signal }) => ({ code, signal }));
|
|
3136
3202
|
}
|
|
3137
3203
|
getPath(filePath) {
|
|
3138
|
-
if (
|
|
3204
|
+
if (path14.isAbsolute(filePath))
|
|
3139
3205
|
return filePath;
|
|
3140
3206
|
if (filePath.startsWith("."))
|
|
3141
|
-
return
|
|
3207
|
+
return path14.join(this.cwdPath, filePath);
|
|
3142
3208
|
const baseParts = this.cwdPath.split(/[\\/]/).filter(Boolean);
|
|
3143
3209
|
const targetParts = filePath.split(/[\\/]/).filter(Boolean);
|
|
3144
3210
|
let overlapLength = 0;
|
|
@@ -3152,7 +3218,7 @@ class Executor {
|
|
|
3152
3218
|
if (isOverlap)
|
|
3153
3219
|
overlapLength = i;
|
|
3154
3220
|
}
|
|
3155
|
-
return
|
|
3221
|
+
return path14.join(this.cwdPath, ...targetParts.slice(overlapLength));
|
|
3156
3222
|
}
|
|
3157
3223
|
async mkdir(dirPath) {
|
|
3158
3224
|
const writePath = this.getPath(dirPath);
|
|
@@ -3193,7 +3259,7 @@ class Executor {
|
|
|
3193
3259
|
return this;
|
|
3194
3260
|
}
|
|
3195
3261
|
async removeDir(dirPath) {
|
|
3196
|
-
const readPath =
|
|
3262
|
+
const readPath = path14.join(this.getPath(dirPath), ".");
|
|
3197
3263
|
if (await FileSys2.entryExists(readPath))
|
|
3198
3264
|
await rm4(readPath, { recursive: true, force: true });
|
|
3199
3265
|
this.logger.verbose(`Remove directory ${readPath}`);
|
|
@@ -3201,7 +3267,7 @@ class Executor {
|
|
|
3201
3267
|
}
|
|
3202
3268
|
async writeFile(filePath, content, { overwrite = true, silent = false } = {}) {
|
|
3203
3269
|
const writePath = this.getPath(filePath);
|
|
3204
|
-
const dir =
|
|
3270
|
+
const dir = path14.dirname(writePath);
|
|
3205
3271
|
if (!await FileSys2.dirExists(dir))
|
|
3206
3272
|
await mkdir3(dir, { recursive: true });
|
|
3207
3273
|
let contentStr = typeof content === "string" ? content : JsonFormatter.stringify(content, writePath);
|
|
@@ -3228,7 +3294,7 @@ class Executor {
|
|
|
3228
3294
|
await this.writeFile(filePath, content);
|
|
3229
3295
|
}
|
|
3230
3296
|
async getLocalFile(targetPath) {
|
|
3231
|
-
const filePath =
|
|
3297
|
+
const filePath = path14.isAbsolute(targetPath) ? targetPath : targetPath.replace(this.cwdPath, "");
|
|
3232
3298
|
const content = await this.readFile(filePath);
|
|
3233
3299
|
return { filePath, content };
|
|
3234
3300
|
}
|
|
@@ -3307,7 +3373,8 @@ class Executor {
|
|
|
3307
3373
|
templatePath,
|
|
3308
3374
|
targetPath,
|
|
3309
3375
|
scanInfo,
|
|
3310
|
-
overwrite = true
|
|
3376
|
+
overwrite = true,
|
|
3377
|
+
dryRun = false
|
|
3311
3378
|
}, dict = {}, options = {}) {
|
|
3312
3379
|
const convertPath = (target) => Object.entries(dict).reduce((converted, [key, value]) => converted.replace(new RegExp(`__${key}__`, "g"), value), target);
|
|
3313
3380
|
if (targetPath.endsWith(".ts") || targetPath.endsWith(".tsx")) {
|
|
@@ -3315,23 +3382,29 @@ class Executor {
|
|
|
3315
3382
|
const result = await getContent.default(scanInfo ?? null, dict, options);
|
|
3316
3383
|
if (result === null)
|
|
3317
3384
|
return null;
|
|
3318
|
-
const filename = typeof result === "object" ? result.filename :
|
|
3385
|
+
const filename = typeof result === "object" ? result.filename : path14.basename(targetPath).replace(".js", ".ts");
|
|
3319
3386
|
const content = typeof result === "object" ? result.content : result;
|
|
3320
|
-
const convertedTargetPath = convertPath(`${
|
|
3387
|
+
const convertedTargetPath = convertPath(`${path14.dirname(targetPath)}/${filename}`);
|
|
3388
|
+
if (dryRun)
|
|
3389
|
+
return { filePath: this.getPath(convertedTargetPath), content, written: false };
|
|
3321
3390
|
this.logger.verbose(`Apply template ${templatePath} to ${convertedTargetPath}`);
|
|
3322
3391
|
return this.writeFile(convertedTargetPath, content, { overwrite });
|
|
3323
3392
|
} else if (targetPath.endsWith(".template")) {
|
|
3324
3393
|
const content = await FileSys2.readText(templatePath);
|
|
3325
3394
|
const convertedTargetPath = convertPath(targetPath.slice(0, -9));
|
|
3326
3395
|
const convertedContent = Object.entries(dict).reduce((data, [key, value]) => data.replace(new RegExp(`<%= ${key} %>`, "g"), value), content);
|
|
3396
|
+
if (dryRun)
|
|
3397
|
+
return { filePath: this.getPath(convertedTargetPath), content: convertedContent, written: false };
|
|
3327
3398
|
this.logger.verbose(`Apply template ${templatePath} to ${convertedTargetPath}`);
|
|
3328
3399
|
return this.writeFile(convertedTargetPath, convertedContent, { overwrite });
|
|
3329
|
-
} else if (staticTemplateFileExtensions.has(
|
|
3400
|
+
} else if (staticTemplateFileExtensions.has(path14.extname(targetPath).toLowerCase())) {
|
|
3330
3401
|
const convertedTargetPath = convertPath(targetPath);
|
|
3331
3402
|
const writePath = this.getPath(convertedTargetPath);
|
|
3403
|
+
if (dryRun)
|
|
3404
|
+
return { filePath: writePath, content: "", written: false };
|
|
3332
3405
|
if (!overwrite && await FileSys2.fileExists(writePath))
|
|
3333
3406
|
return { filePath: writePath, content: "", written: false };
|
|
3334
|
-
const dirname =
|
|
3407
|
+
const dirname = path14.dirname(writePath);
|
|
3335
3408
|
if (!await FileSys2.dirExists(dirname))
|
|
3336
3409
|
await mkdir3(dirname, { recursive: true });
|
|
3337
3410
|
await copyFile(templatePath, writePath);
|
|
@@ -3346,37 +3419,41 @@ class Executor {
|
|
|
3346
3419
|
scanInfo,
|
|
3347
3420
|
dict = {},
|
|
3348
3421
|
options = {},
|
|
3349
|
-
overwrite = true
|
|
3422
|
+
overwrite = true,
|
|
3423
|
+
dryRun = false
|
|
3350
3424
|
}) {
|
|
3351
3425
|
const templateRoot = await this.#resolveTemplateRoot();
|
|
3352
3426
|
const templatePath = `${templateRoot}${template ? `/${template}` : ""}`;
|
|
3353
3427
|
if ((await stat2(templatePath)).isFile()) {
|
|
3354
3428
|
const fileContent = await this.#applyTemplateFile({
|
|
3355
3429
|
templatePath,
|
|
3356
|
-
targetPath:
|
|
3430
|
+
targetPath: path14.join(basePath, path14.basename(templatePath)),
|
|
3357
3431
|
scanInfo,
|
|
3358
|
-
overwrite
|
|
3432
|
+
overwrite,
|
|
3433
|
+
dryRun
|
|
3359
3434
|
}, dict, options);
|
|
3360
3435
|
return fileContent ? [fileContent] : [];
|
|
3361
3436
|
} else {
|
|
3362
3437
|
const subdirs = await readDirEntries(templatePath);
|
|
3363
3438
|
const fileContents = (await Promise.all(subdirs.map(async (subdir) => {
|
|
3364
|
-
const subpath =
|
|
3439
|
+
const subpath = path14.join(templatePath, subdir);
|
|
3365
3440
|
if ((await stat2(subpath)).isFile()) {
|
|
3366
3441
|
const fileContent = await this.#applyTemplateFile({
|
|
3367
3442
|
templatePath: subpath,
|
|
3368
|
-
targetPath:
|
|
3443
|
+
targetPath: path14.join(basePath, subdir),
|
|
3369
3444
|
scanInfo,
|
|
3370
|
-
overwrite
|
|
3445
|
+
overwrite,
|
|
3446
|
+
dryRun
|
|
3371
3447
|
}, dict, options);
|
|
3372
3448
|
return fileContent ? [fileContent] : [];
|
|
3373
3449
|
} else
|
|
3374
3450
|
return await this._applyTemplate({
|
|
3375
|
-
basePath:
|
|
3376
|
-
template:
|
|
3451
|
+
basePath: path14.join(basePath, subdir),
|
|
3452
|
+
template: path14.join(template, subdir),
|
|
3377
3453
|
scanInfo,
|
|
3378
3454
|
dict,
|
|
3379
3455
|
overwrite,
|
|
3456
|
+
dryRun,
|
|
3380
3457
|
options
|
|
3381
3458
|
});
|
|
3382
3459
|
}))).flat();
|
|
@@ -3385,8 +3462,8 @@ class Executor {
|
|
|
3385
3462
|
}
|
|
3386
3463
|
async#resolveTemplateRoot() {
|
|
3387
3464
|
const candidates = [
|
|
3388
|
-
|
|
3389
|
-
|
|
3465
|
+
path14.resolve(getDirname2(import.meta.url), "templates"),
|
|
3466
|
+
path14.resolve(getDirname2(import.meta.url), "../cli/templates")
|
|
3390
3467
|
];
|
|
3391
3468
|
for (const candidate of candidates) {
|
|
3392
3469
|
if (await FileSys2.dirExists(candidate))
|
|
@@ -3492,7 +3569,7 @@ class WorkspaceExecutor extends Executor {
|
|
|
3492
3569
|
const appName = sourceEnv.AKAN_PUBLIC_APP_NAME;
|
|
3493
3570
|
const workspaceRoot = sourceEnv.AKAN_WORKSPACE_ROOT;
|
|
3494
3571
|
const workspaceId = sourceEnv.AKAN_WORKSPACE_ID;
|
|
3495
|
-
const repoName = sourceEnv.AKAN_PUBLIC_REPO_NAME || resolveRepoName(envPath ?
|
|
3572
|
+
const repoName = sourceEnv.AKAN_PUBLIC_REPO_NAME || resolveRepoName(envPath ? path14.dirname(envPath) : workspaceRoot ?? process.cwd());
|
|
3496
3573
|
const serveDomain = sourceEnv.AKAN_PUBLIC_SERVE_DOMAIN || WorkspaceExecutor.localServeDomain;
|
|
3497
3574
|
const defaulted = ["AKAN_PUBLIC_REPO_NAME", "AKAN_PUBLIC_SERVE_DOMAIN"].filter((key) => !sourceEnv[key]);
|
|
3498
3575
|
const portOffset = parseInt(sourceEnv.PORT_OFFSET ?? "0");
|
|
@@ -3510,6 +3587,10 @@ class WorkspaceExecutor extends Executor {
|
|
|
3510
3587
|
defaulted
|
|
3511
3588
|
};
|
|
3512
3589
|
}
|
|
3590
|
+
static defaultCloneToLocalEnv(workspaceRoot) {
|
|
3591
|
+
if (!existsSync3(path14.join(workspaceRoot, ".env")))
|
|
3592
|
+
process.env.AKAN_PUBLIC_ENV ??= "local";
|
|
3593
|
+
}
|
|
3513
3594
|
static assertDeployableEnv(baseDevEnv, environment, purpose) {
|
|
3514
3595
|
const defaulted = environment === "local" ? [] : baseDevEnv.defaulted ?? [];
|
|
3515
3596
|
if (!defaulted.length)
|
|
@@ -3582,7 +3663,7 @@ class WorkspaceExecutor extends Executor {
|
|
|
3582
3663
|
await Promise.all(dirs.map(async (dir) => {
|
|
3583
3664
|
if (dir.includes("_") || AVOID_DIRS.includes(dir))
|
|
3584
3665
|
return;
|
|
3585
|
-
const dirPath =
|
|
3666
|
+
const dirPath = path14.join(dirname, dir);
|
|
3586
3667
|
if ((await stat2(dirPath)).isDirectory()) {
|
|
3587
3668
|
results.push(`${prefix}${dir}`);
|
|
3588
3669
|
if (maxDepth > 0)
|
|
@@ -3593,12 +3674,17 @@ class WorkspaceExecutor extends Executor {
|
|
|
3593
3674
|
};
|
|
3594
3675
|
return await getDirs(basePath);
|
|
3595
3676
|
}
|
|
3596
|
-
async commit(message, {
|
|
3677
|
+
async commit(message, {
|
|
3678
|
+
init = false,
|
|
3679
|
+
add = true,
|
|
3680
|
+
identity
|
|
3681
|
+
} = {}) {
|
|
3597
3682
|
if (init)
|
|
3598
3683
|
await this.spawn("git", ["init", "--quiet"]);
|
|
3599
3684
|
if (add)
|
|
3600
3685
|
await this.spawn("git", ["add", "."]);
|
|
3601
|
-
|
|
3686
|
+
const author = identity ? ["-c", `user.name=${identity.name}`, "-c", `user.email=${identity.email}`] : [];
|
|
3687
|
+
await this.spawn("git", [...author, "commit", "--quiet", "-m", message]);
|
|
3602
3688
|
}
|
|
3603
3689
|
async hasChanges() {
|
|
3604
3690
|
return !!(await this.spawn("git", ["status", "--porcelain"])).trim();
|
|
@@ -3619,9 +3705,9 @@ class WorkspaceExecutor extends Executor {
|
|
|
3619
3705
|
await Promise.all(dirs.map(async (dir) => {
|
|
3620
3706
|
if (AVOID_DIRS.includes(dir))
|
|
3621
3707
|
return;
|
|
3622
|
-
const dirPath =
|
|
3708
|
+
const dirPath = path14.join(dirname, dir);
|
|
3623
3709
|
if (await FileSys2.dirExists(dirPath)) {
|
|
3624
|
-
const hasTargetFile = await FileSys2.fileExists(
|
|
3710
|
+
const hasTargetFile = await FileSys2.fileExists(path14.join(dirPath, targetFilename));
|
|
3625
3711
|
if (hasTargetFile)
|
|
3626
3712
|
results.push(`${prefix}${dir}`);
|
|
3627
3713
|
if (maxDepth > 0)
|
|
@@ -3680,7 +3766,7 @@ class SysExecutor extends Executor {
|
|
|
3680
3766
|
return [];
|
|
3681
3767
|
const violations = [];
|
|
3682
3768
|
for (const entry of await this.getAllFiles("**/*", { cwd: this.getPath("page") })) {
|
|
3683
|
-
const relativePath = entry.split(
|
|
3769
|
+
const relativePath = entry.split(path14.sep).join("/");
|
|
3684
3770
|
const reason = getPageSourceFileViolation(relativePath);
|
|
3685
3771
|
if (reason)
|
|
3686
3772
|
violations.push({ relativePath: `page/${relativePath}`, reason });
|
|
@@ -3698,8 +3784,18 @@ class SysExecutor extends Executor {
|
|
|
3698
3784
|
throw new Error("Scan info is not available");
|
|
3699
3785
|
return this.#scanInfo;
|
|
3700
3786
|
}
|
|
3787
|
+
async#seedEnvFiles() {
|
|
3788
|
+
const envDir = path14.join(this.cwdPath, "env");
|
|
3789
|
+
const missing = await new EnvSeed(envDir).missing();
|
|
3790
|
+
if (!missing.length)
|
|
3791
|
+
return [];
|
|
3792
|
+
const written = await Promise.all(missing.map(({ fileName, content }) => this.writeFile(path14.join(envDir, fileName), content, { overwrite: false, silent: true })));
|
|
3793
|
+
this.logger.info(`${missing.map(({ fileName }) => `env/${fileName}`).join(", ")} were missing (gitignored, so a clone has none) and now hold local defaults: put this machine's values in them, or fetch the team's with \`akan download-env\`.`);
|
|
3794
|
+
return written;
|
|
3795
|
+
}
|
|
3701
3796
|
#getScanTemplateTasks(scanInfo) {
|
|
3702
3797
|
return [
|
|
3798
|
+
this.#seedEnvFiles(),
|
|
3703
3799
|
this._applyTemplate({ basePath: "env", template: "env", scanInfo }),
|
|
3704
3800
|
this._applyTemplate({ basePath: "lib", template: "lib", scanInfo }),
|
|
3705
3801
|
this._applyTemplate({ basePath: ".", template: "server.ts", scanInfo }),
|
|
@@ -3775,7 +3871,7 @@ class SysExecutor extends Executor {
|
|
|
3775
3871
|
await this.setPackageJson({ ...packageJson, dependencies, devDependencies });
|
|
3776
3872
|
}
|
|
3777
3873
|
async getLocalFile(targetPath) {
|
|
3778
|
-
const filePath =
|
|
3874
|
+
const filePath = path14.isAbsolute(targetPath) ? targetPath : `${this.type}s/${this.name}/${targetPath}`;
|
|
3779
3875
|
const content = await this.workspace.readFile(filePath);
|
|
3780
3876
|
return { filePath, content };
|
|
3781
3877
|
}
|
|
@@ -3863,19 +3959,19 @@ class AppExecutor extends SysExecutor {
|
|
|
3863
3959
|
static from(executor, name) {
|
|
3864
3960
|
return new AppExecutor({ workspace: executor instanceof WorkspaceExecutor ? executor : executor.workspace, name });
|
|
3865
3961
|
}
|
|
3866
|
-
static #keptOnStart = [
|
|
3867
|
-
static #legacyNative =
|
|
3962
|
+
static #keptOnStart = [path14.join(".akan", "cache", "bin")];
|
|
3963
|
+
static #legacyNative = path14.join(".akan", "native");
|
|
3868
3964
|
async#removeDevOutput(dir = ".akan") {
|
|
3869
3965
|
const entries = await readDirEntries(this.getPath(dir)).catch(() => []);
|
|
3870
3966
|
await Promise.all(entries.map(async (name) => {
|
|
3871
|
-
const entry =
|
|
3967
|
+
const entry = path14.join(dir, name);
|
|
3872
3968
|
if (entry === AppExecutor.#legacyNative) {
|
|
3873
3969
|
this.logger.warn(`apps/${this.name}/.akan/native holds native builds from before they moved to dist/native/${this.name}: upload any release waiting in its updates folders, then delete it.`);
|
|
3874
3970
|
return;
|
|
3875
3971
|
}
|
|
3876
3972
|
if (AppExecutor.#keptOnStart.includes(entry))
|
|
3877
3973
|
return;
|
|
3878
|
-
if (AppExecutor.#keptOnStart.some((kept) => kept.startsWith(`${entry}${
|
|
3974
|
+
if (AppExecutor.#keptOnStart.some((kept) => kept.startsWith(`${entry}${path14.sep}`)))
|
|
3879
3975
|
return await this.#removeDevOutput(entry);
|
|
3880
3976
|
await this.removeDir(entry);
|
|
3881
3977
|
}));
|
|
@@ -4003,13 +4099,13 @@ class AppExecutor extends SysExecutor {
|
|
|
4003
4099
|
absolute: false,
|
|
4004
4100
|
onlyFiles: true
|
|
4005
4101
|
})) {
|
|
4006
|
-
const segments = rel.split(
|
|
4102
|
+
const segments = rel.split(path14.sep);
|
|
4007
4103
|
if (segments.some((s) => s === "node_modules"))
|
|
4008
4104
|
continue;
|
|
4009
4105
|
const posix = `${root.keyPrefix}${segments.join("/")}`;
|
|
4010
4106
|
if (!root.keyPrefix && libKeyPrefixes.some((prefix) => posix.startsWith(prefix)))
|
|
4011
4107
|
continue;
|
|
4012
|
-
const absPath =
|
|
4108
|
+
const absPath = path14.join(root.dir, ...segments);
|
|
4013
4109
|
validatePageSourceFile(posix, { filePath: absPath });
|
|
4014
4110
|
if (!isRouteSourceFile(posix))
|
|
4015
4111
|
continue;
|
|
@@ -4156,7 +4252,7 @@ class AppExecutor extends SysExecutor {
|
|
|
4156
4252
|
static async#linkLibAsset(targetPath, linkPath) {
|
|
4157
4253
|
const isWindows = process.platform === "win32";
|
|
4158
4254
|
try {
|
|
4159
|
-
const target = isWindows ? targetPath :
|
|
4255
|
+
const target = isWindows ? targetPath : path14.relative(path14.dirname(linkPath), targetPath);
|
|
4160
4256
|
await symlink(target, linkPath, isWindows ? "junction" : "dir");
|
|
4161
4257
|
} catch (error) {
|
|
4162
4258
|
if (!isWindows)
|
|
@@ -4199,7 +4295,7 @@ class AppExecutor extends SysExecutor {
|
|
|
4199
4295
|
await this.writeFile(rel, content, opts);
|
|
4200
4296
|
},
|
|
4201
4297
|
readEnvClient: async () => {
|
|
4202
|
-
const envClientPath =
|
|
4298
|
+
const envClientPath = path14.join(this.cwdPath, "env", "env.client.ts");
|
|
4203
4299
|
if (!await FileSys2.fileExists(envClientPath))
|
|
4204
4300
|
return null;
|
|
4205
4301
|
try {
|
|
@@ -4293,7 +4389,7 @@ class PkgExecutor extends Executor {
|
|
|
4293
4389
|
return overrideVersion;
|
|
4294
4390
|
try {
|
|
4295
4391
|
const packageJsonPath = `pkgs/${dep}/package.json`;
|
|
4296
|
-
if (!await Bun.file(
|
|
4392
|
+
if (!await Bun.file(path14.join(this.workspace.workspaceRoot, packageJsonPath)).exists())
|
|
4297
4393
|
return;
|
|
4298
4394
|
const packageJson = await this.workspace.readJson(packageJsonPath);
|
|
4299
4395
|
if (packageJson.name === dep)
|