|
2 | 2 |
|
3 | 3 | // Bumps extension manifests if changes detected + git commit/push |
4 | 4 | // NOTE: Pass --cache to use cachePaths.manifestPaths for faster init |
| 5 | +// NOTE: Pass --dev to use cachePaths.bumpUtils for faster init |
5 | 6 | // NOTE: Pass --chrom<e|ium> to forcibly bump Chromium manifests only |
6 | 7 | // NOTE: Pass --<ff|firefox> to forcibly bump Firefox manifests only |
7 | 8 | // NOTE: Pass --no-<commit|push> to skip git commit/push |
8 | 9 |
|
9 | 10 | (async () => { |
10 | 11 |
|
| 12 | + // Parse ARGS |
| 13 | + const args = process.argv.slice(2), |
| 14 | + cacheMode = args.some(arg => arg == '--cache'), |
| 15 | + devMode = args.some(arg => arg == '--dev'), |
| 16 | + chromiumOnly = args.some(arg => /chrom/i.test(arg)), |
| 17 | + ffOnly = args.some(arg => /f{2}/i.test(arg)), |
| 18 | + noCommit = args.some(arg => ['--no-commit', '-nc'].includes(arg)), |
| 19 | + noPush = args.some(arg => ['--no-push', '-np'].includes(arg)) |
| 20 | + |
11 | 21 | // Import LIBS |
12 | 22 | const fs = require('fs'), |
13 | 23 | path = require('path'), |
|
19 | 29 | cachePaths.manifestPaths = path.join(__dirname, `${cachePaths.root}manifest-paths.json`) |
20 | 30 |
|
21 | 31 | // Import BUMP UTILS |
22 | | - fs.mkdirSync(path.dirname(cachePaths.bumpUtils), { recursive: true }) |
23 | | - fs.writeFileSync(cachePaths.bumpUtils, (await (await fetch( |
24 | | - 'https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@latest/utils/bump/bump-utils.min.mjs')).text() |
25 | | - ).replace(/^\/\*\*[\s\S]*?\*\/\s*/, '')) // strip JSD header minification comment |
26 | | - const bump = await import(`file://${cachePaths.bumpUtils}`) ; fs.unlinkSync(cachePaths.bumpUtils) |
27 | | - |
28 | | - // Parse ARGS |
29 | | - const args = process.argv.slice(2), |
30 | | - cacheMode = args.some(arg => arg == '--cache'), |
31 | | - chromiumOnly = args.some(arg => /chrom/i.test(arg)), |
32 | | - ffOnly = args.some(arg => /f{2}/i.test(arg)), |
33 | | - noCommit = args.some(arg => ['--no-commit', '-nc'].includes(arg)), |
34 | | - noPush = args.some(arg => ['--no-push', '-np'].includes(arg)) |
| 32 | + let bump |
| 33 | + if (devMode) bump = await import('./bump-utils.mjs') |
| 34 | + else { |
| 35 | + fs.mkdirSync(path.dirname(cachePaths.bumpUtils), { recursive: true }) |
| 36 | + fs.writeFileSync(cachePaths.bumpUtils, (await (await fetch( |
| 37 | + 'https://cdn.jsdelivr.net/gh/adamlui/ai-web-extensions@latest/utils/bump/bump-utils.min.mjs')).text() |
| 38 | + ).replace(/^\/\*\*[\s\S]*?\*\/\s*/, '')) // strip JSD header minification comment |
| 39 | + bump = await import(`file://${cachePaths.bumpUtils}`) ; fs.unlinkSync(cachePaths.bumpUtils) |
| 40 | + } |
35 | 41 |
|
36 | 42 | // Collect extension manifests |
37 | 43 | bump.log.working(`\n${ cacheMode ? 'Collecting' : 'Searching for' } extension manifests...\n`) |
|
0 commit comments