diff --git a/.eslintignore b/.eslintignore index a8db16f484..99e0829e60 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,3 +2,4 @@ dist node_modules public extension +extension-firefox diff --git a/.github/workflows/sync-bugfixes.yml b/.github/workflows/sync-bugfixes.yml new file mode 100644 index 0000000000..0e909d756e --- /dev/null +++ b/.github/workflows/sync-bugfixes.yml @@ -0,0 +1,24 @@ +name: Sync Back to Bugfixes +on: + push: + branches: + - main + +jobs: + sync-branches: + runs-on: ubuntu-latest + name: Syncing branches + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Node + uses: actions/setup-node@v1 + with: + node-version: 12 + - name: Opening pull request + id: pull + uses: tretuna/sync-branches@1.4.0 + with: + GITHUB_TOKEN: ${{secrets.SYNC_TOKEN}} + FROM_BRANCH: main + TO_BRANCH: bugfixes diff --git a/.github/workflows/sync-dev-firefox.yml b/.github/workflows/sync-dev-firefox.yml new file mode 100644 index 0000000000..451557a46c --- /dev/null +++ b/.github/workflows/sync-dev-firefox.yml @@ -0,0 +1,24 @@ +name: Sync Back to Dev Firefox +on: + push: + branches: + - dev + +jobs: + sync-branches: + runs-on: ubuntu-latest + name: Syncing branches + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Node + uses: actions/setup-node@v1 + with: + node-version: 12 + - name: Opening pull request + id: pull + uses: tretuna/sync-branches@1.4.0 + with: + GITHUB_TOKEN: ${{secrets.SYNC_TOKEN}} + FROM_BRANCH: dev + TO_BRANCH: dev-firefox diff --git a/.github/workflows/sync-dev.yml b/.github/workflows/sync-dev.yml new file mode 100644 index 0000000000..76abbba1bd --- /dev/null +++ b/.github/workflows/sync-dev.yml @@ -0,0 +1,24 @@ +name: Sync Back to Dev +on: + push: + branches: + - main + +jobs: + sync-branches: + runs-on: ubuntu-latest + name: Syncing branches + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Node + uses: actions/setup-node@v1 + with: + node-version: 12 + - name: Opening pull request + id: pull + uses: tretuna/sync-branches@1.4.0 + with: + GITHUB_TOKEN: ${{secrets.SYNC_TOKEN}} + FROM_BRANCH: main + TO_BRANCH: dev diff --git a/.gitignore b/.gitignore index 89e3cdde89..fe7e78ae01 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ dist dist-ssr extension/ +extension-firefox/ node_modules src/auto-imports.d.ts src/components.d.ts diff --git a/package.json b/package.json index d32eb2dcfb..e289120dd2 100644 --- a/package.json +++ b/package.json @@ -8,24 +8,26 @@ "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-firefox": "npm run clear-firefox && 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-firefox": "cross-env NODE_ENV=production FIREFOX=true run-s clear-firefox 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", "build:bg": "tsup", "pack": "cross-env NODE_ENV=production run-p pack:*", "pack:zip": "rimraf extension.zip && jszip-cli add extension/* -o ./extension.zip", + "pack:zip-firefox": "rimraf extension-firefox.zip && jszip-cli add extension-firefox/* -o ./extension-firefox.zip", "pack:crx": "crx pack extension -o ./extension.crx", - "pack:xpi": "cross-env WEB_EXT_ARTIFACTS_DIR=./ FIREFOX=true web-ext build --source-dir ./extension --filename extension.xpi --overwrite-dest", + "pack:xpi": "cross-env WEB_EXT_ARTIFACTS_DIR=./ FIREFOX=true web-ext build --source-dir ./extension-firefox --filename extension.xpi --overwrite-dest", "start:chromium": "web-ext run --source-dir ./extension --target=chromium", - "start:firefox": "web-ext run --source-dir ./extension --target=firefox-desktop", + "start:firefox": "web-ext run --source-dir ./extension-firefox --target=firefox-desktop", "clear": "rimraf extension extension.*", + "clear-firefox": "rimraf extension-firefox extension-firefox.*", "lint": "eslint .", "test": "vitest test", "postinstall": "npx simple-git-hooks" diff --git a/scripts/manifest.ts b/scripts/manifest.ts index 4a9b696b0c..dbe354b710 100644 --- a/scripts/manifest.ts +++ b/scripts/manifest.ts @@ -1,9 +1,9 @@ import fs from 'fs-extra' import { getManifest } from '../src/manifest' -import { log, r } from './utils' +import { isFirefox, log, r } from './utils' export async function writeManifest() { - await fs.writeJSON(r('extension/manifest.json'), await getManifest(), { spaces: 2 }) + await fs.writeJSON(r(isFirefox ? 'extension-firefox/manifest.json' : 'extension/manifest.json'), await getManifest(), { spaces: 2 }) log('PRE', 'write manifest.json') } diff --git a/scripts/prepare.ts b/scripts/prepare.ts index a1b353c73c..c36835c220 100644 --- a/scripts/prepare.ts +++ b/scripts/prepare.ts @@ -2,7 +2,7 @@ import { execSync } from 'node:child_process' import fs from 'fs-extra' import chokidar from 'chokidar' -import { isDev, log, r } from './utils' +import { isDev, isFirefox, log, r } from './utils' /** * Stub index.html to use Vite in development @@ -14,12 +14,12 @@ async function stubIndexHtml() { ] for (const view of views) { - await fs.ensureDir(r(`extension/dist/${view}`)) + await fs.ensureDir(r(isFirefox ? `extension-firefox/dist/${view}` : `extension/dist/${view}`)) let data = await fs.readFile(r(`src/${view}/index.html`), 'utf-8') data = data .replace('"./main.ts"', `"/${view}/main.ts.js"`) .replace('
', '
Vite server did not start
') - await fs.writeFile(r(`extension/dist/${view}/index.html`), data, 'utf-8') + await fs.writeFile(r(isFirefox ? `extension-firefox/dist/${view}/index.html` : `extension/dist/${view}/index.html`), data, 'utf-8') log('PRE', `stub ${view}`) } } @@ -28,8 +28,8 @@ function writeManifest() { execSync('npx esno ./scripts/manifest.ts', { stdio: 'inherit' }) } -fs.ensureDirSync(r('extension')) -fs.copySync(r('assets'), r('extension/assets')) +fs.ensureDirSync(r(isFirefox ? 'extension-firefox' : 'extension')) +fs.copySync(r('assets'), r(isFirefox ? 'extension-firefox/assets' : 'extension/assets')) writeManifest() if (isDev) { diff --git a/src/components/Dock/Dock.vue b/src/components/Dock/Dock.vue index 9cbcee3a7b..56c6181cef 100644 --- a/src/components/Dock/Dock.vue +++ b/src/components/Dock/Dock.vue @@ -153,23 +153,33 @@ function toggleDockHide(hide: boolean) {