-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: separate building scripts for Chrome and Firefox
- Loading branch information
1 parent
2c8a090
commit 0c16c95
Showing
2 changed files
with
16 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
import { createRequire } from 'node:module' | ||
import process from 'node:process' | ||
import gulp from 'gulp' | ||
import zip from 'gulp-zip' | ||
|
||
const require = createRequire(import.meta.url) | ||
const manifest = require('../build/manifest.json') | ||
|
||
const postfix = process.argv[2] ? `-${process.argv[2]}` : '' | ||
|
||
const isFirefox = process.env.BROWSER === 'firefox' | ||
const browserPostfix = isFirefox ? '-firefox' : '-chrome' | ||
|
||
const dashedName = manifest.name.replaceAll(' ', '-') | ||
const fileName = `${dashedName}-${manifest.version}${postfix}${browserPostfix}.zip` | ||
|
||
gulp | ||
.src('build/**') | ||
.pipe(zip(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`)) | ||
.pipe(zip(fileName)) | ||
.pipe(gulp.dest('package')) | ||
console.log(`${manifest.name.replaceAll(' ', '-')}-${manifest.version}.zip`) | ||
|
||
console.log(fileName) |