@batijs/cli 0.0.212 → 0.0.213

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.
@@ -0,0 +1,114 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ // package.json
28
+ var require_package = __commonJS({
29
+ "package.json"(exports, module) {
30
+ module.exports = {
31
+ name: "@batijs/cloudflare",
32
+ private: true,
33
+ version: "0.0.1",
34
+ description: "",
35
+ type: "module",
36
+ scripts: {
37
+ "check-types": "tsc --noEmit",
38
+ build: "bati-compile-boilerplate"
39
+ },
40
+ keywords: [],
41
+ author: "",
42
+ license: "MIT",
43
+ devDependencies: {
44
+ "@batijs/compile": "workspace:*",
45
+ "@types/node": "^18.19.14",
46
+ "@hattip/adapter-cloudflare-workers": "^0.0.46",
47
+ "npm-run-all2": "^6.2.0",
48
+ "vike-cloudflare": "^0.0.4",
49
+ wrangler: "^3.62.0"
50
+ },
51
+ dependencies: {
52
+ "@batijs/core": "workspace:*"
53
+ },
54
+ files: [
55
+ "dist/"
56
+ ],
57
+ bati: {
58
+ if: {
59
+ flag: "cloudflare"
60
+ }
61
+ },
62
+ exports: {
63
+ "./test": {
64
+ types: "./dist/types/test.d.ts"
65
+ }
66
+ },
67
+ typesVersions: {
68
+ "*": {
69
+ test: [
70
+ "./dist/types/test.d.ts"
71
+ ]
72
+ }
73
+ }
74
+ };
75
+ }
76
+ });
77
+
78
+ // files/$package.json.ts
79
+ import { addDependency, loadAsJson, setScripts } from "@batijs/core";
80
+ async function getPackageJson(props) {
81
+ const packageJson = await loadAsJson(props);
82
+ setScripts(packageJson, {
83
+ "preview:wrangler": {
84
+ value: "wrangler pages dev",
85
+ precedence: 20,
86
+ warnIfReplaced: true
87
+ },
88
+ preview: {
89
+ value: "run-s build preview:wrangler",
90
+ precedence: 20,
91
+ warnIfReplaced: true
92
+ },
93
+ "deploy:wrangler": {
94
+ value: "wrangler pages deploy",
95
+ precedence: 20,
96
+ warnIfReplaced: true
97
+ },
98
+ deploy: {
99
+ value: "run-s build deploy:wrangler",
100
+ precedence: 20,
101
+ warnIfReplaced: true
102
+ }
103
+ });
104
+ return addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
105
+ devDependencies: ["wrangler", "npm-run-all2"],
106
+ dependencies: [
107
+ "vike-cloudflare",
108
+ ...props.meta.BATI.has("hattip") ? ["@hattip/adapter-cloudflare-workers"] : []
109
+ ]
110
+ });
111
+ }
112
+ export {
113
+ getPackageJson as default
114
+ };
@@ -0,0 +1,24 @@
1
+ // files/$vite.config.ts.ts
2
+ import { addVitePlugin, loadAsMagicast } from "@batijs/core";
3
+ async function getViteConfig(props) {
4
+ const mod = await loadAsMagicast(props);
5
+ let options = void 0;
6
+ if (props.meta.BATI.has("hattip") || props.meta.BATI.has("hono")) {
7
+ options = {
8
+ server: {
9
+ kind: props.meta.BATI.has("hono") ? "hono" : "hattip",
10
+ entry: props.meta.BATI.has("hono") ? "hono-entry.ts" : "hattip-entry.ts"
11
+ }
12
+ };
13
+ }
14
+ addVitePlugin(mod, {
15
+ from: "vike-cloudflare",
16
+ constructor: "pages",
17
+ imported: "pages",
18
+ options
19
+ });
20
+ return mod.generate().code;
21
+ }
22
+ export {
23
+ getViteConfig as default
24
+ };
@@ -0,0 +1,4 @@
1
+ name = "my-app"
2
+ compatibility_date = "2024-07-01"
3
+ pages_build_output_dir = "./dist/cloudflare"
4
+ compatibility_flags = [ "nodejs_compat" ]
@@ -130,3 +130,6 @@ dist
130
130
  .yarn/build-state.yml
131
131
  .yarn/install-state.gz
132
132
  .pnp.*
133
+
134
+ # Cloudflare
135
+ .wrangler/
@@ -37,6 +37,17 @@
37
37
  "files"
