@vsceasy/cli 0.1.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 (124) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/LICENSE +21 -0
  3. package/README.md +474 -0
  4. package/dist/bin/cli.d.ts +1 -0
  5. package/dist/bin/cli.js +9044 -0
  6. package/dist/cli.d.ts +3 -0
  7. package/dist/commands/command/add.d.ts +3 -0
  8. package/dist/commands/components/add.d.ts +3 -0
  9. package/dist/commands/create.d.ts +3 -0
  10. package/dist/commands/crud/add.d.ts +3 -0
  11. package/dist/commands/db/init.d.ts +3 -0
  12. package/dist/commands/doctor.d.ts +3 -0
  13. package/dist/commands/groups.d.ts +16 -0
  14. package/dist/commands/helper/add.d.ts +3 -0
  15. package/dist/commands/job/add.d.ts +3 -0
  16. package/dist/commands/menu/add.d.ts +3 -0
  17. package/dist/commands/menu/edit.d.ts +3 -0
  18. package/dist/commands/model/add.d.ts +3 -0
  19. package/dist/commands/panel/add.d.ts +3 -0
  20. package/dist/commands/publish/init.d.ts +3 -0
  21. package/dist/commands/rpc/add.d.ts +3 -0
  22. package/dist/commands/statusBar/add.d.ts +3 -0
  23. package/dist/commands/subpanel/add.d.ts +3 -0
  24. package/dist/commands/test/setup.d.ts +3 -0
  25. package/dist/commands/treeView/add.d.ts +3 -0
  26. package/dist/commands/upgrade.d.ts +3 -0
  27. package/dist/commands/wizard.d.ts +3 -0
  28. package/dist/data/codicons.d.ts +9 -0
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +3169 -0
  31. package/dist/lib/command/add.d.ts +31 -0
  32. package/dist/lib/components/add.d.ts +20 -0
  33. package/dist/lib/config.d.ts +10 -0
  34. package/dist/lib/crud/add.d.ts +19 -0
  35. package/dist/lib/crud/crudConfig.d.ts +37 -0
  36. package/dist/lib/crud/parseModel.d.ts +33 -0
  37. package/dist/lib/db/init.d.ts +16 -0
  38. package/dist/lib/db/wire.d.ts +10 -0
  39. package/dist/lib/doctor.d.ts +30 -0
  40. package/dist/lib/findProject.d.ts +10 -0
  41. package/dist/lib/helper/add.d.ts +14 -0
  42. package/dist/lib/iconPicker.d.ts +7 -0
  43. package/dist/lib/index.d.ts +46 -0
  44. package/dist/lib/interactive.d.ts +30 -0
  45. package/dist/lib/job/add.d.ts +24 -0
  46. package/dist/lib/menu/add.d.ts +13 -0
  47. package/dist/lib/menu/edit.d.ts +39 -0
  48. package/dist/lib/menuTree.d.ts +33 -0
  49. package/dist/lib/model/add.d.ts +27 -0
  50. package/dist/lib/model/parseFields.d.ts +14 -0
  51. package/dist/lib/panel/add.d.ts +29 -0
  52. package/dist/lib/publish/init.d.ts +12 -0
  53. package/dist/lib/rpc/add.d.ts +22 -0
  54. package/dist/lib/scaffold.d.ts +13 -0
  55. package/dist/lib/statusBar/add.d.ts +33 -0
  56. package/dist/lib/subpanel/add.d.ts +20 -0
  57. package/dist/lib/testSetup/index.d.ts +10 -0
  58. package/dist/lib/treeView/add.d.ts +13 -0
  59. package/dist/lib/upgrade.d.ts +22 -0
  60. package/dist/lib/validate.d.ts +14 -0
  61. package/dist/lib/wizard/run.d.ts +13 -0
  62. package/package.json +67 -0
  63. package/templates/_generators/command/command.ts.tpl +8 -0
  64. package/templates/_generators/components/Button.tsx.tpl +12 -0
  65. package/templates/_generators/components/Card.tsx.tpl +22 -0
  66. package/templates/_generators/components/Field.tsx.tpl +20 -0
  67. package/templates/_generators/components/Input.tsx.tpl +10 -0
  68. package/templates/_generators/components/List.tsx.tpl +29 -0
  69. package/templates/_generators/components/components.css.tpl +66 -0
  70. package/templates/_generators/components/index.ts.tpl +10 -0
  71. package/templates/_generators/crud/formApp.tsx.tpl +83 -0
  72. package/templates/_generators/crud/formNav.ts.tpl +19 -0
  73. package/templates/_generators/crud/formPanel.ts.tpl +32 -0
  74. package/templates/_generators/crud/listApp.tsx.tpl +84 -0
  75. package/templates/_generators/crud/listPanel.ts.tpl +30 -0
  76. package/templates/_generators/crud/main.tsx.tpl +6 -0
  77. package/templates/_generators/crud/service.ts.tpl +27 -0
  78. package/templates/_generators/helper/cache.ts.tpl +117 -0
  79. package/templates/_generators/helper/config.ts.tpl +36 -0
  80. package/templates/_generators/helper/db.ts.tpl +322 -0
  81. package/templates/_generators/helper/notifications.ts.tpl +45 -0
  82. package/templates/_generators/helper/secrets.ts.tpl +36 -0
  83. package/templates/_generators/helper/state.ts.tpl +44 -0
  84. package/templates/_generators/job/job.ts.tpl +10 -0
  85. package/templates/_generators/menu/menu.ts.tpl +21 -0
  86. package/templates/_generators/model/model.ts.tpl +17 -0
  87. package/templates/_generators/panel/App.tsx.tpl +10 -0
  88. package/templates/_generators/panel/main.tsx.tpl +6 -0
  89. package/templates/_generators/panel/panel.ts.tpl +5 -0
  90. package/templates/_generators/panel/templates/dashboard/App.tsx.tpl +41 -0
  91. package/templates/_generators/panel/templates/form/App.tsx.tpl +44 -0
  92. package/templates/_generators/panel/templates/list/App.tsx.tpl +40 -0
  93. package/templates/_generators/publish/CHANGELOG.md.tpl +8 -0
  94. package/templates/_generators/publish/README.md.tpl +23 -0
  95. package/templates/_generators/statusBar/statusBar.ts.tpl +7 -0
  96. package/templates/_generators/subpanel/App.tsx.tpl +10 -0
  97. package/templates/_generators/subpanel/main.tsx.tpl +6 -0
  98. package/templates/_generators/subpanel/subpanel.ts.tpl +6 -0
  99. package/templates/_generators/test/_helpers.ts.tpl +120 -0
  100. package/templates/_generators/test/sample.test.ts.tpl +38 -0
  101. package/templates/_generators/test/vitest.config.ts.tpl +23 -0
  102. package/templates/_generators/test/vscode.stub.ts.tpl +109 -0
  103. package/templates/_generators/treeView/treeView.ts.tpl +16 -0
  104. package/templates/react/.vscode/launch.json +34 -0
  105. package/templates/react/.vscode/tasks.json +32 -0
  106. package/templates/react/.vscodeignore +8 -0
  107. package/templates/react/README.md +50 -0
  108. package/templates/react/package.json +54 -0
  109. package/templates/react/scripts/gen.ts +395 -0
  110. package/templates/react/src/commands/hello.ts +6 -0
  111. package/templates/react/src/extension/extension.ts +5 -0
  112. package/templates/react/src/panels/dashboard.ts +21 -0
  113. package/templates/react/src/shared/api.ts +7 -0
  114. package/templates/react/src/shared/vsceasy/bootstrap.ts +657 -0
  115. package/templates/react/src/shared/vsceasy/client.ts +8 -0
  116. package/templates/react/src/shared/vsceasy/codiconNames.ts +196 -0
  117. package/templates/react/src/shared/vsceasy/define.ts +269 -0
  118. package/templates/react/src/shared/vsceasy/index.ts +13 -0
  119. package/templates/react/src/shared/vsceasy/rpc.ts +214 -0
  120. package/templates/react/src/webview/panels/dashboard/App.tsx +31 -0
  121. package/templates/react/src/webview/panels/dashboard/main.tsx +6 -0
  122. package/templates/react/src/webview/styles.css +33 -0
  123. package/templates/react/tsconfig.json +17 -0
  124. package/templates/react/vite.config.ts +42 -0
