@skafform/create 0.2.0 → 0.2.2
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 +79 -0
- package/dist/index.js +9 -8
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# create-skafform
|
|
2
|
+
|
|
3
|
+
Scaffold a new [Skafform](https://github.com/skafform) project with Next.js or Nuxt, pre-configured with security headers, CSP, and the Skafform module system.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @skafform/create <project-name> [next|nuxt]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
| Argument | Description |
|
|
14
|
+
|----------|-------------|
|
|
15
|
+
| `next` | Scaffold a Next.js project (default) |
|
|
16
|
+
| `nuxt` | Scaffold a Nuxt project _(coming soon)_ |
|
|
17
|
+
| `-v, --version` | Show version number |
|
|
18
|
+
| `-h, --help` | Show help message |
|
|
19
|
+
|
|
20
|
+
## Examples
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Next.js (default)
|
|
24
|
+
npx @skafform/create my-app
|
|
25
|
+
|
|
26
|
+
# Next.js (explicit)
|
|
27
|
+
npx @skafform/create my-app next
|
|
28
|
+
|
|
29
|
+
# Nuxt (coming soon)
|
|
30
|
+
npx @skafform/create my-app nuxt
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## What's included
|
|
34
|
+
|
|
35
|
+
### Next.js
|
|
36
|
+
- Next.js with TypeScript, Tailwind CSS, ESLint, and App Router
|
|
37
|
+
- Content Security Policy (CSP) via `next.config.ts`
|
|
38
|
+
- Security headers: `X-Frame-Options`, `X-Content-Type-Options`, `Referrer-Policy`, `Permissions-Policy`
|
|
39
|
+
- Middleware proxy via `proxy.ts` with `beforeAuth` / `afterAuth` hooks
|
|
40
|
+
- `Providers` wrapper in `app/layout.tsx`
|
|
41
|
+
|
|
42
|
+
### Project structure
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
my-app/
|
|
46
|
+
├── .skafform/
|
|
47
|
+
│ ├── contracts/ # Skafform module contracts
|
|
48
|
+
│ ├── modules/ # Installed module overrides
|
|
49
|
+
│ ├── installed.json # Installed modules registry
|
|
50
|
+
│ ├── csp.ts # CSP builder (managed)
|
|
51
|
+
│ ├── proxy.ts # Middleware logic (managed)
|
|
52
|
+
│ └── providers.tsx # React providers (managed)
|
|
53
|
+
├── proxy.ts # User-owned middleware entry point
|
|
54
|
+
├── app/
|
|
55
|
+
│ ├── layout.ts
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## After scaffolding
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
cd my-app
|
|
62
|
+
npm run dev
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
To add integrations:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npx skafform serve
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Project name rules
|
|
72
|
+
|
|
73
|
+
Only lowercase letters, numbers, hyphens, and underscores are allowed.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
my-app # valid
|
|
77
|
+
my_app # valid
|
|
78
|
+
MyApp # invalid
|
|
79
|
+
```
|
package/dist/index.js
CHANGED
|
@@ -12,25 +12,26 @@ if (process.argv[2] === "--version" || process.argv[2] === "-v") {
|
|
|
12
12
|
}
|
|
13
13
|
if (process.argv[2] === "--help" || process.argv[2] === "-h") {
|
|
14
14
|
console.log(`
|
|
15
|
-
Usage: create-skafform <project-name> [
|
|
15
|
+
Usage: create-skafform <project-name> [next|nuxt]
|
|
16
16
|
|
|
17
17
|
Options:
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
next Scaffold a Next.js project (default)
|
|
19
|
+
nuxt Scaffold a Nuxt project
|
|
20
20
|
-v, --version Show version number
|
|
21
21
|
-h, --help Show this help message
|
|
22
22
|
|
|
23
23
|
Examples:
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
npm create @skafform@latest my-app
|
|
25
|
+
npm create @skafform@latest my-app next
|
|
26
|
+
npm create @skafform@latest my-app nuxt
|
|
26
27
|
`);
|
|
27
28
|
process.exit(0);
|
|
28
29
|
}
|
|
29
30
|
const name = process.argv[2];
|
|
30
|
-
const
|
|
31
|
-
const isNuxt =
|
|
31
|
+
const framework = process.argv[3];
|
|
32
|
+
const isNuxt = framework === "nuxt";
|
|
32
33
|
if (!name) {
|
|
33
|
-
console.error("Usage:
|
|
34
|
+
console.error("Usage: npm create @skafform@latest <project-name> [next|nuxt]");
|
|
34
35
|
process.exit(1);
|
|
35
36
|
}
|
|
36
37
|
if (!/^[a-z0-9-_]+$/.test(name)) {
|