forked from AminoffZ/catonaut
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
overall qol changes, added workflows, manifest control and linting
- Loading branch information
1 parent
76ba5cc
commit 09cb72f
Showing
15 changed files
with
210 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
node: true, | ||
es2021: true, | ||
}, | ||
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], | ||
overrides: [ | ||
{ | ||
files: ['.eslintrc.{js,cjs}'], | ||
parserOptions: { | ||
sourceType: 'script', | ||
}, | ||
}, | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 2021, | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint'], | ||
ignorePatterns: ['node_modules/', 'github-repo-size-extension/'], | ||
rules: {}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: 'npm' | ||
directory: '/' | ||
schedule: | ||
interval: 'weekly' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Extension Build CI | ||
|
||
on: | ||
push: | ||
branches: ['**'] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use bun | ||
uses: oven-sh/setup-bun@v1 | ||
with: | ||
bun-version: latest | ||
|
||
- name: Install dependencies | ||
run: | | ||
bun install | ||
- name: Build extension | ||
run: | | ||
bun run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Extension Format CI | ||
|
||
on: | ||
push: | ||
branches: ['**'] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
format: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use bun | ||
uses: oven-sh/setup-bun@v1 | ||
with: | ||
bun-version: latest | ||
|
||
- name: Install dependencies | ||
run: | | ||
bun install | ||
- name: Check code formatting | ||
run: bun run checkFormat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Extension Lint CI | ||
|
||
on: | ||
push: | ||
branches: ['**'] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use bun | ||
uses: oven-sh/setup-bun@v1 | ||
with: | ||
bun-version: latest | ||
|
||
- name: Install dependencies | ||
run: bun install | ||
|
||
- name: Check code linting | ||
run: bun run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dist | ||
node_modules/ | ||
package-lock.json | ||
pnpm-lock.yaml | ||
bun.lockb |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { join } from 'path'; | ||
import { readFile, writeFile } from 'fs/promises'; | ||
import chalk from 'chalk'; | ||
|
||
export async function updateManifest() { | ||
try { | ||
const arg = process.argv[2]; | ||
const browser = arg && arg === 'firefox' ? 'firefox' : 'chrome'; | ||
|
||
const packageJsonPath = join(import.meta.dir, 'package.json'); | ||
const { version } = await import(packageJsonPath); | ||
|
||
const manifestPath = join(import.meta.dir, 'public', 'manifest.json'); | ||
const manifestData = await readFile(manifestPath, 'utf-8'); | ||
const manifest = JSON.parse(manifestData); | ||
|
||
manifest.version = version; | ||
|
||
if (browser && browser === 'firefox') { | ||
manifest.background = { | ||
scripts: ['background.js'], | ||
}; | ||
|
||
manifest.browser_specific_settings = { | ||
gecko: { | ||
id: 'github-repo-size@gmail.com', | ||
strict_min_version: '42.0', | ||
}, | ||
}; | ||
} else { | ||
manifest.background = { | ||
service_worker: 'background.js', | ||
}; | ||
delete manifest.browser_specific_settings; | ||
} | ||
await writeFile(manifestPath, JSON.stringify(manifest, null, 2)); | ||
|
||
console.log( | ||
chalk.green( | ||
'Version updated successfully in manifest.json for ' + | ||
browser + | ||
' Browser!' | ||
) | ||
); | ||
} catch (error) { | ||
console.error(chalk.red('Error updating version: ' + error)); | ||
process.exit(1); | ||
} | ||
} | ||
updateManifest(); |