@simplysm/sd-cli 13.0.70 → 13.0.72

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 (103) hide show
  1. package/dist/commands/init.d.ts +4 -5
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js +26 -8
  4. package/dist/commands/init.js.map +1 -1
  5. package/dist/sd-cli-entry.d.ts.map +1 -1
  6. package/dist/sd-cli-entry.js +0 -20
  7. package/dist/sd-cli-entry.js.map +1 -1
  8. package/package.json +4 -4
  9. package/src/commands/init.ts +40 -21
  10. package/src/sd-cli-entry.ts +0 -24
  11. package/templates/init/{.prettierrc.yaml.hbs → .prettierrc.yaml} +1 -1
  12. package/templates/init/eslint.config.ts +15 -0
  13. package/templates/init/mise.toml +3 -0
  14. package/templates/init/package.json.hbs +8 -7
  15. package/templates/init/packages/client-admin/index.html.hbs +144 -0
  16. package/templates/init/packages/client-admin/package.json.hbs +26 -0
  17. package/templates/init/packages/client-admin/public/assets/logo-landscape.png +0 -0
  18. package/templates/init/packages/client-admin/public/assets/logo.png +0 -0
  19. package/templates/init/packages/client-admin/src/App.tsx +42 -0
  20. package/templates/init/packages/client-admin/src/dev/DevDialog.tsx +34 -0
  21. package/templates/{add-client/__CLIENT__/src/main.css.hbs → init/packages/client-admin/src/main.css} +1 -1
  22. package/templates/init/packages/client-admin/src/main.tsx.hbs +146 -0
  23. package/templates/init/packages/client-admin/src/providers/AppServiceProvider.tsx.hbs +103 -0
  24. package/templates/init/packages/client-admin/src/providers/AppStructureProvider.tsx +84 -0
  25. package/templates/init/packages/client-admin/src/providers/AuthProvider.tsx.hbs +71 -0
  26. package/templates/init/packages/client-admin/src/providers/configureSharedData.ts.hbs +67 -0
  27. package/templates/init/packages/client-admin/src/views/auth/LoginView.tsx +132 -0
  28. package/templates/init/packages/client-admin/src/views/home/HomeView.tsx +108 -0
  29. package/templates/init/packages/client-admin/src/views/home/base/employee/EmployeeDetail.tsx.hbs +262 -0
  30. package/templates/init/packages/client-admin/src/views/home/base/employee/EmployeeSheet.tsx.hbs +271 -0
  31. package/templates/init/packages/client-admin/src/views/home/base/role-permission/RoleDetail.tsx.hbs +154 -0
  32. package/templates/init/packages/client-admin/src/views/home/base/role-permission/RolePermissionDetail.tsx.hbs +123 -0
  33. package/templates/init/packages/client-admin/src/views/home/base/role-permission/RolePermissionView.tsx +52 -0
  34. package/templates/init/packages/client-admin/src/views/home/base/role-permission/RoleSheet.tsx.hbs +125 -0
  35. package/templates/init/packages/client-admin/src/views/home/main/MainView.tsx.hbs +13 -0
  36. package/templates/init/packages/client-admin/src/views/home/my-info/MyInfoDetail.tsx.hbs +248 -0
  37. package/templates/init/packages/client-admin/src/views/home/system/system-log/SystemLogSheet.tsx.hbs +169 -0
  38. package/templates/init/packages/client-admin/src/views/not-found/NotFoundView.tsx +15 -0
  39. package/templates/init/packages/client-admin/tailwind.config.ts +10 -0
  40. package/templates/init/packages/db-main/package.json.hbs +13 -0
  41. package/templates/init/packages/db-main/src/MainDbContext.ts +20 -0
  42. package/templates/init/packages/db-main/src/dataLogExt.ts +127 -0
  43. package/templates/init/packages/db-main/src/index.ts +10 -0
  44. package/templates/init/packages/db-main/src/tables/Employee.ts +24 -0
  45. package/templates/init/packages/db-main/src/tables/EmployeeConfig.ts +13 -0
  46. package/templates/init/packages/db-main/src/tables/Role.ts +9 -0
  47. package/templates/init/packages/db-main/src/tables/RolePermission.ts +13 -0
  48. package/templates/init/packages/db-main/src/tables/_DataLog.ts +19 -0
  49. package/templates/init/packages/db-main/src/tables/_Log.ts +16 -0
  50. package/templates/init/packages/server/package.json.hbs +20 -0
  51. package/templates/init/packages/server/public-dev/dev//354/264/210/352/270/260/355/231/224.xlsx +0 -0
  52. package/templates/init/packages/server/src/index.ts +4 -0
  53. package/templates/init/packages/server/src/main.ts.hbs +34 -0
  54. package/templates/init/packages/server/src/services/AuthService.ts.hbs +171 -0
  55. package/templates/init/packages/server/src/services/DevService.ts.hbs +94 -0
  56. package/templates/init/packages/server/src/services/EmployeeService.ts.hbs +122 -0
  57. package/templates/init/packages/server/src/services/RoleService.ts.hbs +59 -0
  58. package/templates/init/{pnpm-workspace.yaml.hbs → pnpm-workspace.yaml} +3 -1
  59. package/templates/init/sd.config.ts.hbs +30 -1
  60. package/templates/init/tests/e2e/package.json.hbs +16 -0
  61. package/templates/init/tests/e2e/src/e2e.spec.ts +36 -0
  62. package/templates/init/tests/e2e/src/employee-crud.ts +204 -0
  63. package/templates/init/tests/e2e/src/login.ts +61 -0
  64. package/templates/init/tests/e2e/vitest.setup.ts.hbs +220 -0
  65. package/templates/init/tsconfig.json.hbs +0 -11
  66. package/templates/init/{vitest.config.ts.hbs → vitest.config.ts} +16 -12
  67. package/tests/infra/WorkerManager.spec.ts +1 -1
  68. package/tests/replace-deps.spec.ts +2 -2
  69. package/tests/run-lint.spec.ts +6 -6
  70. package/tests/run-typecheck.spec.ts +3 -3
  71. package/tests/sd-cli.spec.ts +1 -1
  72. package/dist/commands/add-client.d.ts +0 -18
  73. package/dist/commands/add-client.d.ts.map +0 -1
  74. package/dist/commands/add-client.js +0 -79
  75. package/dist/commands/add-client.js.map +0 -6
  76. package/dist/commands/add-server.d.ts +0 -18
  77. package/dist/commands/add-server.d.ts.map +0 -1
  78. package/dist/commands/add-server.js +0 -83
  79. package/dist/commands/add-server.js.map +0 -6
  80. package/dist/utils/config-editor.d.ts +0 -17
  81. package/dist/utils/config-editor.d.ts.map +0 -1
  82. package/dist/utils/config-editor.js +0 -79
  83. package/dist/utils/config-editor.js.map +0 -6
  84. package/src/commands/add-client.ts +0 -126
  85. package/src/commands/add-server.ts +0 -138
  86. package/src/utils/config-editor.ts +0 -141
  87. package/templates/add-client/__CLIENT__/index.html.hbs +0 -13
  88. package/templates/add-client/__CLIENT__/package.json.hbs +0 -16
  89. package/templates/add-client/__CLIENT__/src/App.tsx.hbs +0 -65
  90. package/templates/add-client/__CLIENT__/src/appStructure.ts.hbs +0 -20
  91. package/templates/add-client/__CLIENT__/src/main.tsx.hbs +0 -24
  92. package/templates/add-client/__CLIENT__/src/pages/HomePage.tsx.hbs +0 -9
  93. package/templates/add-client/__CLIENT__/tailwind.config.ts.hbs +0 -15
  94. package/templates/add-server/__SERVER__/package.json.hbs +0 -10
  95. package/templates/add-server/__SERVER__/src/main.ts.hbs +0 -14
  96. package/templates/init/.gitignore.hbs +0 -26
  97. package/templates/init/.npmrc.hbs +0 -1
  98. package/templates/init/eslint.config.ts.hbs +0 -5
  99. package/templates/init/mise.toml.hbs +0 -3
  100. package/tests/config-editor.spec.ts +0 -160
  101. /package/templates/init/{.prettierignore.hbs → .prettierignore} +0 -0
  102. /package/templates/{add-client/__CLIENT__ → init/packages/client-admin}/public/favicon.ico +0 -0
  103. /package/templates/init/{stylelint.config.ts.hbs → stylelint.config.ts} +0 -0
