@wealthfolio/addon-dev-tools 3.5.1 → 3.6.1
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.
- package/README.md +10 -6
- package/cli.js +1 -1
- package/package.json +2 -1
- package/templates/addon.tsx.template +11 -5
- package/templates/manifest.json.template +14 -3
- package/templates/package.json.template +21 -10
- package/templates/vite.config.ts.template +27 -17
package/README.md
CHANGED
|
@@ -8,37 +8,41 @@ Development tools for Wealthfolio addons including hot reload server and CLI.
|
|
|
8
8
|
npm install -g @wealthfolio/addon-dev-tools
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
> **Deprecation note:** the CLI command is now `wealthfolio-addon`. The old
|
|
12
|
+
> `wealthfolio` alias still works but will be removed in a future release — the
|
|
13
|
+
> `wealthfolio` name is reserved for the upcoming native Wealthfolio CLI.
|
|
14
|
+
|
|
11
15
|
## CLI Commands
|
|
12
16
|
|
|
13
17
|
### Create New Addon
|
|
14
18
|
|
|
15
19
|
```bash
|
|
16
|
-
wealthfolio create my-awesome-addon
|
|
20
|
+
wealthfolio-addon create my-awesome-addon
|
|
17
21
|
```
|
|
18
22
|
|
|
19
23
|
### Start Development Server
|
|
20
24
|
|
|
21
25
|
```bash
|
|
22
26
|
# In your addon directory
|
|
23
|
-
wealthfolio dev
|
|
27
|
+
wealthfolio-addon dev
|
|
24
28
|
```
|
|
25
29
|
|
|
26
30
|
### Build Addon
|
|
27
31
|
|
|
28
32
|
```bash
|
|
29
|
-
wealthfolio build
|
|
33
|
+
wealthfolio-addon build
|
|
30
34
|
```
|
|
31
35
|
|
|
32
36
|
### Package for Distribution
|
|
33
37
|
|
|
34
38
|
```bash
|
|
35
|
-
wealthfolio package
|
|
39
|
+
wealthfolio-addon package
|
|
36
40
|
```
|
|
37
41
|
|
|
38
42
|
### Test Setup
|
|
39
43
|
|
|
40
44
|
```bash
|
|
41
|
-
wealthfolio test
|
|
45
|
+
wealthfolio-addon test
|
|
42
46
|
```
|
|
43
47
|
|
|
44
48
|
## Development Server
|
|
@@ -66,7 +70,7 @@ Add to your addon's `package.json`:
|
|
|
66
70
|
```json
|
|
67
71
|
{
|
|
68
72
|
"scripts": {
|
|
69
|
-
"dev:server": "wealthfolio dev"
|
|
73
|
+
"dev:server": "wealthfolio-addon dev"
|
|
70
74
|
},
|
|
71
75
|
"devDependencies": {
|
|
72
76
|
"@wealthfolio/addon-dev-tools": "^1.0.0"
|
package/cli.js
CHANGED
|
@@ -271,7 +271,7 @@ async function installAddon(zipPath) {
|
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
// CLI Setup
|
|
274
|
-
program.name("wealthfolio").description("Wealthfolio Addon Development CLI").version("1.0.0");
|
|
274
|
+
program.name("wealthfolio-addon").description("Wealthfolio Addon Development CLI").version("1.0.0");
|
|
275
275
|
|
|
276
276
|
program
|
|
277
277
|
.command("create <name>")
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wealthfolio/addon-dev-tools",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.1",
|
|
4
4
|
"description": "Development tools for Wealthfolio addons - hot reload server and CLI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
|
+
"wealthfolio-addon": "cli.js",
|
|
7
8
|
"wealthfolio": "cli.js"
|
|
8
9
|
},
|
|
9
10
|
"keywords": [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createRoot, type Root } from 'react-dom/client';
|
|
2
2
|
import type { AddonContext } from '@wealthfolio/addon-sdk';
|
|
3
3
|
import { Card, CardContent, Icons } from '@wealthfolio/ui';
|
|
4
4
|
|
|
@@ -18,28 +18,34 @@ function AddonExample({ ctx }: { ctx: AddonContext }) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export default function enable(ctx: AddonContext) {
|
|
21
|
+
let root: Root | null = null;
|
|
22
|
+
|
|
21
23
|
// Add a sidebar item
|
|
22
24
|
const sidebarItem = ctx.sidebar.addItem({
|
|
23
25
|
id: '{{addonId}}',
|
|
24
26
|
label: '{{addonName}}',
|
|
25
|
-
icon:
|
|
27
|
+
icon: 'blocks',
|
|
26
28
|
route: '/addon/{{addonId}}',
|
|
27
29
|
order: 100,
|
|
28
30
|
});
|
|
29
31
|
|
|
30
32
|
// Add a route
|
|
31
|
-
const Wrapper = () => <AddonExample ctx={ctx} />;
|
|
32
33
|
ctx.router.add({
|
|
33
34
|
path: '/addon/{{addonId}}',
|
|
34
|
-
|
|
35
|
+
render: ({ root: routeRoot }) => {
|
|
36
|
+
root ??= createRoot(routeRoot);
|
|
37
|
+
root.render(<AddonExample ctx={ctx} />);
|
|
38
|
+
},
|
|
35
39
|
});
|
|
36
40
|
|
|
37
41
|
// Cleanup on disable
|
|
38
42
|
ctx.onDisable(() => {
|
|
39
43
|
try {
|
|
40
44
|
sidebarItem.remove();
|
|
45
|
+
root?.unmount();
|
|
46
|
+
root = null;
|
|
41
47
|
} catch (err) {
|
|
42
|
-
ctx.api.logger.error(
|
|
48
|
+
ctx.api.logger.error(`Failed to remove sidebar item: ${String(err)}`);
|
|
43
49
|
}
|
|
44
50
|
});
|
|
45
51
|
}
|
|
@@ -5,13 +5,24 @@
|
|
|
5
5
|
"description": "{{description}}",
|
|
6
6
|
"author": "{{author}}",
|
|
7
7
|
"main": "dist/addon.js",
|
|
8
|
-
"sdkVersion": "
|
|
8
|
+
"sdkVersion": "3.6.0",
|
|
9
|
+
"minWealthfolioVersion": "3.6.0",
|
|
9
10
|
"enabled": true,
|
|
11
|
+
"hostDependencies": {
|
|
12
|
+
"@tanstack/react-query": "^5.90.0",
|
|
13
|
+
"@wealthfolio/addon-sdk": "^3.6.0",
|
|
14
|
+
"@wealthfolio/ui": "^3.6.0",
|
|
15
|
+
"date-fns": "^4.1.0",
|
|
16
|
+
"lucide-react": "^0.561.0",
|
|
17
|
+
"react": "^19.2.0",
|
|
18
|
+
"react-dom": "^19.2.0",
|
|
19
|
+
"recharts": "^3.7.0"
|
|
20
|
+
},
|
|
10
21
|
"permissions": [
|
|
11
22
|
{
|
|
12
23
|
"category": "ui",
|
|
13
|
-
"functions": ["sidebar.addItem"],
|
|
14
|
-
"purpose": "Add navigation items
|
|
24
|
+
"functions": ["sidebar.addItem", "router.add"],
|
|
25
|
+
"purpose": "Add navigation items and pages"
|
|
15
26
|
}
|
|
16
27
|
],
|
|
17
28
|
"keywords": ["wealthfolio", "addon"],
|
|
@@ -11,25 +11,36 @@
|
|
|
11
11
|
"dev": "vite build --watch",
|
|
12
12
|
"dev:server": "wealthfolio dev",
|
|
13
13
|
"clean": "rm -rf dist",
|
|
14
|
-
"package": "mkdir -p dist && zip -r dist/$npm_package_name-$npm_package_version.zip manifest.json dist/ assets/ README.md",
|
|
14
|
+
"package": "mkdir -p dist && find dist -name '*.map' -delete && zip -r dist/$npm_package_name-$npm_package_version.zip manifest.json dist/ assets/ README.md -x '*.map'",
|
|
15
15
|
"bundle": "pnpm clean && pnpm build && pnpm package",
|
|
16
16
|
"lint": "tsc --noEmit",
|
|
17
17
|
"type-check": "tsc --noEmit"
|
|
18
18
|
},
|
|
19
|
-
"
|
|
20
|
-
"@
|
|
21
|
-
"@wealthfolio/
|
|
22
|
-
"
|
|
23
|
-
"
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@tanstack/react-query": "^5.90.0",
|
|
21
|
+
"@wealthfolio/addon-sdk": "^3.6.0",
|
|
22
|
+
"@wealthfolio/ui": "^3.6.0",
|
|
23
|
+
"date-fns": "^4.1.0",
|
|
24
|
+
"lucide-react": "^0.561.0",
|
|
25
|
+
"react": "^19.2.0",
|
|
26
|
+
"react-dom": "^19.2.0",
|
|
27
|
+
"recharts": "^3.7.0"
|
|
24
28
|
},
|
|
25
29
|
"devDependencies": {
|
|
30
|
+
"@tanstack/react-query": "^5.90.20",
|
|
26
31
|
"@tailwindcss/vite": "^4.1.13",
|
|
27
|
-
"@wealthfolio/addon-dev-tools": "^
|
|
32
|
+
"@wealthfolio/addon-dev-tools": "^3.6.0",
|
|
33
|
+
"@wealthfolio/addon-sdk": "^3.6.0",
|
|
34
|
+
"@wealthfolio/ui": "^3.6.0",
|
|
28
35
|
"@types/node": "^20.0.0",
|
|
29
|
-
"@types/react": "^19.
|
|
30
|
-
"@types/react-dom": "^19.
|
|
36
|
+
"@types/react": "^19.2.13",
|
|
37
|
+
"@types/react-dom": "^19.2.3",
|
|
31
38
|
"@vitejs/plugin-react": "^5.0.2",
|
|
32
|
-
"
|
|
39
|
+
"date-fns": "^4.1.0",
|
|
40
|
+
"lucide-react": "^0.561.0",
|
|
41
|
+
"react": "^19.2.4",
|
|
42
|
+
"react-dom": "^19.2.4",
|
|
43
|
+
"recharts": "^3.7.0",
|
|
33
44
|
"tailwindcss": "^4.1.13",
|
|
34
45
|
"typescript": "^5.9.2",
|
|
35
46
|
"vite": "^7.1.5"
|
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
import react from '@vitejs/plugin-react';
|
|
2
2
|
import tailwindcss from '@tailwindcss/vite';
|
|
3
3
|
import { defineConfig } from 'vite';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
const hostProvidedDependencies = [
|
|
6
|
+
'@tanstack/react-query',
|
|
7
|
+
'@wealthfolio/addon-sdk',
|
|
8
|
+
'@wealthfolio/addon-sdk/goal-progress',
|
|
9
|
+
'@wealthfolio/addon-sdk/host-api',
|
|
10
|
+
'@wealthfolio/addon-sdk/host-dependencies',
|
|
11
|
+
'@wealthfolio/addon-sdk/manifest',
|
|
12
|
+
'@wealthfolio/addon-sdk/permissions',
|
|
13
|
+
'@wealthfolio/addon-sdk/query-keys',
|
|
14
|
+
'@wealthfolio/addon-sdk/types',
|
|
15
|
+
'@wealthfolio/addon-sdk/utils',
|
|
16
|
+
'@wealthfolio/ui',
|
|
17
|
+
'@wealthfolio/ui/chart',
|
|
18
|
+
'date-fns',
|
|
19
|
+
'lucide-react',
|
|
20
|
+
'react',
|
|
21
|
+
'react-dom',
|
|
22
|
+
'react-dom/client',
|
|
23
|
+
'react/jsx-dev-runtime',
|
|
24
|
+
'react/jsx-runtime',
|
|
25
|
+
'recharts',
|
|
26
|
+
];
|
|
5
27
|
|
|
6
28
|
export default defineConfig({
|
|
7
29
|
plugins: [react(), tailwindcss()],
|
|
@@ -14,24 +36,12 @@ export default defineConfig({
|
|
|
14
36
|
fileName: () => 'addon.js',
|
|
15
37
|
formats: ['es'],
|
|
16
38
|
},
|
|
17
|
-
rollupOptions: {
|
|
18
|
-
external: ['react', 'react-dom'],
|
|
19
|
-
plugins: [
|
|
20
|
-
externalGlobals({
|
|
21
|
-
react: 'React',
|
|
22
|
-
'react-dom': 'ReactDOM'
|
|
23
|
-
})
|
|
24
|
-
],
|
|
25
|
-
output: {
|
|
26
|
-
globals: {
|
|
27
|
-
react: 'React',
|
|
28
|
-
'react-dom': 'ReactDOM',
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
39
|
outDir: 'dist',
|
|
33
|
-
minify:
|
|
40
|
+
minify: true,
|
|
34
41
|
sourcemap: false,
|
|
42
|
+
rollupOptions: {
|
|
43
|
+
external: hostProvidedDependencies,
|
|
44
|
+
},
|
|
35
45
|
watch: {
|
|
36
46
|
// Watch mode options for better hot reloading
|
|
37
47
|
include: ['src/**'],
|