create-addfox-app 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/README.md +18 -18
  2. package/dist/cli.js +77 -5
  3. package/package.json +3 -6
  4. package/templates/template-preact-js/addfox.config.js +27 -27
  5. package/templates/template-preact-js/app/background/index.js +8 -8
  6. package/templates/template-preact-js/app/content/index.js +1 -1
  7. package/templates/template-preact-js/app/options/App.jsx +5 -5
  8. package/templates/template-preact-js/app/options/index.jsx +5 -5
  9. package/templates/template-preact-js/app/popup/index.jsx +5 -5
  10. package/templates/template-preact-js/app/sidepanel/App.jsx +5 -5
  11. package/templates/template-preact-js/app/sidepanel/index.jsx +5 -5
  12. package/templates/template-preact-js/package.json +3 -3
  13. package/templates/template-preact-ts/addfox.config.ts +27 -27
  14. package/templates/template-preact-ts/app/background/index.ts +8 -8
  15. package/templates/template-preact-ts/app/content/index.ts +1 -1
  16. package/templates/template-preact-ts/app/options/App.tsx +5 -5
  17. package/templates/template-preact-ts/app/options/index.tsx +5 -5
  18. package/templates/template-preact-ts/app/popup/index.tsx +5 -5
  19. package/templates/template-preact-ts/app/sidepanel/App.tsx +5 -5
  20. package/templates/template-preact-ts/app/sidepanel/index.tsx +5 -5
  21. package/templates/template-preact-ts/package.json +3 -3
  22. package/templates/template-react-js/addfox.config.js +27 -27
  23. package/templates/template-react-js/app/background/index.js +8 -8
  24. package/templates/template-react-js/app/content/index.js +1 -1
  25. package/templates/template-react-js/app/options/App.jsx +3 -3
  26. package/templates/template-react-js/app/options/index.jsx +5 -5
  27. package/templates/template-react-js/app/popup/index.jsx +5 -5
  28. package/templates/template-react-js/app/sidepanel/App.jsx +3 -3
  29. package/templates/template-react-js/app/sidepanel/index.jsx +5 -5
  30. package/templates/template-react-js/package.json +3 -3
  31. package/templates/template-react-ts/addfox.config.ts +27 -27
  32. package/templates/template-react-ts/app/background/index.ts +8 -8
  33. package/templates/template-react-ts/app/content/index.ts +1 -1
  34. package/templates/template-react-ts/app/options/App.tsx +3 -3
  35. package/templates/template-react-ts/app/options/index.tsx +5 -5
  36. package/templates/template-react-ts/app/popup/index.tsx +5 -5
  37. package/templates/template-react-ts/app/sidepanel/App.tsx +3 -3
  38. package/templates/template-react-ts/app/sidepanel/index.tsx +5 -5
  39. package/templates/template-react-ts/package.json +3 -3
  40. package/templates/template-solid-js/addfox.config.js +28 -28
  41. package/templates/template-solid-js/app/background/index.js +8 -8
  42. package/templates/template-solid-js/app/content/index.js +1 -1
  43. package/templates/template-solid-js/app/options/App.jsx +3 -3
  44. package/templates/template-solid-js/app/options/index.jsx +5 -5
  45. package/templates/template-solid-js/app/popup/index.jsx +5 -5
  46. package/templates/template-solid-js/app/sidepanel/App.jsx +3 -3
  47. package/templates/template-solid-js/app/sidepanel/index.jsx +5 -5
  48. package/templates/template-solid-js/package.json +4 -4
  49. package/templates/template-solid-ts/addfox.config.ts +28 -28
  50. package/templates/template-solid-ts/app/background/index.ts +8 -8
  51. package/templates/template-solid-ts/app/content/index.ts +1 -1
  52. package/templates/template-solid-ts/app/options/App.tsx +3 -3
  53. package/templates/template-solid-ts/app/options/index.tsx +5 -5
  54. package/templates/template-solid-ts/app/popup/index.tsx +5 -5
  55. package/templates/template-solid-ts/app/sidepanel/App.tsx +3 -3
  56. package/templates/template-solid-ts/app/sidepanel/index.tsx +5 -5
  57. package/templates/template-solid-ts/package.json +4 -4
  58. package/templates/template-svelte-js/addfox.config.js +27 -27
  59. package/templates/template-svelte-js/app/background/index.js +8 -8
  60. package/templates/template-svelte-js/app/content/index.js +1 -1
  61. package/templates/template-svelte-js/app/options/App.svelte +4 -4
  62. package/templates/template-svelte-js/app/options/index.js +4 -4
  63. package/templates/template-svelte-js/app/popup/index.js +4 -4
  64. package/templates/template-svelte-js/app/sidepanel/App.svelte +4 -4
  65. package/templates/template-svelte-js/app/sidepanel/index.js +4 -4
  66. package/templates/template-svelte-js/package.json +3 -3
  67. package/templates/template-svelte-ts/addfox.config.ts +27 -27
  68. package/templates/template-svelte-ts/app/background/index.ts +8 -8
  69. package/templates/template-svelte-ts/app/content/index.ts +1 -1
  70. package/templates/template-svelte-ts/app/options/App.svelte +4 -4
  71. package/templates/template-svelte-ts/app/options/index.ts +4 -4
  72. package/templates/template-svelte-ts/app/popup/index.ts +4 -4
  73. package/templates/template-svelte-ts/app/sidepanel/App.svelte +4 -4
  74. package/templates/template-svelte-ts/app/sidepanel/index.ts +4 -4
  75. package/templates/template-svelte-ts/package.json +3 -3
  76. package/templates/template-vanilla-js/addfox.config.js +25 -25
  77. package/templates/template-vanilla-js/app/background/index.js +8 -8
  78. package/templates/template-vanilla-js/app/content/index.js +1 -1
  79. package/templates/template-vanilla-js/app/options/index.js +2 -2
  80. package/templates/template-vanilla-js/app/sidepanel/index.js +2 -2
  81. package/templates/template-vanilla-js/package.json +1 -1
  82. package/templates/template-vanilla-ts/addfox.config.ts +25 -25
  83. package/templates/template-vanilla-ts/app/background/index.ts +8 -8
  84. package/templates/template-vanilla-ts/app/content/index.ts +1 -1
  85. package/templates/template-vanilla-ts/app/options/index.ts +2 -2
  86. package/templates/template-vanilla-ts/app/sidepanel/index.ts +2 -2
  87. package/templates/template-vanilla-ts/package.json +1 -1
  88. package/templates/template-vanilla-ts/tsconfig.json +16 -16
  89. package/templates/template-vue-js/addfox.config.js +27 -27
  90. package/templates/template-vue-js/app/background/index.js +8 -8
  91. package/templates/template-vue-js/app/content/index.js +1 -1
  92. package/templates/template-vue-js/app/options/App.vue +6 -6
  93. package/templates/template-vue-js/app/options/index.js +5 -5
  94. package/templates/template-vue-js/app/popup/index.js +5 -5
  95. package/templates/template-vue-js/app/sidepanel/App.vue +6 -6
  96. package/templates/template-vue-js/app/sidepanel/index.js +5 -5
  97. package/templates/template-vue-js/package.json +3 -3
  98. package/templates/template-vue-ts/addfox.config.ts +27 -27
  99. package/templates/template-vue-ts/app/background/index.ts +8 -8
  100. package/templates/template-vue-ts/app/content/index.ts +1 -1
  101. package/templates/template-vue-ts/app/options/App.vue +6 -6
  102. package/templates/template-vue-ts/app/options/index.ts +5 -5
  103. package/templates/template-vue-ts/app/popup/index.ts +5 -5
  104. package/templates/template-vue-ts/app/sidepanel/App.vue +6 -6
  105. package/templates/template-vue-ts/app/sidepanel/index.ts +5 -5
  106. package/templates/template-vue-ts/package.json +3 -3
