Skip to content

Commit 3477fab

Browse files
Fix bundle naming: consistent names, no special characters
- Use branch name instead of ambiguous "dev" prefix - Replace ":" and "+" with "_" for filesystem compatibility - Write version name to .version_name so Firefox gets same name as Chrome - Exclude .version_name and .DS_Store from Chrome ZIP Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 3bad22e commit 3477fab

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

scripts/copy.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ function getVersionName(baseVersion) {
3737
// Not tagged - development build
3838
}
3939

40+
// Get branch name
41+
const branch = execSync('git rev-parse --abbrev-ref HEAD', { cwd: ROOT, encoding: 'utf8' }).trim();
42+
4043
// Check if extension source is dirty
4144
const dirty = execSync('git status --porcelain -- extension/', { cwd: ROOT, encoding: 'utf8' }).trim();
4245

4346
if (dirty) {
44-
// Get worktree directory name
45-
const worktreePath = execSync('git rev-parse --show-toplevel', { cwd: ROOT, encoding: 'utf8' }).trim();
46-
const worktreeName = path.basename(worktreePath);
47-
return `${baseVersion}-dev+${commitHash}-dirty:${worktreeName}`;
47+
return `${baseVersion}-${branch}_${commitHash}-dirty`;
4848
}
4949

50-
return `${baseVersion}-dev+${commitHash}`;
50+
return `${baseVersion}-${branch}_${commitHash}`;
5151
} catch (err) {
5252
// Not a git repo or git not available
5353
console.warn('Warning: Could not get git info for version_name');
@@ -108,6 +108,9 @@ async function build() {
108108

109109
await fs.writeFile(manifestDest, JSON.stringify(manifest, null, 2) + '\n');
110110

111+
// Write version name for package.js (Firefox manifest can't store it)
112+
await fs.writeFile(path.join(TARGET, '.version_name'), versionName);
113+
111114
console.log(`✓ Extension files copied for ${browser}`);
112115
}
113116

scripts/package.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ async function packageExtension() {
2222
// Create bundle directory
2323
await fs.mkdir(bundleDir, { recursive: true });
2424

25-
// Read version from manifest (prefer version_name for dev builds)
26-
const manifestContent = await fs.readFile(manifestPath, 'utf8');
27-
const manifest = JSON.parse(manifestContent);
28-
const version = manifest.version_name || manifest.version;
25+
// Read version name written by copy.js (works for both browsers)
26+
const versionNamePath = path.join(buildDir, '.version_name');
27+
const version = (await fs.readFile(versionNamePath, 'utf8')).trim();
2928

3029
const packageName = `github-bookmarked-issues-${version}`;
3130

@@ -38,7 +37,7 @@ async function packageExtension() {
3837
const isWindows = process.platform === 'win32';
3938
const cmd = isWindows
4039
? `powershell -Command "Compress-Archive -Path '.\\*' -DestinationPath '${zipPath}' -Force"`
41-
: `zip -r "${zipPath}" . -x "*.zip"`;
40+
: `zip -r "${zipPath}" . -x "*.zip" -x ".version_name" -x ".DS_Store"`;
4241

4342
execSync(cmd, {
4443
cwd: buildDir,

0 commit comments

Comments
 (0)