@arcote.tech/arc-cli 0.7.3 → 0.7.4
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/dist/index.js +32 -21
- package/package.json +7 -7
- package/src/builder/build-cache.ts +27 -8
package/dist/index.js
CHANGED
|
@@ -26625,7 +26625,7 @@ ${colors3.yellow}Type declaration errors:${colors3.reset}`);
|
|
|
26625
26625
|
|
|
26626
26626
|
// src/platform/shared.ts
|
|
26627
26627
|
import { copyFileSync, existsSync as existsSync10, mkdirSync as mkdirSync9, readdirSync as readdirSync5, readFileSync as readFileSync10, writeFileSync as writeFileSync9 } from "fs";
|
|
26628
|
-
import { dirname as
|
|
26628
|
+
import { dirname as dirname7, join as join11 } from "path";
|
|
26629
26629
|
|
|
26630
26630
|
// src/builder/module-builder.ts
|
|
26631
26631
|
import { execSync } from "child_process";
|
|
@@ -26637,17 +26637,28 @@ import {
|
|
|
26637
26637
|
rmSync,
|
|
26638
26638
|
writeFileSync as writeFileSync6
|
|
26639
26639
|
} from "fs";
|
|
26640
|
-
import { basename as basename2, dirname as
|
|
26640
|
+
import { basename as basename2, dirname as dirname6, join as join8, relative as relative3 } from "path";
|
|
26641
26641
|
init_i18n();
|
|
26642
26642
|
init_compile();
|
|
26643
26643
|
|
|
26644
26644
|
// src/builder/build-cache.ts
|
|
26645
26645
|
import { existsSync as existsSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync5, writeFileSync as writeFileSync5 } from "fs";
|
|
26646
|
-
import { join as join6 } from "path";
|
|
26647
|
-
|
|
26646
|
+
import { join as join6, dirname as dirname5 } from "path";
|
|
26647
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
26648
|
+
var CACHE_SCHEMA_VERSION = 3;
|
|
26648
26649
|
var CACHE_FILE = ".build-cache.json";
|
|
26650
|
+
function readCliVersion() {
|
|
26651
|
+
try {
|
|
26652
|
+
const here = dirname5(fileURLToPath5(import.meta.url));
|
|
26653
|
+
const pkg = JSON.parse(readFileSync5(join6(here, "..", "package.json"), "utf-8"));
|
|
26654
|
+
return typeof pkg.version === "string" ? pkg.version : "unknown";
|
|
26655
|
+
} catch {
|
|
26656
|
+
return "unknown";
|
|
26657
|
+
}
|
|
26658
|
+
}
|
|
26659
|
+
var CACHE_FINGERPRINT = `${CACHE_SCHEMA_VERSION}:${readCliVersion()}`;
|
|
26649
26660
|
function emptyCache() {
|
|
26650
|
-
return { version:
|
|
26661
|
+
return { version: CACHE_FINGERPRINT, units: {} };
|
|
26651
26662
|
}
|
|
26652
26663
|
function loadBuildCache(arcDir) {
|
|
26653
26664
|
const path4 = join6(arcDir, CACHE_FILE);
|
|
@@ -26655,7 +26666,7 @@ function loadBuildCache(arcDir) {
|
|
|
26655
26666
|
return emptyCache();
|
|
26656
26667
|
try {
|
|
26657
26668
|
const raw = JSON.parse(readFileSync5(path4, "utf-8"));
|
|
26658
|
-
if (raw?.version !==
|
|
26669
|
+
if (raw?.version !== CACHE_FINGERPRINT || typeof raw.units !== "object") {
|
|
26659
26670
|
return emptyCache();
|
|
26660
26671
|
}
|
|
26661
26672
|
return raw;
|
|
@@ -26963,7 +26974,7 @@ async function buildContextClient(pkg, rootDir, client, cache, noCache) {
|
|
|
26963
26974
|
}
|
|
26964
26975
|
const globalsContent = Object.entries(client.defines).map(([k, v]) => `declare const ${k}: ${v};`).join(`
|
|
26965
26976
|
`);
|
|
26966
|
-
const declResult = await buildTypeDeclarations([pkg.entrypoint], outDir,
|
|
26977
|
+
const declResult = await buildTypeDeclarations([pkg.entrypoint], outDir, dirname6(pkg.entrypoint), globalsContent);
|
|
26967
26978
|
const declarationErrors = !declResult.success && declResult.errors.length > 0 ? declResult.errors.map((e) => `[${pkg.name}/${client.name}] ${e}`) : [];
|
|
26968
26979
|
const outputHash = sha256OfDir(outDir);
|
|
26969
26980
|
updateCache(cache, unitId, inputHash, { outputHash });
|
|
@@ -27527,7 +27538,7 @@ function resolveWorkspace() {
|
|
|
27527
27538
|
err("No package.json found");
|
|
27528
27539
|
process.exit(1);
|
|
27529
27540
|
}
|
|
27530
|
-
const rootDir =
|
|
27541
|
+
const rootDir = dirname7(packageJsonPath);
|
|
27531
27542
|
const rootPkg = JSON.parse(readFileSync10(packageJsonPath, "utf-8"));
|
|
27532
27543
|
const appName = rootPkg.name ?? "Arc App";
|
|
27533
27544
|
const arcDir = join11(rootDir, ".arc", "platform");
|
|
@@ -27704,7 +27715,7 @@ async function copyBrowserAssets(ws, cache, noCache) {
|
|
|
27704
27715
|
const outputHashes = {};
|
|
27705
27716
|
for (const asset of assets) {
|
|
27706
27717
|
const dest = join11(ws.assetsDir, asset.to);
|
|
27707
|
-
mkdirSync9(
|
|
27718
|
+
mkdirSync9(dirname7(dest), { recursive: true });
|
|
27708
27719
|
copyFileSync(asset.src, dest);
|
|
27709
27720
|
outputHashes[asset.to] = sha256Hex(readFileSync10(dest));
|
|
27710
27721
|
}
|
|
@@ -27763,8 +27774,8 @@ async function platformBuild(opts = {}) {
|
|
|
27763
27774
|
|
|
27764
27775
|
// src/commands/platform-deploy.ts
|
|
27765
27776
|
import { existsSync as existsSync17, readFileSync as readFileSync14 } from "fs";
|
|
27766
|
-
import { dirname as
|
|
27767
|
-
import { fileURLToPath as
|
|
27777
|
+
import { dirname as dirname9, join as join19 } from "path";
|
|
27778
|
+
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
27768
27779
|
|
|
27769
27780
|
// src/deploy/bootstrap.ts
|
|
27770
27781
|
var {spawn: spawn4 } = globalThis.Bun;
|
|
@@ -28968,8 +28979,8 @@ import {
|
|
|
28968
28979
|
writeFileSync as writeFileSync14
|
|
28969
28980
|
} from "fs";
|
|
28970
28981
|
import { tmpdir as tmpdir3 } from "os";
|
|
28971
|
-
import { dirname as
|
|
28972
|
-
import { fileURLToPath as
|
|
28982
|
+
import { dirname as dirname8, join as join18 } from "path";
|
|
28983
|
+
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
28973
28984
|
|
|
28974
28985
|
// src/deploy/image-template.ts
|
|
28975
28986
|
function generateDockerfile(inputs) {
|
|
@@ -29061,8 +29072,8 @@ function embedCliBundle(ws) {
|
|
|
29061
29072
|
copyFileSync2(source, target);
|
|
29062
29073
|
}
|
|
29063
29074
|
function locateCliBundle() {
|
|
29064
|
-
const here =
|
|
29065
|
-
let cur =
|
|
29075
|
+
const here = fileURLToPath6(import.meta.url);
|
|
29076
|
+
let cur = dirname8(here);
|
|
29066
29077
|
while (cur !== "/" && cur !== "") {
|
|
29067
29078
|
const candidate = join18(cur, "package.json");
|
|
29068
29079
|
if (existsSync16(candidate)) {
|
|
@@ -29080,7 +29091,7 @@ function locateCliBundle() {
|
|
|
29080
29091
|
throw e;
|
|
29081
29092
|
}
|
|
29082
29093
|
}
|
|
29083
|
-
const parent =
|
|
29094
|
+
const parent = dirname8(cur);
|
|
29084
29095
|
if (parent === cur)
|
|
29085
29096
|
break;
|
|
29086
29097
|
cur = parent;
|
|
@@ -29969,7 +29980,7 @@ async function platformDeploy(envArg, options = {}) {
|
|
|
29969
29980
|
log2("Inspecting remote server...");
|
|
29970
29981
|
const state = await detectRemoteState(cfg);
|
|
29971
29982
|
log2(`Remote state: ${state.kind}`);
|
|
29972
|
-
const cliVersion =
|
|
29983
|
+
const cliVersion = readCliVersion2();
|
|
29973
29984
|
const configHash = await hashDeployConfig(ws.rootDir);
|
|
29974
29985
|
await bootstrap({
|
|
29975
29986
|
cfg,
|
|
@@ -30001,10 +30012,10 @@ async function platformDeploy(envArg, options = {}) {
|
|
|
30001
30012
|
}
|
|
30002
30013
|
}
|
|
30003
30014
|
}
|
|
30004
|
-
function
|
|
30015
|
+
function readCliVersion2() {
|
|
30005
30016
|
try {
|
|
30006
|
-
let cur =
|
|
30007
|
-
const root =
|
|
30017
|
+
let cur = dirname9(fileURLToPath7(import.meta.url));
|
|
30018
|
+
const root = dirname9(cur).startsWith("/") ? "/" : ".";
|
|
30008
30019
|
while (cur !== root && cur !== "") {
|
|
30009
30020
|
const candidate = join19(cur, "package.json");
|
|
30010
30021
|
if (existsSync17(candidate)) {
|
|
@@ -30013,7 +30024,7 @@ function readCliVersion() {
|
|
|
30013
30024
|
return pkg.version ?? "unknown";
|
|
30014
30025
|
}
|
|
30015
30026
|
}
|
|
30016
|
-
const parent =
|
|
30027
|
+
const parent = dirname9(cur);
|
|
30017
30028
|
if (parent === cur)
|
|
30018
30029
|
break;
|
|
30019
30030
|
cur = parent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcote.tech/arc-cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "CLI tool for Arc framework",
|
|
5
5
|
"module": "index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
"build": "bun build --target=bun ./src/index.ts --outdir=dist --external @arcote.tech/arc --external @arcote.tech/arc-ds --external @arcote.tech/arc-react --external @arcote.tech/platform && chmod +x dist/index.js"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@arcote.tech/arc": "^0.7.
|
|
16
|
-
"@arcote.tech/arc-ds": "^0.7.
|
|
17
|
-
"@arcote.tech/arc-react": "^0.7.
|
|
18
|
-
"@arcote.tech/arc-host": "^0.7.
|
|
19
|
-
"@arcote.tech/arc-adapter-db-sqlite": "^0.7.
|
|
20
|
-
"@arcote.tech/platform": "^0.7.
|
|
15
|
+
"@arcote.tech/arc": "^0.7.4",
|
|
16
|
+
"@arcote.tech/arc-ds": "^0.7.4",
|
|
17
|
+
"@arcote.tech/arc-react": "^0.7.4",
|
|
18
|
+
"@arcote.tech/arc-host": "^0.7.4",
|
|
19
|
+
"@arcote.tech/arc-adapter-db-sqlite": "^0.7.4",
|
|
20
|
+
"@arcote.tech/platform": "^0.7.4",
|
|
21
21
|
"@clack/prompts": "^0.9.0",
|
|
22
22
|
"commander": "^11.1.0",
|
|
23
23
|
"chokidar": "^3.5.3",
|
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
2
|
-
import { join } from "path";
|
|
2
|
+
import { join, dirname } from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
3
4
|
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
const CACHE_VERSION = 2;
|
|
5
|
+
// Schema version — bump if cache entry shape changes.
|
|
6
|
+
const CACHE_SCHEMA_VERSION = 3;
|
|
7
7
|
const CACHE_FILE = ".build-cache.json";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Combined cache fingerprint: schema version + CLI version. Lets a newer CLI
|
|
11
|
+
* automatically invalidate dist/ produced by an older CLI even when source
|
|
12
|
+
* hashes match. Without this, a build-logic change in the CLI (e.g.
|
|
13
|
+
* externalization rules in buildContextClient) silently kept stale dist/
|
|
14
|
+
* around — see the v0.7.3 "creatorWorkspaces not found in context" incident.
|
|
15
|
+
*/
|
|
16
|
+
function readCliVersion(): string {
|
|
17
|
+
try {
|
|
18
|
+
// Bundled CLI lives at `<pkg>/dist/index.js`; package.json is one level up.
|
|
19
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
20
|
+
const pkg = JSON.parse(readFileSync(join(here, "..", "package.json"), "utf-8"));
|
|
21
|
+
return typeof pkg.version === "string" ? pkg.version : "unknown";
|
|
22
|
+
} catch {
|
|
23
|
+
return "unknown";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const CACHE_FINGERPRINT = `${CACHE_SCHEMA_VERSION}:${readCliVersion()}`;
|
|
27
|
+
|
|
9
28
|
export interface CacheEntry {
|
|
10
29
|
inputHash: string;
|
|
11
30
|
outputHash?: string;
|
|
@@ -13,22 +32,22 @@ export interface CacheEntry {
|
|
|
13
32
|
}
|
|
14
33
|
|
|
15
34
|
export interface BuildCache {
|
|
16
|
-
version:
|
|
35
|
+
version: string;
|
|
17
36
|
units: Record<string, CacheEntry>;
|
|
18
37
|
}
|
|
19
38
|
|
|
20
39
|
function emptyCache(): BuildCache {
|
|
21
|
-
return { version:
|
|
40
|
+
return { version: CACHE_FINGERPRINT, units: {} };
|
|
22
41
|
}
|
|
23
42
|
|
|
24
43
|
/** Loads cache from .arc/platform/.build-cache.json. Returns empty cache on
|
|
25
|
-
* missing file, parse error, or
|
|
44
|
+
* missing file, parse error, or fingerprint mismatch (schema OR CLI version). */
|
|
26
45
|
export function loadBuildCache(arcDir: string): BuildCache {
|
|
27
46
|
const path = join(arcDir, CACHE_FILE);
|
|
28
47
|
if (!existsSync(path)) return emptyCache();
|
|
29
48
|
try {
|
|
30
49
|
const raw = JSON.parse(readFileSync(path, "utf-8"));
|
|
31
|
-
if (raw?.version !==
|
|
50
|
+
if (raw?.version !== CACHE_FINGERPRINT || typeof raw.units !== "object") {
|
|
32
51
|
return emptyCache();
|
|
33
52
|
}
|
|
34
53
|
return raw as BuildCache;
|