diff --git a/.github/workflows/actions/build-test-pack/action.yml b/.github/workflows/actions/build-test-pack/action.yml index 836558ef..3e7e3e08 100644 --- a/.github/workflows/actions/build-test-pack/action.yml +++ b/.github/workflows/actions/build-test-pack/action.yml @@ -15,15 +15,11 @@ runs: version: 9 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - - name: Install dependencies - run: | - pnpm i --frozen-lockfile --prefer-offline - # Add additional build and test steps here - name: create .env & web-extension build shell: bash @@ -32,7 +28,7 @@ runs: touch .env echo $API_URL >> .env echo $PAGE_URL >> .env - tsx ./scripts/updateManifestVersion.ts + pnpm run generateManifest pnpm prodBuild # - name: Install Playwright Browsers & Run Playwright tests with backend diff --git a/.github/workflows/android_build.yml b/.github/workflows/android_build.yml index 44e02871..621ebb9b 100644 --- a/.github/workflows/android_build.yml +++ b/.github/workflows/android_build.yml @@ -25,7 +25,7 @@ jobs: java-version: 11.0.15 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9d4bf4ad..c34ba3c6 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,7 +66,7 @@ jobs: with: version: 9 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' diff --git a/web-extension/package.json b/web-extension/package.json index 17f806a0..d82e929f 100755 --- a/web-extension/package.json +++ b/web-extension/package.json @@ -10,7 +10,8 @@ "scripts": { "prodBuild": "NODE_ENV=production webpack --config webpack.prod.js", "devBuild": "webpack --config webpack.dev.js", - "newTag": "npm version patch && git add package.json && npx tsx ./scripts/updateManifestVersion.ts && npx tsx ./scripts/newTag.ts", + "newTag": "npm version patch && git add package.json && npx tsx ./scripts/generateExtensionManifest.ts && npx tsx ./scripts/newTag.ts", + "generateManifest": "npx tsx ./scripts/generateExtensionManifest.ts", "clean": "rm -rf dist/js", "checkBuildOutput": "node ./check-es6.js", "dev": "NODE_ENV=development webpack -w --config webpack.dev.js", diff --git a/web-extension/scripts/generateExtensionManifest.ts b/web-extension/scripts/generateExtensionManifest.ts new file mode 100644 index 00000000..ff25a01d --- /dev/null +++ b/web-extension/scripts/generateExtensionManifest.ts @@ -0,0 +1,15 @@ +import fs from 'fs-extra' +import { resolve } from 'node:path' +import { getManifest } from '../src/manifest' + +export const dir = (...args: string[]) => resolve(__dirname, '..', ...args) +export async function generateExtensionManifest() { + const manifest = await getManifest() + + await fs.writeJSON(dir('dist/manifest.json'), manifest, { + spaces: 2 + }) + console.log(`written manifest.json with version ${manifest.version}`) +} + +generateExtensionManifest() diff --git a/web-extension/scripts/updateManifestVersion.ts b/web-extension/scripts/updateManifestVersion.ts deleted file mode 100644 index 82389be6..00000000 --- a/web-extension/scripts/updateManifestVersion.ts +++ /dev/null @@ -1,21 +0,0 @@ -import fs from 'fs-extra' -import { resolve } from 'node:path' -import { getManifest } from '../src/manifest' -import child_process from 'child_process' - -export const dir = (...args: string[]) => resolve(__dirname, '..', ...args) -export async function updateManifestVersion() { - const manifest = await getManifest() - - await fs.writeJSON(dir('dist/manifest.json'), manifest, { - spaces: 2 - }) - console.log(`written manifest.json for version ${manifest.version}`) - - child_process.execSync(`git add *`) - child_process.execSync( - `git commit -m "bump web extension to ${manifest.version}"` - ) -} - -updateManifestVersion() diff --git a/web-extension/src/manifest.ts b/web-extension/src/manifest.ts index fb02b75b..138fa7e5 100644 --- a/web-extension/src/manifest.ts +++ b/web-extension/src/manifest.ts @@ -1,7 +1,7 @@ import fs from 'fs-extra' import type { Manifest } from 'webextension-polyfill' import type PkgType from '../package.json' -import { dir } from '../scripts/updateManifestVersion' +import { dir } from '../scripts/generateExtensionManifest' export async function getManifest() { const pkg = (await fs.readJSON(dir('package.json'))) as typeof PkgType