package/README.md CHANGED
@@ -1,18 +1,18 @@
1
- <p align="center">
2
- <img width="200" src="https://raw.githubusercontent.com/addfox/addfox/main/addfox.png" alt="Addfox">
3
- </p>
4
-
5
- # create-addfox-app
6
-
7
- [中文](README-zh_CN.md) | English
8
-
9
- ---
10
-
11
- Interactive scaffolder: generates a addfox-based extension project from options (template, package manager, entries, skills).
12
-
13
- - Commands: `create-addfox-app` or `pnpm create addfox-app` (and npm/yarn/bun equivalents)
14
- - Flow: (1) select framework (vanilla / vue / react / preact / svelte / solid), (2) language (TypeScript / JavaScript), (3) package manager (pnpm / npm / yarn / bun), (4) entries to include (multi-select), (5) whether to install addfox skills (yes/no). Output to cwd or a given directory. Generated project uses **addfox.config.ts** or **addfox.config.js** with minimal manifest (entry discovery; no built-in entry paths in manifest).
15
-
16
- ## Templates
17
-
18
- Scaffold templates ship inside this package under **`templates/`** (e.g. `template-vanilla-ts`, `template-react-ts`). They are included in the published npm tarball; the CLI copies the chosen folder into your new project (no remote download). The template’s **`addfox.config`** (including `manifest`) is **preserved**; the CLI only **merges** Rsbuild Less/Sass plugins when those style engines are selected. If no config file exists, a full fallback config is generated.
1
+ <p align="center">
2
+ <img width="200" src="https://raw.githubusercontent.com/addfox/addfox/main/addfox.png" alt="Addfox">
3
+ </p>
4
+
5
+ # create-addfox-app
6
+
7
+ [中文](README-zh_CN.md) | English
8
+
9
+ ---
10
+
11
+ Interactive scaffolder: generates a addfox-based extension project from options (template, package manager, entries, skills).
12
+
13
+ - Commands: `create-addfox-app` or `pnpm create addfox-app` (and npm/yarn/bun equivalents)
14
+ - Flow: (1) select framework (vanilla / vue / react / preact / svelte / solid), (2) language (TypeScript / JavaScript), (3) package manager (pnpm / npm / yarn / bun), (4) entries to include (multi-select), (5) whether to install addfox skills (yes/no). Output to cwd or a given directory. Generated project uses **addfox.config.ts** or **addfox.config.js** with minimal manifest (entry discovery; no built-in entry paths in manifest).
15
+
16
+ ## Templates
17
+
18
+ Scaffold templates ship inside this package under **`templates/`** (e.g. `template-vanilla-ts`, `template-react-ts`). They are included in the published npm tarball; the CLI copies the chosen folder into your new project (no remote download). The template’s **`addfox.config`** (including `manifest`) is **preserved**; the CLI only **merges** Rsbuild Less/Sass plugins when those style engines are selected. If no config file exists, a full fallback config is generated.
package/dist/cli.js CHANGED
@@ -5,10 +5,82 @@ import { fileURLToPath } from "node:url";
5
5
  import { createRequire } from "node:module";
