|
1 | 1 | const fs = require('fs'); |
2 | 2 | const path = require('path'); |
3 | 3 | const { getVersion } = require('./get-version'); |
| 4 | +const { buildDir, chromeDir, firefoxDir, projectRoot } = require('./directories'); |
4 | 5 |
|
5 | 6 | // Get version from git tag |
6 | 7 | const version = getVersion(); |
7 | 8 | console.log(`Using version: ${version}`); |
8 | 9 |
|
9 | | -// These directories are where we'll output our build artifacts: |
10 | | -const buildDir = path.join(__dirname, 'build'); |
11 | | -const chromeDir = path.join(buildDir, 'chrome'); |
12 | | -const firefoxDir = path.join(buildDir, 'firefox'); |
13 | | - |
14 | 10 | // Ensure build directories exist |
15 | 11 | if (!fs.existsSync(buildDir)) fs.mkdirSync(buildDir); |
16 | 12 | if (!fs.existsSync(chromeDir)) fs.mkdirSync(chromeDir); |
@@ -70,14 +66,14 @@ copyFiles(sourceFilesInManifest, firefoxDir); |
70 | 66 |
|
71 | 67 | // Copy and update manifest files with dynamic version |
72 | 68 | updateManifestVersion( |
73 | | - path.join(__dirname, 'manifest.json'), |
| 69 | + path.join(projectRoot, 'manifest.json'), |
74 | 70 | path.join(chromeDir, 'manifest.json'), |
75 | 71 | version |
76 | 72 | ); |
77 | 73 | // For Firefox, we use our Chrome manifest as a base and inject Firefox-specific fields |
78 | 74 | renderFirefoxManifest( |
79 | | - path.join(__dirname, 'manifest.json'), |
80 | | - path.join(__dirname, 'manifest_firefox_stub.json'), |
| 75 | + path.join(projectRoot, 'manifest.json'), |
| 76 | + path.join(projectRoot, 'manifest_firefox_stub.json'), |
81 | 77 | path.join(firefoxDir, 'manifest.json'), |
82 | 78 | version |
83 | 79 | ); |
|
0 commit comments