mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
feat: add dev-firefox build-firefox npm scripts
This commit is contained in:
@@ -8,11 +8,13 @@
|
||||
"homepage": "https://github.com/hakadao/BewlyBewly",
|
||||
"scripts": {
|
||||
"dev": "npm run clear && cross-env NODE_ENV=development run-p dev:*",
|
||||
"dev-firefox": "npm run clear && cross-env NODE_ENV=development FIREFOX=true run-p dev:*",
|
||||
"dev:prepare": "esno scripts/prepare.ts",
|
||||
"dev:web": "vite",
|
||||
"dev:js": "npm run build:js -- --mode development",
|
||||
"dev:bg": "tsup --watch ./src",
|
||||
"build": "cross-env NODE_ENV=production run-s clear build:web build:prepare build:js build:bg",
|
||||
"build-firefox": "cross-env NODE_ENV=production FIREFOX=true run-s clear build:web build:prepare build:js build:bg",
|
||||
"build:prepare": "esno scripts/prepare.ts",
|
||||
"build:web": "vite build",
|
||||
"build:js": "vite build --config vite.config.content.ts",
|
||||
|
||||
@@ -5,6 +5,7 @@ export const port = parseInt(process.env.PORT || '') || 3303
|
||||
export const r = (...args: string[]) => resolve(__dirname, '..', ...args)
|
||||
export const isDev = process.env.NODE_ENV !== 'production'
|
||||
export const isWin = process.platform === 'win32'
|
||||
export const isFirefox = process.env.FIREFOX === 'true'
|
||||
|
||||
export function log(name: string, message: string) {
|
||||
console.log(black(bgCyan(` ${name} `)), message)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import fs from 'fs-extra'
|
||||
import type { Manifest } from 'webextension-polyfill'
|
||||
import type PkgType from '../package.json'
|
||||
import { isDev, port, r } from '../scripts/utils'
|
||||
import { isDev, isFirefox, port, r } from '../scripts/utils'
|
||||
|
||||
export async function getManifest() {
|
||||
const pkg = await fs.readJSON(r('package.json')) as typeof PkgType
|
||||
@@ -22,9 +22,9 @@ export async function getManifest() {
|
||||
// page: './dist/options/index.html',
|
||||
// open_in_tab: true,
|
||||
// },
|
||||
background: {
|
||||
service_worker: './dist/background/index.mjs',
|
||||
},
|
||||
background: isFirefox
|
||||
? { scripts: ['./dist/background/index.mjs'] }
|
||||
: { service_worker: './dist/background/index.mjs' },
|
||||
icons: {
|
||||
16: './assets/icon-512.png',
|
||||
48: './assets/icon-512.png',
|
||||
|
||||
Reference in New Issue
Block a user