@@ -1,141 +0,0 @@
1
- import { Project, SyntaxKind, type ObjectLiteralExpression } from "ts-morph";
2
-
3
- /**
4
- * Find packages object literal in sd.config.ts
5
- *
6
- * Structure: const config: SdConfigFn = () => ({ packages: { ... } });
7
- * -> ArrowFunction -> ParenthesizedExpression -> ObjectLiteral -> "packages" property -> ObjectLiteral
8
- */
9
- function findPackagesObject(configPath: string): {
10
- project: Project;
11
- packagesObj: ObjectLiteralExpression;
12
- } {
13
- const project = new Project();
14
- const sourceFile = project.addSourceFileAtPath(configPath);
15
-
16
- // Find "config" variable declaration
17
- const configVar = sourceFile.getVariableDeclarationOrThrow("config");
18
- const arrowFn = configVar.getInitializerIfKindOrThrow(SyntaxKind.ArrowFunction);
19
-
20
- // Find return object in arrow function body
21
- const body = arrowFn.getBody();
22
- let returnObj: ObjectLiteralExpression;
23
-
24
- if (body.isKind(SyntaxKind.ParenthesizedExpression)) {
25
- returnObj = body.getExpressionIfKindOrThrow(SyntaxKind.ObjectLiteralExpression);
26
- } else if (body.isKind(SyntaxKind.Block)) {
27
- const returnStmt = body.getFirstDescendantByKindOrThrow(SyntaxKind.ReturnStatement);
28
- returnObj = returnStmt.getExpressionIfKindOrThrow(SyntaxKind.ObjectLiteralExpression);
29
- } else {
30
- throw new Error("Unable to recognize structure of sd.config.ts");
31
- }
32
-
33
- // Find "packages" property
34
- const packagesProp = returnObj
35
- .getPropertyOrThrow("packages")
36
- .asKindOrThrow(SyntaxKind.PropertyAssignment);
37
- const packagesObj = packagesProp.getInitializerIfKindOrThrow(SyntaxKind.ObjectLiteralExpression);
38
-
39
- return { project, packagesObj };
40
- }
41
-
42
- /**
43
- * Add new package entry to packages object in sd.config.ts
44
- *
45
- * @returns true: success, false: already exists
46
- */
47
- export function addPackageToSdConfig(
48
- configPath: string,
49
- packageName: string,
50
- config: Record<string, unknown>,
51
- ): boolean {
52
- const { project, packagesObj } = findPackagesObject(configPath);
53
-
54
- // Check if already exists (check both quoted and unquoted forms)
55
- const existing =
56
- packagesObj.getProperty(`"${packageName}"`) ?? packagesObj.getProperty(packageName);
57
- if (existing) {
58
- return false;
59
- }
60
-
61
- // Add new property -- convert config object to ts-morph initializer string
62
- const configStr = JSON.stringify(config)
63
- .replace(/"([^"]+)":/g, "$1: ")
64
- .replace(/"/g, '"');
65
-
66
- packagesObj.addPropertyAssignment({
67
- name: `"${packageName}"`,
68
- initializer: configStr,
69
- });
70
-
71
- project.saveSync();
72
- return true;
73
- }
74
-
75
- /**
76
- * Set server field for specific client in sd.config.ts
77
- */
78
- export function setClientServerInSdConfig(
79
- configPath: string,
80
- clientName: string,
81
- serverName: string,
82
- ): void {
83
- const { project, packagesObj } = findPackagesObject(configPath);
84
-
85
- const clientPropNode =
86
- packagesObj.getProperty(`"${clientName}"`) ?? packagesObj.getProperty(clientName);
87
- if (clientPropNode == null) {
88
- throw new Error(`Client "${clientName}" not found in sd.config.ts`);
89
- }
90
-
91
- const clientProp = clientPropNode.asKindOrThrow(SyntaxKind.PropertyAssignment);
92
- const clientObj = clientProp.getInitializerIfKindOrThrow(SyntaxKind.ObjectLiteralExpression);
93
-
94
- // Remove existing server property if present
95
- const serverProp = clientObj.getProperty("server");
96
- if (serverProp) {
97
- serverProp.remove();
98
- }
99
-
100
- // Add server property
101
- clientObj.addPropertyAssignment({
102
- name: "server",
103
- initializer: `"${serverName}"`,
104
- });
105
-
106
- project.saveSync();
107
- }
108
-
109
- /**
110
- * Add tailwindcss config block to eslint.config.ts
111
- *
112
- * @returns true: added, false: already exists
113
- */
114
- export function addTailwindToEslintConfig(configPath: string, clientName: string): boolean {
115
- const project = new Project();
116
- const sourceFile = project.addSourceFileAtPath(configPath);
117
-
118
- // Find default export array
119
- const defaultExport = sourceFile.getFirstDescendantByKindOrThrow(
120
- SyntaxKind.ArrayLiteralExpression,
121
- );
122
-
123
- // Check if tailwindcss config already exists
124
- const text = defaultExport.getText();
125
- if (text.includes("tailwindcss")) {
126
- return false;
127
- }
128
-
129
- // Add new config object
130
- defaultExport.addElement(`{
131
- files: ["**/*.{ts,tsx}"],
132
- settings: {
133
- tailwindcss: {
134
- config: "packages/${clientName}/tailwind.config.ts",
135
- },
136
- },
137
- }`);
138
-
139
- project.saveSync();
140
- return true;
141
- }
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="ko">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <link rel="icon" href="favicon.ico" />
7
- <title>{{projectName}}</title>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- <script type="module" src="src/main.tsx"></script>
12
- </body>
13
- </html>
@@ -1,16 +0,0 @@
1
- {
2
- "name": "@{{projectName}}/{{clientName}}",
3
- "version": "1.0.0",
4
- "type": "module",
5
- "private": true,
6
- "dependencies": {
7
- "@simplysm/solid": "~13.0.70",
8
- {{#if router}}
9
- "@solidjs/router": "^0.15.4",
10
- {{/if}}
11
- "solid-js": "^1.9.11"
12
- },
13
- "devDependencies": {
14
- "tailwindcss": "^3.4.19"
15
- }
16
- }
@@ -1,65 +0,0 @@
1
- {{#if router}}
2
- import type { RouteSectionProps } from "@solidjs/router";
3
- import {
4
- BusyProvider,
5
- ClipboardProvider,
6
- ConfigProvider,
7
- ErrorLoggerProvider,
8
- NotificationBanner,
9
- NotificationProvider,
10
- PwaUpdateProvider,
11
- ThemeProvider,
12
- } from "@simplysm/solid";
13
-
14
- export function App(props: RouteSectionProps) {
15
- return (
16
- <ConfigProvider clientName="{{clientName}}">
17
- <NotificationProvider>
18
- <NotificationBanner />
19
- <ErrorLoggerProvider>
20
- <PwaUpdateProvider>
21
- <ClipboardProvider>
22
- <ThemeProvider>
23
- <BusyProvider>{props.children}</BusyProvider>
24
- </ThemeProvider>
25
- </ClipboardProvider>
26
- </PwaUpdateProvider>
27
- </ErrorLoggerProvider>
28
- </NotificationProvider>
29
- </ConfigProvider>
30
- );
31
- }
32
- {{else}}
33
- import {
34
- BusyProvider,
35
- ClipboardProvider,
36
- ConfigProvider,
37
- ErrorLoggerProvider,
38
- NotificationBanner,
39
- NotificationProvider,
40
- PwaUpdateProvider,
41
- ThemeProvider,
42
- } from "@simplysm/solid";
43
- import { HomePage } from "./pages/HomePage";
44
-
45
- export function App() {
46
- return (
47
- <ConfigProvider clientName="{{clientName}}">
48
- <NotificationProvider>
49
- <NotificationBanner />
50
- <ErrorLoggerProvider>
51
- <PwaUpdateProvider>
52
- <ClipboardProvider>
53
- <ThemeProvider>
54
- <BusyProvider>
55
- <HomePage />
56
- </BusyProvider>
57
- </ThemeProvider>
58
- </ClipboardProvider>
59
- </PwaUpdateProvider>
60
- </ErrorLoggerProvider>
61
- </NotificationProvider>
62
- </ConfigProvider>
63
- );
64
- }
65
- {{/if}}
@@ -1,20 +0,0 @@
1
- {{#if router}}
2
- import { createAppStructure } from "@simplysm/solid";
3
- import { HomePage } from "./pages/HomePage";
4
-
5
- export const appStructure = createAppStructure({
6
- items: [
7
- {
8
- code: "home",
9
- title: "홈",
10
- children: [
11
- {
12
- code: "main",
13
- title: "메인",
14
- component: HomePage,
15
- },
16
- ],
17
- },
18
- ],
19
- });
20
- {{/if}}
@@ -1,24 +0,0 @@
1
- {{#if router}}
2
- import { render } from "solid-js/web";
3
- import { HashRouter, Route } from "@solidjs/router";
4
- import { App } from "./App";
5
- import { HomePage } from "./pages/HomePage";
6
- import "./main.css";
7
-
8
- render(
9
- () => (
10
- <HashRouter>
11
- <Route path="/" component={App}>
12
- <Route path="/" component={HomePage} />
13
- </Route>
14
- </HashRouter>
15
- ),
16
- document.getElementById("root")!,
17
- );
18
- {{else}}
19
- import { render } from "solid-js/web";
20
- import { App } from "./App";
21
- import "./main.css";
22
-
23
- render(() => <App />, document.getElementById("root")!);
24
- {{/if}}
@@ -1,9 +0,0 @@
1
- export function HomePage() {
2
- return (
3
- <div class="flex h-full items-center justify-center">
4
- <h1 class="text-2xl font-bold text-base-700 dark:text-base-200">
5
- {{projectName}}
6
- </h1>
7
- </div>
8
- );
9
- }
@@ -1,15 +0,0 @@
1
- import simplysmPreset from "@simplysm/solid/tailwind.config";
2
-
3
- const __dirname = new URL(".", import.meta.url).pathname
4
- .replace(/^\/[^/]+\/@fs/, "")
5
- .replace(/index\.ts$/, "");
6
-
7
- export default {
8
- darkMode: "class",
9
- presets: [simplysmPreset],
10
- content: [
11
- `${__dirname}index.html`,
12
- `${__dirname}src/**/*.{ts,tsx}`,
13
- ...simplysmPreset.content,
14
- ],
15
- };
@@ -1,10 +0,0 @@
1
- {
2
- "name": "@{{projectName}}/{{serverName}}",
3
- "version": "1.0.0",
4
- "type": "module",
5
- "private": true,
6
- "dependencies": {
7
- "@simplysm/core-common": "~13.0.70",
8
- "@simplysm/service-server": "~13.0.70"
9
- }
10
- }
@@ -1,14 +0,0 @@
1
- import { env } from "@simplysm/core-common";
2
- import { createServiceServer } from "@simplysm/service-server";
3
-
4
- export const server = createServiceServer({
5
- rootPath: process.cwd(),
6
- port: {{port}},
7
- services: [],
8
- });
9
-
10
- // 프로덕션 모드: 정적 파일 서빙 포함하여 직접 listen
11
- // Watch 모드 (env.DEV): Server Runtime Worker가 proxy 설정 후 listen 호출
12
- if (!env.DEV) {
13
- await server.listen();
14
- }
@@ -1,26 +0,0 @@
1
- .tmp
2
- .coverage
3
- .worktrees
4
-
5
- .cache
6
- node_modules
7
- packages/*/.*
8
- packages/*/dist
9
- *.~*
10
- ~*.*
11
-
12
- # TypeScript 컴파일 결과물 (소스 디렉토리에서 제외)
13
- packages/*/src/**/*.js
14
- packages/*/src/**/*.js.map
15
- packages/*/src/**/*.d.ts
16
- packages/*/src/**/*.d.ts.map
17
-
18
- packages/*/tests/**/*.js
19
- packages/*/tests/**/*.js.map
20
- packages/*/tests/**/*.d.ts
21
- packages/*/tests/**/*.d.ts.map
22
-
23
- tests/**/*.js
24
- tests/**/*.js.map
25
- tests/**/*.d.ts
26
- tests/**/*.d.ts.map
@@ -1 +0,0 @@
1
- side-effects-cache=false
@@ -1,5 +0,0 @@
1
- import simplysmEslintRecommended from "@simplysm/lint/eslint-recommended";
2
-
3
- export default [
4
- ...simplysmEslintRecommended,
5
- ];
@@ -1,3 +0,0 @@
1
- [tools]
2
- node = "20"
3
- pnpm = "latest"
@@ -1,160 +0,0 @@
1
- import { describe, test, expect, beforeEach, afterEach } from "vitest";
2
- import path from "path";
3
- import fs from "fs";
4
- import os from "os";
5
- import {
6
- addPackageToSdConfig,
7
- setClientServerInSdConfig,
8
- addTailwindToEslintConfig,
9
- } from "../src/utils/config-editor";
10
-
11
- describe("config-editor", () => {
12
- let tmpDir: string;
13
-
14
- beforeEach(() => {
15
- tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "sd-cli-test-"));
16
- });
17
-
18
- afterEach(() => {
19
- fs.rmSync(tmpDir, { recursive: true });
20
- });
21
-
22
- describe("addPackageToSdConfig", () => {
23
- test("adds client package to empty packages object", () => {
24
- const configPath = path.join(tmpDir, "sd.config.ts");
25
- fs.writeFileSync(
26
- configPath,
27
- [
28
- 'import type { SdConfigFn } from "@simplysm/sd-cli";',
29
- "",
30
- "const config: SdConfigFn = () => ({",
31
- " packages: {},",
32
- "});",
33
- "",
34
- "export default config;",
35
- ].join("\n"),
36
- );
37
-
38
- addPackageToSdConfig(configPath, "client-web", { target: "client" });
39
-
40
- const result = fs.readFileSync(configPath, "utf-8");
41
- expect(result).toContain('"client-web"');
42
- expect(result).toContain('"client"');
43
- });
44
-
45
- test("adds server package to existing packages", () => {
46
- const configPath = path.join(tmpDir, "sd.config.ts");
47
- fs.writeFileSync(
48
- configPath,
49
- [
50
- 'import type { SdConfigFn } from "@simplysm/sd-cli";',
51
- "",
52
- "const config: SdConfigFn = () => ({",
53
- " packages: {",
54
- ' "client-web": { target: "client" },',
55
- " },",
56
- "});",
57
- "",
58
- "export default config;",
59
- ].join("\n"),
60
- );
61
-
62
- addPackageToSdConfig(configPath, "server", { target: "server" });
63
-
64
- const result = fs.readFileSync(configPath, "utf-8");
65
- expect(result).toContain('"client-web"');
66
- expect(result).toContain('"server"');
67
- });
68
-
69
- test("returns false if package already exists", () => {
70
- const configPath = path.join(tmpDir, "sd.config.ts");
71
- fs.writeFileSync(
72
- configPath,
73
- [
74
- 'import type { SdConfigFn } from "@simplysm/sd-cli";',
75
- "",
76
- "const config: SdConfigFn = () => ({",
77
- " packages: {",
78
- ' "client-web": { target: "client" },',
79
- " },",
80
- "});",
81
- "",
82
- "export default config;",
83
- ].join("\n"),
84
- );
85
-
86
- const result = addPackageToSdConfig(configPath, "client-web", { target: "client" });
87
- expect(result).toBe(false);
88
- });
89
- });
90
-
91
- describe("setClientServerInSdConfig", () => {
92
- test("adds server field to client config", () => {
93
- const configPath = path.join(tmpDir, "sd.config.ts");
94
- fs.writeFileSync(
95
- configPath,
96
- [
97
- 'import type { SdConfigFn } from "@simplysm/sd-cli";',
98
- "",
99
- "const config: SdConfigFn = () => ({",
100
- " packages: {",
101
- ' "client-web": { target: "client" },',
102
- " },",
103
- "});",
104
- "",
105
- "export default config;",
106
- ].join("\n"),
107
- );
108
-
109
- setClientServerInSdConfig(configPath, "client-web", "server");
110
-
111
- const result = fs.readFileSync(configPath, "utf-8");
112
- expect(result).toContain('server: "server"');
113
- });
114
- });
115
-
116
- describe("addTailwindToEslintConfig", () => {
117
- test("adds tailwind settings to eslint config without tailwind", () => {
118
- const configPath = path.join(tmpDir, "eslint.config.ts");
119
- fs.writeFileSync(
120
- configPath,
121
- [
122
- 'import simplysmEslintRecommended from "@simplysm/lint/eslint-recommended";',
123
- "",
124
- "export default [",
125
- " ...simplysmEslintRecommended,",
126
- "];",
127
- ].join("\n"),
128
- );
129
-
130
- addTailwindToEslintConfig(configPath, "client-web");
131
-
132
- const result = fs.readFileSync(configPath, "utf-8");
133
- expect(result).toContain("tailwindcss");
134
- expect(result).toContain("packages/client-web/tailwind.config.ts");
135
- });
136
-
137
- test("does nothing if tailwind settings already exist", () => {
138
- const configPath = path.join(tmpDir, "eslint.config.ts");
139
- const original = [
140
- 'import simplysmEslintRecommended from "@simplysm/lint/eslint-recommended";',
141
- "",
142
- "export default [",
143
- " ...simplysmEslintRecommended,",
144
- " {",
145
- ' files: ["**/*.{ts,tsx}"],',
146
- " settings: {",
147
- " tailwindcss: {",
148
- ' config: "packages/client-old/tailwind.config.ts",',
149
- " },",
150
- " },",
151
- " },",
152
- "];",
153
- ].join("\n");
154
- fs.writeFileSync(configPath, original);
155
-
156
- const result = addTailwindToEslintConfig(configPath, "client-web");
157
- expect(result).toBe(false);
158
- });
159
- });
160
- });