@@ -0,0 +1,31 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { connectWebview } from '../../../shared/vsceasy/client';
3
+ import type { DashboardApi } from '../../../shared/api';
4
+
5
+ const api = connectWebview<DashboardApi>();
6
+
7
+ export function App() {
8
+ const [info, setInfo] = useState<{ workspace: string | null; vscodeVersion: string } | null>(null);
9
+ const [files, setFiles] = useState<string[]>([]);
10
+ const [pattern, setPattern] = useState('**/*.ts');
11
+
12
+ useEffect(() => { api.getInfo().then(setInfo); }, []);
13
+
14
+ return (
15
+ <div className="app">
16
+ <h1>{{displayName}} Dashboard</h1>
17
+ {info && (
18
+ <section>
19
+ <p><strong>Workspace:</strong> {info.workspace ?? '(none)'}</p>
20
+ <p><strong>VS Code:</strong> {info.vscodeVersion}</p>
21
+ </section>
22
+ )}
23
+ <section>
24
+ <input value={pattern} onChange={(e) => setPattern(e.target.value)} />
25
+ <button onClick={async () => setFiles(await api.listFiles(pattern))}>Find files</button>
26
+ <button onClick={() => api.showMessage('Hello from the webview!')}>Toast</button>
27
+ <ul>{files.map((f) => <li key={f}>{f}</li>)}</ul>
28
+ </section>
29
+ </div>
30
+ );
31
+ }
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+ import { App } from './App';
4
+ import '../../styles.css';
5
+
6
+ createRoot(document.getElementById('root')!).render(<App />);
@@ -0,0 +1,33 @@
1
+ :root { color-scheme: light dark; }
2
+
3
+ body {
4
+ margin: 0;
5
+ padding: 1rem;
6
+ font-family: var(--vscode-font-family);
7
+ font-size: var(--vscode-font-size);
8
+ color: var(--vscode-foreground);
9
+ background: var(--vscode-editor-background);
10
+ }
11
+
12
+ .app h1 { font-size: 1.25rem; margin: 0 0 1rem; }
13
+
14
+ button, input {
15
+ font: inherit;
16
+ color: var(--vscode-button-foreground, inherit);
17
+ background: var(--vscode-button-background, transparent);
18
+ border: 1px solid var(--vscode-button-border, var(--vscode-input-border, #555));
19
+ padding: 0.35rem 0.75rem;
20
+ border-radius: 2px;
21
+ margin-right: 0.5rem;
22
+ }
23
+
24
+ input {
25
+ background: var(--vscode-input-background);
26
+ color: var(--vscode-input-foreground);
27
+ min-width: 16rem;
28
+ }
29
+
30
+ button:hover { background: var(--vscode-button-hoverBackground); }
31
+
32
+ ul { padding-left: 1.25rem; }
33
+ li { line-height: 1.6; }
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Bundler",
6
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
+ "jsx": "react-jsx",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "noEmit": true
15
+ },
16
+ "include": ["src"]
17
+ }
@@ -0,0 +1,42 @@
1
+ import { defineConfig } from 'vite';
2
+ import react from '@vitejs/plugin-react';
3
+ import * as fs from 'fs';
4
+ import * as path from 'path';
5
+
6
+ const WEBVIEW_ROOT = path.resolve(__dirname, 'src/webview');
7
+
8
+ function discoverHtmlEntries(subdir: string): Record<string, string> {
9
+ const dir = path.join(WEBVIEW_ROOT, subdir);
10
+ if (!fs.existsSync(dir)) return {};
11
+ const out: Record<string, string> = {};
12
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
13
+ if (!entry.isDirectory()) continue;
14
+ const html = path.join(dir, entry.name, 'index.html');
15
+ // Key includes subdir so panel `dashboard` and subpanel `dashboard` never collide.
16
+ if (fs.existsSync(html)) out[`${subdir}/${entry.name}`] = html;
17
+ }
18
+ return out;
19
+ }
20
+
21
+ const entries = {
22
+ ...discoverHtmlEntries('panels'),
23
+ ...discoverHtmlEntries('subpanels'),
24
+ };
25
+
26
+ export default defineConfig({
27
+ plugins: [react()],
28
+ root: WEBVIEW_ROOT,
29
+ build: {
30
+ outDir: path.resolve(__dirname, 'dist/webview'),
31
+ emptyOutDir: true,
32
+ manifest: 'manifest.json',
33
+ rollupOptions: {
34
+ input: entries,
35
+ output: {
36
+ entryFileNames: '[name]/index.js',
37
+ chunkFileNames: 'chunks/[name]-[hash].js',
38
+ assetFileNames: 'assets/[name]-[hash].[ext]',
39
+ },
40
+ },
41
+ },
42
+ });