6
6
  import { execSync } from "node:child_process";
7
7
  import prompts from "prompts";
8
- import { blue, cyan, dim, gray, green, lightBlue, magenta, red, trueColor, yellow } from "kolorist";
9
- import minimist from "minimist";
10
8
  import { cp, mkdir } from "node:fs/promises";
11
9
  import { detectPackageManager, getExecCommand, getInstallCommand, getRunCommand } from "@addfox/pkg-manager";
10
+ const RESET = "\x1b[0m";
11
+ function color(code) {
12
+ return (s)=>`\x1b[${code}m${s}${RESET}`;
13
+ }
14
+ color(30);
15
+ const red = color(31);
16
+ const green = color(32);
17
+ const yellow = color(33);
18
+ const blue = color(34);
19
+ const magenta = color(35);
20
+ const cyan = color(36);
21
+ color(37);
22
+ const gray = color(90);
23
+ color(91);
24
+ color(92);
25
+ color(93);
26
+ const lightBlue = color(94);
27
+ color(95);
28
+ color(96);
29
+ color(97);
30
+ const dim = color(2);
31
+ function trueColor(r, g, b) {
32
+ return (s)=>`\x1b[38;2;${r};${g};${b}m${s}${RESET}`;
33
+ }
34
+ function parseArgv(argv) {
35
+ const result = {
36
+ _: []
37
+ };
38
+ for(let i = 0; i < argv.length; i++){
39
+ const arg = argv[i];
40
+ if ("--" === arg) {
41
+ result._.push(...argv.slice(i + 1));
42
+ break;
43
+ }
44
+ if (arg.startsWith("--")) {
45
+ const eqIdx = arg.indexOf("=");
46
+ let key;
47
+ let value;
48
+ if (eqIdx >= 0) {
49
+ key = arg.slice(2, eqIdx);
50
+ value = arg.slice(eqIdx + 1);
51
+ } else {
52
+ key = arg.slice(2);
53
+ const next = argv[i + 1];
54
+ if (null == next || next.startsWith("-")) value = true;
55
+ else {
56
+ value = next;
57
+ i++;
58
+ }
59
+ }
60
+ const num = Number(value);
61
+ if (!isNaN(num) && String(value) === String(num)) value = num;
62
+ result[key] = value;
63
+ continue;
64
+ }
65
+ if (arg.startsWith("-") && arg.length > 1) {
66
+ const chars = arg.slice(1).split("");
67
+ for(let j = 0; j < chars.length; j++){
68
+ const key = chars[j];
69
+ const next = argv[i + 1];
70
+ if (j !== chars.length - 1 || null == next || next.startsWith("-")) result[key] = true;
71
+ else {
72
+ const num = Number(next);
73
+ result[key] = isNaN(num) || String(next) !== String(num) ? next : num;
74
+ i++;
75
+ }
76
+ }
77
+ continue;
78
+ }
79
+ const num = Number(arg);
80
+ result._.push(isNaN(num) || String(arg) !== String(num) ? arg : num);
81
+ }
82
+ return result;
83
+ }
12
84
  const TEMPLATE_BASE = "templates";
