Skip to content

Commit

Permalink
add new npm script generateManifest
Browse files Browse the repository at this point in the history
  • Loading branch information
capaj committed Jul 9, 2024
1 parent 2f2e730 commit d55c5d0
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 31 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/actions/build-test-pack/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/android_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
3 changes: 2 additions & 1 deletion web-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 15 additions & 0 deletions web-extension/scripts/generateExtensionManifest.ts
Original file line number Diff line number Diff line change
@@ -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()
21 changes: 0 additions & 21 deletions web-extension/scripts/updateManifestVersion.ts

This file was deleted.

2 changes: 1 addition & 1 deletion web-extension/src/manifest.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit d55c5d0

Please sign in to comment.