Skip to content

Commit 18fb048

Browse files
committed
2.0.0, 2.1.0: manifest v3 support
Core change: Alpine.js can't run in the panel (manifest v3 disallows unsafe eval), rebuild that application with solidjs Other changes: minor API changes, use of TypeScript. Note: background.js doesn't need to change much. - package v2 extension - detector injection - detector -> background <-> panel messaging - manifest v3 main config options - strip back panel.html + path forward with State instance - duplicate shell-chrome for v3 support - setup solidjs with state outside of the app - component list display - select a component, component data display - array/object display - editing disabled - hide future features - show detected alpine version - implement resize/breakpoint - fix editing mode - implement split-grid, fix lg layout - reformat all the things - tidy up typecheck
1 parent afb7be7 commit 18fb048

Some content is hidden

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

54 files changed

+7406
-37
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
branches:
77
- master
8+
- devtools-early-access
89

910
concurrency:
1011
group: ${{ github.workflow }}-${{ github.ref }}
@@ -29,20 +30,23 @@ jobs:
2930
with:
3031
node-version: ${{ matrix.node-version }}
3132
- name: install
32-
run: npm ci
33+
run: npm ci && npm --prefix=packages/shell-chrome-v3 ci
3334
env:
3435
CYPRESS_INSTALL_BINARY: "0"
3536
- name: build
37+
# need npm run because we have shell commands inside this script
3638
run: npm run package
3739
- name: Archive production artifacts
3840
uses: actions/upload-artifact@v4
3941
with:
4042
name: alpine-devtools
4143
path: dist
4244
- name: unit tests
43-
run: npm t
45+
run: node --run test
46+
- name: typecheck
47+
run: node --run typecheck
4448
- name: check formatting
45-
run: npm run format
49+
run: node --run format
4650
- name: Commit changes
4751
uses: stefanzweifel/git-auto-commit-action@v5
4852
with:
@@ -59,8 +63,16 @@ jobs:
5963
key: cypress-cache-v1-${{ runner.os }}-${{ hashFiles('**/package.json') }}
6064
# install Cypress binary
6165
- run: npx cypress install && npx cypress cache list
62-
- uses: cypress-io/github-action@v6
66+
- name: Devtools@v2 E2E
67+
uses: cypress-io/github-action@v6
6368
with:
64-
start: npm run start:ci
65-
command: npm run cy:run
69+
start: node --run start
70+
command: node --run cy:run
71+
working-directory: packages/shell-chrome-v3
72+
install: false
73+
- name: Devtools@v1 E2E
74+
uses: cypress-io/github-action@v6
75+
with:
76+
start: node --run start:ci
77+
command: node --run cy:run
6678
install: false

package-lock.json

Lines changed: 42 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,22 @@
55
"description": "DevTools extension for debugging Alpine.js applications.",
66
"homepage": "https://github.com/alpine-collective/alpinejs-devtools",
77
"scripts": {
8+
"bootstrap": "npm i && npm --prefix=packages/shell-chrome-v3 i",
89
"start": "rollup -c -w",
910
"dev": "npm start",
1011
"start:ci": "ROLLUP_SERVE=true rollup -c",
1112
"build:dev": "rollup -c",
12-
"build": "NODE_ENV=production rollup -c",
13+
"build": "NODE_ENV=production rollup -c && npm --prefix packages/shell-chrome-v3 run build",
1314
"watch": "npm start",
1415
"test": "node --test tests/*",
1516
"cy:run": "cypress run",
1617
"cy:open": "cypress open",
17-
"format": "prettier './{packages/**/,cypress/**/*,lib/}*.{js,html,css}' --write",
18-
"check:format": "prettier './{packages/**/,cypress/**/*,}*.{js,html,css}' -c",
18+
"format": "prettier './{packages/**/,cypress/**/*,lib/}*.{js,ts,tsx,html,css}' --write",
19+
"check:format": "prettier './{packages/**/,cypress/**/*,}*.{js,ts,tsx,html,css}' -c",
20+
"typecheck": "npm --prefix packages/shell-chrome-v3 run typecheck",
1921
"prepackage": "npm run build",
20-
"package": "cd ./dist/chrome && zip -r ../alpine-devtools-$npm_package_version.zip . && rm -rf ../chrome"
22+
"package": "cd ./dist/chrome && zip -r ../alpine-devtools-$npm_package_version.zip .",
23+
"postpackage": "cd ./dist/shell-chrome-v3 && zip -r ../alpine-devtools-v2.zip ."
2124
},
2225
"license": "MIT",
2326
"devDependencies": {
@@ -47,6 +50,6 @@
4750
}
4851
},
4952
"lint-staged": {
50-
"*.{js,css,md,html}": "prettier --write"
53+
"*.{js,ts,tsx,css,md,html,json}": "prettier --write"
5154
}
5255
}

packages/build/watch.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ export function watch({ assetsDir, viewsDir, outputDir }) {
1212
}
1313
})
1414

15-
fs.watch(viewsDir, { recursive: true }, (_event, filename) => {
16-
try {
17-
console.info(`View "${filename}" updated. Rendering panel to ${outputDir}`)
15+
if (viewsDir) {
16+
fs.watch(viewsDir, { recursive: true }, (_event, filename) => {
17+
try {
18+
console.info(`View "${filename}" updated. Rendering panel to ${outputDir}`)
1819

19-
renderPanel()
20-
} catch (e) {
21-
console.error(e)
22-
}
23-
})
20+
renderPanel()
21+
} catch (e) {
22+
console.error(e)
23+
}
24+
})
25+
}
2426
}

packages/shell-chrome-v3/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
semi: true,
3+
printWidth: 120,
4+
singleQuote: true,
5+
tabWidth: 2,
6+
trailingComma: 'all',
7+
};

packages/shell-chrome-v3/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Manifest v3 compatible devtools
2+
3+
Todo:
4+
5+
- [x] switch to Preact or other signal-supporting system ~~(Vue?)~~ Solid
6+
- [x] update build pipeline
7+
- [x] setup manifest.json v3
8+
- [x] get a simulator running
9+
- [x] messaging
10+
- [x] detector -> content
11+
- [x] content -> background (service_worker)
12+
- [x] panel -> background connection
13+
- [ ] select 1 Cypress scenario and get it working
14+
- content runs on page and has access to Chrome Ext APIs, it injects detector
15+
- background = service worker
16+
- [x] detection popup
17+
- [ ] disable things that aren't implemented (eg. warnings tab, "latest version" loading)
18+
- [ ] Tab links/switching between tabs (components vs warnings, stores)
19+
20+
Using [Solid](https://solidjs.com) since Alpine.js is disallowed (unsafe eval is not allowed in panels in Manifest v3).
21+
22+
```bash
23+
$ npm install
24+
```
25+
26+
## Available Scripts
27+
28+
In the project directory, you can run:
29+
30+
### `npm run dev` or `npm start`
31+
32+
Runs the app in the development mode.<br>
33+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
34+
35+
The page will reload if you make edits.<br>
36+
37+
### `npm run build`
38+
39+
Builds the app for production to the roo `dist` folder.
1.15 KB
Loading
2.75 KB
Loading
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<meta charset="utf-8" />
2+
<script src="./devtools-background.js"></script>

0 commit comments

Comments
 (0)