38
38
  ]
39
39
  },
40
+ {
41
+ "config": {
42
+ "if": {
43
+ "flag": "cloudflare"
44
+ }
45
+ },
46
+ "folder": "@batijs/cloudflare",
47
+ "subfolders": [
48
+ "files"
49
+ ]
50
+ },
40
51
  {
41
52
  "config": {
42
53
  "if": {
package/dist/index.js CHANGED
@@ -1559,13 +1559,13 @@ var import_which_pm_runs = __toESM(require_which_pm_runs(), 1);
1559
1559
  // package.json
1560
1560
  var package_default = {
1561
1561
  name: "@batijs/cli",
1562
- version: "0.0.212",
1562
+ version: "0.0.213",
1563
1563
  type: "module",
1564
1564
  scripts: {
1565
1565
  "check-types": "tsc --noEmit",
1566
1566
  prerelease: "rimraf ./dist",
1567
- prepublishOnly: "pnpm run build-cli",
1568
- "build-cli": "rimraf ./dist && tsup"
1567
+ prepublishOnly: "pnpm run build",
1568
+ build: "rimraf ./dist && tsup"
1569
1569
  },
1570
1570
  keywords: [],
1571
1571
  description: "Next-gen scaffolder. Get started with fully-functional apps, and choose any tool you want",
@@ -1623,14 +1623,18 @@ var rulesMessages = {
1623
1623
  )}. Check https://vike.dev/integration#server-side-tools for details and https://batijs.dev for available servers`
1624
1624
  ),
1625
1625
  [RulesMessage.ERROR_COMPILED_R_REACT]: error(
1626
- `${inverse(bold("React"))} is required when using ${inverse(bold("Compiled"))}.`
1626
+ `${inverse(bold("React"))} is required when using ${inverse(bold("Compiled"))}`
1627
1627
  ),
1628
1628
  [RulesMessage.INFO_HATTIP]: info(`${inverse(bold("HatTip"))} is an experimental project`),
1629
1629
  [RulesMessage.ERROR_DRIZZLE_R_SERVER]: error(
1630
- `A ${inverse(bold("Server"))} is required when using ${inverse(bold("Drizzle"))}.`
1630
+ `A ${inverse(bold("Server"))} is required when using ${inverse(bold("Drizzle"))}`
1631
1631
  ),
1632
1632
  [RulesMessage.ERROR_DATA_R_SERVER]: error(
1633
- `A ${inverse(bold("Server"))} is required when using ${inverse(bold("Data fetching"))}.`
1633
+ `A ${inverse(bold("Server"))} is required when using ${inverse(bold("Data fetching"))}`
1634
+ ),
1635
+ [RulesMessage.ERROR_CLOUDFLARE_R_COMPAT_SERVER]: error(
1636
+ `${inverse(bold("Cloudflare"))} is only compatible with ${inverse(bold("Hono"))} or ${inverse(bold("HatTip"))}.
1637
+ Choose one of them, or simply remove selected Server`
1634
1638
  )
1635
1639
  };
1636
1640
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batijs/cli",
3
- "version": "0.0.212",
3
+ "version": "0.0.213",
4
4
  "type": "module",
5
5
  "keywords": [],
6
6
  "description": "Next-gen scaffolder. Get started with fully-functional apps, and choose any tool you want",
@@ -21,12 +21,12 @@
21
21
  "typescript": "^5.5.2",
22
22
  "vite": "^5.3.2",
23
23
  "which-pm-runs": "^1.1.0",
24
- "@batijs/build": "0.0.212",
25
- "@batijs/compile": "0.0.212"
24
+ "@batijs/build": "0.0.213",
25
+ "@batijs/compile": "0.0.213"
26
26
  },
27
27
  "dependencies": {
28
- "@batijs/core": "0.0.212",
29
- "@batijs/features": "0.0.212"
28
+ "@batijs/core": "0.0.213",
29
+ "@batijs/features": "0.0.213"
30
30
  },
31
31
  "bin": "./dist/index.js",
32
32
  "exports": {
@@ -38,6 +38,6 @@
38
38
  "scripts": {
39
39
  "check-types": "tsc --noEmit",
40
40
  "prerelease": "rimraf ./dist",
41
- "build-cli": "rimraf ./dist && tsup"
41
+ "build": "rimraf ./dist && tsup"
42
42
  }
43
43
  }