@simplysm/sd-cli 13.0.85 → 13.0.87
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 +302 -23
- package/docs/architecture.md +311 -0
- package/docs/config-types.md +253 -0
- package/package.json +6 -6
- package/templates/init/.gitignore.hbs +35 -0
- package/templates/init/.npmrc.hbs +1 -0
- package/templates/init/mise.toml +2 -2
- package/templates/init/package.json.hbs +9 -4
- package/templates/init/packages/client-admin/package.json.hbs +6 -5
- package/templates/init/packages/client-admin/src/events/AuthChangeEvent.ts +3 -0
- package/templates/init/packages/client-admin/src/main.tsx.hbs +2 -2
- package/templates/init/packages/client-admin/src/providers/AppServiceProvider.tsx.hbs +4 -4
- package/templates/init/packages/client-admin/src/providers/AuthProvider.tsx.hbs +27 -2
- package/templates/init/packages/client-admin/src/providers/configureSharedData.ts.hbs +8 -8
- package/templates/init/packages/client-admin/src/views/auth/LoginView.tsx +4 -4
- package/templates/init/packages/client-admin/src/views/home/HomeView.tsx +2 -2
- package/templates/init/packages/db-main/package.json.hbs +2 -2
- package/templates/init/packages/db-main/src/MainDbContext.ts +8 -6
- package/templates/init/packages/db-main/src/dataLogExt.ts +1 -1
- package/templates/init/packages/db-main/src/index.ts +10 -6
- package/templates/init/packages/server/package.json.hbs +4 -4
- package/templates/init/pnpm-workspace.yaml +1 -0
- package/templates/init/sd.config.ts.hbs +21 -9
- package/templates/init/{tests/e2e → tests-e2e}/package.json.hbs +1 -1
- package/templates/init/{tests/e2e → tests-e2e}/vitest.setup.ts.hbs +1 -1
- package/templates/init/tsconfig.json.hbs +2 -1
- package/templates/init/vitest-e2e.config.ts +23 -0
- package/templates/init/vitest.config.ts +0 -13
- package/docs/commands.md +0 -177
- package/docs/configuration.md +0 -211
- package/docs/vite-config.md +0 -67
- /package/templates/init/packages/db-main/src/tables/{Employee.ts → base/Employee.ts} +0 -0
- /package/templates/init/packages/db-main/src/tables/{EmployeeConfig.ts → base/EmployeeConfig.ts} +0 -0
- /package/templates/init/packages/db-main/src/tables/{Role.ts → base/Role.ts} +0 -0
- /package/templates/init/packages/db-main/src/tables/{RolePermission.ts → base/RolePermission.ts} +0 -0
- /package/templates/init/packages/db-main/src/tables/{_DataLog.ts → system/_DataLog.ts} +0 -0
- /package/templates/init/packages/db-main/src/tables/{_Log.ts → system/_Log.ts} +0 -0
- /package/templates/init/{tests/e2e → tests-e2e}/src/e2e.spec.ts +0 -0
- /package/templates/init/{tests/e2e → tests-e2e}/src/employee-crud.ts +0 -0
- /package/templates/init/{tests/e2e → tests-e2e}/src/login.ts +0 -0
|
@@ -3,7 +3,10 @@ import type { SdConfigFn } from "@simplysm/sd-cli";
|
|
|
3
3
|
const dbPort = Number(process.env["DB_PORT"] ?? 5432);
|
|
4
4
|
const dbDatabase = process.env["DB_DATABASE"] ?? "{{projectName}}";
|
|
5
5
|
|
|
6
|
-
const config: SdConfigFn = () => ({
|
|
6
|
+
const config: SdConfigFn = ({ dev }) => ({
|
|
7
|
+
replaceDeps: {
|
|
8
|
+
"@simplysm/*": "../simplysm/packages/*",
|
|
9
|
+
},
|
|
7
10
|
packages: {
|
|
8
11
|
"db-main": { target: "neutral" },
|
|
9
12
|
"client-admin": {
|
|
@@ -16,14 +19,23 @@ const config: SdConfigFn = () => ({
|
|
|
16
19
|
pm2: {},
|
|
17
20
|
configs: {
|
|
18
21
|
orm: {
|
|
19
|
-
default:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
default: dev
|
|
23
|
+
? {
|
|
24
|
+
dialect: "postgresql",
|
|
25
|
+
host: "localhost",
|
|
26
|
+
port: dbPort,
|
|
27
|
+
username: "postgres",
|
|
28
|
+
password: "1234",
|
|
29
|
+
database: dbDatabase,
|
|
30
|
+
}
|
|
31
|
+
: {
|
|
32
|
+
dialect: "postgresql",
|
|
33
|
+
host: "localhost",
|
|
34
|
+
port: 5432,
|
|
35
|
+
username: "postgres",
|
|
36
|
+
password: "TODO",
|
|
37
|
+
database: "{{projectName}}",
|
|
38
|
+
},
|
|
27
39
|
},
|
|
28
40
|
auth: {
|
|
29
41
|
jwtSecret: "{{jwtSecret}}",
|
|
@@ -8,7 +8,7 @@ import { chromium } from "playwright";
|
|
|
8
8
|
import type { TestProject } from "vitest/node";
|
|
9
9
|
|
|
10
10
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
11
|
-
const rootDir = path.resolve(__dirname, "
|
|
11
|
+
const rootDir = path.resolve(__dirname, "..");
|
|
12
12
|
|
|
13
13
|
const DB_CONFIG = {
|
|
14
14
|
dialect: "postgresql" as const,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [
|
|
6
|
+
tsconfigPaths({
|
|
7
|
+
root: ".",
|
|
8
|
+
projects: ["./tsconfig.json"],
|
|
9
|
+
}),
|
|
10
|
+
],
|
|
11
|
+
define: {
|
|
12
|
+
"process.env.DEV": JSON.stringify("true"),
|
|
13
|
+
"process.env.VER": JSON.stringify("1.0.0-test"),
|
|
14
|
+
},
|
|
15
|
+
test: {
|
|
16
|
+
globals: true,
|
|
17
|
+
environment: "node",
|
|
18
|
+
include: ["tests-e2e/src/**/*.spec.ts"],
|
|
19
|
+
globalSetup: "./tests-e2e/vitest.setup.ts",
|
|
20
|
+
fileParallelism: false,
|
|
21
|
+
testTimeout: 30000,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -22,9 +22,7 @@ export default defineConfig({
|
|
|
22
22
|
coverage: {
|
|
23
23
|
reportsDirectory: "./.coverage",
|
|
24
24
|
},
|
|
25
|
-
// Define as projects array here
|
|
26
25
|
projects: [
|
|
27
|
-
// Unit tests (tests within packages)
|
|
28
26
|
{
|
|
29
27
|
extends: true,
|
|
30
28
|
test: {
|
|
@@ -33,17 +31,6 @@ export default defineConfig({
|
|
|
33
31
|
testTimeout: 30000,
|
|
34
32
|
},
|
|
35
33
|
},
|
|
36
|
-
// E2E tests (requires Docker + dev server)
|
|
37
|
-
{
|
|
38
|
-
extends: true,
|
|
39
|
-
test: {
|
|
40
|
-
name: "e2e",
|
|
41
|
-
include: ["tests/e2e/src/**/*.spec.ts"],
|
|
42
|
-
globalSetup: "./tests/e2e/vitest.setup.ts",
|
|
43
|
-
fileParallelism: false,
|
|
44
|
-
testTimeout: 30000,
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
34
|
],
|
|
48
35
|
},
|
|
49
36
|
});
|
package/docs/commands.md
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
# CLI Commands
|
|
2
|
-
|
|
3
|
-
All commands support the `--debug` flag for verbose logging.
|
|
4
|
-
|
|
5
|
-
## dev
|
|
6
|
-
|
|
7
|
-
Run client and server packages in development mode.
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
sd-cli dev [targets..]
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
| Option | Alias | Description |
|
|
14
|
-
|--------|-------|-------------|
|
|
15
|
-
| `targets` | | Package paths to run (e.g., `packages/solid-demo`). Omit for all. |
|
|
16
|
-
| `--opt <value>` | `-o` | Options to pass to `sd.config.ts` (repeatable). |
|
|
17
|
-
|
|
18
|
-
- **client** targets start a Vite dev server with HMR.
|
|
19
|
-
- **server** targets run an esbuild watch build and spawn a server runtime process.
|
|
20
|
-
- Server-connected clients are proxied through the server automatically.
|
|
21
|
-
- Capacitor projects are initialized if configured.
|
|
22
|
-
- Terminates on SIGINT / SIGTERM.
|
|
23
|
-
|
|
24
|
-
## watch
|
|
25
|
-
|
|
26
|
-
Build library packages in watch mode.
|
|
27
|
-
|
|
28
|
-
```
|
|
29
|
-
sd-cli watch [targets..]
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
| Option | Alias | Description |
|
|
33
|
-
|--------|-------|-------------|
|
|
34
|
-
| `targets` | | Package paths to watch. Omit for all. |
|
|
35
|
-
| `--opt <value>` | `-o` | Options to pass to `sd.config.ts` (repeatable). |
|
|
36
|
-
|
|
37
|
-
- Applies to `node`, `browser`, and `neutral` target packages only.
|
|
38
|
-
- Runs esbuild in watch mode and generates `.d.ts` declaration files.
|
|
39
|
-
- Terminates on SIGINT / SIGTERM.
|
|
40
|
-
|
|
41
|
-
## build
|
|
42
|
-
|
|
43
|
-
Run a production build.
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
sd-cli build [targets..]
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
| Option | Alias | Description |
|
|
50
|
-
|--------|-------|-------------|
|
|
51
|
-
| `targets` | | Package paths to build. Omit for all. |
|
|
52
|
-
| `--opt <value>` | `-o` | Options to pass to `sd.config.ts` (repeatable). |
|
|
53
|
-
|
|
54
|
-
Build pipeline:
|
|
55
|
-
1. Clean `dist/` folders.
|
|
56
|
-
2. Run lint and build concurrently.
|
|
57
|
-
3. **node/browser/neutral** targets: esbuild JS bundle + `.d.ts` generation (with type checking).
|
|
58
|
-
4. **client** targets: Vite production build + type checking + optional Capacitor/Electron build.
|
|
59
|
-
5. **server** targets: esbuild JS bundle.
|
|
60
|
-
6. Sets `process.exitCode = 1` on any failure.
|
|
61
|
-
|
|
62
|
-
## publish
|
|
63
|
-
|
|
64
|
-
Build and publish packages.
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
sd-cli publish [targets..]
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
| Option | Alias | Description |
|
|
71
|
-
|--------|-------|-------------|
|
|
72
|
-
| `targets` | | Package paths to publish. Omit for all with `publish` config. |
|
|
73
|
-
| `--no-build` | | Skip the build step (dangerous). |
|
|
74
|
-
| `--dry-run` | | Simulate without actual deployment. |
|
|
75
|
-
| `--opt <value>` | `-o` | Options to pass to `sd.config.ts` (repeatable). |
|
|
76
|
-
|
|
77
|
-
Deployment order:
|
|
78
|
-
1. Pre-validation (npm auth, Git status, SSH key setup for SFTP).
|
|
79
|
-
2. Version upgrade (patch or prerelease bump in all `package.json` files and templates).
|
|
80
|
-
3. Build.
|
|
81
|
-
4. Git commit, tag, and push.
|
|
82
|
-
5. Publish packages by dependency level (npm / local-directory / FTP / FTPS / SFTP).
|
|
83
|
-
6. Run `postPublish` scripts (failures are warned but do not block).
|
|
84
|
-
|
|
85
|
-
## lint
|
|
86
|
-
|
|
87
|
-
Run ESLint (with Stylelint support).
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
sd-cli lint [targets..]
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
| Option | Alias | Description |
|
|
94
|
-
|--------|-------|-------------|
|
|
95
|
-
| `targets` | | Package paths to lint. Omit for all. |
|
|
96
|
-
| `--fix` | | Auto-fix issues. |
|
|
97
|
-
| `--timing` | | Print execution time per ESLint rule. |
|
|
98
|
-
|
|
99
|
-
- Reads `eslint.config.ts` (or `.mts`, `.js`, `.mjs`) for global ignore patterns.
|
|
100
|
-
- Uses ESLint cache (`.cache/eslint.cache`).
|
|
101
|
-
|
|
102
|
-
## typecheck
|
|
103
|
-
|
|
104
|
-
Run TypeScript type checking.
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
sd-cli typecheck [targets..]
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
| Option | Alias | Description |
|
|
111
|
-
|--------|-------|-------------|
|
|
112
|
-
| `targets` | | Package paths to check. Omit for all. |
|
|
113
|
-
| `--opt <value>` | `-o` | Options to pass to `sd.config.ts` (repeatable). |
|
|
114
|
-
|
|
115
|
-
- Loads `tsconfig.json` and `sd.config.ts` to determine per-package environments.
|
|
116
|
-
- **neutral** packages are checked in both `node` and `browser` environments.
|
|
117
|
-
- Uses parallel Worker threads for concurrent type checking.
|
|
118
|
-
- Uses incremental compilation (`.cache/typecheck-{env}.tsbuildinfo`).
|
|
119
|
-
|
|
120
|
-
## check
|
|
121
|
-
|
|
122
|
-
Run typecheck, lint, and test in parallel.
|
|
123
|
-
|
|
124
|
-
```
|
|
125
|
-
sd-cli check [targets..]
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
| Option | Alias | Description |
|
|
129
|
-
|--------|-------|-------------|
|
|
130
|
-
| `targets` | | Package paths to check. Omit for all. |
|
|
131
|
-
| `--type <types>` | | Comma-separated check types: `typecheck`, `lint`, `test`. Default: all three. |
|
|
132
|
-
|
|
133
|
-
Runs the selected checks concurrently and prints a combined summary.
|
|
134
|
-
|
|
135
|
-
## device
|
|
136
|
-
|
|
137
|
-
Run an app on an Android device or Electron.
|
|
138
|
-
|
|
139
|
-
```
|
|
140
|
-
sd-cli device -p <package>
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
| Option | Alias | Description |
|
|
144
|
-
|--------|-------|-------------|
|
|
145
|
-
| `--package <name>` | `-p` | Package name (required). |
|
|
146
|
-
| `--url <url>` | `-u` | Development server URL (optional; derived from config if omitted). |
|
|
147
|
-
| `--opt <value>` | `-o` | Options to pass to `sd.config.ts` (repeatable). |
|
|
148
|
-
|
|
149
|
-
- Only works with **client** target packages that have `capacitor` or `electron` configuration.
|
|
150
|
-
- Connects the development server URL to the native WebView for hot reload.
|
|
151
|
-
|
|
152
|
-
## init
|
|
153
|
-
|
|
154
|
-
Initialize a new Simplysm project.
|
|
155
|
-
|
|
156
|
-
```
|
|
157
|
-
sd-cli init
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
- Must be run from an empty directory.
|
|
161
|
-
- Prompts for project description and server port.
|
|
162
|
-
- Generates project scaffolding from built-in Handlebars templates.
|
|
163
|
-
- Runs `pnpm install` after file generation.
|
|
164
|
-
|
|
165
|
-
## replace-deps
|
|
166
|
-
|
|
167
|
-
Replace `node_modules` packages with symlinks to local source directories.
|
|
168
|
-
|
|
169
|
-
```
|
|
170
|
-
sd-cli replace-deps
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
| Option | Alias | Description |
|
|
174
|
-
|--------|-------|-------------|
|
|
175
|
-
| `--opt <value>` | `-o` | Options to pass to `sd.config.ts` (repeatable). |
|
|
176
|
-
|
|
177
|
-
Uses the `replaceDeps` mapping from `sd.config.ts` to create symlinks.
|
package/docs/configuration.md
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
# Configuration Types
|
|
2
|
-
|
|
3
|
-
All types are exported from the package entry point:
|
|
4
|
-
|
|
5
|
-
```typescript
|
|
6
|
-
import type { SdConfig, SdConfigFn, SdConfigParams, ... } from "@simplysm/sd-cli";
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
## SdConfigFn
|
|
10
|
-
|
|
11
|
-
The function signature that `sd.config.ts` must default-export.
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
type SdConfigFn = (params: SdConfigParams) => SdConfig | Promise<SdConfig>;
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## SdConfigParams
|
|
18
|
-
|
|
19
|
-
Parameters passed to the config function.
|
|
20
|
-
|
|
21
|
-
| Property | Type | Description |
|
|
22
|
-
|----------|------|-------------|
|
|
23
|
-
| `cwd` | `string` | Current working directory. |
|
|
24
|
-
| `dev` | `boolean` | `true` in dev/watch mode, `false` in build/publish. |
|
|
25
|
-
| `options` | `string[]` | Additional options from CLI `-o` flag. |
|
|
26
|
-
|
|
27
|
-
## SdConfig
|
|
28
|
-
|
|
29
|
-
Top-level configuration object.
|
|
30
|
-
|
|
31
|
-
| Property | Type | Description |
|
|
32
|
-
|----------|------|-------------|
|
|
33
|
-
| `packages` | `Record<string, SdPackageConfig \| undefined>` | Per-package configuration. Key is the subdirectory name under `packages/`. |
|
|
34
|
-
| `replaceDeps` | `Record<string, string>` | Dependency replacement mapping. Key: glob pattern for packages in `node_modules` (e.g., `@simplysm/*`). Value: local source path (`*` is substituted from key). |
|
|
35
|
-
| `postPublish` | `SdPostPublishScriptConfig[]` | Scripts to execute after deployment completes. |
|
|
36
|
-
|
|
37
|
-
## SdPackageConfig
|
|
38
|
-
|
|
39
|
-
Union of all package configuration types:
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
type SdPackageConfig =
|
|
43
|
-
| SdBuildPackageConfig
|
|
44
|
-
| SdClientPackageConfig
|
|
45
|
-
| SdServerPackageConfig
|
|
46
|
-
| SdScriptsPackageConfig;
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## BuildTarget
|
|
50
|
-
|
|
51
|
-
```typescript
|
|
52
|
-
type BuildTarget = "node" | "browser" | "neutral";
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
- `node` -- Node.js only library.
|
|
56
|
-
- `browser` -- Browser only library.
|
|
57
|
-
- `neutral` -- Node/browser shared library.
|
|
58
|
-
|
|
59
|
-
## SdBuildPackageConfig
|
|
60
|
-
|
|
61
|
-
Configuration for library packages (`node` / `browser` / `neutral`).
|
|
62
|
-
|
|
63
|
-
| Property | Type | Description |
|
|
64
|
-
|----------|------|-------------|
|
|
65
|
-
| `target` | `BuildTarget` | Build target. |
|
|
66
|
-
| `publish` | `SdPublishConfig` | Optional publish configuration. |
|
|
67
|
-
| `copySrc` | `string[]` | Glob patterns for files to copy from `src/` to `dist/` (relative to `src/`). |
|
|
68
|
-
|
|
69
|
-
## SdClientPackageConfig
|
|
70
|
-
|
|
71
|
-
Configuration for client app packages (Vite dev server).
|
|
72
|
-
|
|
73
|
-
| Property | Type | Description |
|
|
74
|
-
|----------|------|-------------|
|
|
75
|
-
| `target` | `"client"` | Must be `"client"`. |
|
|
76
|
-
| `server` | `string \| number` | Server package name to connect to, or a Vite port number. |
|
|
77
|
-
| `env` | `Record<string, string>` | Environment variables substituted during build (`process.env` replacement). |
|
|
78
|
-
| `publish` | `SdPublishConfig` | Optional publish configuration. |
|
|
79
|
-
| `capacitor` | `SdCapacitorConfig` | Optional Capacitor configuration. |
|
|
80
|
-
| `electron` | `SdElectronConfig` | Optional Electron configuration. |
|
|
81
|
-
| `configs` | `Record<string, unknown>` | Runtime config written to `dist/.config.json` during build. |
|
|
82
|
-
|
|
83
|
-
## SdServerPackageConfig
|
|
84
|
-
|
|
85
|
-
Configuration for server app packages (Fastify server).
|
|
86
|
-
|
|
87
|
-
| Property | Type | Description |
|
|
88
|
-
|----------|------|-------------|
|
|
89
|
-
| `target` | `"server"` | Must be `"server"`. |
|
|
90
|
-
| `env` | `Record<string, string>` | Environment variables substituted during build. |
|
|
91
|
-
| `publish` | `SdPublishConfig` | Optional publish configuration. |
|
|
92
|
-
| `configs` | `Record<string, unknown>` | Runtime config written to `dist/.config.json` during build. |
|
|
93
|
-
| `externals` | `string[]` | External modules excluded from esbuild bundle. |
|
|
94
|
-
| `pm2` | `{ name?: string; ignoreWatchPaths?: string[] }` | PM2 configuration. Generates `dist/pm2.config.cjs` when specified. |
|
|
95
|
-
| `packageManager` | `"volta" \| "mise"` | Package manager (affects `mise.toml` or Volta settings). |
|
|
96
|
-
|
|
97
|
-
## SdScriptsPackageConfig
|
|
98
|
-
|
|
99
|
-
Configuration for scripts-only packages (excluded from watch/typecheck).
|
|
100
|
-
|
|
101
|
-
| Property | Type | Description |
|
|
102
|
-
|----------|------|-------------|
|
|
103
|
-
| `target` | `"scripts"` | Must be `"scripts"`. |
|
|
104
|
-
|
|
105
|
-
## SdPublishConfig
|
|
106
|
-
|
|
107
|
-
Union of publish target types:
|
|
108
|
-
|
|
109
|
-
```typescript
|
|
110
|
-
type SdPublishConfig =
|
|
111
|
-
| SdNpmPublishConfig
|
|
112
|
-
| SdLocalDirectoryPublishConfig
|
|
113
|
-
| SdStoragePublishConfig;
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### SdNpmPublishConfig
|
|
117
|
-
|
|
118
|
-
```typescript
|
|
119
|
-
interface SdNpmPublishConfig {
|
|
120
|
-
type: "npm";
|
|
121
|
-
}
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### SdLocalDirectoryPublishConfig
|
|
125
|
-
|
|
126
|
-
| Property | Type | Description |
|
|
127
|
-
|----------|------|-------------|
|
|
128
|
-
| `type` | `"local-directory"` | |
|
|
129
|
-
| `path` | `string` | Deployment target path. Supports `%VER%` and `%PROJECT%` substitution. |
|
|
130
|
-
|
|
131
|
-
### SdStoragePublishConfig
|
|
132
|
-
|
|
133
|
-
| Property | Type | Description |
|
|
134
|
-
|----------|------|-------------|
|
|
135
|
-
| `type` | `"ftp" \| "ftps" \| "sftp"` | Storage protocol. |
|
|
136
|
-
| `host` | `string` | Server hostname. |
|
|
137
|
-
| `port` | `number` | Optional port number. |
|
|
138
|
-
| `path` | `string` | Optional remote path. |
|
|
139
|
-
| `user` | `string` | Optional username. |
|
|
140
|
-
| `password` | `string` | Optional password. For SFTP without password, SSH key auth is used automatically. |
|
|
141
|
-
|
|
142
|
-
## SdPostPublishScriptConfig
|
|
143
|
-
|
|
144
|
-
| Property | Type | Description |
|
|
145
|
-
|----------|------|-------------|
|
|
146
|
-
| `type` | `"script"` | Must be `"script"`. |
|
|
147
|
-
| `cmd` | `string` | Command to execute. Supports `%VER%` and `%PROJECT%` substitution. |
|
|
148
|
-
| `args` | `string[]` | Command arguments. Supports `%VER%` and `%PROJECT%` substitution. |
|
|
149
|
-
|
|
150
|
-
## SdCapacitorConfig
|
|
151
|
-
|
|
152
|
-
Capacitor mobile app configuration.
|
|
153
|
-
|
|
154
|
-
| Property | Type | Description |
|
|
155
|
-
|----------|------|-------------|
|
|
156
|
-
| `appId` | `string` | App identifier (e.g., `"com.example.app"`). |
|
|
157
|
-
| `appName` | `string` | Display name. |
|
|
158
|
-
| `plugins` | `Record<string, Record<string, unknown> \| true>` | Capacitor plugin configuration. |
|
|
159
|
-
| `icon` | `string` | App icon path (relative to package directory). |
|
|
160
|
-
| `debug` | `boolean` | Debug build flag. |
|
|
161
|
-
| `platform.android` | `SdCapacitorAndroidConfig` | Android-specific settings. |
|
|
162
|
-
|
|
163
|
-
### SdCapacitorAndroidConfig
|
|
164
|
-
|
|
165
|
-
| Property | Type | Description |
|
|
166
|
-
|----------|------|-------------|
|
|
167
|
-
| `config` | `Record<string, string>` | AndroidManifest.xml application tag attributes. |
|
|
168
|
-
| `bundle` | `boolean` | Build AAB bundle (`true`) or APK (`false`). |
|
|
169
|
-
| `intentFilters` | `SdCapacitorIntentFilter[]` | Intent filter configuration. |
|
|
170
|
-
| `sign` | `SdCapacitorSignConfig` | APK/AAB signing configuration. |
|
|
171
|
-
| `sdkVersion` | `number` | Android SDK version (minSdk, targetSdk). |
|
|
172
|
-
| `permissions` | `SdCapacitorPermission[]` | Additional Android permissions. |
|
|
173
|
-
|
|
174
|
-
### SdCapacitorSignConfig
|
|
175
|
-
|
|
176
|
-
| Property | Type | Description |
|
|
177
|
-
|----------|------|-------------|
|
|
178
|
-
| `keystore` | `string` | Keystore file path (relative to package directory). |
|
|
179
|
-
| `storePassword` | `string` | Keystore password. |
|
|
180
|
-
| `alias` | `string` | Key alias. |
|
|
181
|
-
| `password` | `string` | Key password. |
|
|
182
|
-
| `keystoreType` | `string` | Keystore type (default: `"jks"`). |
|
|
183
|
-
|
|
184
|
-
### SdCapacitorPermission
|
|
185
|
-
|
|
186
|
-
| Property | Type | Description |
|
|
187
|
-
|----------|------|-------------|
|
|
188
|
-
| `name` | `string` | Permission name (e.g., `"CAMERA"`). |
|
|
189
|
-
| `maxSdkVersion` | `number` | Maximum SDK version. |
|
|
190
|
-
| `ignore` | `string` | `tools:ignore` attribute value. |
|
|
191
|
-
|
|
192
|
-
### SdCapacitorIntentFilter
|
|
193
|
-
|
|
194
|
-
| Property | Type | Description |
|
|
195
|
-
|----------|------|-------------|
|
|
196
|
-
| `action` | `string` | Intent action (e.g., `"android.intent.action.VIEW"`). |
|
|
197
|
-
| `category` | `string` | Intent category (e.g., `"android.intent.category.DEFAULT"`). |
|
|
198
|
-
|
|
199
|
-
## SdElectronConfig
|
|
200
|
-
|
|
201
|
-
Electron desktop app configuration.
|
|
202
|
-
|
|
203
|
-
| Property | Type | Description |
|
|
204
|
-
|----------|------|-------------|
|
|
205
|
-
| `appId` | `string` | App identifier (e.g., `"com.example.myapp"`). |
|
|
206
|
-
| `portable` | `boolean` | `true` for portable `.exe`, `false` for NSIS installer. |
|
|
207
|
-
| `installerIcon` | `string` | Installer icon path (`.ico`, relative to package directory). |
|
|
208
|
-
| `reinstallDependencies` | `string[]` | npm packages to include in Electron (native modules, etc.). |
|
|
209
|
-
| `postInstallScript` | `string` | npm postinstall script. |
|
|
210
|
-
| `nsisOptions` | `Record<string, unknown>` | NSIS options (when `portable` is `false`). |
|
|
211
|
-
| `env` | `Record<string, string>` | Environment variables (accessible via `process.env` in `electron-main.ts`). |
|
package/docs/vite-config.md
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# Vite Config API
|
|
2
|
-
|
|
3
|
-
Utility for generating Vite configuration for SolidJS + TailwindCSS client packages. Exported from the package entry point.
|
|
4
|
-
|
|
5
|
-
```typescript
|
|
6
|
-
import { createViteConfig, type ViteConfigOptions } from "@simplysm/sd-cli";
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
## createViteConfig
|
|
10
|
-
|
|
11
|
-
Creates a Vite `UserConfig` for building or serving a client package.
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
function createViteConfig(options: ViteConfigOptions): ViteUserConfig;
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### ViteConfigOptions
|
|
18
|
-
|
|
19
|
-
| Property | Type | Description |
|
|
20
|
-
|----------|------|-------------|
|
|
21
|
-
| `pkgDir` | `string` | Absolute path to the package directory. |
|
|
22
|
-
| `name` | `string` | Package name (used as the Vite `base` path: `/<name>/`). |
|
|
23
|
-
| `tsconfigPath` | `string` | Path to `tsconfig.json` for the package. |
|
|
24
|
-
| `compilerOptions` | `Record<string, unknown>` | TypeScript compiler options passed to esbuild. |
|
|
25
|
-
| `env` | `Record<string, string>` | Environment variables substituted via Vite `define` (replaces `process.env`). |
|
|
26
|
-
| `mode` | `"build" \| "dev"` | `"build"` for production (silent logging), `"dev"` for dev server. |
|
|
27
|
-
| `serverPort` | `number` | Server port in dev mode. `0` for auto-assign (server-connected client). |
|
|
28
|
-
| `replaceDeps` | `string[]` | Array of `replaceDeps` package names (for scope watching). |
|
|
29
|
-
| `onScopeRebuild` | `() => void` | Callback when a `replaceDeps` package dist changes. |
|
|
30
|
-
|
|
31
|
-
### Built-in Plugins
|
|
32
|
-
|
|
33
|
-
The generated config includes the following Vite plugins:
|
|
34
|
-
|
|
35
|
-
- **vite-tsconfig-paths** -- Resolves TypeScript path aliases.
|
|
36
|
-
- **vite-plugin-solid** -- SolidJS JSX compilation.
|
|
37
|
-
- **vite-plugin-pwa** -- PWA manifest and service worker generation.
|
|
38
|
-
- **sd-tailwind-config-deps** (dev only, when `replaceDeps` is set) -- Watches Tailwind config dependencies in scope packages and invalidates cache on change.
|
|
39
|
-
- **sd-scope-watch** (dev only, when `replaceDeps` is set) -- Watches `dist/` directories in scope packages and triggers HMR. Excludes scope packages from Vite's `optimizeDeps` to prevent stale pre-bundled cache.
|
|
40
|
-
- **sd-public-dev** (dev only) -- Serves files from `public-dev/` directory with priority over `public/`.
|
|
41
|
-
|
|
42
|
-
### Usage Example
|
|
43
|
-
|
|
44
|
-
```typescript
|
|
45
|
-
import { createViteConfig } from "@simplysm/sd-cli";
|
|
46
|
-
|
|
47
|
-
const config = createViteConfig({
|
|
48
|
-
pkgDir: "/path/to/packages/my-client",
|
|
49
|
-
name: "my-client",
|
|
50
|
-
tsconfigPath: "/path/to/packages/my-client/tsconfig.json",
|
|
51
|
-
compilerOptions: { jsx: "preserve", jsxImportSource: "solid-js" },
|
|
52
|
-
mode: "dev",
|
|
53
|
-
serverPort: 3000,
|
|
54
|
-
});
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## getMimeType
|
|
58
|
-
|
|
59
|
-
Returns a MIME type string for a given file extension. Used internally by the `sd-public-dev` plugin.
|
|
60
|
-
|
|
61
|
-
```typescript
|
|
62
|
-
function getMimeType(ext: string): string;
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Supports common web asset extensions (`.html`, `.css`, `.js`, `.json`, `.png`, `.jpg`, `.svg`, `.ico`, `.woff2`, `.mp4`, etc.). Returns `"application/octet-stream"` for unknown extensions.
|
|
66
|
-
|
|
67
|
-
> **Note:** This function is exported for testing purposes and is marked `@internal`.
|
|
File without changes
|
/package/templates/init/packages/db-main/src/tables/{EmployeeConfig.ts → base/EmployeeConfig.ts}
RENAMED
|
File without changes
|
|
File without changes
|
/package/templates/init/packages/db-main/src/tables/{RolePermission.ts → base/RolePermission.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|