create-acrylblends 0.2.8 → 0.3.1
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 +5 -4
- package/dist/index.d.ts +1 -3
- package/dist/index.js +20 -198
- package/dist/index.js.map +1 -1
- package/docs/framework/README.md +2 -2
- package/docs/framework/UPSTREAM.md +1 -1
- package/docs/framework/getting-started/basic.md +1 -2
- package/docs/framework/getting-started/desktop.md +1 -1
- package/docs/framework/guides/bring-your-own-tool.md +216 -0
- package/docs/framework/guides/create-acrylblends.md +5 -4
- package/docs/framework/guides/data.md +2 -1
- package/docs/framework/upstream.json +3 -3
- package/package.json +2 -3
- package/templates/bun/gitignore +0 -2
- package/templates/bun/package.json +0 -19
- package/templates/bun/src/index.ts +0 -7
- package/templates/bun/test/app.test.ts +0 -8
- package/templates/bun/tsconfig.json +0 -15
- package/templates/chat/gitignore +0 -7
- package/templates/chat/migrations/001-chat.sql +0 -12
- package/templates/chat/package.json +0 -26
- package/templates/chat/src/app.ts +0 -8
- package/templates/chat/src/chat-app.ts +0 -100
- package/templates/chat/src/client/chat.tsx +0 -115
- package/templates/chat/src/client/tsconfig.json +0 -15
- package/templates/chat/src/db.ts +0 -53
- package/templates/chat/src/index.ts +0 -27
- package/templates/chat/src/llm.ts +0 -42
- package/templates/chat/src/page.tsx +0 -38
- package/templates/chat/test/chat.test.ts +0 -165
- package/templates/chat/test/server.test.ts +0 -59
- package/templates/chat/tsconfig.json +0 -19
- package/templates/nodejs/gitignore +0 -3
- package/templates/nodejs/package.json +0 -23
- package/templates/nodejs/src/app.ts +0 -10
- package/templates/nodejs/src/client/counter.tsx +0 -12
- package/templates/nodejs/src/client/tsconfig.json +0 -15
- package/templates/nodejs/src/index.ts +0 -21
- package/templates/nodejs/src/page.tsx +0 -26
- package/templates/nodejs/src/routes.ts +0 -10
- package/templates/nodejs/test/app.test.ts +0 -40
- package/templates/nodejs/test/server.test.ts +0 -48
- package/templates/nodejs/tsconfig.json +0 -19
- package/templates/notes/gitignore +0 -7
- package/templates/notes/migrations/001-notes.sql +0 -18
- package/templates/notes/package.json +0 -26
- package/templates/notes/src/app.ts +0 -8
- package/templates/notes/src/auth.ts +0 -57
- package/templates/notes/src/client/counter.tsx +0 -21
- package/templates/notes/src/client/tsconfig.json +0 -15
- package/templates/notes/src/db.ts +0 -60
- package/templates/notes/src/index.ts +0 -27
- package/templates/notes/src/notes-app.ts +0 -205
- package/templates/notes/src/schema.ts +0 -38
- package/templates/notes/src/views.tsx +0 -134
- package/templates/notes/test/notes.test.ts +0 -252
- package/templates/notes/test/server.test.ts +0 -59
- package/templates/notes/tsconfig.json +0 -19
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict'
|
|
2
|
-
import { spawn } from 'node:child_process'
|
|
3
|
-
import { once } from 'node:events'
|
|
4
|
-
import { mkdtempSync } from 'node:fs'
|
|
5
|
-
import { tmpdir } from 'node:os'
|
|
6
|
-
import { join } from 'node:path'
|
|
7
|
-
import { test } from 'node:test'
|
|
8
|
-
|
|
9
|
-
/** Start `src/index.ts` the way `npm start` does, on a port the system chooses, and read the address it prints. */
|
|
10
|
-
async function start(env: Record<string, string> = {}) {
|
|
11
|
-
const child = spawn(
|
|
12
|
-
process.execPath,
|
|
13
|
-
['--import', '__PACKAGE__/node-server/register', 'src/index.ts'],
|
|
14
|
-
{
|
|
15
|
-
env: {
|
|
16
|
-
...process.env,
|
|
17
|
-
PORT: '0',
|
|
18
|
-
NOTES_DB: join(mkdtempSync(join(tmpdir(), 'notes-')), 'notes.sqlite'),
|
|
19
|
-
...env,
|
|
20
|
-
},
|
|
21
|
-
stdio: ['ignore', 'pipe', 'inherit'],
|
|
22
|
-
},
|
|
23
|
-
)
|
|
24
|
-
let out = ''
|
|
25
|
-
const address = await new Promise<string>((resolve, reject) => {
|
|
26
|
-
child.once('exit', (code) =>
|
|
27
|
-
reject(new Error(`the server exited with ${code} before it listened`)),
|
|
28
|
-
)
|
|
29
|
-
child.stdout.on('data', (chunk) => {
|
|
30
|
-
out += chunk
|
|
31
|
-
const match = /listening on (http:\/\/\S+)/.exec(out)
|
|
32
|
-
if (match?.[1]) resolve(match[1])
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
return { child, address }
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
test('the server listens on 127.0.0.1 unless HOST says otherwise', async () => {
|
|
39
|
-
const { child, address } = await start()
|
|
40
|
-
try {
|
|
41
|
-
assert.match(address, /^http:\/\/127\.0\.0\.1:\d+$/)
|
|
42
|
-
} finally {
|
|
43
|
-
child.kill('SIGTERM')
|
|
44
|
-
await once(child, 'exit')
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
for (const signal of ['SIGTERM', 'SIGINT'] as const) {
|
|
49
|
-
test(`${signal} stops the server cleanly and frees the port`, async () => {
|
|
50
|
-
const { child, address } = await start()
|
|
51
|
-
assert.equal((await fetch(`${address}/signup`)).status, 200)
|
|
52
|
-
const started = Date.now()
|
|
53
|
-
child.kill(signal)
|
|
54
|
-
const [code] = await once(child, 'exit')
|
|
55
|
-
assert.equal(code, 0)
|
|
56
|
-
assert.ok(Date.now() - started < 5000, 'the server took too long to stop')
|
|
57
|
-
await assert.rejects(fetch(address), 'the port should be free')
|
|
58
|
-
})
|
|
59
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2024",
|
|
4
|
-
"lib": ["ES2024", "DOM", "DOM.Iterable"],
|
|
5
|
-
"module": "NodeNext",
|
|
6
|
-
"moduleResolution": "NodeNext",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"verbatimModuleSyntax": true,
|
|
9
|
-
"erasableSyntaxOnly": true,
|
|
10
|
-
"allowImportingTsExtensions": true,
|
|
11
|
-
"noEmit": true,
|
|
12
|
-
"skipLibCheck": true,
|
|
13
|
-
"types": ["node"],
|
|
14
|
-
"jsx": "react-jsx",
|
|
15
|
-
"jsxImportSource": "__PACKAGE__/jsx"
|
|
16
|
-
},
|
|
17
|
-
"include": ["src", "test"],
|
|
18
|
-
"exclude": ["src/client"]
|
|
19
|
-
}
|