castle-web-cli 0.4.64 → 0.4.66
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/castle-host/host.d.ts +1 -0
- package/dist/castle-host/host.js +9 -4
- package/dist/config.js +5 -0
- package/dist/ide.js +46 -650
- package/dist/index.js +20 -5
- package/dist/save-deck.d.ts +7 -1
- package/dist/save-deck.js +19 -7
- package/dist/shell/assets/index-DWeEuBNg.css +1 -0
- package/dist/shell/assets/index-nbJVgKix.js +106 -0
- package/dist/shell/index.html +13 -0
- package/kits/basic-2d/editors/CodeEditor.jsx +2 -1
- package/package.json +3 -2
- package/dist/buildArchive.d.ts +0 -1
- package/dist/buildArchive.js +0 -108
- package/dist/chat-client.d.ts +0 -1
- package/dist/chat-client.js +0 -538
- package/dist/ide-client.d.ts +0 -1
- package/dist/ide-client.js +0 -569
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>Castle Editor</title>
|
|
7
|
+
<script type="module" crossorigin src="/__castle/ide/assets/index-nbJVgKix.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/__castle/ide/assets/index-DWeEuBNg.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div id="root"></div>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -17,6 +17,7 @@ const castleHighlightStyle = HighlightStyle.define([
|
|
|
17
17
|
]);
|
|
18
18
|
const castleCodeTheme = EditorView.theme({
|
|
19
19
|
'&': {
|
|
20
|
+
width: '100%',
|
|
20
21
|
height: '100%',
|
|
21
22
|
fontSize: '9pt',
|
|
22
23
|
backgroundColor: '#fff',
|
|
@@ -32,7 +33,7 @@ const castleCodeTheme = EditorView.theme({
|
|
|
32
33
|
minHeight: '100%',
|
|
33
34
|
color: '#322b28',
|
|
34
35
|
paddingBottom: '400px',
|
|
35
|
-
paddingRight: '
|
|
36
|
+
paddingRight: '16px',
|
|
36
37
|
},
|
|
37
38
|
'.cm-gutters': {
|
|
38
39
|
display: 'none',
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "castle-web-cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.66",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"castle-web": "./dist/index.js"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "
|
|
9
|
+
"build": "rm -rf dist && tsc && vite build && cp -R src/castle-host dist/castle-host && rm -rf kits && cp -R ../kits kits",
|
|
10
10
|
"dev": "tsc --watch",
|
|
11
11
|
"check": "eslint . && jscpd && tsc --noEmit"
|
|
12
12
|
},
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"@xterm/addon-serialize": "^0.14.0",
|
|
29
29
|
"@xterm/headless": "^6.0.0",
|
|
30
30
|
"@xterm/xterm": "^6.0.0",
|
|
31
|
+
"dockview": "^4.13.1",
|
|
31
32
|
"marked": "^18.0.5",
|
|
32
33
|
"nanoid": "^5.1.7",
|
|
33
34
|
"open": "^10.0.0",
|
package/dist/buildArchive.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function buildKitArchives(kits?: string[]): void;
|
package/dist/buildArchive.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { execFileSync } from 'child_process';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import * as os from 'os';
|
|
4
|
-
import * as path from 'path';
|
|
5
|
-
import { ARCHIVE_NAME, PUBLISHED_SDK_VERSION, copyKitSource, getKitArchivePath, rewriteKitPackageJson, } from './init.js';
|
|
6
|
-
import { getKitsDir, getSdkPackagePath, toPosixPath } from './localPaths.js';
|
|
7
|
-
// Refs forced to "published" so the archived deck looks like one scaffolded
|
|
8
|
-
// from a globally-installed castle-web (registry sdk + `castle-web` binary),
|
|
9
|
-
// regardless of the workspace checkout we generate it from.
|
|
10
|
-
const PUBLISHED_REFS = {
|
|
11
|
-
workspaceMode: false,
|
|
12
|
-
sdkRef: `^${PUBLISHED_SDK_VERSION}`,
|
|
13
|
-
cliCommand: 'castle-web',
|
|
14
|
-
cliDistAbs: null,
|
|
15
|
-
sdkPathPosix: null,
|
|
16
|
-
};
|
|
17
|
-
// Build the local sdk and `npm pack` it into a temp dir, returning the tarball
|
|
18
|
-
// path. Installing a tarball (not a `file:` dir) gives the archive a real copy
|
|
19
|
-
// of the sdk in node_modules instead of a symlink to the local checkout.
|
|
20
|
-
function packSdk() {
|
|
21
|
-
const sdkDir = getSdkPackagePath();
|
|
22
|
-
if (!fs.existsSync(sdkDir)) {
|
|
23
|
-
throw new Error(`sdk/ not found at ${sdkDir}; build-archives must run from a workspace checkout.`);
|
|
24
|
-
}
|
|
25
|
-
console.log('Building sdk...');
|
|
26
|
-
execFileSync('npm', ['run', 'build'], { cwd: sdkDir, stdio: 'inherit' });
|
|
27
|
-
const dest = fs.mkdtempSync(path.join(os.tmpdir(), 'castle-sdk-pack-'));
|
|
28
|
-
console.log('Packing sdk...');
|
|
29
|
-
const out = execFileSync('npm', ['pack', '--pack-destination', dest], {
|
|
30
|
-
cwd: sdkDir,
|
|
31
|
-
encoding: 'utf8',
|
|
32
|
-
}).trim();
|
|
33
|
-
// npm pack prints the created tarball filename on its last line.
|
|
34
|
-
const file = out.split('\n').pop().trim();
|
|
35
|
-
return path.join(dest, file);
|
|
36
|
-
}
|
|
37
|
-
// Find every real kit under kits/ (a subdir with a package.json).
|
|
38
|
-
function discoverKits(kitsDir) {
|
|
39
|
-
return fs.readdirSync(kitsDir).filter((name) => {
|
|
40
|
-
const dir = path.join(kitsDir, name);
|
|
41
|
-
return fs.statSync(dir).isDirectory() && fs.existsSync(path.join(dir, 'package.json'));
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
// Generate one ready-to-serve archive for `kit`: kit source (minus build junk)
|
|
45
|
-
// + installed node_modules + a published-mode package.json, gzipped into the
|
|
46
|
-
// bundled kit dir (cli/kits/<kit>/published-deck.tgz).
|
|
47
|
-
function buildKitArchive(kit, sdkTarball) {
|
|
48
|
-
const kitDir = path.join(getKitsDir(), kit);
|
|
49
|
-
if (!fs.existsSync(path.join(kitDir, 'package.json'))) {
|
|
50
|
-
throw new Error(`Kit "${kit}" has no package.json at ${kitDir}.`);
|
|
51
|
-
}
|
|
52
|
-
const stagingRoot = fs.mkdtempSync(path.join(os.tmpdir(), `castle-archive-${kit}-`));
|
|
53
|
-
const deck = path.join(stagingRoot, 'deck');
|
|
54
|
-
try {
|
|
55
|
-
// Same filter the live scaffold uses, plus drop any prior archive.
|
|
56
|
-
copyKitSource(kitDir, deck, new Set([ARCHIVE_NAME]));
|
|
57
|
-
// A stale workspace lock would pin file:../../sdk; drop it before install.
|
|
58
|
-
fs.rmSync(path.join(deck, 'package-lock.json'), { force: true });
|
|
59
|
-
// Published-mode package.json, but point the sdk at the local tarball so
|
|
60
|
-
// the install copies our freshly-built sdk into node_modules.
|
|
61
|
-
const pkgPath = path.join(deck, 'package.json');
|
|
62
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
63
|
-
rewriteKitPackageJson(pkg, kit, PUBLISHED_REFS);
|
|
64
|
-
pkg.dependencies['castle-web-sdk'] = `file:${toPosixPath(sdkTarball)}`;
|
|
65
|
-
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
66
|
-
// Deck deps are pure JS (no native binaries), so this mac-built
|
|
67
|
-
// node_modules runs as-is on linux/e2b.
|
|
68
|
-
console.log(`Installing deps for ${kit}...`);
|
|
69
|
-
execFileSync('npm', ['install', '--no-audit', '--no-fund', '--loglevel=error'], {
|
|
70
|
-
cwd: deck,
|
|
71
|
-
stdio: 'inherit',
|
|
72
|
-
});
|
|
73
|
-
// Restore the published sdk range (node_modules already holds the real
|
|
74
|
-
// sdk) and drop the lock pinning the local tarball path.
|
|
75
|
-
pkg.dependencies['castle-web-sdk'] = `^${PUBLISHED_SDK_VERSION}`;
|
|
76
|
-
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
77
|
-
fs.rmSync(path.join(deck, 'package-lock.json'), { force: true });
|
|
78
|
-
const archivePath = getKitArchivePath(kit);
|
|
79
|
-
fs.mkdirSync(path.dirname(archivePath), { recursive: true });
|
|
80
|
-
fs.rmSync(archivePath, { force: true });
|
|
81
|
-
console.log(`Archiving ${kit} -> ${archivePath}`);
|
|
82
|
-
execFileSync('tar', ['-czf', archivePath, '-C', deck, '.'], { stdio: 'inherit' });
|
|
83
|
-
const sizeMb = (fs.statSync(archivePath).size / 1e6).toFixed(1);
|
|
84
|
-
console.log(` ${kit} archive: ${sizeMb} MB`);
|
|
85
|
-
}
|
|
86
|
-
finally {
|
|
87
|
-
fs.rmSync(stagingRoot, { recursive: true, force: true });
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
// Generate archives for the given kits (default: every kit under kits/). Builds
|
|
91
|
-
// + packs the sdk once, then archives each kit against that same tarball.
|
|
92
|
-
export function buildKitArchives(kits) {
|
|
93
|
-
const kitsDir = getKitsDir();
|
|
94
|
-
const targets = kits ?? discoverKits(kitsDir);
|
|
95
|
-
if (targets.length === 0) {
|
|
96
|
-
console.error(`No kits found under ${kitsDir}.`);
|
|
97
|
-
process.exit(1);
|
|
98
|
-
}
|
|
99
|
-
const sdkTarball = packSdk();
|
|
100
|
-
try {
|
|
101
|
-
for (const kit of targets)
|
|
102
|
-
buildKitArchive(kit, sdkTarball);
|
|
103
|
-
}
|
|
104
|
-
finally {
|
|
105
|
-
fs.rmSync(path.dirname(sdkTarball), { recursive: true, force: true });
|
|
106
|
-
}
|
|
107
|
-
console.log(`Done. Archived: ${targets.join(', ')}`);
|
|
108
|
-
}
|
package/dist/chat-client.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|