create-hollware 0.3.0 → 0.5.0
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 +21 -7
- package/dist/index.d.mts +30 -8
- package/dist/index.mjs +212 -20
- package/package.json +4 -3
- package/template/AGENTS.md +14 -0
- package/template/README.md +65 -0
- package/template/gitignore +5 -0
- package/template/hollware.config.ts +36 -0
- package/template/package.json +34 -0
- package/template/src/worker.ts +15 -0
- package/template/test/apply-migrations.ts +5 -0
- package/template/test/env.d.ts +10 -0
- package/template/test/worker.workerd.test.ts +100 -0
- package/template/tsconfig.json +34 -0
- package/template/vite.config.ts +18 -0
- package/template/vitest.config.ts +38 -0
- package/template/worker-configuration.d.ts +16246 -0
- package/template/wrangler.jsonc +53 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"lib": [
|
|
5
|
+
"es2024"
|
|
6
|
+
],
|
|
7
|
+
"module": "esnext",
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"moduleDetection": "force",
|
|
10
|
+
"strict": true,
|
|
11
|
+
"noUncheckedIndexedAccess": true,
|
|
12
|
+
"noImplicitOverride": true,
|
|
13
|
+
"noFallthroughCasesInSwitch": true,
|
|
14
|
+
"noUnusedLocals": true,
|
|
15
|
+
"noUnusedParameters": true,
|
|
16
|
+
"verbatimModuleSyntax": true,
|
|
17
|
+
"isolatedModules": true,
|
|
18
|
+
"erasableSyntaxOnly": true,
|
|
19
|
+
"allowImportingTsExtensions": true,
|
|
20
|
+
"resolveJsonModule": true,
|
|
21
|
+
"skipLibCheck": true,
|
|
22
|
+
"noEmit": true,
|
|
23
|
+
"types": [
|
|
24
|
+
"./worker-configuration.d.ts",
|
|
25
|
+
"@cloudflare/vitest-plugin/types"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"include": [
|
|
29
|
+
"worker-configuration.d.ts",
|
|
30
|
+
"hollware.config.ts",
|
|
31
|
+
"src",
|
|
32
|
+
"test"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { cloudflare } from '@cloudflare/vite-plugin'
|
|
2
|
+
import { adminAssets } from '@hollware/admin'
|
|
3
|
+
import { defineConfig } from 'vite-plus'
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: [cloudflare()],
|
|
7
|
+
// The admin's built files: served at /admin/ in development, and copied into the build, where
|
|
8
|
+
// the Worker's static assets hold them.
|
|
9
|
+
publicDir: adminAssets(),
|
|
10
|
+
// Hollware's own port, not Vite's default 5173, which the frontend next to it usually takes.
|
|
11
|
+
// It must stay the port of HOLLWARE_PUBLIC_URL in wrangler.jsonc: with strictPort, a port in
|
|
12
|
+
// use fails instead of moving to one the Host check would refuse.
|
|
13
|
+
server: { port: 5199, strictPort: true },
|
|
14
|
+
build: {
|
|
15
|
+
// What you deploy is what the size budget of Hollware measures: minified.
|
|
16
|
+
minify: true,
|
|
17
|
+
},
|
|
18
|
+
})
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { cloudflareTest, readD1Migrations } from '@cloudflare/vitest-plugin'
|
|
2
|
+
import { defineConfig } from 'vite-plus'
|
|
3
|
+
import { unstable_readConfig as readWranglerConfig } from 'wrangler'
|
|
4
|
+
|
|
5
|
+
// The test database gets the migrations that wrangler.jsonc points at, so the tests cannot drift
|
|
6
|
+
// from what `wrangler d1 migrations apply` would run.
|
|
7
|
+
const wranglerConfig = readWranglerConfig({ config: `${import.meta.dirname}/wrangler.jsonc` })
|
|
8
|
+
const migrationsDir: unknown = wranglerConfig.d1_databases.find(
|
|
9
|
+
(database: { binding: string }) => database.binding === 'DB',
|
|
10
|
+
)?.migrations_dir
|
|
11
|
+
if (typeof migrationsDir !== 'string') {
|
|
12
|
+
throw new Error('wrangler.jsonc must declare the D1 binding DB with a migrations_dir')
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default defineConfig({
|
|
16
|
+
plugins: [
|
|
17
|
+
cloudflareTest(async () => ({
|
|
18
|
+
wrangler: { configPath: './wrangler.jsonc' },
|
|
19
|
+
miniflare: {
|
|
20
|
+
// Read here in Node and applied inside workerd by the setup file.
|
|
21
|
+
bindings: {
|
|
22
|
+
TEST_MIGRATIONS: await readD1Migrations({
|
|
23
|
+
projectPath: import.meta.dirname,
|
|
24
|
+
migrationsDir,
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
})),
|
|
29
|
+
],
|
|
30
|
+
test: {
|
|
31
|
+
name: 'starter:workerd',
|
|
32
|
+
include: ['test/**/*.workerd.test.ts'],
|
|
33
|
+
setupFiles: ['test/apply-migrations.ts'],
|
|
34
|
+
// The default, kept explicit: @cloudflare/vitest-plugin cannot read Vitest 5's module cache from
|
|
35
|
+
// workerd ("no such file or directory, readAll .vitest-cache/..."), cloudflare/workers-sdk#15618.
|
|
36
|
+
fsModuleCache: false,
|
|
37
|
+
},
|
|
38
|
+
})
|