13
85
  function getPackageRoot() {
14
86
  return external_node_path_resolve(dirname(fileURLToPath(import.meta.url)), "..");
@@ -495,7 +567,7 @@ function applyTestAndReportSetup(root, language, selection) {
495
567
  if (testKinds.includes("e2e")) writeE2eSample(root, language);
496
568
  }
497
569
  }
498
- const RESET = "\x1b[0m";
570
+ const logo_RESET = "\x1b[0m";
499
571
  const LOGO_LINES = [
500
572
  " █████╗ ██████╗ ██████╗ ███████╗ ██████╗ ██╗ ██╗",
501
573
  "██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔═══██╗╚██╗██╔╝",
@@ -526,7 +598,7 @@ function colorizeLineAnsi256(line) {
526
598
  const code = Math.round(GRADIENT_START_256 + t * (GRADIENT_END_256 - GRADIENT_START_256));
527
599
  out += ansi256Fg(code) + ch;
528
600
  }
529
- return out + RESET;
601
+ return out + logo_RESET;
530
602
  }
531
603
  function printPlainLogo() {
532
604
  console.log("");
@@ -916,7 +988,7 @@ function updatePackageName(destDir, projectName) {
916
988
  writeJsonFile(pkgPath, pkg);
917
989
  }
918
990
  async function main() {
919
- const argv = minimist(process.argv.slice(2));
991
+ const argv = parseArgv(process.argv.slice(2));
920
992
  if (argv.help || argv.h) return void printHelp();
921
993
  if (argv.version || argv.v) return void console.log(getVersion());
922
994
  const targetDir = argv._[0] ?? "my-extension";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-addfox-app",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Interactive scaffolder for addfox extension projects",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -13,17 +13,14 @@
13
13
  "LICENSE"
14
14
  ],
15
15
  "dependencies": {
16
- "chalk": "^5.3.0",
17
16
  "prompts": "^2.4.2",
18
- "kolorist": "^1.8.0",
19
- "minimist": "^1.2.8",
20
- "@addfox/pkg-manager": "0.1.1"
17
+ "@addfox/pkg-manager": "0.2.0"
21
18
  },
22
19
  "engines": {
23
20
  "node": ">=18.0.0"
24
21
  },
25
22
  "devDependencies": {
26
- "@rslib/core": "^0.21.3",
23
+ "@rslib/core": "^0.21.5",
27
24
  "@rstest/core": "^0.9.9",
28
25
  "@rstest/coverage-istanbul": "^0.3.2",
29
26
  "@types/node": "^20.0.0",
@@ -1,27 +1,27 @@
1
- import { defineConfig } from "addfox";
2
- import { pluginPreact } from "@rsbuild/plugin-preact";
3
-
4
- const manifest = {
5
- name: "My Extension",
6
- version: "1.0.0",
7
- manifest_version: 3,
8
- description: "Browser extension built with addfox",
9
- permissions: ["activeTab"],
10
- icons: {
11
- "16": "icons/icon_128.png",
12
- "48": "icons/icon_128.png",
13
- "128": "icons/icon_128.png",
14
- },
15
- action: {
16
- default_icon: {
17
- "16": "icons/icon_128.png",
18
- "48": "icons/icon_128.png",
19
- "128": "icons/icon_128.png",
20
- },
21
- },
22
- };
23
-
24
- export default defineConfig({
25
- manifest: { chromium: manifest, firefox: { ...manifest } },
26
- plugins: [pluginPreact()],
27
- });
1
+ import { defineConfig } from "addfox";
2
+ import { pluginPreact } from "@rsbuild/plugin-preact";
3
+
4
+ const manifest = {
5
+ name: "My Extension",
6
+ version: "1.0.0",
7
+ manifest_version: 3,
8
+ description: "Browser extension built with addfox",
9
+ permissions: ["activeTab"],
10
+ icons: {
11
+ "16": "icons/icon_128.png",
12
+ "48": "icons/icon_128.png",
13
+ "128": "icons/icon_128.png",
14
+ },
15
+ action: {
16
+ default_icon: {
17
+ "16": "icons/icon_128.png",
18
+ "48": "icons/icon_128.png",
19
+ "128": "icons/icon_128.png",
20
+ },
21
+ },
22
+ };
23
+
24
+ export default defineConfig({
25
+ manifest: { chromium: manifest, firefox: { ...manifest } },
26
+ plugins: [pluginPreact()],
27
+ });
@@ -1,8 +1,8 @@
1
- function openWelcomePage() {
2
- chrome.tabs.create({ url: chrome.runtime.getURL("welcome.html") });
3
- }
4
-
5
- chrome.runtime.onInstalled.addListener((details) => {
6
- if (details.reason === "install" || details.reason === "update") openWelcomePage();
7
- console.log("Extension installed");
8
- });
1
+ function openWelcomePage() {
2
+ chrome.tabs.create({ url: chrome.runtime.getURL("welcome.html") });
3
+ }
4
+
5
+ chrome.runtime.onInstalled.addListener((details) => {
6
+ if (details.reason === "install" || details.reason === "update") openWelcomePage();
7
+ console.log("Extension installed");
8
+ });
@@ -1 +1 @@
1
- console.log("Content script loaded");
1
+ console.log("Content script loaded");
@@ -1,5 +1,5 @@
1
- import { h } from "preact";
2
-
3
- export default function App() {
4
- return <div>Hello from Preact</div>;
5
- }
1
+ import { h } from "preact";
2
+
3
+ export default function App() {
4
+ return <div>Hello from Preact</div>;
5
+ }
@@ -1,5 +1,5 @@
1
- import { render, h } from "preact";
2
- import App from "./App";
3
-
4
- const root = document.getElementById("root");
5
- if (root) render(h(App, null), root);
1
+ import { render, h } from "preact";
2
+ import App from "./App";
3
+
4
+ const root = document.getElementById("root");
5
+ if (root) render(h(App, null), root);
@@ -1,5 +1,5 @@
1
- import { render, h } from "preact";
2
- import App from "./App";
3
-
4
- const root = document.getElementById("root");
5
- if (root) render(h(App, null), root);
1
+ import { render, h } from "preact";
2
+ import App from "./App";
3
+
4
+ const root = document.getElementById("root");
5
+ if (root) render(h(App, null), root);
@@ -1,5 +1,5 @@
1
- import { h } from "preact";
2
-
3
- export default function App() {
4
- return <div>Hello from Preact</div>;
5
- }
1
+ import { h } from "preact";
2
+
3
+ export default function App() {
4
+ return <div>Hello from Preact</div>;
5
+ }
@@ -1,5 +1,5 @@
1
- import { render, h } from "preact";
2
- import App from "./App";
3
-
4
- const root = document.getElementById("root");
5
- if (root) render(h(App, null), root);
1
+ import { render, h } from "preact";
2
+ import App from "./App";
3
+
4
+ const root = document.getElementById("root");
5
+ if (root) render(h(App, null), root);
@@ -8,11 +8,11 @@
8
8
  "build": "addfox build"
9
9
  },
10
10
  "dependencies": {
11
- "@addfox/utils": "^0.1.1",
11
+ "@addfox/utils": "0.1.1",
12
12
  "preact": "^10.29.0"
13
13
  },
14
14
  "devDependencies": {
15
- "addfox": "^0.1.1",
16
- "@rsbuild/plugin-preact": "^1.7.2"
15
+ "addfox": "0.1.1",
16
+ "@rsbuild/plugin-preact": "1.7.2"
17
17
  }
18
18
  }
