@batijs/cli 0.0.629 → 0.0.631
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/dist/asset-env-Jk0sS-Q2.js +35 -0
- package/dist/{asset-package.json-BpYtzVUp.js → asset-package.json-B-yhAahL.js} +2 -0
- package/dist/{asset-package.json-WJvmKmkO.js → asset-package.json-BKz7RIOA.js} +4 -2
- package/dist/asset-package.json-DKULIe-Z.js +26 -0
- package/dist/asset-package.json-DoD27uYD.js +26 -0
- package/dist/{asset-package.json-CHD5b5fl.js → asset-package.json-Y6cFx6TQ.js} +1 -0
- package/dist/boilerplates/@batijs/auth0/bati.config.mjs +24 -1
- package/dist/boilerplates/@batijs/authjs/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/aws/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/aws/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/biome/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/cloudflare/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/cloudflare/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/cloudflare/files/$wrangler.jsonc.js +22 -0
- package/dist/boilerplates/@batijs/cloudflare/files/asset-env.mjs +9 -0
- package/dist/boilerplates/@batijs/cloudflare/files/asset-package.json.mjs +2 -0
- package/dist/boilerplates/@batijs/compiled/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/d1/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/d1-kysely/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/d1-sqlite/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/docker-compose/bati.config.mjs +17 -0
- package/dist/boilerplates/@batijs/docker-compose/files/$.dockerignore.js +19 -0
- package/dist/boilerplates/@batijs/docker-compose/files/$Dockerfile.js +80 -0
- package/dist/boilerplates/@batijs/docker-compose/files/$docker-compose.yml.js +10 -0
- package/dist/boilerplates/@batijs/docker-compose/files/asset-env.mjs +33 -0
- package/dist/boilerplates/@batijs/docker-compose/files/docker-compose.yml +18 -0
- package/dist/boilerplates/@batijs/dokploy/bati.config.mjs +23 -0
- package/dist/boilerplates/@batijs/dokploy/files/$TODO.md.js +28 -0
- package/dist/boilerplates/@batijs/dokploy/files/$package.json.js +13 -0
- package/dist/boilerplates/@batijs/dokploy/files/asset-package.json.mjs +24 -0
- package/dist/boilerplates/@batijs/drizzle/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/edgeone/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/eslint/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/eslint/files/$package.json.js +3 -2
- package/dist/boilerplates/@batijs/eslint/files/asset-package.json.mjs +1 -0
- package/dist/boilerplates/@batijs/express/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/express/files/$package.json.js +5 -2
- package/dist/boilerplates/@batijs/fastify/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/fastify/files/$package.json.js +2 -3
- package/dist/boilerplates/@batijs/google-analytics/bati.config.mjs +14 -4
- package/dist/boilerplates/@batijs/h3/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/h3/files/$package.json.js +1 -2
- package/dist/boilerplates/@batijs/hono/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/hono/files/$package.json.js +1 -2
- package/dist/boilerplates/@batijs/kysely/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/kysely/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/kysely/files/$vite.config.ts.js +20 -0
- package/dist/boilerplates/@batijs/kysely/files/asset-package.json.mjs +4 -2
- package/dist/boilerplates/@batijs/kysely/files/vite-plugin-input.ts +28 -0
- package/dist/boilerplates/@batijs/kysely/types/vite-plugin-input.d.mts +17 -0
- package/dist/boilerplates/@batijs/mantine/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/netlify/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/oxlint/bati.config.mjs +7 -4
- package/dist/boilerplates/@batijs/plausible.io/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/pnpm/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/pnpm/files/$pnpm-workspace.yaml.js +20 -13
- package/dist/boilerplates/@batijs/prettier/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/prisma/bati.config.mjs +13 -1
- package/dist/boilerplates/@batijs/react/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/react-sentry/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/sentry/bati.config.mjs +13 -1
- package/dist/boilerplates/@batijs/shadcn-ui/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/shadcn-ui/files/$package.json.js +2 -3
- package/dist/boilerplates/@batijs/shared/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/shared/files/$.env.js +31 -0
- package/dist/boilerplates/@batijs/shared/files/$package.json.js +23 -0
- package/dist/boilerplates/@batijs/shared/files/asset-env.mjs +24 -0
- package/dist/boilerplates/@batijs/shared-db/bati.config.mjs +17 -4
- package/dist/boilerplates/@batijs/shared-server/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/shared-todo/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/solid/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/solid-sentry/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/sqlite/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/sqlite/files/$package.json.js +2 -2
- package/dist/boilerplates/@batijs/storybook/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/storybook/files/$package.json.js +9 -0
- package/dist/boilerplates/@batijs/storybook/files/asset-package.json.mjs +24 -0
- package/dist/boilerplates/@batijs/tailwindcss/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/telefunc/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/trpc/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/ts-rest/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/universal-deploy/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/universal-deploy/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/vercel/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/vercel/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/vue/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/vue-sentry/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/vue-sentry/files/$package.json.js +1 -1
- package/dist/boilerplates/boilerplates.json +14 -3
- package/dist/index.js +15 -7
- package/package.json +3 -3
- package/dist/boilerplates/@batijs/auth0/files/$.env.js +0 -17
- package/dist/boilerplates/@batijs/auth0/files/$wrangler.jsonc.js +0 -18
- package/dist/boilerplates/@batijs/drizzle/files/$.env.js +0 -10
- package/dist/boilerplates/@batijs/google-analytics/files/$.env.js +0 -11
- package/dist/boilerplates/@batijs/kysely/files/$.env.js +0 -10
- package/dist/boilerplates/@batijs/prisma/files/$.env.js +0 -15
- package/dist/boilerplates/@batijs/sentry/files/$.env.js +0 -13
- package/dist/boilerplates/@batijs/shared/files/package.json +0 -15
- package/dist/boilerplates/@batijs/sqlite/files/$.env.js +0 -10
- /package/dist/{asset-package.json-BdZNR8Cf.js → asset-package2.json-BdZNR8Cf.js} +0 -0
- /package/dist/{asset-package.json-CGHsBMPO.js → asset-package2.json-CGHsBMPO.js} +0 -0
- /package/dist/{asset-package.json-JaXo-ozU.js → asset-package2.json-JaXo-ozU.js} +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { committedValue, isServerVar } from "@batijs/core";
|
|
4
|
+
//#region ../../boilerplates/docker-compose/dist/files/asset-env.mjs
|
|
5
|
+
/**
|
|
6
|
+
* `KEY=<expr>` lines for the docker-compose `services.<app>.environment` list:
|
|
7
|
+
* secrets are pulled from the host (`${KEY}`), defaulted vars are host-overridable
|
|
8
|
+
* (`${KEY:-<default>}`).
|
|
9
|
+
*/
|
|
10
|
+
function composeEnvEntries(registry) {
|
|
11
|
+
return registry.filter(isServerVar).map((def) => def.scope === "secret" ? `${def.key}=\${${def.key}}` : `${def.key}=\${${def.key}:-${committedValue(def, "compose")}}`);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Dockerfile `ENV` defaults grouped by `group` (first-seen order), one
|
|
15
|
+
* `.env(vars, { comment })` per group. Secrets default to empty — compose
|
|
16
|
+
* overrides them at runtime.
|
|
17
|
+
*/
|
|
18
|
+
function serverEnvDefaults(registry) {
|
|
19
|
+
const groups = /* @__PURE__ */ new Map();
|
|
20
|
+
for (const def of registry.filter(isServerVar)) {
|
|
21
|
+
const groupKey = def.group ?? "";
|
|
22
|
+
let group = groups.get(groupKey);
|
|
23
|
+
if (!group) {
|
|
24
|
+
group = {
|
|
25
|
+
comment: def.group,
|
|
26
|
+
vars: {}
|
|
27
|
+
};
|
|
28
|
+
groups.set(groupKey, group);
|
|
29
|
+
}
|
|
30
|
+
group.vars[def.key] = def.scope === "secret" ? "" : committedValue(def, "dockerfile");
|
|
31
|
+
}
|
|
32
|
+
return [...groups.values()];
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { serverEnvDefaults as n, composeEnvEntries as t };
|
|
@@ -9,6 +9,7 @@ var package_default = {
|
|
|
9
9
|
type: "module",
|
|
10
10
|
scripts: {
|
|
11
11
|
"check-types": "tsc --noEmit",
|
|
12
|
+
"test": "vitest run",
|
|
12
13
|
"build": "bati-compile-boilerplate"
|
|
13
14
|
},
|
|
14
15
|
keywords: [],
|
|
@@ -19,6 +20,7 @@ var package_default = {
|
|
|
19
20
|
"@batijs/core": "workspace:",
|
|
20
21
|
"@cloudflare/vite-plugin": "^1.38.0",
|
|
21
22
|
"@types/node": "^20.19.37",
|
|
23
|
+
"vitest": "^4.1.7",
|
|
22
24
|
"wrangler": "^4.94.0"
|
|
23
25
|
},
|
|
24
26
|
files: ["dist/"],
|
|
@@ -32,14 +32,16 @@ var package_default = {
|
|
|
32
32
|
"./database/kysely/migrate": { "types": "./dist/types/database/kysely/migrate.d.mts" },
|
|
33
33
|
"./database/kysely/migrations/001_create_todos_table": { "types": "./dist/types/database/kysely/migrations/001_create_todos_table.d.mts" },
|
|
34
34
|
"./database/kysely/queries/todos": { "types": "./dist/types/database/kysely/queries/todos.d.mts" },
|
|
35
|
-
"./database/kysely/types": { "types": "./dist/types/database/kysely/types.d.mts" }
|
|
35
|
+
"./database/kysely/types": { "types": "./dist/types/database/kysely/types.d.mts" },
|
|
36
|
+
"./vite-plugin-input": { "types": "./dist/types/vite-plugin-input.d.mts" }
|
|
36
37
|
},
|
|
37
38
|
typesVersions: { "*": {
|
|
38
39
|
"database/kysely/db": ["./dist/types/database/kysely/db.d.mts"],
|
|
39
40
|
"database/kysely/migrate": ["./dist/types/database/kysely/migrate.d.mts"],
|
|
40
41
|
"database/kysely/migrations/001_create_todos_table": ["./dist/types/database/kysely/migrations/001_create_todos_table.d.mts"],
|
|
41
42
|
"database/kysely/queries/todos": ["./dist/types/database/kysely/queries/todos.d.mts"],
|
|
42
|
-
"database/kysely/types": ["./dist/types/database/kysely/types.d.mts"]
|
|
43
|
+
"database/kysely/types": ["./dist/types/database/kysely/types.d.mts"],
|
|
44
|
+
"vite-plugin-input": ["./dist/types/vite-plugin-input.d.mts"]
|
|
43
45
|
} },
|
|
44
46
|
nx: { "tags": ["type:boilerplate"] }
|
|
45
47
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
//#region ../../boilerplates/storybook/dist/files/asset-package.json.mjs
|
|
4
|
+
var package_default = {
|
|
5
|
+
name: "@batijs/storybook",
|
|
6
|
+
"private": true,
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
description: "",
|
|
9
|
+
type: "module",
|
|
10
|
+
scripts: {
|
|
11
|
+
"check-types": "tsc --noEmit",
|
|
12
|
+
"build": "bati-compile-boilerplate"
|
|
13
|
+
},
|
|
14
|
+
keywords: [],
|
|
15
|
+
author: "",
|
|
16
|
+
license: "MIT",
|
|
17
|
+
devDependencies: {
|
|
18
|
+
"@batijs/compile": "workspace:*",
|
|
19
|
+
"@batijs/core": "workspace:",
|
|
20
|
+
"@types/node": "^20.19.37"
|
|
21
|
+
},
|
|
22
|
+
files: ["dist/"],
|
|
23
|
+
nx: { "tags": ["type:boilerplate"] }
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { package_default as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
//#region ../../boilerplates/dokploy/dist/files/asset-package.json.mjs
|
|
4
|
+
var package_default = {
|
|
5
|
+
name: "@batijs/dokploy",
|
|
6
|
+
"private": true,
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
description: "",
|
|
9
|
+
type: "module",
|
|
10
|
+
scripts: {
|
|
11
|
+
"check-types": "tsc --noEmit",
|
|
12
|
+
"build": "bati-compile-boilerplate"
|
|
13
|
+
},
|
|
14
|
+
keywords: [],
|
|
15
|
+
author: "",
|
|
16
|
+
license: "MIT",
|
|
17
|
+
devDependencies: {
|
|
18
|
+
"@batijs/compile": "workspace:*",
|
|
19
|
+
"@batijs/core": "workspace:",
|
|
20
|
+
"@types/node": "^20.19.37"
|
|
21
|
+
},
|
|
22
|
+
nx: { "tags": ["type:boilerplate"] },
|
|
23
|
+
files: ["dist/"]
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { package_default as default };
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -11,6 +11,29 @@ var bati_config_default = t({
|
|
|
11
11
|
if(meta) {
|
|
12
12
|
return meta.BATI.has("auth0");
|
|
13
13
|
},
|
|
14
|
+
env: () => [
|
|
15
|
+
{
|
|
16
|
+
key: "AUTH0_CLIENT_ID",
|
|
17
|
+
scope: "secret",
|
|
18
|
+
comment: "Auth0 Client ID",
|
|
19
|
+
devValueFrom: "TEST_AUTH0_CLIENT_ID",
|
|
20
|
+
group: "auth0"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: "AUTH0_CLIENT_SECRET",
|
|
24
|
+
scope: "secret",
|
|
25
|
+
comment: "Auth0 Client Secret",
|
|
26
|
+
devValueFrom: "TEST_AUTH0_CLIENT_SECRET",
|
|
27
|
+
group: "auth0"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
key: "AUTH0_ISSUER_BASE_URL",
|
|
31
|
+
scope: "secret",
|
|
32
|
+
comment: "Auth0 base URL",
|
|
33
|
+
devValueFrom: "TEST_AUTH0_ISSUER_BASE_URL",
|
|
34
|
+
group: "auth0"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
14
37
|
nextSteps(_meta, _packageManager, { bold }) {
|
|
15
38
|
return [{
|
|
16
39
|
type: "text",
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { loadPackageJson } from "@batijs/core";
|
|
4
4
|
//#region ../../boilerplates/cloudflare/dist/files/$package.json.mjs
|
|
5
5
|
async function getPackageJson(props) {
|
|
6
|
-
return (await loadPackageJson(props, await import("../../../../asset-package.json-
|
|
6
|
+
return (await loadPackageJson(props, await import("../../../../asset-package.json-B-yhAahL.js").then((x) => x.default))).removeScript("prod").setScript("deploy", {
|
|
7
7
|
value: "vike build && wrangler deploy",
|
|
8
8
|
precedence: 25,
|
|
9
9
|
warnIfReplaced: true
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { committedValue, isServerVar, loadAsJson, secretDevValue } from "@batijs/core";
|
|
4
|
+
//#region ../../boilerplates/cloudflare/dist/files/asset-env.mjs
|
|
5
|
+
function wranglerEnv(registry) {
|
|
6
|
+
const vars = {};
|
|
7
|
+
for (const def of registry.filter(isServerVar)) vars[def.key] = def.scope === "secret" ? secretDevValue(def) : committedValue(def, "wrangler");
|
|
8
|
+
return vars;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region ../../boilerplates/cloudflare/dist/files/$wrangler.jsonc.mjs
|
|
12
|
+
async function getWrangler(props) {
|
|
13
|
+
const wrangler = await loadAsJson(props);
|
|
14
|
+
const vars = wranglerEnv(props.env);
|
|
15
|
+
if (Object.keys(vars).length > 0) wrangler.vars = {
|
|
16
|
+
...wrangler.vars,
|
|
17
|
+
...vars
|
|
18
|
+
};
|
|
19
|
+
return wrangler;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { getWrangler as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { committedValue, isServerVar, secretDevValue } from "@batijs/core";
|
|
2
|
+
//#region env.ts
|
|
3
|
+
function wranglerEnv(registry) {
|
|
4
|
+
const vars = {};
|
|
5
|
+
for (const def of registry.filter(isServerVar)) vars[def.key] = def.scope === "secret" ? secretDevValue(def) : committedValue(def, "wrangler");
|
|
6
|
+
return vars;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { wranglerEnv };
|
|
@@ -7,6 +7,7 @@ var package_default = {
|
|
|
7
7
|
type: "module",
|
|
8
8
|
scripts: {
|
|
9
9
|
"check-types": "tsc --noEmit",
|
|
10
|
+
"test": "vitest run",
|
|
10
11
|
"build": "bati-compile-boilerplate"
|
|
11
12
|
},
|
|
12
13
|
keywords: [],
|
|
@@ -17,6 +18,7 @@ var package_default = {
|
|
|
17
18
|
"@batijs/core": "workspace:",
|
|
18
19
|
"@cloudflare/vite-plugin": "^1.38.0",
|
|
19
20
|
"@types/node": "^20.19.37",
|
|
21
|
+
"vitest": "^4.1.7",
|
|
20
22
|
"wrangler": "^4.94.0"
|
|
21
23
|
},
|
|
22
24
|
files: ["dist/"],
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region ../../packages/core/dist/config.js
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
if (!e) throw Error(t);
|
|
4
|
+
}
|
|
5
|
+
function t(t) {
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region bati.config.ts
|
|
10
|
+
var bati_config_default = t({
|
|
11
|
+
if(meta) {
|
|
12
|
+
return meta.BATI.has("dokploy");
|
|
13
|
+
},
|
|
14
|
+
enforce: "post"
|
|
15
|
+
});
|
|
16
|
+
//#endregion
|
|
17
|
+
export { bati_config_default as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
//#region ../../boilerplates/docker-compose/dist/files/$.dockerignore.mjs
|
|
4
|
+
async function getDockerignore(props) {
|
|
5
|
+
const lines = [
|
|
6
|
+
"node_modules",
|
|
7
|
+
".git",
|
|
8
|
+
"dist",
|
|
9
|
+
".env",
|
|
10
|
+
".env.*",
|
|
11
|
+
"!.env.example",
|
|
12
|
+
"*.log",
|
|
13
|
+
".DS_Store"
|
|
14
|
+
];
|
|
15
|
+
if (props.meta.BATI_TEST) lines.push("# e2e plumbing (lives in the sibling `<app>.e2e/` workspace, never the image)", "batijs-tests-utils-*.tgz", "bati.config.json", "vitest.config.ts", "*.spec.ts");
|
|
16
|
+
return `${lines.join("\n")}\n`;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { getDockerignore as default };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { n as serverEnvDefaults } from "../../../../asset-env-Jk0sS-Q2.js";
|
|
4
|
+
import { dockerPackageManager, dockerfile, packageManager } from "@batijs/core";
|
|
5
|
+
//#region ../../boilerplates/docker-compose/dist/files/$Dockerfile.mjs
|
|
6
|
+
async function getDockerfile(props) {
|
|
7
|
+
const { meta } = props;
|
|
8
|
+
let pm = packageManager();
|
|
9
|
+
const deps = Object.keys({
|
|
10
|
+
...props.packageJson.dependencies,
|
|
11
|
+
...props.packageJson.devDependencies
|
|
12
|
+
});
|
|
13
|
+
if (pm.name === "bun" && deps.includes("better-sqlite3")) pm = {
|
|
14
|
+
name: "npm",
|
|
15
|
+
run: "npm run",
|
|
16
|
+
exec: "npx"
|
|
17
|
+
};
|
|
18
|
+
const nodeCli = pm.name === "bun" ? "bun" : "node";
|
|
19
|
+
const run = pm.run;
|
|
20
|
+
const config = dockerPackageManager(pm.name, { frozenLockfile: !meta.BATI_TEST });
|
|
21
|
+
const startupMigrations = [];
|
|
22
|
+
const migrationCopies = [];
|
|
23
|
+
if (meta.BATI.has("sqlite")) {
|
|
24
|
+
startupMigrations.push(`${run} sqlite:migrate`);
|
|
25
|
+
migrationCopies.push({
|
|
26
|
+
sources: ["/app/database/sqlite"],
|
|
27
|
+
dest: "./database/sqlite",
|
|
28
|
+
from: "builder"
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (meta.BATI.has("drizzle")) {
|
|
32
|
+
startupMigrations.push(`${run} drizzle:migrate`);
|
|
33
|
+
migrationCopies.push({
|
|
34
|
+
sources: ["/app/database/migrations"],
|
|
35
|
+
dest: "./database/migrations",
|
|
36
|
+
from: "deps-dev"
|
|
37
|
+
});
|
|
38
|
+
migrationCopies.push({
|
|
39
|
+
sources: ["/app/drizzle.config.ts"],
|
|
40
|
+
dest: "./drizzle.config.ts",
|
|
41
|
+
from: "builder"
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
if (meta.BATI.has("kysely")) {
|
|
45
|
+
startupMigrations.push(`${nodeCli} ./dist/server/migrate.mjs`);
|
|
46
|
+
migrationCopies.push({
|
|
47
|
+
sources: ["/app/database/kysely/migrations"],
|
|
48
|
+
dest: "./dist/server/migrations",
|
|
49
|
+
from: "builder"
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const startCmd = startupMigrations.length > 0 ? [
|
|
53
|
+
"sh",
|
|
54
|
+
"-c",
|
|
55
|
+
[...startupMigrations, `${nodeCli} ./dist/server/index.mjs`].join(" && ")
|
|
56
|
+
] : [nodeCli, "./dist/server/index.mjs"];
|
|
57
|
+
const installSources = ["package.json", ...config.lockfiles];
|
|
58
|
+
return `${dockerfile().from(config.image, {
|
|
59
|
+
as: "deps-dev",
|
|
60
|
+
comment: "install all dependencies (devDeps + deps) for build & migrations"
|
|
61
|
+
}).workdir("/app").when(config.corepack, (b) => b.run("corepack enable")).copy(["."], ".").run(config.install).when(meta.BATI.has("drizzle"), (b) => b.env({ DATABASE_URL: "/app/database/sqlite.db" }).run(`${run} drizzle:generate`)).from(config.image, {
|
|
62
|
+
as: "deps-prod",
|
|
63
|
+
comment: "install production-only dependencies for the runtime image"
|
|
64
|
+
}).workdir("/app").when(config.corepack, (b) => b.run("corepack enable")).copy(installSources, "./").run(config.installProd).from(config.image, {
|
|
65
|
+
as: "builder",
|
|
66
|
+
comment: "build the application"
|
|
67
|
+
}).workdir("/app").when(config.corepack, (b) => b.run("corepack enable")).copy(["/app/node_modules"], "./node_modules", { from: "deps-dev" }).copy(["."], ".").run(`${run} build`).from(config.image, {
|
|
68
|
+
as: "runner",
|
|
69
|
+
comment: "production runtime image"
|
|
70
|
+
}).workdir("/app").env({
|
|
71
|
+
NODE_ENV: "production",
|
|
72
|
+
PORT: "3000"
|
|
73
|
+
}).pipe((b) => {
|
|
74
|
+
for (const group of serverEnvDefaults(props.env)) b.env(group.vars, { comment: group.comment });
|
|
75
|
+
}).when(config.corepack, (b) => b.run("corepack enable")).copy(installSources, "./").copy(["/app/node_modules"], "./node_modules", { from: "deps-prod" }).copy(["/app/dist"], "./dist", { from: "builder" }).pipe((b) => {
|
|
76
|
+
for (const { sources, dest, from } of migrationCopies) b.copy(sources, dest, { from });
|
|
77
|
+
}).expose(3e3).cmd(startCmd).build()}\n`;
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
export { getDockerfile as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { t as composeEnvEntries } from "../../../../asset-env-Jk0sS-Q2.js";
|
|
4
|
+
import { setComposeEnvironment } from "@batijs/core";
|
|
5
|
+
//#region ../../boilerplates/docker-compose/dist/files/$docker-compose.yml.mjs
|
|
6
|
+
async function getDockerCompose(props) {
|
|
7
|
+
return setComposeEnvironment(await props.readfile(), composeEnvEntries(props.env));
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { getDockerCompose as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { committedValue, isServerVar } from "@batijs/core";
|
|
2
|
+
//#region env.ts
|
|
3
|
+
/**
|
|
4
|
+
* `KEY=<expr>` lines for the docker-compose `services.<app>.environment` list:
|
|
5
|
+
* secrets are pulled from the host (`${KEY}`), defaulted vars are host-overridable
|
|
6
|
+
* (`${KEY:-<default>}`).
|
|
7
|
+
*/
|
|
8
|
+
function composeEnvEntries(registry) {
|
|
9
|
+
return registry.filter(isServerVar).map((def) => def.scope === "secret" ? `${def.key}=\${${def.key}}` : `${def.key}=\${${def.key}:-${committedValue(def, "compose")}}`);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Dockerfile `ENV` defaults grouped by `group` (first-seen order), one
|
|
13
|
+
* `.env(vars, { comment })` per group. Secrets default to empty — compose
|
|
14
|
+
* overrides them at runtime.
|
|
15
|
+
*/
|
|
16
|
+
function serverEnvDefaults(registry) {
|
|
17
|
+
const groups = /* @__PURE__ */ new Map();
|
|
18
|
+
for (const def of registry.filter(isServerVar)) {
|
|
19
|
+
const groupKey = def.group ?? "";
|
|
20
|
+
let group = groups.get(groupKey);
|
|
21
|
+
if (!group) {
|
|
22
|
+
group = {
|
|
23
|
+
comment: def.group,
|
|
24
|
+
vars: {}
|
|
25
|
+
};
|
|
26
|
+
groups.set(groupKey, group);
|
|
27
|
+
}
|
|
28
|
+
group.vars[def.key] = def.scope === "secret" ? "" : committedValue(def, "dockerfile");
|
|
29
|
+
}
|
|
30
|
+
return [...groups.values()];
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { composeEnvEntries, serverEnvDefaults };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
services:
|
|
2
|
+
app:
|
|
3
|
+
build:
|
|
4
|
+
context: .
|
|
5
|
+
dockerfile: Dockerfile
|
|
6
|
+
ports:
|
|
7
|
+
- "${PORT:-3000}:3000"
|
|
8
|
+
environment:
|
|
9
|
+
- NODE_ENV=production
|
|
10
|
+
- PORT=3000
|
|
11
|
+
# BATI.hasDatabase
|
|
12
|
+
volumes:
|
|
13
|
+
- sqlite_data:/app/data
|
|
14
|
+
restart: unless-stopped
|
|
15
|
+
|
|
16
|
+
# BATI.hasDatabase
|
|
17
|
+
volumes:
|
|
18
|
+
sqlite_data:
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region ../../packages/core/dist/config.js
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
if (!e) throw Error(t);
|
|
4
|
+
}
|
|
5
|
+
function t(t) {
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region bati.config.ts
|
|
10
|
+
var bati_config_default = t({
|
|
11
|
+
if(meta) {
|
|
12
|
+
return meta.BATI.has("dokploy");
|
|
13
|
+
},
|
|
14
|
+
nextSteps(_meta, _packageManager, { bold }) {
|
|
15
|
+
return [{
|
|
16
|
+
type: "text",
|
|
17
|
+
step: `${bold("dokploy")}: Check ${bold("TODO.md")} for remaining steps.`
|
|
18
|
+
}];
|
|
19
|
+
},
|
|
20
|
+
enforce: "post"
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
export { bati_config_default as default };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { loadMarkdown } from "@batijs/core";
|
|
4
|
+
//#region ../../boilerplates/dokploy/dist/files/$TODO.md.mjs
|
|
5
|
+
async function getTodo(props) {
|
|
6
|
+
const content = await loadMarkdown(props);
|
|
7
|
+
content.addMarkdownFeature(`
|
|
8
|
+
## Dokploy
|
|
9
|
+
|
|
10
|
+
1. **Push your repository** to a Git provider (GitHub, GitLab, Bitbucket, etc.)
|
|
11
|
+
|
|
12
|
+
2. **Install Dokploy** on your VPS if you haven't already:
|
|
13
|
+
\`\`\`sh
|
|
14
|
+
curl -sSL https://dokploy.com/install.sh | sudo sh
|
|
15
|
+
\`\`\`
|
|
16
|
+
|
|
17
|
+
3. **Open Dokploy** at \`http://<your-server-ip>:3000\` and complete the initial setup.
|
|
18
|
+
|
|
19
|
+
4. **Create a new application** in the Dokploy dashboard and connect it to your repository.
|
|
20
|
+
|
|
21
|
+
5. **Deploy** — Dokploy will use the \`docker-compose.yml\` at the root of your repository to build and start your application.
|
|
22
|
+
|
|
23
|
+
See also: https://docs.dokploy.com
|
|
24
|
+
`, "dokploy");
|
|
25
|
+
return content;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { getTodo as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { loadPackageJson } from "@batijs/core";
|
|
4
|
+
//#region ../../boilerplates/dokploy/dist/files/$package.json.mjs
|
|
5
|
+
async function getPackageJson(props) {
|
|
6
|
+
return (await loadPackageJson(props, await import("../../../../asset-package.json-DoD27uYD.js").then((x) => x.default))).setScript("prod", {
|
|
7
|
+
value: "docker compose up -d --build",
|
|
8
|
+
precedence: 25,
|
|
9
|
+
warnIfReplaced: true
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { getPackageJson as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region package.json
|
|
2
|
+
var package_default = {
|
|
3
|
+
name: "@batijs/dokploy",
|
|
4
|
+
"private": true,
|
|
5
|
+
version: "0.0.1",
|
|
6
|
+
description: "",
|
|
7
|
+
type: "module",
|
|
8
|
+
scripts: {
|
|
9
|
+
"check-types": "tsc --noEmit",
|
|
10
|
+
"build": "bati-compile-boilerplate"
|
|
11
|
+
},
|
|
12
|
+
keywords: [],
|
|
13
|
+
author: "",
|
|
14
|
+
license: "MIT",
|
|
15
|
+
devDependencies: {
|
|
16
|
+
"@batijs/compile": "workspace:*",
|
|
17
|
+
"@batijs/core": "workspace:",
|
|
18
|
+
"@types/node": "^20.19.37"
|
|
19
|
+
},
|
|
20
|
+
nx: { "tags": ["type:boilerplate"] },
|
|
21
|
+
files: ["dist/"]
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { package_default as default };
|