feat(chrome-extension,hutch): add Chrome browser extension (Manifest V3) · Readplace/readplace.com@eceb151

GitHub ~1 min read
View original
Crawl details
  • current
Summary (TL;DR)
The article consists of configuration files for a Chrome extension project, including coverage settings (enforce-coverage.config.js) with 100% thresholds and exclusion patterns for entry points and e2e tests, Jest test configuration (jest.config.js) ignoring node_modules and dist/e2e, Biome linter configuration extending a base config, TypeScript target set to chrome109, and encrypted salt values for staging and production environments.

File tree

  • projects

    • chrome-extension

      • scripts

      • src

        • e2e

          • login-flow

        • icons-saved

        • icons

        • infra

        • runtime

          • background

          • content

          • offscreen

    • hutch/src/runtime/providers/oauth

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,9 @@

1+

{

2+

"all": true,

3+

"src": "src",

4+

"reporter": ["text", "html", "json-summary"],

5+

"reports-dir": "./coverage",

6+

"resolve": ".",

7+

"source-map": true,

8+

"exclude-after-remap": true

9+

}

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,3 @@

1+

/dist-extension-compiled

2+

/dist-extension-files

3+

/.cache

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,3 @@

1+

config:

2+

chrome-extension:stage: prod

3+

encryptionsalt: v1:0NIV/oDbgFw=:v1:uSchBWVEQxMgzPz/:70VB4QDpYvSaJMsndYPC0jBEU8lkew==

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,3 @@

1+

encryptionsalt: v1:fJgbiFOTC+8=:v1:uw9e1QOYl5l1L3WD:NavyfQedgI2FvZOKy3+a2Nsx1MyB5Q==

2+

config:

3+

chrome-extension:stage: staging

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,5 @@

1+

name: chrome-extension

2+

runtime:

3+

name: nodejs

4+

options:

5+

typescript: true

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,4 @@

1+

{

2+

"$schema": "https://biomejs.dev/schemas/2.3.8/schema.json",

3+

"extends": ["../../biome.config.base.json"]

4+

}

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,3 @@

1+

module.exports = {

2+

target: 'chrome109',

3+

};

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,30 @@

1+

const baseConfig = require('../../enforce-coverage.config.base');

2+

const path = require('path')

3+
4+

// All testable business logic moved to browser-extension-core.

5+

// Chrome-extension only contains browser-specific bootstrap code

6+

// (entry points excluded below) and *.browser.ts files (excluded by base config).

7+

const config = {

8+

...baseConfig,

9+

thresholds: {

10+

statements: 100,

11+

branches: 100,

12+

functions: 100,

13+

lines: 100,

14+

},

15+

extraExcludePatterns: [

16+

// esbuild entry points — bootstrap code for browser extension

17+

'src/runtime/background/background.ts',

18+

'src/runtime/popup/popup.ts',

19+

'src/runtime/content/shortcut.ts',

20+

'src/runtime/offscreen/offscreen.ts',

21+

// E2E tests run with selenium, not covered by c8

22+

'src/e2e/**',

23+

],

24+

};

25+
26+

config.enforceCoverage({

27+

projectRoot: path.resolve(__dirname),

28+

thresholds: config.thresholds,

29+

extraExcludePatterns: config.extraExcludePatterns,

30+

})

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,7 @@

1+

const baseConfig = require('../../jest.config.base');

2+
3+

/** @type {import('jest').Config} */

4+

module.exports = {

5+

...baseConfig,

6+

testPathIgnorePatterns: ['/node_modules/', '/dist/e2e/'],

7+

};