@oss-ma/tpl 1.0.34 → 1.0.36
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 +19 -4
- package/package.json +1 -1
- package/resources/templates/react-next/files/.github/dependabot.yml +14 -0
- package/resources/templates/react-next/files/.github/workflows/ci.yml +46 -0
- package/resources/templates/react-next/files/.github/workflows/codeql.yml +37 -0
- package/resources/templates/react-next/files/.husky/commit-msg +1 -0
- package/resources/templates/react-next/files/.husky/pre-commit +1 -0
- package/resources/templates/react-next/files/README.md +40 -0
- package/resources/templates/react-next/files/SECURITY.md +24 -0
- package/resources/templates/react-next/files/commitlint.config.cjs +3 -0
- package/resources/templates/react-next/files/docs/adr/0001-context.md +34 -0
- package/resources/templates/react-next/files/editorconfig +12 -0
- package/resources/templates/react-next/files/next.config.ts +6 -0
- package/resources/templates/react-next/files/prettierrc.json +6 -0
package/dist/commands/check.js
CHANGED
|
@@ -15,15 +15,30 @@ async function hashFile(filePath) {
|
|
|
15
15
|
const content = await fs.readFile(filePath);
|
|
16
16
|
return crypto.createHash("sha256").update(content).digest("hex");
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
const EXCLUDED_DIRS = new Set([
|
|
19
|
+
"node_modules",
|
|
20
|
+
".git",
|
|
21
|
+
".next",
|
|
22
|
+
"dist",
|
|
23
|
+
"build",
|
|
24
|
+
"coverage",
|
|
25
|
+
".turbo",
|
|
26
|
+
".cache",
|
|
27
|
+
]);
|
|
28
|
+
async function collectFiles(dir, root) {
|
|
29
|
+
const baseDir = root ?? dir;
|
|
19
30
|
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
20
31
|
const results = [];
|
|
21
32
|
for (const entry of entries) {
|
|
33
|
+
if (EXCLUDED_DIRS.has(entry.name))
|
|
34
|
+
continue;
|
|
22
35
|
const full = path.join(dir, entry.name);
|
|
23
|
-
if (entry.isDirectory())
|
|
24
|
-
results.push(...(await collectFiles(full)));
|
|
25
|
-
|
|
36
|
+
if (entry.isDirectory()) {
|
|
37
|
+
results.push(...(await collectFiles(full, baseDir)));
|
|
38
|
+
}
|
|
39
|
+
else if (entry.isFile()) {
|
|
26
40
|
results.push(full);
|
|
41
|
+
}
|
|
27
42
|
}
|
|
28
43
|
return results.sort();
|
|
29
44
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: npm
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: weekly
|
|
7
|
+
ignore:
|
|
8
|
+
- dependency-name: "*"
|
|
9
|
+
update-types: ["version-update:semver-major"]
|
|
10
|
+
|
|
11
|
+
- package-ecosystem: github-actions
|
|
12
|
+
directory: "/"
|
|
13
|
+
schedule:
|
|
14
|
+
interval: weekly
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["main"]
|
|
8
|
+
|
|
9
|
+
permissions: {}
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
name: Build & Test
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout
|
|
20
|
+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
|
21
|
+
with:
|
|
22
|
+
persist-credentials: false
|
|
23
|
+
|
|
24
|
+
- name: Setup Node.js
|
|
25
|
+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e
|
|
26
|
+
with:
|
|
27
|
+
node-version: 20
|
|
28
|
+
cache: npm
|
|
29
|
+
|
|
30
|
+
- name: Install dependencies
|
|
31
|
+
run: npm ci --ignore-scripts
|
|
32
|
+
|
|
33
|
+
- name: Audit
|
|
34
|
+
run: npm audit --audit-level=high
|
|
35
|
+
|
|
36
|
+
- name: Lint
|
|
37
|
+
run: npm run lint
|
|
38
|
+
|
|
39
|
+
- name: Type check
|
|
40
|
+
run: npm run typecheck
|
|
41
|
+
|
|
42
|
+
- name: Test
|
|
43
|
+
run: npm test
|
|
44
|
+
|
|
45
|
+
- name: Build
|
|
46
|
+
run: npm run build
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: codeql
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["main"]
|
|
8
|
+
schedule:
|
|
9
|
+
- cron: "0 8 * * 1"
|
|
10
|
+
|
|
11
|
+
permissions: {}
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
analyze:
|
|
15
|
+
name: Analyze (javascript-typescript)
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
actions: read
|
|
20
|
+
security-events: write
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout
|
|
24
|
+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
|
25
|
+
with:
|
|
26
|
+
persist-credentials: false
|
|
27
|
+
|
|
28
|
+
- name: Initialize CodeQL
|
|
29
|
+
uses: github/codeql-action/init@v4
|
|
30
|
+
with:
|
|
31
|
+
languages: javascript-typescript
|
|
32
|
+
queries: security-extended
|
|
33
|
+
|
|
34
|
+
- name: Perform CodeQL Analysis
|
|
35
|
+
uses: github/codeql-action/analyze@v4
|
|
36
|
+
with:
|
|
37
|
+
category: "/language:javascript-typescript"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx --no -- commitlint --edit "$1"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx lint-staged
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# {{appName}}
|
|
2
|
+
|
|
3
|
+
Next.js 15 · App Router · TypeScript
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm run dev
|
|
9
|
+
# Open http://localhost:3000
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Scripts
|
|
13
|
+
|
|
14
|
+
- `npm run dev` — Start development server
|
|
15
|
+
- `npm run build` — Build for production
|
|
16
|
+
- `npm start` — Start production server
|
|
17
|
+
- `npm test` — Run tests
|
|
18
|
+
- `npm run lint` — Lint code
|
|
19
|
+
- `npm run format` — Format code with Prettier
|
|
20
|
+
- `npm run typecheck` — Type check with TypeScript
|
|
21
|
+
|
|
22
|
+
## Project Structure
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
src/
|
|
26
|
+
├── app/ # Next.js App Router pages
|
|
27
|
+
├── features/ # Feature modules
|
|
28
|
+
├── shared/ # Shared components and utilities
|
|
29
|
+
└── lib/ # Library code (providers, etc.)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Standards
|
|
33
|
+
|
|
34
|
+
This project follows the [@oss-ma/tpl](https://www.npmjs.com/package/@oss-ma/tpl) standard.
|
|
35
|
+
|
|
36
|
+
Run `npx @oss-ma/tpl check` to validate compliance.
|
|
37
|
+
|
|
38
|
+
## Security
|
|
39
|
+
|
|
40
|
+
See [SECURITY.md](SECURITY.md) for reporting vulnerabilities.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
|---------|-----------|
|
|
7
|
+
| latest | ✅ |
|
|
8
|
+
|
|
9
|
+
## Reporting a Vulnerability
|
|
10
|
+
|
|
11
|
+
If you discover a security vulnerability, please report it privately:
|
|
12
|
+
|
|
13
|
+
1. **Do not** open a public GitHub issue
|
|
14
|
+
2. Contact the maintainer directly via email or private channel
|
|
15
|
+
3. Include details: description, steps to reproduce, potential impact
|
|
16
|
+
|
|
17
|
+
We will respond within 48 hours and provide updates as we investigate.
|
|
18
|
+
|
|
19
|
+
## Security Measures
|
|
20
|
+
|
|
21
|
+
- Dependabot enabled for automated dependency updates
|
|
22
|
+
- CodeQL SAST scans on every push
|
|
23
|
+
- npm audit in CI pipeline
|
|
24
|
+
- GitHub Actions pinned by SHA
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# 1. Context
|
|
2
|
+
|
|
3
|
+
Date: {{date}}
|
|
4
|
+
|
|
5
|
+
## Status
|
|
6
|
+
|
|
7
|
+
Accepted
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
This project was bootstrapped with [@oss-ma/tpl](https://www.npmjs.com/package/@oss-ma/tpl) using the `react-next` template.
|
|
12
|
+
|
|
13
|
+
Stack:
|
|
14
|
+
- Next.js 15 with App Router
|
|
15
|
+
- TypeScript
|
|
16
|
+
- React 19{{#if state}}
|
|
17
|
+
- Zustand for state management{{/if}}{{#if fetching}}
|
|
18
|
+
- TanStack Query for data fetching{{/if}}
|
|
19
|
+
|
|
20
|
+
## Decision
|
|
21
|
+
|
|
22
|
+
We use Next.js App Router for its server component architecture, built-in routing, and excellent DX.
|
|
23
|
+
|
|
24
|
+
## Consequences
|
|
25
|
+
|
|
26
|
+
**Positive:**
|
|
27
|
+
- Server components by default → better performance
|
|
28
|
+
- File-system based routing → no react-router needed
|
|
29
|
+
- Built-in API routes and server actions
|
|
30
|
+
- Excellent TypeScript support
|
|
31
|
+
|
|
32
|
+
**Negative:**
|
|
33
|
+
- Learning curve for developers new to App Router
|
|
34
|
+
- Some third-party libraries may not support React Server Components yet
|