feat: refresh creation config and visual assets
This commit is contained in:
@@ -675,7 +675,17 @@ class DevRunner {
|
||||
}
|
||||
|
||||
if (!this.options.skipPublish) {
|
||||
await this.publishSpacetimeModule();
|
||||
try {
|
||||
await this.publishSpacetimeModule();
|
||||
} catch (error) {
|
||||
if (isSpacetimePublishPermissionError(error)) {
|
||||
console.warn(
|
||||
`[dev:spacetime] 本地发布被当前 identity 拒绝,保留已启动的 standalone: ${error.message}`,
|
||||
);
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -769,20 +779,11 @@ class DevRunner {
|
||||
const env = {...this.baseEnv};
|
||||
this.prepareMigrationBootstrapSecret(env);
|
||||
|
||||
const args = [
|
||||
'publish',
|
||||
this.options.database,
|
||||
'--server',
|
||||
this.state.spacetimeServer,
|
||||
'--module-path',
|
||||
modulePath,
|
||||
'--build-options=--debug',
|
||||
];
|
||||
|
||||
if (!this.options.preserveDatabase) {
|
||||
args.push('-c=on-conflict');
|
||||
}
|
||||
args.push('--yes');
|
||||
const args = buildSpacetimePublishArgs({
|
||||
database: this.options.database,
|
||||
preserveDatabase: this.options.preserveDatabase,
|
||||
server: this.state.spacetimeServer,
|
||||
});
|
||||
|
||||
console.log(`[dev:spacetime] 发布模块: ${this.options.database}`);
|
||||
await runForeground('spacetime', args, {
|
||||
@@ -1459,10 +1460,40 @@ function normalizePath(path) {
|
||||
return path.replace(/\\/gu, '/');
|
||||
}
|
||||
|
||||
function buildSpacetimePublishArgs({database, server, preserveDatabase}) {
|
||||
const args = [
|
||||
'publish',
|
||||
database,
|
||||
'--server',
|
||||
server,
|
||||
'--module-path',
|
||||
modulePath,
|
||||
'--build-options=--debug',
|
||||
];
|
||||
|
||||
if (!preserveDatabase) {
|
||||
args.push('-c=on-conflict');
|
||||
}
|
||||
|
||||
args.push('--yes', '--no-config');
|
||||
return args;
|
||||
}
|
||||
|
||||
function isSpacetimePublishPermissionError(error) {
|
||||
const message = String(error?.message ?? error ?? '');
|
||||
return (
|
||||
message.includes('Pre-publish check failed with status 403 Forbidden') ||
|
||||
message.includes('not authorized to perform action on database') ||
|
||||
message.includes('is not authorized to perform action on database')
|
||||
);
|
||||
}
|
||||
|
||||
export {
|
||||
DevRunner,
|
||||
buildSpacetimePublishArgs,
|
||||
createDevServerSpawnOptions,
|
||||
createWatchConfigs,
|
||||
isSpacetimePublishPermissionError,
|
||||
parseArgs,
|
||||
shouldAcceptWatchEvent,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user