build: let the sidecar build run from a source archive (P1.3d)
build-sidecar.mjs required a git checkout: it read HEAD, the tracked file list and the marketplace database blob from git. Outside a checkout it now records no source revision and ships the database from disk; a checkout keeps the exact-revision checks.
This commit is contained in:
@@ -677,6 +677,22 @@ describe('Tauri Production Configuration', () => {
|
||||
fs.readdirSync(path.dirname(marketplaceResourcePath))
|
||||
.filter((name) => name.startsWith('marketplace.db.stage-')),
|
||||
).toEqual([]);
|
||||
|
||||
// A source archive has no .git: the build still succeeds, records no
|
||||
// revision and ships the database it finds on disk.
|
||||
fs.rmSync(path.join(fixtureRoot, '.git'), { recursive: true, force: true });
|
||||
run(process.execPath, ['scripts/build-sidecar.mjs']);
|
||||
const archiveService = fs.readFileSync(
|
||||
path.join(fixtureRoot, 'app', 'src-tauri', 'resources', 'service.js'),
|
||||
);
|
||||
const archiveLine = archiveService
|
||||
.subarray(0, archiveService.indexOf(0x0a))
|
||||
.toString('utf8');
|
||||
const archiveManifest = JSON.parse(
|
||||
Buffer.from(archiveLine.slice(prefix.length), 'base64').toString('utf8'),
|
||||
) as { sourceRevision: string | null };
|
||||
expect(archiveManifest.sourceRevision).toBeNull();
|
||||
expect(fs.readFileSync(marketplaceResourcePath, 'utf8')).toBe('dirty worktree database');
|
||||
} finally {
|
||||
fs.rmSync(fixtureRoot, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user