@oss-ma/tpl 1.0.3 → 1.0.24
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/dist/commands/check.js +87 -9
- package/dist/commands/init.js +1 -0
- package/dist/engine/copy.js +52 -2
- package/dist/engine/hooks.js +103 -6
- package/dist/engine/initProject.js +4 -4
- package/dist/engine/loadTemplate.js +1 -0
- package/dist/engine/lock.js +66 -1
- package/dist/engine/packs/applyPackFiles.js +16 -5
- package/dist/engine/packs/validatePackRules.js +58 -115
- package/dist/engine/prompt.js +1 -0
- package/dist/engine/readLock.js +16 -0
- package/dist/engine/render.js +1 -0
- package/dist/engine/validators/reactTs.js +70 -3
- package/dist/engine/validators/standard.js +1 -0
- package/dist/engine/validators/template.js +1 -0
- package/package.json +36 -33
- package/resources/packs/company-pack-a/files/.github/badges/company-a.svg +5 -5
- package/resources/packs/company-pack-a/files/README.company.md +14 -14
- package/resources/packs/company-pack-a/files/SECURITY.md +19 -19
- package/resources/packs/company-pack-a/pack.yaml +28 -28
- package/resources/packs/company-pack-a/rules/rules.json +11 -11
- package/resources/standard.schema.json +31 -28
- package/resources/templates/react-ts/files/.editorconfig +9 -9
- package/resources/templates/react-ts/files/.gitattributes +1 -1
- package/resources/templates/react-ts/files/.github/dependabot.yml +12 -12
- package/resources/templates/react-ts/files/.github/workflows/ci.yml +297 -94
- package/resources/templates/react-ts/files/.github/workflows/codeql.yml +38 -37
- package/resources/templates/react-ts/files/.husky/commit-msg +4 -4
- package/resources/templates/react-ts/files/.husky/pre-commit +6 -6
- package/resources/templates/react-ts/files/.prettierrc.json +4 -4
- package/resources/templates/react-ts/files/README.md +51 -51
- package/resources/templates/react-ts/files/SECURITY.md +23 -0
- package/resources/templates/react-ts/files/commitlint.config.cjs +2 -2
- package/resources/templates/react-ts/files/eslint.config.js +67 -67
- package/resources/templates/react-ts/files/gitignore +8 -8
- package/resources/templates/react-ts/files/index.html +39 -11
- package/resources/templates/react-ts/files/package.json +55 -55
- package/resources/templates/react-ts/files/src/app/App.js +3 -3
- package/resources/templates/react-ts/files/src/app/App.tsx +9 -9
- package/resources/templates/react-ts/files/src/app/main.js +2 -2
- package/resources/templates/react-ts/files/src/app/main.tsx +8 -8
- package/resources/templates/react-ts/files/src/features/example/Example.js +4 -4
- package/resources/templates/react-ts/files/src/features/example/Example.tsx +13 -13
- package/resources/templates/react-ts/files/src/shared/ui/Button.js +2 -2
- package/resources/templates/react-ts/files/src/shared/ui/Button.tsx +19 -19
- package/resources/templates/react-ts/files/template.lock +8 -8
- package/resources/templates/react-ts/files/tsconfig.json +20 -20
- package/resources/templates/react-ts/files/tsconfig.node.json +9 -9
- package/resources/templates/react-ts/files/vite.config.ts +5 -5
- package/resources/templates/react-ts/template.yaml +60 -20
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import js from "@eslint/js";
|
|
2
|
-
import globals from "globals";
|
|
3
|
-
import tsParser from "@typescript-eslint/parser";
|
|
4
|
-
import tsPlugin from "@typescript-eslint/eslint-plugin";
|
|
5
|
-
import reactHooks from "eslint-plugin-react-hooks";
|
|
6
|
-
import reactRefresh from "eslint-plugin-react-refresh";
|
|
7
|
-
|
|
8
|
-
export default [
|
|
9
|
-
{
|
|
10
|
-
ignores: ["dist/**", "coverage/**", "node_modules/**"]
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
js.configs.recommended,
|
|
14
|
-
|
|
15
|
-
{
|
|
16
|
-
files: ["**/*.{ts,tsx}"],
|
|
17
|
-
languageOptions: {
|
|
18
|
-
ecmaVersion: 2022,
|
|
19
|
-
sourceType: "module",
|
|
20
|
-
parser: tsParser,
|
|
21
|
-
parserOptions: {
|
|
22
|
-
ecmaFeatures: { jsx: true }
|
|
23
|
-
},
|
|
24
|
-
globals: globals.browser
|
|
25
|
-
},
|
|
26
|
-
plugins: {
|
|
27
|
-
"@typescript-eslint": tsPlugin,
|
|
28
|
-
"react-hooks": reactHooks,
|
|
29
|
-
"react-refresh": reactRefresh
|
|
30
|
-
},
|
|
31
|
-
rules: {
|
|
32
|
-
...tsPlugin.configs.recommended.rules,
|
|
33
|
-
...reactHooks.configs.recommended.rules,
|
|
34
|
-
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }]
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
// import js from "@eslint/js";
|
|
40
|
-
// import globals from "globals";
|
|
41
|
-
// import reactHooks from "eslint-plugin-react-hooks";
|
|
42
|
-
// import reactRefresh from "eslint-plugin-react-refresh";
|
|
43
|
-
|
|
44
|
-
// export default [
|
|
45
|
-
// js.configs.recommended,
|
|
46
|
-
|
|
47
|
-
// // ignore build artifacts
|
|
48
|
-
// {
|
|
49
|
-
// ignores: ["dist/**", "coverage/**", "node_modules/**"]
|
|
50
|
-
// },
|
|
51
|
-
|
|
52
|
-
// {
|
|
53
|
-
// files: ["**/*.{ts,tsx}"],
|
|
54
|
-
// languageOptions: {
|
|
55
|
-
// ecmaVersion: 2022,
|
|
56
|
-
// globals: globals.browser
|
|
57
|
-
// },
|
|
58
|
-
// plugins: {
|
|
59
|
-
// "react-hooks": reactHooks,
|
|
60
|
-
// "react-refresh": reactRefresh
|
|
61
|
-
// },
|
|
62
|
-
// rules: {
|
|
63
|
-
// ...reactHooks.configs.recommended.rules,
|
|
64
|
-
// "react-refresh/only-export-components": ["warn", { allowConstantExport: true }]
|
|
65
|
-
// }
|
|
66
|
-
// }
|
|
67
|
-
// ];
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import globals from "globals";
|
|
3
|
+
import tsParser from "@typescript-eslint/parser";
|
|
4
|
+
import tsPlugin from "@typescript-eslint/eslint-plugin";
|
|
5
|
+
import reactHooks from "eslint-plugin-react-hooks";
|
|
6
|
+
import reactRefresh from "eslint-plugin-react-refresh";
|
|
7
|
+
|
|
8
|
+
export default [
|
|
9
|
+
{
|
|
10
|
+
ignores: ["dist/**", "coverage/**", "node_modules/**"]
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
js.configs.recommended,
|
|
14
|
+
|
|
15
|
+
{
|
|
16
|
+
files: ["**/*.{ts,tsx}"],
|
|
17
|
+
languageOptions: {
|
|
18
|
+
ecmaVersion: 2022,
|
|
19
|
+
sourceType: "module",
|
|
20
|
+
parser: tsParser,
|
|
21
|
+
parserOptions: {
|
|
22
|
+
ecmaFeatures: { jsx: true }
|
|
23
|
+
},
|
|
24
|
+
globals: globals.browser
|
|
25
|
+
},
|
|
26
|
+
plugins: {
|
|
27
|
+
"@typescript-eslint": tsPlugin,
|
|
28
|
+
"react-hooks": reactHooks,
|
|
29
|
+
"react-refresh": reactRefresh
|
|
30
|
+
},
|
|
31
|
+
rules: {
|
|
32
|
+
...tsPlugin.configs.recommended.rules,
|
|
33
|
+
...reactHooks.configs.recommended.rules,
|
|
34
|
+
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
// import js from "@eslint/js";
|
|
40
|
+
// import globals from "globals";
|
|
41
|
+
// import reactHooks from "eslint-plugin-react-hooks";
|
|
42
|
+
// import reactRefresh from "eslint-plugin-react-refresh";
|
|
43
|
+
|
|
44
|
+
// export default [
|
|
45
|
+
// js.configs.recommended,
|
|
46
|
+
|
|
47
|
+
// // ignore build artifacts
|
|
48
|
+
// {
|
|
49
|
+
// ignores: ["dist/**", "coverage/**", "node_modules/**"]
|
|
50
|
+
// },
|
|
51
|
+
|
|
52
|
+
// {
|
|
53
|
+
// files: ["**/*.{ts,tsx}"],
|
|
54
|
+
// languageOptions: {
|
|
55
|
+
// ecmaVersion: 2022,
|
|
56
|
+
// globals: globals.browser
|
|
57
|
+
// },
|
|
58
|
+
// plugins: {
|
|
59
|
+
// "react-hooks": reactHooks,
|
|
60
|
+
// "react-refresh": reactRefresh
|
|
61
|
+
// },
|
|
62
|
+
// rules: {
|
|
63
|
+
// ...reactHooks.configs.recommended.rules,
|
|
64
|
+
// "react-refresh/only-export-components": ["warn", { allowConstantExport: true }]
|
|
65
|
+
// }
|
|
66
|
+
// }
|
|
67
|
+
// ];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
node_modules
|
|
2
|
-
dist
|
|
3
|
-
coverage
|
|
4
|
-
.env
|
|
5
|
-
.env.*
|
|
6
|
-
.DS_Store
|
|
7
|
-
.vscode
|
|
8
|
-
.idea
|
|
1
|
+
node_modules
|
|
2
|
+
dist
|
|
3
|
+
coverage
|
|
4
|
+
.env
|
|
5
|
+
.env.*
|
|
6
|
+
.DS_Store
|
|
7
|
+
.vscode
|
|
8
|
+
.idea
|
|
@@ -1,12 +1,40 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
|
|
6
|
+
<!--
|
|
7
|
+
Content Security Policy — defence-in-depth against XSS.
|
|
8
|
+
Adjust 'connect-src' if you add external APIs.
|
|
9
|
+
Remove 'unsafe-eval' once all dependencies support it.
|
|
10
|
+
-->
|
|
11
|
+
<meta
|
|
12
|
+
http-equiv="Content-Security-Policy"
|
|
13
|
+
content="
|
|
14
|
+
default-src 'self';
|
|
15
|
+
script-src 'self' 'unsafe-inline';
|
|
16
|
+
style-src 'self' 'unsafe-inline';
|
|
17
|
+
img-src 'self' data: blob:;
|
|
18
|
+
font-src 'self';
|
|
19
|
+
connect-src 'self';
|
|
20
|
+
object-src 'none';
|
|
21
|
+
base-uri 'self';
|
|
22
|
+
form-action 'self';
|
|
23
|
+
frame-ancestors 'none';
|
|
24
|
+
"
|
|
25
|
+
/>
|
|
26
|
+
|
|
27
|
+
<!-- Prevent MIME-type sniffing -->
|
|
28
|
+
<meta http-equiv="X-Content-Type-Options" content="nosniff" />
|
|
29
|
+
|
|
30
|
+
<!-- Block referrer leakage -->
|
|
31
|
+
<meta name="referrer" content="strict-origin-when-cross-origin" />
|
|
32
|
+
|
|
33
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
34
|
+
<title>{{appName}}</title>
|
|
35
|
+
</head>
|
|
36
|
+
<body>
|
|
37
|
+
<div id="root"></div>
|
|
38
|
+
<script type="module" src="/src/app/main.tsx"></script>
|
|
39
|
+
</body>
|
|
12
40
|
</html>
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "{{appName}}",
|
|
3
|
-
"private": true,
|
|
4
|
-
"version": "0.1.0",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "vite",
|
|
8
|
-
"build": "tsc -b && vite build",
|
|
9
|
-
"preview": "vite preview",
|
|
10
|
-
|
|
11
|
-
"test": "vitest run",
|
|
12
|
-
"test:watch": "vitest",
|
|
13
|
-
|
|
14
|
-
"lint": "eslint .",
|
|
15
|
-
"format": "prettier -w .",
|
|
16
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
17
|
-
|
|
18
|
-
"gen:feature": "node scripts/gen-feature.mjs",
|
|
19
|
-
|
|
20
|
-
"prepare": "husky",
|
|
21
|
-
"audit": "npm audit --audit-level=high"
|
|
22
|
-
},
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"react": "^18.3.0",
|
|
25
|
-
"react-dom": "^18.3.0"
|
|
26
|
-
},
|
|
27
|
-
"devDependencies": {
|
|
28
|
-
"@commitlint/cli": "^19.3.0",
|
|
29
|
-
"@commitlint/config-conventional": "^19.2.0",
|
|
30
|
-
"@eslint/js": "^9.0.0",
|
|
31
|
-
"@types/react": "^18.3.0",
|
|
32
|
-
"@types/react-dom": "^18.3.0",
|
|
33
|
-
"@vitejs/plugin-react": "^4.3.0",
|
|
34
|
-
"eslint": "^9.0.0",
|
|
35
|
-
"eslint-plugin-react-hooks": "^5.0.0",
|
|
36
|
-
"eslint-plugin-react-refresh": "^0.4.0",
|
|
37
|
-
"globals": "^15.0.0",
|
|
38
|
-
"husky": "^9.0.0",
|
|
39
|
-
"lint-staged": "^15.2.0",
|
|
40
|
-
"prettier": "^3.3.0",
|
|
41
|
-
"typescript": "^5.5.0",
|
|
42
|
-
"vite": "^5.4.0",
|
|
43
|
-
"vitest": "^2.0.0",
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
45
|
-
"@typescript-eslint/parser": "^8.0.0",
|
|
46
|
-
"jsdom": "^26.0.0"
|
|
47
|
-
},
|
|
48
|
-
"lint-staged": {
|
|
49
|
-
"*.{ts,tsx,js,jsx,json,md,yml,yaml}": [
|
|
50
|
-
"prettier -w"
|
|
51
|
-
],
|
|
52
|
-
"*.{ts,tsx,js,jsx}": [
|
|
53
|
-
"eslint --fix"
|
|
54
|
-
]
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "{{appName}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "tsc -b && vite build",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
|
|
11
|
+
"test": "vitest run",
|
|
12
|
+
"test:watch": "vitest",
|
|
13
|
+
|
|
14
|
+
"lint": "eslint .",
|
|
15
|
+
"format": "prettier -w .",
|
|
16
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
17
|
+
|
|
18
|
+
"gen:feature": "node scripts/gen-feature.mjs",
|
|
19
|
+
|
|
20
|
+
"prepare": "husky",
|
|
21
|
+
"audit": "npm audit --audit-level=high"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"react": "^18.3.0",
|
|
25
|
+
"react-dom": "^18.3.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@commitlint/cli": "^19.3.0",
|
|
29
|
+
"@commitlint/config-conventional": "^19.2.0",
|
|
30
|
+
"@eslint/js": "^9.0.0",
|
|
31
|
+
"@types/react": "^18.3.0",
|
|
32
|
+
"@types/react-dom": "^18.3.0",
|
|
33
|
+
"@vitejs/plugin-react": "^4.3.0",
|
|
34
|
+
"eslint": "^9.0.0",
|
|
35
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
36
|
+
"eslint-plugin-react-refresh": "^0.4.0",
|
|
37
|
+
"globals": "^15.0.0",
|
|
38
|
+
"husky": "^9.0.0",
|
|
39
|
+
"lint-staged": "^15.2.0",
|
|
40
|
+
"prettier": "^3.3.0",
|
|
41
|
+
"typescript": "^5.5.0",
|
|
42
|
+
"vite": "^5.4.0",
|
|
43
|
+
"vitest": "^2.0.0",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
45
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
46
|
+
"jsdom": "^26.0.0"
|
|
47
|
+
},
|
|
48
|
+
"lint-staged": {
|
|
49
|
+
"*.{ts,tsx,js,jsx,json,md,yml,yaml}": [
|
|
50
|
+
"prettier -w"
|
|
51
|
+
],
|
|
52
|
+
"*.{ts,tsx,js,jsx}": [
|
|
53
|
+
"eslint --fix"
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
56
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Example } from "../features/example/Example.js";
|
|
2
|
-
|
|
3
|
-
export function App() {
|
|
4
|
-
return (
|
|
5
|
-
<main style={{ padding: 16 }}>
|
|
6
|
-
<h1>{{appName}}</h1>
|
|
7
|
-
<Example />
|
|
8
|
-
</main>
|
|
9
|
-
);
|
|
1
|
+
import { Example } from "../features/example/Example.js";
|
|
2
|
+
|
|
3
|
+
export function App() {
|
|
4
|
+
return (
|
|
5
|
+
<main style={{ padding: 16 }}>
|
|
6
|
+
<h1>{{appName}}</h1>
|
|
7
|
+
<Example />
|
|
8
|
+
</main>
|
|
9
|
+
);
|
|
10
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import ReactDOM from "react-dom/client";
|
|
3
3
|
import { App } from "./App.js";
|
|
4
|
-
ReactDOM.createRoot(document.getElementById("root")).render(<React.StrictMode>
|
|
5
|
-
<App />
|
|
4
|
+
ReactDOM.createRoot(document.getElementById("root")).render(<React.StrictMode>
|
|
5
|
+
<App />
|
|
6
6
|
</React.StrictMode>);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import ReactDOM from "react-dom/client";
|
|
3
|
-
import { App } from "./App.js";
|
|
4
|
-
|
|
5
|
-
ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
6
|
-
<React.StrictMode>
|
|
7
|
-
<App />
|
|
8
|
-
</React.StrictMode>
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ReactDOM from "react-dom/client";
|
|
3
|
+
import { App } from "./App.js";
|
|
4
|
+
|
|
5
|
+
ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
6
|
+
<React.StrictMode>
|
|
7
|
+
<App />
|
|
8
|
+
</React.StrictMode>
|
|
9
9
|
);
|
|
@@ -2,9 +2,9 @@ import { useState } from "react";
|
|
|
2
2
|
import { Button } from "../../shared/ui/Button.js";
|
|
3
3
|
export function Example() {
|
|
4
4
|
const [msg, setMsg] = useState(null);
|
|
5
|
-
return (<section style={{ marginTop: 16 }}>
|
|
6
|
-
<p>Feature module example.</p>
|
|
7
|
-
<Button onClick={() => setMsg("Hello!")}>Click</Button>
|
|
8
|
-
{msg && <p style={{ marginTop: 8 }}>{msg}</p>}
|
|
5
|
+
return (<section style={{ marginTop: 16 }}>
|
|
6
|
+
<p>Feature module example.</p>
|
|
7
|
+
<Button onClick={() => setMsg("Hello!")}>Click</Button>
|
|
8
|
+
{msg && <p style={{ marginTop: 8 }}>{msg}</p>}
|
|
9
9
|
</section>);
|
|
10
10
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import { Button } from "../../shared/ui/Button.js";
|
|
3
|
-
|
|
4
|
-
export function Example() {
|
|
5
|
-
const [msg, setMsg] = useState<string | null>(null);
|
|
6
|
-
|
|
7
|
-
return (
|
|
8
|
-
<section style={{ marginTop: 16 }}>
|
|
9
|
-
<p>Feature module example.</p>
|
|
10
|
-
<Button onClick={() => setMsg("Hello!")}>Click</Button>
|
|
11
|
-
{msg && <p style={{ marginTop: 8 }}>{msg}</p>}
|
|
12
|
-
</section>
|
|
13
|
-
);
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Button } from "../../shared/ui/Button.js";
|
|
3
|
+
|
|
4
|
+
export function Example() {
|
|
5
|
+
const [msg, setMsg] = useState<string | null>(null);
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<section style={{ marginTop: 16 }}>
|
|
9
|
+
<p>Feature module example.</p>
|
|
10
|
+
<Button onClick={() => setMsg("Hello!")}>Click</Button>
|
|
11
|
+
{msg && <p style={{ marginTop: 8 }}>{msg}</p>}
|
|
12
|
+
</section>
|
|
13
|
+
);
|
|
14
14
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
type Props = {
|
|
2
|
-
children: React.ReactNode;
|
|
3
|
-
onClick?: () => void;
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
export function Button({ children, onClick }: Props) {
|
|
7
|
-
return (
|
|
8
|
-
<button
|
|
9
|
-
onClick={onClick}
|
|
10
|
-
style={{
|
|
11
|
-
padding: "8px 12px",
|
|
12
|
-
borderRadius: 10,
|
|
13
|
-
border: "1px solid #ddd",
|
|
14
|
-
cursor: "pointer"
|
|
15
|
-
}}
|
|
16
|
-
>
|
|
17
|
-
{children}
|
|
18
|
-
</button>
|
|
19
|
-
);
|
|
1
|
+
type Props = {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
onClick?: () => void;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export function Button({ children, onClick }: Props) {
|
|
7
|
+
return (
|
|
8
|
+
<button
|
|
9
|
+
onClick={onClick}
|
|
10
|
+
style={{
|
|
11
|
+
padding: "8px 12px",
|
|
12
|
+
borderRadius: 10,
|
|
13
|
+
border: "1px solid #ddd",
|
|
14
|
+
cursor: "pointer"
|
|
15
|
+
}}
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
18
|
+
</button>
|
|
19
|
+
);
|
|
20
20
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
{
|
|
2
|
-
"template": "react-ts",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"options": {
|
|
5
|
-
"appName": "{{appName}}",
|
|
6
|
-
"packageManager": "{{packageManager}}"
|
|
7
|
-
},
|
|
8
|
-
"generatedAt": "{{isoDate}}"
|
|
1
|
+
{
|
|
2
|
+
"template": "react-ts",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"options": {
|
|
5
|
+
"appName": "{{appName}}",
|
|
6
|
+
"packageManager": "{{packageManager}}"
|
|
7
|
+
},
|
|
8
|
+
"generatedAt": "{{isoDate}}"
|
|
9
9
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
|
|
9
|
-
"moduleResolution": "Bundler",
|
|
10
|
-
"resolveJsonModule": true,
|
|
11
|
-
"isolatedModules": true,
|
|
12
|
-
"noEmit": true,
|
|
13
|
-
"jsx": "react-jsx",
|
|
14
|
-
|
|
15
|
-
"strict": true,
|
|
16
|
-
"noUnusedLocals": true,
|
|
17
|
-
"noUnusedParameters": true,
|
|
18
|
-
"noFallthroughCasesInSwitch": true
|
|
19
|
-
},
|
|
20
|
-
"include": ["src", "vitest.setup.ts"]
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
"moduleResolution": "Bundler",
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"jsx": "react-jsx",
|
|
14
|
+
|
|
15
|
+
"strict": true,
|
|
16
|
+
"noUnusedLocals": true,
|
|
17
|
+
"noUnusedParameters": true,
|
|
18
|
+
"noFallthroughCasesInSwitch": true
|
|
19
|
+
},
|
|
20
|
+
"include": ["src", "vitest.setup.ts"]
|
|
21
21
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"composite": true,
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "Bundler",
|
|
6
|
-
"skipLibCheck": true,
|
|
7
|
-
"allowSyntheticDefaultImports": true
|
|
8
|
-
},
|
|
9
|
-
"include": ["vite.config.ts", "vitest.config.ts"]
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"composite": true,
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"allowSyntheticDefaultImports": true
|
|
8
|
+
},
|
|
9
|
+
"include": ["vite.config.ts", "vitest.config.ts"]
|
|
10
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineConfig } from "vite";
|
|
2
|
-
import react from "@vitejs/plugin-react";
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
plugins: [react()]
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
import react from "@vitejs/plugin-react";
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [react()]
|
|
6
6
|
});
|
|
@@ -1,20 +1,60 @@
|
|
|
1
|
-
name: react-ts
|
|
2
|
-
version: 1.0.0
|
|
3
|
-
description: "Template React + TypeScript (Vite) with lint/format/test/build + CI + ADR"
|
|
4
|
-
engine: "v1"
|
|
5
|
-
|
|
6
|
-
questions:
|
|
7
|
-
- name: appName
|
|
8
|
-
message: "Nom du projet ?"
|
|
9
|
-
default: "my-react-app"
|
|
10
|
-
|
|
11
|
-
- name: packageManager
|
|
12
|
-
message: "Package manager ?"
|
|
13
|
-
choices: ["npm", "pnpm", "yarn"]
|
|
14
|
-
default: "npm"
|
|
15
|
-
|
|
16
|
-
hooks:
|
|
17
|
-
postGenerate:
|
|
18
|
-
- run: "git init"
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
name: react-ts
|
|
2
|
+
version: 1.0.0
|
|
3
|
+
description: "Template React + TypeScript (Vite) with lint/format/test/build + CI + ADR"
|
|
4
|
+
engine: "v1"
|
|
5
|
+
|
|
6
|
+
questions:
|
|
7
|
+
- name: appName
|
|
8
|
+
message: "Nom du projet ?"
|
|
9
|
+
default: "my-react-app"
|
|
10
|
+
|
|
11
|
+
- name: packageManager
|
|
12
|
+
message: "Package manager ?"
|
|
13
|
+
choices: ["npm", "pnpm", "yarn"]
|
|
14
|
+
default: "npm"
|
|
15
|
+
|
|
16
|
+
hooks:
|
|
17
|
+
postGenerate:
|
|
18
|
+
- run: "git init"
|
|
19
|
+
|
|
20
|
+
# npm — frozen install, no scripts
|
|
21
|
+
- run: "npm ci --ignore-scripts"
|
|
22
|
+
when: "{{packageManager}} == npm"
|
|
23
|
+
|
|
24
|
+
# pnpm — frozen install, no scripts
|
|
25
|
+
- run: "pnpm install --frozen-lockfile --ignore-scripts"
|
|
26
|
+
when: "{{packageManager}} == pnpm"
|
|
27
|
+
|
|
28
|
+
# yarn — frozen install, no scripts
|
|
29
|
+
- run: "yarn install --frozen-lockfile --ignore-scripts"
|
|
30
|
+
when: "{{packageManager}} == yarn"
|
|
31
|
+
|
|
32
|
+
# Run tests after install (safe — no scripts flag only applies to lifecycle scripts)
|
|
33
|
+
- run: "npm run test"
|
|
34
|
+
when: "{{packageManager}} == npm"
|
|
35
|
+
|
|
36
|
+
- run: "pnpm run test"
|
|
37
|
+
when: "{{packageManager}} == pnpm"
|
|
38
|
+
|
|
39
|
+
- run: "yarn test"
|
|
40
|
+
when: "{{packageManager}} == yarn"
|
|
41
|
+
# name: react-ts
|
|
42
|
+
# version: 1.0.0
|
|
43
|
+
# description: "Template React + TypeScript (Vite) with lint/format/test/build + CI + ADR"
|
|
44
|
+
# engine: "v1"
|
|
45
|
+
|
|
46
|
+
# questions:
|
|
47
|
+
# - name: appName
|
|
48
|
+
# message: "Nom du projet ?"
|
|
49
|
+
# default: "my-react-app"
|
|
50
|
+
|
|
51
|
+
# - name: packageManager
|
|
52
|
+
# message: "Package manager ?"
|
|
53
|
+
# choices: ["npm", "pnpm", "yarn"]
|
|
54
|
+
# default: "npm"
|
|
55
|
+
|
|
56
|
+
# hooks:
|
|
57
|
+
# postGenerate:
|
|
58
|
+
# - run: "git init"
|
|
59
|
+
# - run: "{{packageManager}} ci --ignore-scripts" # npm
|
|
60
|
+
# - run: "{{packageManager}} run test"
|