@toist/in 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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@toist/in` are recorded here.
|
|
4
4
|
|
|
5
|
+
## 0.2.2 — 2026-05-05
|
|
6
|
+
|
|
7
|
+
Lockstep version bump alongside `@toist/run@0.2.2` (UI MIME-type fix).
|
|
8
|
+
Scaffold template's `_package.json` now pins `@toist/run` and `@toist/spec`
|
|
9
|
+
to `^0.2.2` so freshly scaffolded instances pick up the fix.
|
|
10
|
+
|
|
11
|
+
## 0.2.1 — 2026-05-05
|
|
12
|
+
|
|
13
|
+
- Scaffold now writes `package.json` directly into the target directory
|
|
14
|
+
instead of printing a snippet to stdout for manual merge. The empty-dir
|
|
15
|
+
check that the scaffold already enforces means there's never an existing
|
|
16
|
+
`package.json` to collide with — writing it is unambiguously simpler and
|
|
17
|
+
removes a manual step. The template ships as `_package.json` (the leading
|
|
18
|
+
underscore dodges npm's publish-time stripping rules) and is renamed to
|
|
19
|
+
`package.json` at scaffold time.
|
|
20
|
+
- Stdout is now a brief "next steps" block: `cd <path>; bun install; bun start.ts`.
|
|
21
|
+
|
|
5
22
|
## 0.2.0 — 2026-05-05
|
|
6
23
|
|
|
7
24
|
Initial release. Scaffold CLI for new toist instances.
|
package/package.json
CHANGED
package/src/scaffold.ts
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
// 2121 toist
|
|
2
2
|
// Scaffold logic for @toist/in. Recursively copies templates/default/* into
|
|
3
|
-
// the target directory, with two
|
|
3
|
+
// the target directory, with two `_`-prefixed filenames renamed at copy time:
|
|
4
4
|
//
|
|
5
|
-
// - `_gitignore`
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
5
|
+
// - `_gitignore` -> `.gitignore`
|
|
6
|
+
// - `_package.json` -> `package.json`
|
|
7
|
+
//
|
|
8
|
+
// The underscore prefix exists because npm strips files like `.gitignore` and
|
|
9
|
+
// (in some configurations) `package.json` from publishable subdirs. Prefixing
|
|
10
|
+
// dodges those rules; the runtime rename produces the real names in the host.
|
|
9
11
|
//
|
|
10
12
|
// Templates live in `<package>/templates/default/`, relative to this file's
|
|
11
13
|
// runtime location. Works whether the package is consumed as a workspace
|
|
12
14
|
// link (in this repo) or from node_modules (in a host repo).
|
|
13
15
|
|
|
14
|
-
import { mkdir, copyFile, readdir, stat
|
|
16
|
+
import { mkdir, copyFile, readdir, stat } from "node:fs/promises"
|
|
15
17
|
import { existsSync } from "node:fs"
|
|
16
18
|
import { dirname, join, resolve } from "node:path"
|
|
17
19
|
import { fileURLToPath } from "node:url"
|
|
18
20
|
|
|
19
|
-
const __dir
|
|
20
|
-
const TEMPLATE_DIR
|
|
21
|
-
|
|
22
|
-
const
|
|
21
|
+
const __dir = dirname(fileURLToPath(import.meta.url))
|
|
22
|
+
const TEMPLATE_DIR = resolve(__dir, "..", "templates", "default")
|
|
23
|
+
|
|
24
|
+
const RENAMES: Record<string, string> = {
|
|
25
|
+
_gitignore: ".gitignore",
|
|
26
|
+
"_package.json": "package.json",
|
|
27
|
+
}
|
|
23
28
|
|
|
24
29
|
export async function scaffold(target: string): Promise<void> {
|
|
25
30
|
const dest = resolve(process.cwd(), target)
|
|
@@ -36,13 +41,8 @@ export async function scaffold(target: string): Promise<void> {
|
|
|
36
41
|
|
|
37
42
|
await copyTree(TEMPLATE_DIR, dest)
|
|
38
43
|
|
|
39
|
-
const snippet = await readFile(join(TEMPLATE_DIR, SNIPPET_FILE), "utf8")
|
|
40
|
-
|
|
41
44
|
console.log(`\nScaffolded toist instance at ${dest}\n`)
|
|
42
|
-
console.log(
|
|
43
|
-
console.log("")
|
|
44
|
-
console.log(snippet)
|
|
45
|
-
console.log("Then:")
|
|
45
|
+
console.log("Next:")
|
|
46
46
|
console.log(` cd ${target}`)
|
|
47
47
|
console.log(` bun install`)
|
|
48
48
|
console.log(` bun start.ts`)
|
|
@@ -53,9 +53,8 @@ export async function scaffold(target: string): Promise<void> {
|
|
|
53
53
|
|
|
54
54
|
async function copyTree(src: string, dest: string): Promise<void> {
|
|
55
55
|
for (const entry of await readdir(src)) {
|
|
56
|
-
if (entry === SNIPPET_FILE) continue // printed, not copied
|
|
57
56
|
const srcPath = join(src, entry)
|
|
58
|
-
const destName = entry
|
|
57
|
+
const destName = RENAMES[entry] ?? entry
|
|
59
58
|
const destPath = join(dest, destName)
|
|
60
59
|
const info = await stat(srcPath)
|
|
61
60
|
if (info.isDirectory()) {
|
|
@@ -4,9 +4,8 @@ Generated with [`bunx @toist/in`](https://toist.in).
|
|
|
4
4
|
|
|
5
5
|
## First run
|
|
6
6
|
|
|
7
|
-
1.
|
|
8
|
-
2. `bun
|
|
9
|
-
3. `bun start.ts` — runner boots on `http://localhost:3000`.
|
|
7
|
+
1. `bun install`
|
|
8
|
+
2. `bun start.ts` — runner boots on `http://localhost:3000`.
|
|
10
9
|
|
|
11
10
|
Open `http://localhost:3000` to use the UI.
|
|
12
11
|
|