Skip to content

Commit 0713ae5

Browse files
committed
2.5.1, 2.5.2 firefox compat
Adds a new instruction to AGENTS.md to run `npm run format` as the last step of any plan. test: add tests for stores in devtools shell-chrome-v3 feat: v2 compatiblity with Firefox chore: package using web-ext package instead of homebaked zip command chore: upgrade deps 2.5.2 for FF update testing
1 parent b5a7da2 commit 0713ae5

File tree

13 files changed

+4164
-697
lines changed

13 files changed

+4164
-697
lines changed

AGENTS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This is a SolidJS application.
2+
3+
The main application to work on is in `packages/shell-chrome-v3`. This is a Chrome extension using Manifest v3.
4+
5+
We want to support Firefox and Safari in the future.
6+
7+
A note on coding style: signals should be left outside of components.
8+
9+
As the last step of any plan, run `npm run format`.

package-lock.json

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

package.json

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,24 @@
1111
"start:ci": "ROLLUP_SERVE=true rollup -c",
1212
"build:dev": "rollup -c",
1313
"build": "NODE_ENV=production rollup -c && VITE_MAINLINE_PUBLISH=true npm --prefix packages/shell-chrome-v3 run build",
14-
"early-access": "rm -rf dist && npm --prefix packages/shell-chrome-v3 run build && npm run postpackage",
14+
"early-access": "rm -rf dist && npm --prefix packages/shell-chrome-v3 run build && node --run postpackage",
1515
"ea": "npm run early-access",
1616
"watch": "npm start",
1717
"test": "node --test tests/* && node --experimental-strip-types --test **/*.test.ts",
1818
"cy:run": "cypress run",
1919
"cy:open": "cypress open",
20+
"archive:v3": "git archive -o ./dist/alpine-devtools-source-archive-v2.zip HEAD:packages/shell-chrome-v3",
2021
"format": "prettier './{packages/**/,cypress/**/*,lib/}*.{js,ts,tsx,html,css}' --write",
2122
"check:format": "prettier './{packages/**/,cypress/**/*,}*.{js,ts,tsx,html,css}' -c",
23+
"check:firefox": "npm run ea && web-ext lint --source-dir=dist/firefox-ext",
2224
"typecheck": "npm --prefix packages/shell-chrome-v3 run typecheck",
2325
"prepackage": "rm -rf dist && npm run build",
26+
"sa": "npm run package",
2427
"package": "cd ./dist/chrome && zip -r ../alpine-devtools-$npm_package_version.zip .",
25-
"postpackage": "cd ./dist/shell-chrome-v3 && zip -r ../alpine-devtools-v2.zip ."
28+
"pkg:chrome": "web-ext build --source-dir=dist/shell-chrome-v3 --artifacts-dir=./dist/chrome-v2",
29+
"pkg:firefox": "web-ext build --source-dir=dist/firefox-ext --artifacts-dir=./dist/firefox-v2",
30+
"postpackage": "node --run pkg:chrome && node --run pkg:firefox",
31+
"ff:open": "web-ext run -s=./dist/firefox-ext"
2632
},
2733
"license": "MIT",
2834
"devDependencies": {
@@ -31,20 +37,21 @@
3137
"@tailwindcss/forms": "^0.3.3",
3238
"@tailwindcss/jit": "^0.1.18",
3339
"alpinejs": "^2.8.2",
34-
"cypress": "14.3.2",
40+
"cypress": "14.5.4",
3541
"cypress-iframe": "^1.0.1",
3642
"edge.js": "^5.3.3",
3743
"husky": "9.1.7",
38-
"linkedom": "0.18.10",
39-
"lint-staged": "15.5.1",
40-
"prettier": "3.5.3",
44+
"linkedom": "0.18.11",
45+
"lint-staged": "16.1.4",
46+
"prettier": "3.6.2",
4147
"rollup": "^2.70.0",
4248
"rollup-plugin-copy": "3.5.0",
4349
"rollup-plugin-filesize": "10.0.0",
4450
"rollup-plugin-postcss": "^4.0.2",
4551
"rollup-plugin-serve": "3.0.0",
4652
"split-grid": "^1.0.11",
47-
"tailwindcss": "^2.1.4"
53+
"tailwindcss": "^2.1.4",
54+
"web-ext": "8.9.0"
4855
},
4956
"husky": {
5057
"hooks": {

packages/shell-chrome-v3/build.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,25 @@ async function buildAll() {
5656
if (process.env.VITE_MAINLINE_PUBLISH === 'true') {
5757
newManifestJson.name = 'Alpine.js devtools';
5858
}
59+
5960
await fs.writeFile(
6061
fileURLToPath(new URL('../../dist/shell-chrome-v3/manifest.json', import.meta.url)),
6162
JSON.stringify(newManifestJson, null, 2),
6263
);
6364

65+
if (process.env.TARGET === 'firefox') {
66+
console.log('Overwriting manifest.json with Firefox compatible one.');
67+
await fs.writeFile(
68+
fileURLToPath(new URL('../../dist/shell-chrome-v3/manifest.json', import.meta.url)),
69+
JSON.stringify(convertToFirefoxManifest(newManifestJson), null, 2),
70+
);
71+
} else {
72+
await fs.writeFile(
73+
fileURLToPath(new URL('../../dist/shell-chrome-v3/manifest-ff.json', import.meta.url)),
74+
JSON.stringify(convertToFirefoxManifest(newManifestJson), null, 2),
75+
);
76+
}
77+
6478
console.log('manifest.json updates successful');
6579
} catch (error) {
6680
console.error('Build failed:', error);
@@ -70,3 +84,25 @@ async function buildAll() {
7084

7185
// Run build process
7286
buildAll();
87+
88+
function convertToFirefoxManifest(manifest) {
89+
const { service_worker, ...rest } = manifest.background;
90+
return {
91+
...manifest,
92+
background: {
93+
...rest,
94+
scripts: [service_worker],
95+
},
96+
browser_specific_settings: {
97+
gecko: {
98+
99+
strict_min_version: '112.0',
100+
...(process.env.VITE_MAINLINE_PUBLISH !== 'true'
101+
? {
102+
update_url: 'https://alpinedevtools.com/ff-ea-updates.json',
103+
}
104+
: undefined),
105+
},
106+
},
107+
};
108+
}
Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,41 @@
1-
it.skip('should show "no stores" messages when none detected');
1+
it('should show "no stores" messages when none detected', () => {
2+
cy.visit('/simulator?target=no-stores.html');
3+
cy.get('[data-testid=tab-link-stores]').click();
4+
cy.contains('No stores found').should('be.visible');
5+
});
26

3-
it.skip('should populate stores list when present');
4-
it.skip(
5-
'primitive store - should populate data, allow edits and receive state updates when selected',
6-
);
7-
it.skip('object store - should populate data, allow edits and receive state updates when selected');
7+
it('should populate stores list when present', () => {
8+
cy.visit('/simulator?target=v3.html');
9+
cy.get('[data-testid=tab-link-stores]').click();
10+
cy.get('[data-testid=store-name]').should('have.length', 2);
11+
cy.get('[data-testid=store-name]').contains('sampleStore').should('be.visible');
12+
cy.get('[data-testid=store-name]').contains('primitiveVal').should('be.visible');
13+
});
14+
it('primitive store - should populate data, allow edits and receive state updates when selected', () => {
15+
cy.visit('/simulator?target=v3.html');
16+
cy.get('[data-testid=tab-link-stores]').click();
17+
cy.get('[data-testid=store-name]').contains('primitiveVal').click();
18+
cy.get('[data-testid=data-property-value-__root_value]').should('contain.text', 'true');
19+
cy.get('[data-testid=data-property-value-__root_value] [type=checkbox]').click({ force: true });
20+
cy.get('[data-testid=data-property-value-__root_value]').should('contain.text', 'false');
21+
cy.iframe('#target').contains('primitiveVal false');
22+
cy.iframe('#target').find('[data-testid=reset-primitive-store]').click();
23+
cy.get('[data-testid=data-property-value-__root_value]').should('contain.text', 'false');
24+
});
25+
it('object store - should populate data, allow edits and receive state updates when selected', () => {
26+
cy.visit('/simulator?target=v3.html');
27+
cy.get('[data-testid=tab-link-stores]').click();
28+
cy.get('[data-testid=store-name]').contains('sampleStore').click();
29+
cy.get('[data-testid=data-property-name-nested]').should('be.visible');
30+
cy.get('[data-testid=data-property-value-nested]').should('contain.text', 'Object');
31+
cy.get('[data-testid=data-property-value-nested]').click();
32+
cy.get('[data-testid=data-property-name-array]').should('be.visible');
33+
cy.get('[data-testid=data-property-value-array]').should('contain.text', 'Array[2]');
34+
cy.get('[data-testid=data-property-name-on]').should('be.visible');
35+
cy.get('[data-testid=data-property-value-on]').should('contain.text', 'false');
36+
cy.get('[data-testid=data-property-value-on] [type=checkbox]').click({ force: true });
37+
cy.get('[data-testid=data-property-value-on]').should('contain.text', 'true');
38+
cy.iframe('#target').contains('sampleStore.on true');
39+
cy.iframe('#target').find('[data-testid=reset-nested-store]').click();
40+
cy.get('[data-testid=data-property-value-nested]').should('contain.text', 'Array[0]');
41+
});

packages/shell-chrome-v3/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Alpine.js devtools - Early Access",
33
"description": "DevTools extension for debugging Alpine.js applications.",
4-
"version": "2.5.0",
4+
"version": "2.5.2",
55
"manifest_version": 3,
66
"icons": {
77
"16": "icons/16.png",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Alpine.js Devtools v3</title>
6+
<script src="/cdn.min.js" defer></script>
7+
</head>
8+
<body>
9+
<div x-data="{ hello: 'world' }">
10+
<span x-text="hello"></span>
11+
</div>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)