@@ -1,27 +1,27 @@
1
- import { defineConfig } from "addfox";
2
- import { pluginPreact } from "@rsbuild/plugin-preact";
3
-
4
- const manifest = {
5
- name: "My Extension",
6
- version: "1.0.0",
7
- manifest_version: 3,
8
- description: "Browser extension built with addfox",
9
- permissions: ["activeTab"],
10
- icons: {
11
- "16": "icons/icon_128.png",
12
- "48": "icons/icon_128.png",
13
- "128": "icons/icon_128.png",
14
- },
15
- action: {
16
- default_icon: {
17
- "16": "icons/icon_128.png",
18
- "48": "icons/icon_128.png",
19
- "128": "icons/icon_128.png",
20
- },
21
- },
22
- };
23
-
24
- export default defineConfig({
25
- manifest: { chromium: manifest, firefox: { ...manifest } },
26
- plugins: [pluginPreact()],
27
- });
1
+ import { defineConfig } from "addfox";
2
+ import { pluginPreact } from "@rsbuild/plugin-preact";
3
+
4
+ const manifest = {
5
+ name: "My Extension",
6
+ version: "1.0.0",
7
+ manifest_version: 3,
8
+ description: "Browser extension built with addfox",
9
+ permissions: ["activeTab"],
10
+ icons: {
11
+ "16": "icons/icon_128.png",
12
+ "48": "icons/icon_128.png",
13
+ "128": "icons/icon_128.png",
14
+ },
15
+ action: {
16
+ default_icon: {
17
+ "16": "icons/icon_128.png",
18
+ "48": "icons/icon_128.png",
19
+ "128": "icons/icon_128.png",
20
+ },
21
+ },
22
+ };
23
+
24
+ export default defineConfig({
25
+ manifest: { chromium: manifest, firefox: { ...manifest } },
26
+ plugins: [pluginPreact()],
27
+ });
@@ -1,8 +1,8 @@
1
- function openWelcomePage() {
2
- chrome.tabs.create({ url: chrome.runtime.getURL("welcome.html") });
3
- }
4
-
5
- chrome.runtime.onInstalled.addListener((details) => {
6
- if (details.reason === "install" || details.reason === "update") openWelcomePage();
7
- console.log("Extension installed");
8
- });
1
+ function openWelcomePage() {
2
+ chrome.tabs.create({ url: chrome.runtime.getURL("welcome.html") });
3
+ }
4
+
5
+ chrome.runtime.onInstalled.addListener((details) => {
6
+ if (details.reason === "install" || details.reason === "update") openWelcomePage();
7
+ console.log("Extension installed");
8
+ });
@@ -1 +1 @@
1
- console.log("Content script loaded");
1
+ console.log("Content script loaded");
@@ -1,5 +1,5 @@
1
- import { h } from "preact";
2
-
3
- export default function App() {
4
- return <div>Hello from Preact</div>;
5
- }
1
+ import { h } from "preact";
2
+
3
+ export default function App() {
4
+ return <div>Hello from Preact</div>;
5
+ }
@@ -1,5 +1,5 @@
1
- import { createRoot } from "react-dom/client";
2
- import App from "./App";
3
-
4
- const root = document.getElementById("root");
5
- if (root) createRoot(root).render(<App />);
1
+ import { createRoot } from "react-dom/client";
2
+ import App from "./App";
3
+
4
+ const root = document.getElementById("root");
5
+ if (root) createRoot(root).render(<App />);
@@ -1,5 +1,5 @@
1
- import { createRoot } from "react-dom/client";
2
- import App from "./App";
3
-
4
- const root = document.getElementById("root");
5
- if (root) createRoot(root).render(<App />);
1
+ import { createRoot } from "react-dom/client";
2
+ import App from "./App";
3
+
4
+ const root = document.getElementById("root");
5
+ if (root) createRoot(root).render(<App />);
@@ -1,5 +1,5 @@
1
- import { h } from "preact";
2
-
3
- export default function App() {
4
- return <div>Hello from Preact</div>;
5
- }
1
+ import { h } from "preact";
2
+
3
+ export default function App() {
4
+ return <div>Hello from Preact</div>;
5
+ }
@@ -1,5 +1,5 @@
1
- import { createRoot } from "react-dom/client";
2
- import App from "./App";
3
-
4
- const root = document.getElementById("root");
5
- if (root) createRoot(root).render(<App />);
1
+ import { createRoot } from "react-dom/client";
2
+ import App from "./App";
3
+
4
+ const root = document.getElementById("root");
5
+ if (root) createRoot(root).render(<App />);
@@ -8,12 +8,12 @@
8
8
  "build": "addfox build"
