Skip to content

Commit ec7263e

Browse files
authored
chore: Refactor repo to a standard monorepo (#646)
1 parent e7c3fc2 commit ec7263e

File tree

223 files changed

+491
-539
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+491
-539
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@ jobs:
2525
pnpx changelogen@latest --release
2626
git push
2727
git push --tags
28+
working-directory: packages/wxt
2829

2930
- name: NPM
3031
run: |
3132
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc
3233
pnpm publish
34+
working-directory: packages/wxt
3335

3436
- name: GitHub Release
3537
run: pnpx changelogen@latest gh release --token ${{ secrets.GITHUB_TOKEN }}
38+
working-directory: packages/wxt

.github/workflows/validate.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,15 @@ jobs:
1313
- uses: actions/checkout@v4
1414
- uses: ./.github/actions/setup
1515
- run: pnpm check
16-
validate-demo:
16+
build-demo:
1717
runs-on: ubuntu-22.04
1818
steps:
1919
- uses: actions/checkout@v4
2020
- uses: ./.github/actions/setup
21-
- run: pnpm tsc --noEmit
22-
working-directory: demo
2321
- run: pnpm build:all
24-
working-directory: demo
22+
working-directory: packages/wxt-demo
2523
- run: pnpm wxt zip
26-
working-directory: demo
27-
- run: pnpm vitest run
28-
working-directory: demo
24+
working-directory: packages/wxt-demo
2925
tests:
3026
runs-on: ubuntu-22.04
3127
steps:
@@ -57,9 +53,10 @@ jobs:
5753
- uses: actions/checkout@v4
5854
- uses: ./.github/actions/setup
5955
- run: pnpm pack
56+
working-directory: packages/wxt
6057
- run: npm i
6158
working-directory: templates/${{ matrix.template }}
62-
- run: npm i -D ../../wxt-*.tgz
59+
- run: npm i -D ../../packages/wxt/wxt-*.tgz
6360
working-directory: templates/${{ matrix.template }}
6461
- run: pnpm compile
6562
if: matrix.template != 'svelte'

.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

demo/package.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

docs/.vitepress/plugins/generate-cli-docs.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { execaCommand } from 'execa';
66

77
let hasGenerated = false;
88

9-
const cliDir = resolve('src/cli/commands');
9+
const cliDir = resolve('packages/wxt/src/cli/commands');
1010
const cliDirGlob = resolve(cliDir, '**');
1111
const cliTemplatePath = resolve('docs/.vitepress/plugins/cli.tpl.md');
1212
const cliPath = resolve('docs/api/cli.md');
@@ -23,7 +23,9 @@ export function generateCliDocs() {
2323
const generateDocs = async () => {
2424
consola.info(`Generating ${relative(process.cwd(), cliPath)}`);
2525
try {
26-
const res = await execaCommand('pnpm -s wxt --help');
26+
const res = await execaCommand('pnpm -s wxt --help', {
27+
cwd: 'packages/wxt',
28+
});
2729
const dev = splitInfo(res.stdout);
2830
const lines: Array<string | string[]> = [
2931
`## \`wxt\``,
@@ -34,7 +36,9 @@ export function generateCliDocs() {
3436

3537
const commands = await Promise.allSettled(
3638
extractCommands(dev.info).map(async (command) => {
37-
const res = await execaCommand(`pnpm -s wxt ${command} --help`);
39+
const res = await execaCommand(`pnpm -s wxt ${command} --help`, {
40+
cwd: 'packages/wxt',
41+
});
3842
const { rest: docs } = splitInfo(res.stdout);
3943
return [`## \`wxt ${command}\``, '```sh', docs, '```'];
4044
}),

docs/guide/manifest.md

Lines changed: 1 addition & 1 deletion

docs/typedoc.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
{
2-
"entryPoints": [
3-
"../src",
4-
"../src/client",
5-
"../src/browser.ts",
6-
"../src/sandbox",
7-
"../src/storage.ts",
8-
"../src/testing"
9-
],
2+
"$schema": "https://typedoc.org/schema.json",
3+
"entryPointStrategy": "packages",
4+
"entryPoints": ["../packages/wxt"],
105
"plugin": ["typedoc-plugin-markdown", "typedoc-vitepress-theme"],
116
"out": "./api",
127
"githubPages": false,

package.json

Lines changed: 8 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,15 @@
11
{
2-
"name": "wxt",
2+
"private": true,
33
"type": "module",
4-
"version": "0.17.12",
5-
"description": "Next gen framework for developing web extensions",
64
"engines": {
75
"node": ">=18",
86
"pnpm": ">=8"
97
},
10-
"repository": {
11-
"type": "git",
12-
"url": "https://github.com/wxt-dev/wxt"
13-
},
14-
"homepage": "https://wxt.dev",
15-
"keywords": [
16-
"vite",
17-
"chrome",
18-
"web",
19-
"extension",
20-
"browser",
21-
"bundler",
22-
"framework"
23-
],
24-
"author": {
25-
"name": "Aaron Klinker",
26-
"email": "[email protected]"
27-
},
28-
"license": "MIT",
29-
"files": [
30-
"bin",
31-
"dist"
32-
],
33-
"bin": {
34-
"wxt": "./bin/wxt.mjs",
35-
"wxt-publish-extension": "./bin/wxt-publish-extension.cjs"
36-
},
37-
"main": "./dist/index.cjs",
38-
"module": "./dist/index.js",
39-
"types": "./dist/index.d.ts",
40-
"exports": {
41-
".": {
42-
"import": {
43-
"types": "./dist/index.d.ts",
44-
"default": "./dist/index.js"
45-
},
46-
"require": {
47-
"types": "./dist/index.d.cts",
48-
"default": "./dist/index.cjs"
49-
}
50-
},
51-
"./client": {
52-
"types": "./dist/client.d.ts",
53-
"import": "./dist/client.js"
54-
},
55-
"./sandbox": {
56-
"types": "./dist/sandbox.d.ts",
57-
"import": "./dist/sandbox.js"
58-
},
59-
"./browser": {
60-
"types": "./dist/browser.d.ts",
61-
"import": "./dist/browser.js"
62-
},
63-
"./testing": {
64-
"import": {
65-
"types": "./dist/testing.d.ts",
66-
"default": "./dist/testing.js"
67-
},
68-
"require": {
69-
"types": "./dist/testing.d.cts",
70-
"default": "./dist/testing.cjs"
71-
}
72-
},
73-
"./storage": {
74-
"import": {
75-
"types": "./dist/storage.d.ts",
76-
"default": "./dist/storage.js"
77-
},
78-
"require": {
79-
"types": "./dist/storage.d.cts",
80-
"default": "./dist/storage.cjs"
81-
}
82-
},
83-
"./vite-builder-env": {
84-
"types": "./dist/vite-builder-env.d.ts"
85-
}
86-
},
8+
"packageManager": "[email protected]",
879
"scripts": {
88-
"wxt": "tsx src/cli/index.ts",
89-
"build": "tsx scripts/build.ts",
90-
"check": "run-s -c check:*",
91-
"check:default": "check",
92-
"check:tsc-virtual": "tsc --noEmit -p src/virtual",
10+
"check": "pnpm -r run check",
9311
"test": "vitest",
94-
"test:coverage": "vitest run --coverage.enabled \"--coverage.include=src/**\" \"--coverage.exclude=src/core/utils/testing/**\" \"--coverage.exclude=**/*.d.ts\"",
12+
"test:coverage": "vitest run --coverage.enabled \"--coverage.include=packages/wxt/src/**\" \"--coverage.exclude=packages/wxt/src/core/utils/testing/**\" \"--coverage.exclude=**/*.d.ts\"",
9513
"prepare": "simple-git-hooks",
9614
"prepublish": "pnpm -s build",
9715
"docs:gen": "typedoc --options docs/typedoc.json",
@@ -100,79 +18,26 @@
10018
"docs:preview": "pnpm -s docs:gen && vitepress preview docs",
10119
"sync-releases": "pnpx changelogen@latest gh release"
10220
},
103-
"dependencies": {
104-
"@aklinker1/rollup-plugin-visualizer": "5.12.0",
105-
"@types/webextension-polyfill": "^0.10.5",
106-
"@webext-core/fake-browser": "^1.3.1",
107-
"@webext-core/isolated-element": "^1.1.2",
108-
"@webext-core/match-patterns": "^1.0.3",
109-
"async-mutex": "^0.4.0",
110-
"c12": "^1.5.1",
111-
"cac": "^6.7.14",
112-
"chokidar": "^3.5.3",
113-
"ci-info": "^4.0.0",
114-
"consola": "^3.2.3",
115-
"defu": "^6.1.3",
116-
"dequal": "^2.0.3",
117-
"esbuild": "^0.19.5",
118-
"fast-glob": "^3.3.1",
119-
"filesize": "^10.0.8",
120-
"fs-extra": "^11.1.1",
121-
"get-port": "^7.0.0",
122-
"giget": "^1.1.3",
123-
"hookable": "^5.5.3",
124-
"is-wsl": "^3.0.0",
125-
"jiti": "^1.21.0",
126-
"json5": "^2.2.3",
127-
"jszip": "^3.10.1",
128-
"linkedom": "^0.16.1",
129-
"minimatch": "^9.0.3",
130-
"natural-compare": "^1.4.0",
131-
"normalize-path": "^3.0.0",
132-
"nypm": "^0.3.6",
133-
"open": "^10.1.0",
134-
"ora": "^7.0.1",
135-
"picocolors": "^1.0.0",
136-
"prompts": "^2.4.2",
137-
"publish-browser-extension": "^2.1.3",
138-
"unimport": "^3.4.0",
139-
"vite": "^5.2.8",
140-
"web-ext-run": "^0.2.0",
141-
"webextension-polyfill": "^0.10.0"
142-
},
14321
"devDependencies": {
14422
"@aklinker1/check": "^1.1.1",
145-
"@faker-js/faker": "^8.3.1",
146-
"@types/fs-extra": "^11.0.4",
147-
"@types/lodash.merge": "^4.6.9",
148-
"@types/natural-compare": "^1.4.3",
149-
"@types/node": "^20.10.3",
150-
"@types/normalize-path": "^3.0.2",
151-
"@types/prompts": "^2.4.9",
15223
"@vitest/coverage-v8": "^1.0.1",
24+
"consola": "^3.2.3",
15325
"execa": "^8.0.1",
154-
"extract-zip": "^2.0.1",
155-
"happy-dom": "^13.3.8",
15626
"lint-staged": "^15.2.0",
157-
"lodash.merge": "^4.6.2",
15827
"npm-run-all": "^4.1.5",
159-
"p-map": "^7.0.0",
16028
"prettier": "^3.1.0",
161-
"publint": "^0.2.6",
16229
"simple-git-hooks": "^2.9.0",
163-
"tsup": "^8.0.1",
164-
"tsx": "^4.6.2",
16530
"typedoc": "^0.25.4",
16631
"typedoc-plugin-markdown": "4.0.0-next.23",
16732
"typedoc-vitepress-theme": "1.0.0-next.3",
16833
"typescript": "^5.3.2",
16934
"vitepress": "1.0.0-rc.34",
170-
"vitest": "^1.2.2",
35+
"vitest": "^1.5.3",
17136
"vitest-mock-extended": "^1.3.1",
17237
"vitest-plugin-random-seed": "^1.0.2",
173-
"vue": "^3.3.10"
38+
"vue": "^3.3.10",
39+
"wxt": "workspace:*"
17440
},
175-
"packageManager": "[email protected]",
17641
"simple-git-hooks": {
17742
"pre-commit": "pnpm lint-staged"
17843
},

packages/wxt-demo/package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "wxt-demo",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"dev": "pnpm build:deps && wxt",
8+
"build:deps": "pnpm --filter wxt build",
9+
"build": "pnpm build:deps && wxt build",
10+
"build:all": "pnpm build:deps && run-s -s 'build:all:*'",
11+
"build:all:chrome-mv3": "wxt build",
12+
"build:all:chrome-mv2": "wxt build --mv2",
13+
"build:all:firefox-mv3": "wxt build -b firefox --mv3",
14+
"build:all:firefox-mv2": "wxt build -b firefox",
15+
"test": "pnpm build:deps && vitest",
16+
"zip": "pnpm build:deps && wxt zip",
17+
"check": "pnpm build:deps && check",
18+
"postinstall": "pnpm build:deps && wxt prepare"
19+
},
20+
"dependencies": {
21+
"react": "^18.2.0",
22+
"react-dom": "^18.2.0"
23+
},
24+
"devDependencies": {
25+
"@types/react": "^18.2.34",
26+
"@types/react-dom": "^18.2.14",
27+
"sass": "^1.69.5",
28+
"typescript": "^5.3.2",
29+
"wxt": "workspace:*"
30+
}
31+
}
File renamed without changes.
File renamed without changes.

demo/tsconfig.json renamed to packages/wxt-demo/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": ["../tsconfig.base.json", "./.wxt/tsconfig.json"],
2+
"extends": ["../../tsconfig.base.json", "./.wxt/tsconfig.json"],
33
"compilerOptions": {
44
"allowImportingTsExtensions": true,
55
"jsx": "react-jsx"

demo/vitest.config.ts renamed to packages/wxt-demo/vitest.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { defineConfig } from 'vitest/config';
1+
import { defineProject } from 'vitest/config';
22
import { WxtVitest } from 'wxt/testing';
33

4-
export default defineConfig({
4+
export default defineProject({
55
test: {
66
mockReset: true,
77
restoreMocks: true,
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)