@coze-arch/cli 0.0.36-alpha.1b252b → 0.0.36-alpha.64974b
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 +65 -114
- package/docs/deploy.md +10 -2
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +74 -18
- package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +1 -1
- package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +1 -1
- package/lib/__templates__/expo/client/metro.config.js +3 -1
- package/lib/__templates__/expo/pnpm-lock.yaml +5 -5
- package/lib/__templates__/expo/server/package.json +2 -2
- package/lib/__templates__/expo/server/src/index.ts +1 -1
- package/lib/__templates__/expo/template.config.js +11 -2
- package/lib/__templates__/native-static/.coze +2 -0
- package/lib/__templates__/native-static/scripts/serve.ps1 +7 -0
- package/lib/__templates__/nextjs/.coze +5 -0
- package/lib/__templates__/nextjs/scripts/build.ps1 +16 -0
- package/lib/__templates__/nextjs/scripts/dev.ps1 +63 -0
- package/lib/__templates__/nextjs/scripts/dev.sh +83 -2
- package/lib/__templates__/nextjs/scripts/prepare.ps1 +18 -0
- package/lib/__templates__/nextjs/scripts/start.ps1 +11 -0
- package/lib/__templates__/nextjs/scripts/validate.ps1 +8 -0
- package/lib/__templates__/nuxt-vue/.coze +5 -0
- package/lib/__templates__/nuxt-vue/scripts/build.ps1 +12 -0
- package/lib/__templates__/nuxt-vue/scripts/dev.ps1 +63 -0
- package/lib/__templates__/nuxt-vue/scripts/dev.sh +82 -1
- package/lib/__templates__/nuxt-vue/scripts/prepare.ps1 +12 -0
- package/lib/__templates__/nuxt-vue/scripts/start.ps1 +11 -0
- package/lib/__templates__/nuxt-vue/scripts/validate.ps1 +8 -0
- package/lib/__templates__/phaser/.coze +5 -0
- package/lib/__templates__/phaser/README.md +8 -0
- package/lib/__templates__/phaser/scripts/build.ps1 +12 -0
- package/lib/__templates__/phaser/scripts/dev.ps1 +49 -0
- package/lib/__templates__/phaser/scripts/prepare.ps1 +8 -0
- package/lib/__templates__/phaser/scripts/start.ps1 +49 -0
- package/lib/__templates__/phaser/scripts/validate.ps1 +7 -0
- package/lib/__templates__/phaser/src/global.d.ts +3 -0
- package/lib/__templates__/phaser/src/scene/BootScene.ts +4 -0
- package/lib/__templates__/phaser/src/scene/DevLoadingScene.ts +3 -0
- package/lib/__templates__/phaser/src/utils/mark-editable.ts +8 -1
- package/lib/__templates__/phaser/vite.config.ts +1 -1
- package/lib/__templates__/phaser-static/.coze +15 -0
- package/lib/__templates__/phaser-static/README.md +40 -0
- package/lib/__templates__/phaser-static/_gitignore +6 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0001.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0002.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0003.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0004.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0005.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0006.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0007.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0008.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0009.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0010.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0011.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0012.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0013.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0014.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0015.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0016.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0017.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0018.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0019.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0020.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0021.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0022.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0023.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0024.png +0 -0
- package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/manifest.json +11 -0
- package/lib/__templates__/phaser-static/debug-runtime/flow-graph.json +20 -0
- package/lib/__templates__/phaser-static/index.html +17 -0
- package/lib/__templates__/phaser-static/scripts/serve.ps1 +7 -0
- package/lib/__templates__/phaser-static/src/assets.js +15 -0
- package/lib/__templates__/phaser-static/src/main.js +26 -0
- package/lib/__templates__/phaser-static/src/phaser.js +7 -0
- package/lib/__templates__/phaser-static/src/scene/BootScene.js +205 -0
- package/lib/__templates__/phaser-static/src/scene/DevLoadingScene.js +67 -0
- package/lib/__templates__/phaser-static/src/style.css +28 -0
- package/lib/__templates__/phaser-static/src/utils/asset-loader.js +267 -0
- package/lib/__templates__/phaser-static/src/utils/index.js +2 -0
- package/lib/__templates__/phaser-static/src/utils/mark-editable.js +3 -0
- package/lib/__templates__/phaser-static/template.config.js +35 -0
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +1 -1
- package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +150 -68
- package/lib/__templates__/taro/AGENTS.md +11 -7
- package/lib/__templates__/taro/README.md +4 -4
- package/lib/__templates__/taro/config/index.ts +10 -2
- package/lib/__templates__/taro/pnpm-lock.yaml +5 -5
- package/lib/__templates__/taro/server/package.json +1 -1
- package/lib/__templates__/taro/server/src/main.ts +8 -2
- package/lib/__templates__/templates.json +26 -1
- package/lib/__templates__/vite/.coze +5 -0
- package/lib/__templates__/vite/scripts/build.ps1 +16 -0
- package/lib/__templates__/vite/scripts/dev.ps1 +63 -0
- package/lib/__templates__/vite/scripts/dev.sh +82 -1
- package/lib/__templates__/vite/scripts/prepare.ps1 +18 -0
- package/lib/__templates__/vite/scripts/start.ps1 +11 -0
- package/lib/__templates__/vite/scripts/validate.ps1 +8 -0
- package/lib/cli.js +647 -358
- package/lib/deploy/package-project.js +28 -4
- package/lib/deploy/package-project.py +21 -3
- package/package.json +1 -1
|
@@ -36,6 +36,7 @@ const LOCAL_METADATA_FILES = new Set([
|
|
|
36
36
|
]);
|
|
37
37
|
const UPLOAD_SESSION_TEMP_PREFIX = '.coze-deploy-upload-';
|
|
38
38
|
const REPRODUCIBLE_ARCHIVE_MTIME = new Date(0);
|
|
39
|
+
const PROJECT_METADATA_FILE_MODE = 0o644;
|
|
39
40
|
|
|
40
41
|
const parseArguments = argv => {
|
|
41
42
|
const positional = [];
|
|
@@ -92,6 +93,18 @@ const readCommand = (config, section, key) => {
|
|
|
92
93
|
return command;
|
|
93
94
|
};
|
|
94
95
|
|
|
96
|
+
const readPlatformCommand = (config, section, key) => {
|
|
97
|
+
const defaultCommand = readCommand(config, section, key);
|
|
98
|
+
const windowsCommand = process.platform === 'win32'
|
|
99
|
+
? readCommand(config, section, `${key}_win`)
|
|
100
|
+
: undefined;
|
|
101
|
+
|
|
102
|
+
if (windowsCommand?.length) {
|
|
103
|
+
return { command: windowsCommand, key: `${key}_win` };
|
|
104
|
+
}
|
|
105
|
+
return defaultCommand?.length ? { command: defaultCommand, key } : undefined;
|
|
106
|
+
};
|
|
107
|
+
|
|
95
108
|
const runCommand = (command, sourceDir, env) => {
|
|
96
109
|
const result = spawnSync(command[0], command.slice(1), {
|
|
97
110
|
cwd: sourceDir,
|
|
@@ -109,10 +122,16 @@ const runCommand = (command, sourceDir, env) => {
|
|
|
109
122
|
};
|
|
110
123
|
|
|
111
124
|
const runPackCommand = sourceDir => {
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
125
|
+
const configuredCommand = readPlatformCommand(
|
|
126
|
+
readCozeConfig(sourceDir),
|
|
127
|
+
'dev',
|
|
128
|
+
'pack',
|
|
129
|
+
);
|
|
130
|
+
if (configuredCommand) {
|
|
131
|
+
process.stderr.write(
|
|
132
|
+
`[package] Running dev.${configuredCommand.key}: ${configuredCommand.command.join(' ')}\n`,
|
|
133
|
+
);
|
|
134
|
+
runCommand(configuredCommand.command, sourceDir, buildCommandEnv());
|
|
116
135
|
}
|
|
117
136
|
};
|
|
118
137
|
|
|
@@ -193,6 +212,11 @@ const createTarGzWithoutRoot = async (sourceDir, outputPath, excludeCozeFile = f
|
|
|
193
212
|
filter: archivePath => shouldInclude(archivePath, excludeCozeFile),
|
|
194
213
|
gzip: true,
|
|
195
214
|
mtime: REPRODUCIBLE_ARCHIVE_MTIME,
|
|
215
|
+
onWriteEntry: entry => {
|
|
216
|
+
if (entry.path === '.coze' && entry.stat?.isFile()) {
|
|
217
|
+
entry.stat.mode = PROJECT_METADATA_FILE_MODE;
|
|
218
|
+
}
|
|
219
|
+
},
|
|
196
220
|
portable: true,
|
|
197
221
|
},
|
|
198
222
|
entries,
|
|
@@ -30,6 +30,7 @@ EXCLUDED_PARTS = {
|
|
|
30
30
|
UPLOAD_SESSION_FILENAME = ".coze-deploy-upload.json"
|
|
31
31
|
UPLOAD_SESSION_TEMP_PREFIX = ".coze-deploy-upload-"
|
|
32
32
|
HOST_LINK_FILENAME = ".host.json"
|
|
33
|
+
PROJECT_METADATA_FILE_MODE = 0o644
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
def build_command_env():
|
|
@@ -59,10 +60,25 @@ def read_command(config, section: str, key: str):
|
|
|
59
60
|
return command
|
|
60
61
|
|
|
61
62
|
|
|
63
|
+
def read_platform_command(config, section: str, key: str, platform=sys.platform):
|
|
64
|
+
default_command = read_command(config, section, key)
|
|
65
|
+
windows_command = (
|
|
66
|
+
read_command(config, section, f"{key}_win")
|
|
67
|
+
if platform.startswith("win")
|
|
68
|
+
else None
|
|
69
|
+
)
|
|
70
|
+
if windows_command:
|
|
71
|
+
return f"{key}_win", windows_command
|
|
72
|
+
return (key, default_command) if default_command else None
|
|
73
|
+
|
|
74
|
+
|
|
62
75
|
def run_pack_command(source_dir: Path):
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
76
|
+
configured_command = read_platform_command(
|
|
77
|
+
read_coze_config(source_dir), "dev", "pack"
|
|
78
|
+
)
|
|
79
|
+
if configured_command:
|
|
80
|
+
key, command = configured_command
|
|
81
|
+
print(f"[package] Running dev.{key}: {' '.join(command)}", file=sys.stderr)
|
|
66
82
|
subprocess.run(command, cwd=source_dir, env=build_command_env(), check=True)
|
|
67
83
|
|
|
68
84
|
|
|
@@ -116,6 +132,8 @@ def should_exclude(tar_info: tarfile.TarInfo, exclude_coze_file=False):
|
|
|
116
132
|
return None
|
|
117
133
|
if any(part in EXCLUDED_PARTS for part in parts):
|
|
118
134
|
return None
|
|
135
|
+
if parts == (".coze",) and tar_info.isfile():
|
|
136
|
+
tar_info.mode = PROJECT_METADATA_FILE_MODE
|
|
119
137
|
return tar_info
|
|
120
138
|
|
|
121
139
|
|