-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Rewrite build script to js
Showing
5 changed files
with
50 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env node | ||
|
||
import { argv, env } from "node:process"; | ||
import { cp, mkdir, rm } from "fs/promises"; | ||
import { dirname, join } from "path"; | ||
import { fileURLToPath } from "url"; | ||
import { chromeifyManifestFile } from "./chromeifyManifest.impl.js"; | ||
import webExt from "web-ext"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = dirname(__filename); | ||
const __main = argv[1] === __filename; | ||
const distDir = join(__dirname, "dist"); | ||
const distManifest = join(distDir, "manifest.json"); | ||
const srcDir = join(__dirname, "src"); | ||
const chrome = argv.includes("--chrome") || /yes|true|1/i.test(env.CHROME || ""); | ||
|
||
async function main() { | ||
await rm(distDir, {recursive: true, force: true}); | ||
await mkdir(distDir); | ||
await cp(srcDir, distDir, {recursive: true}); | ||
|
||
let filename; | ||
|
||
if (chrome) { | ||
await chromeifyManifestFile(distManifest); | ||
filename = "{name}-{version}-chrome.zip"; | ||
} else { | ||
filename = "{name}-{version}.zip"; | ||
} | ||
|
||
await webExt.cmd.build({ | ||
artifactsDir: "web-ext-artifacts", | ||
sourceDir: distDir, | ||
overwriteDest: true, | ||
filename: filename, | ||
}); | ||
} | ||
|
||
if (__main) { | ||
main().catch(console.error); | ||
} |
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 was deleted.
Oops, something went wrong.
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