kizlo 0.13.0 → 0.13.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/dist/cli/commands/init.js +1 -1
- package/dist/cli/daemon/config.js +1 -1
- package/dist/cli/utils.js +14 -25
- package/dist/package.js +1 -1
- package/dist/router.d.ts +5 -5
- package/package.json +2 -1
|
@@ -174,7 +174,7 @@ const init = defineCommand({
|
|
|
174
174
|
process.exit(1);
|
|
175
175
|
}
|
|
176
176
|
const pkg = readPkg(pkgPath);
|
|
177
|
-
const detectedPm = detectPackageManager(cwd);
|
|
177
|
+
const detectedPm = await detectPackageManager(cwd);
|
|
178
178
|
const pm = detectedPm ?? (yes ? detectInvokingPackageManager() ?? "npm" : await selectPackageManager("Couldn't detect this project's package manager — which should Kizlo use?"));
|
|
179
179
|
if (!detectedPm && !yes) persistPackageManagerField(cwd, pm);
|
|
180
180
|
const hasKizlo = Boolean(pkg.dependencies?.kizlo) || Boolean(pkg.devDependencies?.kizlo);
|
|
@@ -130,7 +130,7 @@ async function resolveTestConfig(cwd) {
|
|
|
130
130
|
portExplicit: test.port !== void 0,
|
|
131
131
|
fixtures: test.fixtures ?? [],
|
|
132
132
|
credentialsPath: credentialsPath(cwd),
|
|
133
|
-
packageManager: test.packageManager ?? detectPackageManager(configDir) ?? "npm"
|
|
133
|
+
packageManager: test.packageManager ?? await detectPackageManager(configDir) ?? "npm"
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
/**
|
package/dist/cli/utils.js
CHANGED
|
@@ -5,6 +5,7 @@ import { fileURLToPath } from "node:url";
|
|
|
5
5
|
import { spawn, spawnSync } from "node:child_process";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import * as p from "@clack/prompts";
|
|
8
|
+
import { detect } from "package-manager-detector/detect";
|
|
8
9
|
|
|
9
10
|
//#region src/cli/utils.ts
|
|
10
11
|
/**
|
|
@@ -134,32 +135,20 @@ function getVersion() {
|
|
|
134
135
|
return JSON.parse(fs.readFileSync(pkgPath, "utf8")).version;
|
|
135
136
|
}
|
|
136
137
|
/**
|
|
137
|
-
* The manager a project
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
138
|
+
* The package manager a project uses, from evidence in the project or an enclosing workspace — a lockfile
|
|
139
|
+
* (the strongest signal, it reflects an actual install), else package.json's corepack `packageManager` /
|
|
140
|
+
* `devEngines.packageManager` field (declared intent, present before the first install). Delegates to
|
|
141
|
+
* `package-manager-detector`, which recognises every lockfile variant (npm's `package-lock.json` and
|
|
142
|
+
* `npm-shrinkwrap.json` included) and walks up from `cwd` to the filesystem root — so a package in a
|
|
143
|
+
* monorepo resolves to the manager pinned by the workspace root, where the single lockfile lives. Returns
|
|
144
|
+
* `undefined` when no signal is found anywhere up the tree, or the manager isn't one Kizlo supports, rather
|
|
145
|
+
* than guessing: the invoking manager is unreliable (`npx` reports `npm` whatever the user really uses).
|
|
146
|
+
* Callers that can't proceed without one should ask the user (see `selectPackageManager`) instead of
|
|
147
|
+
* defaulting.
|
|
141
148
|
*/
|
|
142
|
-
function
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return name === "pnpm" || name === "yarn" || name === "bun" || name === "npm" ? name : void 0;
|
|
146
|
-
} catch {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* The package manager a project uses, from evidence in the project itself — a lockfile (the strongest
|
|
152
|
-
* signal, it reflects an actual install), else package.json's corepack `packageManager` field (declared
|
|
153
|
-
* intent, present before the first install). Returns `undefined` when neither is present rather than
|
|
154
|
-
* guessing: the invoking manager is unreliable (`npx` reports `npm` whatever the user really uses), and a
|
|
155
|
-
* missing lockfile can just mean a freshly bootstrapped project in a monorepo. Callers that can't proceed
|
|
156
|
-
* without one should ask the user (see `selectPackageManager`) instead of defaulting.
|
|
157
|
-
*/
|
|
158
|
-
function detectPackageManager(cwd) {
|
|
159
|
-
if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
160
|
-
if (fs.existsSync(path.join(cwd, "yarn.lock"))) return "yarn";
|
|
161
|
-
if (fs.existsSync(path.join(cwd, "bun.lockb")) || fs.existsSync(path.join(cwd, "bun.lock"))) return "bun";
|
|
162
|
-
return packageManagerField(cwd);
|
|
149
|
+
async function detectPackageManager(cwd) {
|
|
150
|
+
const name = (await detect({ cwd }))?.name;
|
|
151
|
+
return name === "pnpm" || name === "yarn" || name === "bun" || name === "npm" ? name : void 0;
|
|
163
152
|
}
|
|
164
153
|
/** The installed version of `pm`, from `pm --version` (e.g. `"9.0.0"`). Undefined when it can't be run. */
|
|
165
154
|
function packageManagerVersion(pm) {
|
package/dist/package.js
CHANGED
package/dist/router.d.ts
CHANGED
|
@@ -179,7 +179,7 @@ declare const ROUTER_MAP: {
|
|
|
179
179
|
include?: string | number | (string | number)[] | undefined;
|
|
180
180
|
offset?: string | number | undefined;
|
|
181
181
|
order?: "asc" | "desc" | undefined;
|
|
182
|
-
orderby?: "
|
|
182
|
+
orderby?: "date" | "id" | "slug" | "parent" | "title" | "author" | "include" | "modified" | "relevance" | "include_slugs" | undefined;
|
|
183
183
|
searchColumns?: ("post_title" | "post_content" | "post_excerpt")[] | undefined;
|
|
184
184
|
slug?: string | string[] | undefined;
|
|
185
185
|
taxRelation?: "AND" | "OR" | undefined;
|
|
@@ -507,7 +507,7 @@ declare const ROUTER_MAP: {
|
|
|
507
507
|
include?: string | number | (string | number)[] | undefined;
|
|
508
508
|
offset?: string | number | undefined;
|
|
509
509
|
order?: "asc" | "desc" | undefined;
|
|
510
|
-
orderby?: "
|
|
510
|
+
orderby?: "date" | "id" | "slug" | "parent" | "title" | "author" | "include" | "modified" | "relevance" | "include_slugs" | "menu_order" | undefined;
|
|
511
511
|
searchColumns?: ("post_title" | "post_content" | "post_excerpt")[] | undefined;
|
|
512
512
|
slug?: string | string[] | undefined;
|
|
513
513
|
parent?: string | number | (string | number)[] | undefined;
|
|
@@ -1186,7 +1186,7 @@ declare const ROUTER_MAP: {
|
|
|
1186
1186
|
include?: string | number | (string | number)[] | undefined;
|
|
1187
1187
|
offset?: string | number | undefined;
|
|
1188
1188
|
order?: "asc" | "desc" | undefined;
|
|
1189
|
-
orderby?: "
|
|
1189
|
+
orderby?: "date" | "id" | "slug" | "parent" | "title" | "author" | "include" | "relevance" | "include_slugs" | "menu_order" | undefined;
|
|
1190
1190
|
searchColumns?: ("post_title" | "post_content" | "post_excerpt")[] | undefined;
|
|
1191
1191
|
slug?: string | string[] | undefined;
|
|
1192
1192
|
taxRelation?: "AND" | "OR" | undefined;
|
|
@@ -1265,7 +1265,7 @@ declare const ROUTER_MAP: {
|
|
|
1265
1265
|
include?: string | number | (string | number)[] | undefined;
|
|
1266
1266
|
offset?: string | number | undefined;
|
|
1267
1267
|
order?: "asc" | "desc" | undefined;
|
|
1268
|
-
orderby?: "
|
|
1268
|
+
orderby?: "date" | "id" | "slug" | "parent" | "title" | "author" | "include" | "relevance" | "include_slugs" | "menu_order" | undefined;
|
|
1269
1269
|
searchColumns?: ("post_title" | "post_content" | "post_excerpt")[] | undefined;
|
|
1270
1270
|
slug?: string | string[] | undefined;
|
|
1271
1271
|
taxRelation?: "AND" | "OR" | undefined;
|
|
@@ -1414,7 +1414,7 @@ declare const ROUTER_MAP: {
|
|
|
1414
1414
|
include?: string | number | (string | number)[] | undefined;
|
|
1415
1415
|
offset?: string | number | undefined;
|
|
1416
1416
|
order?: "asc" | "desc" | undefined;
|
|
1417
|
-
orderby?: "
|
|
1417
|
+
orderby?: "date" | "id" | "parent" | "post" | "include" | undefined;
|
|
1418
1418
|
parent?: string | number | (string | number)[] | undefined;
|
|
1419
1419
|
parentExclude?: string | number | (string | number)[] | undefined;
|
|
1420
1420
|
post?: string | number | (string | number)[] | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kizlo",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A headless WordPress framework for TypeScript.",
|
|
6
6
|
"keywords": [
|
|
@@ -102,6 +102,7 @@
|
|
|
102
102
|
"giget": "^3.0.0",
|
|
103
103
|
"jiti": "^2.7.0",
|
|
104
104
|
"magicast": "^0.5.3",
|
|
105
|
+
"package-manager-detector": "^1.8.0",
|
|
105
106
|
"zod": "^4.3.6"
|
|
106
107
|
},
|
|
107
108
|
"peerDependencies": {
|