create-secra 0.1.1 → 0.1.3
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 +34 -3
- package/README.zh-CN.md +52 -0
- package/package.json +1 -1
- package/template/apps/core/src/pages/index.tsx +80 -1
package/README.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# create-secra
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Bootstrap a Secra frontend project from a built-in local template.
|
|
4
|
+
|
|
5
|
+
[中文文档](./README.zh-CN.md)
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Create a project:
|
|
4
10
|
|
|
5
11
|
```bash
|
|
6
12
|
pnpm create secra my-app
|
|
@@ -12,10 +18,35 @@ or
|
|
|
12
18
|
npm create secra@latest my-app
|
|
13
19
|
```
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
## Template Behavior
|
|
22
|
+
|
|
23
|
+
- Default template source: local `template/` directory in this package.
|
|
24
|
+
- No git clone / degit is used.
|
|
25
|
+
- Template copy excludes these directories:
|
|
26
|
+
- `node_modules`
|
|
27
|
+
- `dist`
|
|
28
|
+
- `.turbo`
|
|
29
|
+
- `.git`
|
|
30
|
+
- After scaffolding, dependencies are installed automatically with your detected package manager (`pnpm`/`yarn`/`bun`/`npm`).
|
|
31
|
+
|
|
32
|
+
## Override Template Source
|
|
16
33
|
|
|
17
|
-
You can
|
|
34
|
+
You can temporarily point to another local template path:
|
|
18
35
|
|
|
19
36
|
```bash
|
|
20
37
|
SECRA_TEMPLATE=/absolute/path/to/template pnpm create secra my-app
|
|
21
38
|
```
|
|
39
|
+
|
|
40
|
+
## Maintain the Built-in Template
|
|
41
|
+
|
|
42
|
+
If you want to refresh `template/` from another project (for example `secra-front`), copy files with excludes:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
rsync -a --delete \
|
|
46
|
+
--exclude node_modules \
|
|
47
|
+
--exclude dist \
|
|
48
|
+
--exclude .turbo \
|
|
49
|
+
--exclude .git \
|
|
50
|
+
/path/to/source-project/ \
|
|
51
|
+
./template/
|
|
52
|
+
```
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# create-secra
|
|
2
|
+
|
|
3
|
+
基于内置本地模板快速创建 Secra 前端项目。
|
|
4
|
+
|
|
5
|
+
[English README](./README.md)
|
|
6
|
+
|
|
7
|
+
## 使用方式
|
|
8
|
+
|
|
9
|
+
创建项目:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm create secra my-app
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
或
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm create secra@latest my-app
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Template 功能说明
|
|
22
|
+
|
|
23
|
+
- 默认模板来源:当前包内的 `template/` 目录。
|
|
24
|
+
- 不使用 git clone / degit 拉取远程仓库。
|
|
25
|
+
- 复制模板时会自动排除以下目录:
|
|
26
|
+
- `node_modules`
|
|
27
|
+
- `dist`
|
|
28
|
+
- `.turbo`
|
|
29
|
+
- `.git`
|
|
30
|
+
- 脚手架复制完成后,会自动根据当前环境识别包管理器并安装依赖(`pnpm`/`yarn`/`bun`/`npm`)。
|
|
31
|
+
|
|
32
|
+
## 临时覆盖模板目录
|
|
33
|
+
|
|
34
|
+
如需临时指定其他本地模板目录,可通过环境变量:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
SECRA_TEMPLATE=/absolute/path/to/template pnpm create secra my-app
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 维护内置模板
|
|
41
|
+
|
|
42
|
+
如果你想从其他项目(例如 `secra-front`)更新 `template/`,可执行:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
rsync -a --delete \
|
|
46
|
+
--exclude node_modules \
|
|
47
|
+
--exclude dist \
|
|
48
|
+
--exclude .turbo \
|
|
49
|
+
--exclude .git \
|
|
50
|
+
/path/to/source-project/ \
|
|
51
|
+
./template/
|
|
52
|
+
```
|
package/package.json
CHANGED
|
@@ -1,4 +1,83 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
import reactLogo from "../assets/react.svg";
|
|
3
|
+
|
|
4
|
+
const cardStyle: CSSProperties = {
|
|
5
|
+
border: "1px solid #e5e7eb",
|
|
6
|
+
borderRadius: 12,
|
|
7
|
+
padding: 16,
|
|
8
|
+
background: "#ffffff",
|
|
9
|
+
boxShadow: "0 6px 24px rgba(15, 23, 42, 0.06)",
|
|
10
|
+
};
|
|
11
|
+
|
|
1
12
|
const Home = () => {
|
|
2
|
-
return (
|
|
13
|
+
return (
|
|
14
|
+
<main
|
|
15
|
+
style={{
|
|
16
|
+
minHeight: "100vh",
|
|
17
|
+
padding: "48px 20px",
|
|
18
|
+
background: "linear-gradient(180deg, #f8fafc 0%, #ffffff 100%)",
|
|
19
|
+
color: "#0f172a",
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
22
|
+
<section style={{ maxWidth: 920, margin: "0 auto" }}>
|
|
23
|
+
<header style={{ display: "flex", alignItems: "center", gap: 16, marginBottom: 24 }}>
|
|
24
|
+
<img src={reactLogo} alt="React Logo" width={48} height={48} />
|
|
25
|
+
<div>
|
|
26
|
+
<h1 style={{ fontSize: 34, lineHeight: 1.2, margin: 0 }}>
|
|
27
|
+
React + Vite + Secra
|
|
28
|
+
</h1>
|
|
29
|
+
<p style={{ margin: "8px 0 0", color: "#475569" }}>
|
|
30
|
+
A fast starter template for modern frontend projects.
|
|
31
|
+
</p>
|
|
32
|
+
</div>
|
|
33
|
+
</header>
|
|
34
|
+
|
|
35
|
+
<div
|
|
36
|
+
style={{
|
|
37
|
+
display: "grid",
|
|
38
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(220px, 1fr))",
|
|
39
|
+
gap: 14,
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
<article style={cardStyle}>
|
|
43
|
+
<h3 style={{ marginTop: 0 }}>React</h3>
|
|
44
|
+
<p style={{ margin: 0, color: "#475569" }}>
|
|
45
|
+
Build component-based UI with a clean and maintainable structure.
|
|
46
|
+
</p>
|
|
47
|
+
</article>
|
|
48
|
+
<article style={cardStyle}>
|
|
49
|
+
<h3 style={{ marginTop: 0 }}>Vite</h3>
|
|
50
|
+
<p style={{ margin: 0, color: "#475569" }}>
|
|
51
|
+
Enjoy instant startup and fast HMR for daily development.
|
|
52
|
+
</p>
|
|
53
|
+
</article>
|
|
54
|
+
<article style={cardStyle}>
|
|
55
|
+
<h3 style={{ marginTop: 0 }}>Secra</h3>
|
|
56
|
+
<p style={{ margin: 0, color: "#475569" }}>
|
|
57
|
+
Structured app bootstrap, routing and engineering defaults out of the box.
|
|
58
|
+
</p>
|
|
59
|
+
</article>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<section style={{ ...cardStyle, marginTop: 18 }}>
|
|
63
|
+
<h2 style={{ marginTop: 0, fontSize: 20 }}>Quick Start</h2>
|
|
64
|
+
<pre
|
|
65
|
+
style={{
|
|
66
|
+
margin: 0,
|
|
67
|
+
padding: 14,
|
|
68
|
+
borderRadius: 8,
|
|
69
|
+
background: "#0f172a",
|
|
70
|
+
color: "#e2e8f0",
|
|
71
|
+
overflowX: "auto",
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
{`pnpm install
|
|
75
|
+
pnpm dev`}
|
|
76
|
+
</pre>
|
|
77
|
+
</section>
|
|
78
|
+
</section>
|
|
79
|
+
</main>
|
|
80
|
+
);
|
|
3
81
|
};
|
|
82
|
+
|
|
4
83
|
export default Home;
|