Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions .github/workflows/build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,37 @@ jobs:
run:
working-directory: ./template
steps:
- name: Checkout repo
uses: actions/checkout@v5
- uses: actions/checkout@v5

- name: Setup Node.js
uses: actions/setup-node@v6
- uses: pnpm/action-setup@v4
with:
version: 9

- uses: actions/setup-node@v6
with:
node-version: 22
cache-dependency-path: "template/yarn.lock"
cache: "yarn"

- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('template/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: yarn
run: pnpm install --frozen-lockfile

- name: Create Chrome artifacts
run: yarn zip
run: pnpm zip

- name: Create Firefox artifacts
run: yarn zip:firefox
run: pnpm zip:firefox

- name: Upload artifacts
uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v5
with:
name: extensions
path: template/package/*
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ jobs:
if: success()
run: npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}Ø
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 2 additions & 2 deletions generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ async function generateProject() {
await generateIcons(logo, outputDir);
}

console.log(`Project "${name}" created. Next steps:
console.log(`Project "${name}" created. Next steps:
1. cd ${name}
2. yarn install
2. pnpm install
3. Open chrome://extensions/ → Developer mode → Load unpacked → select build/`);
}
33 changes: 24 additions & 9 deletions template/.github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,34 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4

- uses: pnpm/action-setup@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- uses: actions/setup-node@v6
version: 9

- uses: actions/setup-node@v4
with:
node-version: '22'
- name: install dependency
run: yarn
node-version: 22

- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- run: pnpm install --frozen-lockfile

- name: Create chrome artifacts
run: yarn zip
run: pnpm zip

- name: Create Firefox artifacts
run: yarn zip:firefox
run: pnpm zip:firefox

- uses: actions/upload-artifact@v4
with:
name: extensions
Expand Down
33 changes: 24 additions & 9 deletions template/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,40 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4

- uses: pnpm/action-setup@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- uses: actions/setup-node@v6
version: 9

- uses: actions/setup-node@v4
with:
node-version: '22'
- name: install dependency
run: yarn
node-version: 22

- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- run: pnpm install --frozen-lockfile

- name: Create chrome artifacts
run: yarn zip
run: pnpm zip

- name: Create Firefox artifacts
run: yarn zip:firefox
run: pnpm zip:firefox

- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v5
with:
mode: 'COMMIT'

- name: Create Release
uses: softprops/action-gh-release@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion template/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OS
# OS
.DS_Store

# ignore node dependency directories & lock
Expand Down
1 change: 1 addition & 0 deletions template/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
minimum-release-age=1440
10 changes: 5 additions & 5 deletions template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ my-crx-app

1. Check if your `Node.js` version is >= **14**.
2. Change or configurate the name of your extension on `src/manifest`.
3. Run `yarn` to install the dependencies.
3. Run `pnpm` to install the dependencies.

## Developing

```shell
cd my-crx-app
yarn dev
pnpm dev
```

### Chrome Extension Developer Mode
Expand All @@ -57,15 +57,15 @@ yarn dev

### Firefox Extension Developer Mode

1. Build your project firstly by running `yarn build:firefox`
1. Build your project firstly by running `pnpm build:firefox`
2. Open Firefox and go to `about:debugging#/runtime/this-firefox`
3. Click on 'Load Temporary Add-on' and select `my-crx-app/build` folder

## Packing

```shell
yarn zip # for chrome
yarn zip:firefox # for firefox
pnpm zip # for chrome
pnpm zip:firefox # for firefox
```

---
Expand Down
5 changes: 3 additions & 2 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
},
"scripts": {
"dev": "vite",
"dev:firefox": "BROWSER=firefox NODE_ENV=development vite build --mode development --minify false",
"build": "vite build",
"build:firefox": "BROWSER=firefox vite build",
"preview": "vite preview",
"fmt": "prettier --write '**/*.{jsx,js,json,css,scss,md}'",
"zip": "yarn build && node src/zip.js",
"zip:firefox": "export BROWSER=firefox && yarn build && node src/zip.js"
"zip": "pnpm build && node src/zip.js",
"zip:firefox": "export BROWSER=firefox && pnpm build && node src/zip.js"
},
"dependencies": {
"react": "^18.2.0",
Expand Down
Loading
Loading