@coze-arch/cli 0.0.35 → 0.0.36-alpha.1b252b
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 +11 -0
- package/docs/deploy.md +164 -0
- package/lib/__templates__/nextjs/template.config.js +3 -1
- package/lib/__templates__/phaser/.coze +13 -0
- package/lib/__templates__/phaser/README.md +37 -0
- package/lib/__templates__/phaser/_gitignore +23 -0
- package/lib/__templates__/phaser/_npmrc +14 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0001.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0002.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0003.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0004.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0005.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0006.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0007.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0008.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0009.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0010.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0011.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0012.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0013.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0014.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0015.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0016.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0017.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0018.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0019.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0020.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0021.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0022.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0023.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0024.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/manifest.json +11 -0
- package/lib/__templates__/phaser/debug-runtime/flow-graph.json +20 -0
- package/lib/__templates__/phaser/index.html +12 -0
- package/lib/__templates__/phaser/package.json +31 -0
- package/lib/__templates__/phaser/pnpm-lock.yaml +661 -0
- package/lib/__templates__/phaser/scripts/build.sh +8 -0
- package/lib/__templates__/phaser/scripts/dev.sh +82 -0
- package/lib/__templates__/phaser/scripts/prepare.sh +7 -0
- package/lib/__templates__/phaser/scripts/spawn-detached.cjs +29 -0
- package/lib/__templates__/phaser/scripts/start.sh +82 -0
- package/lib/__templates__/phaser/scripts/validate.sh +7 -0
- package/lib/__templates__/phaser/src/assets.ts +15 -0
- package/lib/__templates__/phaser/src/global.d.ts +36 -0
- package/lib/__templates__/phaser/src/main.ts +28 -0
- package/lib/__templates__/phaser/src/scene/BootScene.ts +209 -0
- package/lib/__templates__/phaser/src/scene/DevLoadingScene.ts +66 -0
- package/lib/__templates__/phaser/src/style.css +28 -0
- package/lib/__templates__/phaser/src/types.ts +32 -0
- package/lib/__templates__/phaser/src/utils/asset-loader.ts +319 -0
- package/lib/__templates__/phaser/src/utils/index.ts +2 -0
- package/lib/__templates__/phaser/src/utils/mark-editable.ts +6 -0
- package/lib/__templates__/phaser/template.config.js +43 -0
- package/lib/__templates__/phaser/tsconfig.json +23 -0
- package/lib/__templates__/phaser/vite.config.ts +96 -0
- package/lib/__templates__/templates.json +25 -0
- package/lib/__templates__/vite/template.config.js +3 -1
- package/lib/cli.js +3164 -201
- package/lib/deploy/package-project.js +220 -0
- package/lib/deploy/package-project.py +165 -0
- package/package.json +5 -4
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Create the source tar.gz consumed by CreateDeployHistoryV2.
|
|
5
|
+
*
|
|
6
|
+
* Keep this implementation behaviorally aligned with package-project.py, which
|
|
7
|
+
* remains in this directory as the Python reference/backup implementation.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
existsSync,
|
|
14
|
+
mkdirSync,
|
|
15
|
+
readFileSync,
|
|
16
|
+
readdirSync,
|
|
17
|
+
statSync,
|
|
18
|
+
} = require('node:fs');
|
|
19
|
+
const path = require('node:path');
|
|
20
|
+
const { spawnSync } = require('node:child_process');
|
|
21
|
+
|
|
22
|
+
const TOML = require('@iarna/toml');
|
|
23
|
+
const tar = require('tar');
|
|
24
|
+
|
|
25
|
+
const EXCLUDED_PARTS = new Set([
|
|
26
|
+
'.codegraph',
|
|
27
|
+
'.next',
|
|
28
|
+
'.venv',
|
|
29
|
+
'__pycache__',
|
|
30
|
+
'node_modules',
|
|
31
|
+
'site-packages',
|
|
32
|
+
]);
|
|
33
|
+
const LOCAL_METADATA_FILES = new Set([
|
|
34
|
+
'.coze-deploy-upload.json',
|
|
35
|
+
'.host.json',
|
|
36
|
+
]);
|
|
37
|
+
const UPLOAD_SESSION_TEMP_PREFIX = '.coze-deploy-upload-';
|
|
38
|
+
const REPRODUCIBLE_ARCHIVE_MTIME = new Date(0);
|
|
39
|
+
|
|
40
|
+
const parseArguments = argv => {
|
|
41
|
+
const positional = [];
|
|
42
|
+
let pages = false;
|
|
43
|
+
for (const argument of argv) {
|
|
44
|
+
if (argument === '--pages') {
|
|
45
|
+
pages = true;
|
|
46
|
+
} else if (argument.startsWith('-')) {
|
|
47
|
+
throw new Error(`Unknown argument: ${argument}`);
|
|
48
|
+
} else {
|
|
49
|
+
positional.push(argument);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (positional.length !== 2) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
'Usage: package-project.js <source_dir> <output_path> [--pages]',
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
sourceDir: path.resolve(positional[0]),
|
|
59
|
+
outputPath: path.resolve(positional[1]),
|
|
60
|
+
pages,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const buildCommandEnv = () => {
|
|
65
|
+
const env = { ...process.env };
|
|
66
|
+
const cliBinDir = path.resolve(__dirname, '..', '..', 'node_modules', '.bin');
|
|
67
|
+
env.PATH = env.PATH
|
|
68
|
+
? `${cliBinDir}${path.delimiter}${env.PATH}`
|
|
69
|
+
: cliBinDir;
|
|
70
|
+
return env;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const readCozeConfig = sourceDir => {
|
|
74
|
+
const cozePath = path.join(sourceDir, '.coze');
|
|
75
|
+
if (!existsSync(cozePath)) {
|
|
76
|
+
return {};
|
|
77
|
+
}
|
|
78
|
+
return TOML.parse(readFileSync(cozePath, 'utf8'));
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const readCommand = (config, section, key) => {
|
|
82
|
+
const command = config[section]?.[key];
|
|
83
|
+
if (command === undefined) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
if (
|
|
87
|
+
!Array.isArray(command) ||
|
|
88
|
+
!command.every(part => typeof part === 'string' && part.length > 0)
|
|
89
|
+
) {
|
|
90
|
+
throw new Error(`.coze ${section}.${key} must be a string array`);
|
|
91
|
+
}
|
|
92
|
+
return command;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const runCommand = (command, sourceDir, env) => {
|
|
96
|
+
const result = spawnSync(command[0], command.slice(1), {
|
|
97
|
+
cwd: sourceDir,
|
|
98
|
+
env,
|
|
99
|
+
stdio: 'inherit',
|
|
100
|
+
});
|
|
101
|
+
if (result.error) {
|
|
102
|
+
throw result.error;
|
|
103
|
+
}
|
|
104
|
+
if (result.status !== 0) {
|
|
105
|
+
throw new Error(
|
|
106
|
+
`Command ${command.join(' ')} exited with code ${String(result.status)}`,
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const runPackCommand = sourceDir => {
|
|
112
|
+
const command = readCommand(readCozeConfig(sourceDir), 'dev', 'pack');
|
|
113
|
+
if (command) {
|
|
114
|
+
process.stderr.write(`[package] Running dev.pack: ${command.join(' ')}\n`);
|
|
115
|
+
runCommand(command, sourceDir, buildCommandEnv());
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const hasIndexHtml = directory =>
|
|
120
|
+
existsSync(path.join(directory, 'index.html')) &&
|
|
121
|
+
statSync(path.join(directory, 'index.html')).isFile();
|
|
122
|
+
|
|
123
|
+
const preparePagesOutput = sourceDir => {
|
|
124
|
+
if (hasIndexHtml(sourceDir)) {
|
|
125
|
+
process.stderr.write(`[package] Pages static source: ${sourceDir}\n`);
|
|
126
|
+
return sourceDir;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const cozePath = path.join(sourceDir, '.coze');
|
|
130
|
+
if (!existsSync(cozePath)) {
|
|
131
|
+
throw new Error(
|
|
132
|
+
'Pages source contains neither index.html nor a .coze file. ' +
|
|
133
|
+
'Add index.html or configure a Next.js build in .coze.',
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const config = readCozeConfig(sourceDir);
|
|
138
|
+
const template = config.project?.template;
|
|
139
|
+
if (typeof template !== 'string' || template.trim().toLowerCase() !== 'nextjs') {
|
|
140
|
+
throw new Error(
|
|
141
|
+
'Pages source contains no index.html; .coze project.template must be "nextjs"',
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
if (!readCommand(config, 'deploy', 'build')) {
|
|
145
|
+
throw new Error(
|
|
146
|
+
'Pages source contains no index.html; .coze deploy.build is required',
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
process.stderr.write(`[package] Pages Next.js source: ${sourceDir}\n`);
|
|
150
|
+
return sourceDir;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const shouldInclude = (archivePath, excludeCozeFile = false) => {
|
|
154
|
+
const parts = archivePath.split(/[\\/]/u);
|
|
155
|
+
if (
|
|
156
|
+
parts.some(
|
|
157
|
+
part =>
|
|
158
|
+
LOCAL_METADATA_FILES.has(part) ||
|
|
159
|
+
(part.startsWith(UPLOAD_SESSION_TEMP_PREFIX) && part.endsWith('.tmp')),
|
|
160
|
+
)
|
|
161
|
+
) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
if (parts.includes('.env')) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
if (excludeCozeFile && parts.includes('.coze')) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
if (parts.some(part => part.startsWith('.git'))) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
return !parts.some(part => EXCLUDED_PARTS.has(part));
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const createTarGzWithoutRoot = async (sourceDir, outputPath, excludeCozeFile = false) => {
|
|
177
|
+
if (!existsSync(sourceDir) || !statSync(sourceDir).isDirectory()) {
|
|
178
|
+
throw new Error(`source directory does not exist: ${sourceDir}`);
|
|
179
|
+
}
|
|
180
|
+
mkdirSync(path.dirname(outputPath), { recursive: true });
|
|
181
|
+
process.stderr.write(`[package] Creating archive from: ${sourceDir}\n`);
|
|
182
|
+
const resolvedOutputPath = path.resolve(outputPath);
|
|
183
|
+
const entries = readdirSync(sourceDir)
|
|
184
|
+
.filter(entry =>
|
|
185
|
+
entry !== '.codegraph' &&
|
|
186
|
+
path.resolve(sourceDir, entry) !== resolvedOutputPath,
|
|
187
|
+
)
|
|
188
|
+
.sort();
|
|
189
|
+
await tar.create(
|
|
190
|
+
{
|
|
191
|
+
cwd: sourceDir,
|
|
192
|
+
file: outputPath,
|
|
193
|
+
filter: archivePath => shouldInclude(archivePath, excludeCozeFile),
|
|
194
|
+
gzip: true,
|
|
195
|
+
mtime: REPRODUCIBLE_ARCHIVE_MTIME,
|
|
196
|
+
portable: true,
|
|
197
|
+
},
|
|
198
|
+
entries,
|
|
199
|
+
);
|
|
200
|
+
const size = statSync(outputPath).size;
|
|
201
|
+
if (size <= 0) {
|
|
202
|
+
throw new Error('source archive is empty');
|
|
203
|
+
}
|
|
204
|
+
process.stderr.write(`[package] Archive ready: ${String(size)} bytes\n`);
|
|
205
|
+
return size;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const main = async () => {
|
|
209
|
+
const { sourceDir, outputPath, pages } = parseArguments(process.argv.slice(2));
|
|
210
|
+
const packageDir = pages
|
|
211
|
+
? preparePagesOutput(sourceDir)
|
|
212
|
+
: (runPackCommand(sourceDir), sourceDir);
|
|
213
|
+
const size = await createTarGzWithoutRoot(packageDir, outputPath, pages);
|
|
214
|
+
process.stdout.write(`${String(size)}\n`);
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
main().catch(error => {
|
|
218
|
+
process.stderr.write(`${error instanceof Error ? error.stack : String(error)}\n`);
|
|
219
|
+
process.exitCode = 1;
|
|
220
|
+
});
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Create the source tar.gz consumed by CreateDeployHistoryV2.
|
|
3
|
+
|
|
4
|
+
This is the standalone subset of coze-coding's devbox package.py. It keeps the
|
|
5
|
+
same archive layout and deployment exclusions without importing the devbox
|
|
6
|
+
service runtime (FastAPI, S3FS, project managers, and background tasks).
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
import os
|
|
11
|
+
import subprocess
|
|
12
|
+
import sys
|
|
13
|
+
import tarfile
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
try:
|
|
17
|
+
import tomllib
|
|
18
|
+
except ModuleNotFoundError as error: # pragma: no cover - depends on host Python
|
|
19
|
+
raise RuntimeError("Python 3.11 or newer is required to read .coze") from error
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
EXCLUDED_PARTS = {
|
|
23
|
+
".codegraph",
|
|
24
|
+
".next",
|
|
25
|
+
".venv",
|
|
26
|
+
"__pycache__",
|
|
27
|
+
"node_modules",
|
|
28
|
+
"site-packages",
|
|
29
|
+
}
|
|
30
|
+
UPLOAD_SESSION_FILENAME = ".coze-deploy-upload.json"
|
|
31
|
+
UPLOAD_SESSION_TEMP_PREFIX = ".coze-deploy-upload-"
|
|
32
|
+
HOST_LINK_FILENAME = ".host.json"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def build_command_env():
|
|
36
|
+
env = os.environ.copy()
|
|
37
|
+
cli_bin_dir = Path(__file__).resolve().parent.parent / "node_modules" / ".bin"
|
|
38
|
+
path = env.get("PATH", "")
|
|
39
|
+
env["PATH"] = f"{cli_bin_dir}{os.pathsep}{path}" if path else str(cli_bin_dir)
|
|
40
|
+
return env
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def read_coze_config(source_dir: Path):
|
|
44
|
+
coze_path = source_dir / ".coze"
|
|
45
|
+
if not coze_path.is_file():
|
|
46
|
+
return {}
|
|
47
|
+
with coze_path.open("rb") as file:
|
|
48
|
+
return tomllib.load(file)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def read_command(config, section: str, key: str):
|
|
52
|
+
command = (config.get(section) or {}).get(key)
|
|
53
|
+
if command is None:
|
|
54
|
+
return None
|
|
55
|
+
if not isinstance(command, list) or not all(
|
|
56
|
+
isinstance(part, str) and part for part in command
|
|
57
|
+
):
|
|
58
|
+
raise ValueError(f".coze {section}.{key} must be a string array")
|
|
59
|
+
return command
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def run_pack_command(source_dir: Path):
|
|
63
|
+
command = read_command(read_coze_config(source_dir), "dev", "pack")
|
|
64
|
+
if command:
|
|
65
|
+
print(f"[package] Running dev.pack: {' '.join(command)}", file=sys.stderr)
|
|
66
|
+
subprocess.run(command, cwd=source_dir, env=build_command_env(), check=True)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def has_index_html(directory: Path):
|
|
70
|
+
return (directory / "index.html").is_file()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def prepare_pages_output(source_dir: Path):
|
|
74
|
+
if has_index_html(source_dir):
|
|
75
|
+
print(f"[package] Pages static source: {source_dir}", file=sys.stderr)
|
|
76
|
+
return source_dir
|
|
77
|
+
|
|
78
|
+
coze_path = source_dir / ".coze"
|
|
79
|
+
if not coze_path.is_file():
|
|
80
|
+
raise ValueError(
|
|
81
|
+
"Pages source contains neither index.html nor a .coze file. "
|
|
82
|
+
"Add index.html or configure a Next.js build in .coze."
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
config = read_coze_config(source_dir)
|
|
86
|
+
template = (config.get("project") or {}).get("template")
|
|
87
|
+
if not isinstance(template, str) or template.strip().lower() != "nextjs":
|
|
88
|
+
raise ValueError(
|
|
89
|
+
'Pages source contains no index.html; .coze project.template must be "nextjs"'
|
|
90
|
+
)
|
|
91
|
+
if not read_command(config, "deploy", "build"):
|
|
92
|
+
raise ValueError(
|
|
93
|
+
"Pages source contains no index.html; .coze deploy.build is required"
|
|
94
|
+
)
|
|
95
|
+
print(f"[package] Pages Next.js source: {source_dir}", file=sys.stderr)
|
|
96
|
+
return source_dir
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def should_exclude(tar_info: tarfile.TarInfo, exclude_coze_file=False):
|
|
100
|
+
parts = Path(tar_info.name).parts
|
|
101
|
+
|
|
102
|
+
# Local deployment metadata is not application source. Including it can change
|
|
103
|
+
# the package digest on the next CLI invocation and make the resumable PreDeploy
|
|
104
|
+
# session look like a different artifact.
|
|
105
|
+
if any(
|
|
106
|
+
part in {UPLOAD_SESSION_FILENAME, HOST_LINK_FILENAME}
|
|
107
|
+
or (part.startswith(UPLOAD_SESSION_TEMP_PREFIX) and part.endswith(".tmp"))
|
|
108
|
+
for part in parts
|
|
109
|
+
):
|
|
110
|
+
return None
|
|
111
|
+
if ".env" in parts:
|
|
112
|
+
return None
|
|
113
|
+
if exclude_coze_file and ".coze" in parts:
|
|
114
|
+
return None
|
|
115
|
+
if any(part.startswith(".git") for part in parts):
|
|
116
|
+
return None
|
|
117
|
+
if any(part in EXCLUDED_PARTS for part in parts):
|
|
118
|
+
return None
|
|
119
|
+
return tar_info
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def create_tar_gz_without_root(source_dir: Path, output_path: Path, exclude_coze_file=False):
|
|
123
|
+
if not source_dir.is_dir():
|
|
124
|
+
raise ValueError(f"source directory does not exist: {source_dir}")
|
|
125
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
126
|
+
print(f"[package] Creating archive from: {source_dir}", file=sys.stderr)
|
|
127
|
+
with tarfile.open(output_path, "w:gz") as archive:
|
|
128
|
+
for entry in sorted(os.listdir(source_dir)):
|
|
129
|
+
if entry == ".codegraph":
|
|
130
|
+
continue
|
|
131
|
+
if (source_dir / entry).resolve() == output_path.resolve():
|
|
132
|
+
continue
|
|
133
|
+
archive.add(
|
|
134
|
+
source_dir / entry,
|
|
135
|
+
arcname=entry,
|
|
136
|
+
filter=lambda info: should_exclude(info, exclude_coze_file),
|
|
137
|
+
)
|
|
138
|
+
if not output_path.is_file() or output_path.stat().st_size <= 0:
|
|
139
|
+
raise RuntimeError("source archive is empty")
|
|
140
|
+
print(
|
|
141
|
+
f"[package] Archive ready: {output_path.stat().st_size} bytes",
|
|
142
|
+
file=sys.stderr,
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def main():
|
|
147
|
+
parser = argparse.ArgumentParser()
|
|
148
|
+
parser.add_argument("source_dir")
|
|
149
|
+
parser.add_argument("output_path")
|
|
150
|
+
parser.add_argument("--pages", action="store_true")
|
|
151
|
+
args = parser.parse_args()
|
|
152
|
+
|
|
153
|
+
source_dir = Path(args.source_dir).resolve()
|
|
154
|
+
output_path = Path(args.output_path).resolve()
|
|
155
|
+
if args.pages:
|
|
156
|
+
package_dir = prepare_pages_output(source_dir)
|
|
157
|
+
else:
|
|
158
|
+
run_pack_command(source_dir)
|
|
159
|
+
package_dir = source_dir
|
|
160
|
+
create_tar_gz_without_root(package_dir, output_path, args.pages)
|
|
161
|
+
print(output_path.stat().st_size)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
if __name__ == "__main__":
|
|
165
|
+
main()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coze-arch/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36-alpha.1b252b",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "coze coding devtools cli",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"lib",
|
|
14
14
|
"bin",
|
|
15
|
+
"docs/deploy.md",
|
|
15
16
|
"lib/**/.npmrc",
|
|
16
17
|
"!**/*.tsbuildinfo",
|
|
17
18
|
"!**/*.map",
|
|
@@ -48,7 +49,9 @@
|
|
|
48
49
|
"fast-glob": "^3.3.3",
|
|
49
50
|
"js-yaml": "^4.2.0",
|
|
50
51
|
"minimist": "^1.2.8",
|
|
51
|
-
"
|
|
52
|
+
"pnpm": "9.0.0",
|
|
53
|
+
"shelljs": "^0.10.0",
|
|
54
|
+
"tar": "^7.5.22"
|
|
52
55
|
},
|
|
53
56
|
"devDependencies": {
|
|
54
57
|
"@coze-arch/cli-logger": "workspace:*",
|
|
@@ -60,7 +63,6 @@
|
|
|
60
63
|
"@coze-arch/ts-config": "workspace:*",
|
|
61
64
|
"@coze-arch/vitest-config": "workspace:*",
|
|
62
65
|
"@coze-coding/lambda": "workspace:*",
|
|
63
|
-
"@emnapi/runtime": "^1.11.1",
|
|
64
66
|
"@inquirer/prompts": "^3.2.0",
|
|
65
67
|
"@rollup/plugin-commonjs": "^28.0.2",
|
|
66
68
|
"@rollup/plugin-json": "~6.1.0",
|
|
@@ -79,7 +81,6 @@
|
|
|
79
81
|
"playwright": "~1.61.1",
|
|
80
82
|
"rollup": "^4.60.1",
|
|
81
83
|
"sucrase": "^3.35.1",
|
|
82
|
-
"tree-kill": "^1.2.2",
|
|
83
84
|
"tsx": "^4.23.11",
|
|
84
85
|
"vitest": "~4.1.10"
|
|
85
86
|
},
|