create-olmo-front 0.1.3 → 0.1.5
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 +3 -2
- package/index.js +18 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,8 +24,9 @@ npm run dev
|
|
|
24
24
|
|
|
25
25
|
1. Downloads the template from the **public** GitLab repo (via `giget` — no auth needed).
|
|
26
26
|
2. Sets your project name in `package.json`.
|
|
27
|
-
3. Seeds a gitignored `.env.local` from `.env.example
|
|
28
|
-
|
|
27
|
+
3. Seeds a gitignored `.env.local` from `.env.development` (falling back to `.env.example`).
|
|
28
|
+
Stage and production values live in `.env.development` and `.env.production`, which are
|
|
29
|
+
committed: the GitLab pipeline renames the right one to `.env` before `vercel build`.
|
|
29
30
|
4. `git init` + first commit.
|
|
30
31
|
5. `npm install` (pulls `@olmocms/front` and the rest).
|
|
31
32
|
|
package/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import pc from 'picocolors';
|
|
|
20
20
|
|
|
21
21
|
// The template lives in a PUBLIC GitLab repo, so giget can fetch it with no auth.
|
|
22
22
|
const TEMPLATE = 'gitlab:olmocms/olmo-front-template';
|
|
23
|
-
const DEFAULT_REF = 'v0.1.
|
|
23
|
+
const DEFAULT_REF = 'v0.1.5';
|
|
24
24
|
|
|
25
25
|
function parseArgs(argv) {
|
|
26
26
|
const opts = { dir: undefined, ref: DEFAULT_REF, install: true, git: true, help: false };
|
|
@@ -115,11 +115,22 @@ async function main() {
|
|
|
115
115
|
/* non-fatal: leave package.json as-is if it can't be parsed */
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
// 4. Seed
|
|
119
|
-
|
|
118
|
+
// 4. Seed the local, gitignored env file. It comes from .env.development —
|
|
119
|
+
// the stage values, the closest thing to a working local setup — and falls
|
|
120
|
+
// back to .env.example. The template also ships .env.development and
|
|
121
|
+
// .env.production committed: the GitLab pipeline renames the right one to
|
|
122
|
+
// .env before `vercel build`, which is why they are in the repo at all.
|
|
120
123
|
const local = join(target, '.env.local');
|
|
121
|
-
|
|
122
|
-
|
|
124
|
+
const seed = ['.env.development', '.env.example']
|
|
125
|
+
.map((name) => join(target, name))
|
|
126
|
+
.find((path) => existsSync(path));
|
|
127
|
+
|
|
128
|
+
if (!existsSync(local)) {
|
|
129
|
+
if (seed) {
|
|
130
|
+
copyFileSync(seed, local);
|
|
131
|
+
} else {
|
|
132
|
+
console.log(pc.yellow('! No .env.development in the template: create .env.local yourself.'));
|
|
133
|
+
}
|
|
123
134
|
}
|
|
124
135
|
|
|
125
136
|
// 5. git init + first commit.
|
|
@@ -146,7 +157,8 @@ async function main() {
|
|
|
146
157
|
if (!opts.install) console.log(' npm install');
|
|
147
158
|
console.log(` ${pc.dim('# edit .env.local — set OLMO_TOKEN, OLMO_FORM_TOKEN, API URLs')}`);
|
|
148
159
|
console.log(' npm run dev\n');
|
|
149
|
-
console.log(pc.dim('
|
|
160
|
+
console.log(pc.dim('Stage and production values live in .env.development and .env.production,'));
|
|
161
|
+
console.log(pc.dim('committed in the repo: the pipeline renames the right one to .env at build time.\n'));
|
|
150
162
|
}
|
|
151
163
|
|
|
152
164
|
main().catch((err) => {
|