9
9
  },
10
10
  "dependencies": {
11
- "@addfox/utils": "^0.1.1",
11
+ "@addfox/utils": "0.1.1",
12
12
  "preact": "^10.29.0"
13
13
  },
14
14
  "devDependencies": {
15
- "addfox": "^0.1.1",
16
- "@rsbuild/plugin-preact": "^1.7.2",
15
+ "addfox": "0.1.1",
16
+ "@rsbuild/plugin-preact": "1.7.2",
17
17
  "typescript": "^5.9.3",
18
18
  "@types/chrome": "^0.1.38"
19
19
  }
@@ -1,27 +1,27 @@
1
- import { defineConfig } from "addfox";
2
- import { pluginReact } from "@rsbuild/plugin-react";
3
-
4
- const manifest = {
5
- name: "My Extension",
6
- version: "1.0.0",
7
- manifest_version: 3,
8
- description: "Browser extension built with addfox",
9
- permissions: ["activeTab"],
10
- icons: {
11
- "16": "icons/icon_128.png",
12
- "48": "icons/icon_128.png",
13
- "128": "icons/icon_128.png",
14
- },
15
- action: {
16
- default_icon: {
17
- "16": "icons/icon_128.png",
18
- "48": "icons/icon_128.png",
19
- "128": "icons/icon_128.png",
20
- },
21
- },
22
- };
23
-
24
- export default defineConfig({
25
- manifest: { chromium: manifest, firefox: { ...manifest } },
26
- plugins: [pluginReact()],
27
- });
1
+ import { defineConfig } from "addfox";
2
+ import { pluginReact } from "@rsbuild/plugin-react";
3
+
4
+ const manifest = {
5
+ name: "My Extension",
6
+ version: "1.0.0",
7
+ manifest_version: 3,
8
+ description: "Browser extension built with addfox",
9
+ permissions: ["activeTab"],
10
+ icons: {
11
+ "16": "icons/icon_128.png",
12
+ "48": "icons/icon_128.png",
13
+ "128": "icons/icon_128.png",
14
+ },
15
+ action: {
16
+ default_icon: {
17
+ "16": "icons/icon_128.png",
18
+ "48": "icons/icon_128.png",
19
+ "128": "icons/icon_128.png",
20
+ },
21
+ },
22
+ };
23
+
24
+ export default defineConfig({
25
+ manifest: { chromium: manifest, firefox: { ...manifest } },
26
+ plugins: [pluginReact()],
27
+ });
@@ -1,8 +1,8 @@
1
- function openWelcomePage() {
2
- chrome.tabs.create({ url: chrome.runtime.getURL("welcome.html") });
3
- }
4
-
5
- chrome.runtime.onInstalled.addListener((details) => {
6
- if (details.reason === "install" || details.reason === "update") openWelcomePage();
7
- console.log("Extension installed");
8
- });
1
+ function openWelcomePage() {
2
+ chrome.tabs.create({ url: chrome.runtime.getURL("welcome.html") });
3
+ }
4
+
5
+ chrome.runtime.onInstalled.addListener((details) => {
6
+ if (details.reason === "install" || details.reason === "update") openWelcomePage();
7
+ console.log("Extension installed");
8
+ });
@@ -1 +1 @@
1
- console.log("Content script loaded");
1
+ console.log("Content script loaded");
@@ -1,3 +1,3 @@
1
- export default function App() {
2
- return <div>Hello from React</div>;
3
- }
1
+ export default function App() {
2
+ return <div>Hello from React</div>;
3
+ }
@@ -1,5 +1,5 @@
1
- import { createRoot } from "react-dom/client";
2
- import App from "./App";
3
-
4
- const root = document.getElementById("root");
5
- if (root) createRoot(root).render(<App />);
1
+ import { createRoot } from "react-dom/client";
2
+ import App from "./App";
3
+
4
+ const root = document.getElementById("root");
5
+ if (root) createRoot(root).render(<App />);
@@ -1,5 +1,5 @@
1
- import { createRoot } from "react-dom/client";
2
- import App from "./App";
3
-
4
- const root = document.getElementById("root");
5
- if (root) createRoot(root).render(<App />);
1
+ import { createRoot } from "react-dom/client";
2
+ import App from "./App";
3
+
4
+ const root = document.getElementById("root");
5
+ if (root) createRoot(root).render(<App />);
@@ -1,3 +1,3 @@
1
- export default function App() {
2
- return <div>Hello from React</div>;
3
- }
1
+ export default function App() {
2
+ return <div>Hello from React</div>;
3
+ }
@@ -1,5 +1,5 @@
1
- import { createRoot } from "react-dom/client";
2
- import App from "./App";
3
-
4
- const root = document.getElementById("root");
5
- if (root) createRoot(root).render(<App />);
1
+ import { createRoot } from "react-dom/client";
2
+ import App from "./App";
3
+
4
+ const root = document.getElementById("root");
5
+ if (root) createRoot(root).render(<App />);
@@ -8,12 +8,12 @@
8
8
  "build": "addfox build"
9
9
  },
10
10
  "dependencies": {
11
- "@addfox/utils": "^0.1.1",
11
+ "@addfox/utils": "0.1.1",
12
12
  "react": "^19.2.4",
13
13
  "react-dom": "^19.2.4"
14
14
  },
15
15
  "devDependencies": {
16
- "addfox": "^0.1.1",
17
- "@rsbuild/plugin-react": "^2.0.0"
16
+ "addfox": "0.1.1",
17
+ "@rsbuild/plugin-react": "2.0.0"
18
18
  }
19
19
  }