kizlo 0.8.3 → 0.8.4

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.
@@ -77,7 +77,7 @@ async function applyManifestWiring(dir, templateDir, manifest, opts) {
77
77
  label: "Kizlo config",
78
78
  relPath: "kizlo.config.ts",
79
79
  contents: kizloConfigTemplate(kizloDir, alias, opts.devPath)
80
- }, ...ownEntries(manifest, { includeStarter: true }).map((entry) => adaptOwnFile(templateDir, entry, manifest.tokens, scaffold))];
80
+ }, ...ownEntries(manifest, { includeStarter: opts.includeStarter }).map((entry) => adaptOwnFile(templateDir, entry, manifest.tokens, scaffold))];
81
81
  for (const file of files) reportScaffold(file, await scaffoldFile(dir, file, {
82
82
  force: true,
83
83
  yes: false
@@ -155,6 +155,10 @@ const create = defineCommand({
155
155
  })),
156
156
  initialValue: defaultPm
157
157
  }));
158
+ const includeStarter = orCancel(await p.confirm({
159
+ message: "Add example pages?",
160
+ initialValue: true
161
+ }));
158
162
  const conn = await collectConnectionInteractively(preset);
159
163
  if (preset.apiPath && conn.baseUrl) conn.baseUrl = withApiPath(conn.baseUrl, preset.apiPath);
160
164
  if (conn.mode === "local" && !await dockerAvailable()) {
@@ -183,7 +187,10 @@ const create = defineCommand({
183
187
  fail(`${preset.label} setup failed — see the output above and try again.`);
184
188
  }
185
189
  try {
186
- await applyManifestWiring(dir, fetched.dir, manifest, { devPath: conn.devPath });
190
+ await applyManifestWiring(dir, fetched.dir, manifest, {
191
+ devPath: conn.devPath,
192
+ includeStarter
193
+ });
187
194
  } catch (error) {
188
195
  fail(error instanceof Error ? error.message : String(error));
189
196
  }
@@ -1,5 +1,5 @@
1
1
  import { dockerAvailable } from "../wp/docker.js";
2
- import { addDependencyArgs, detectImportAlias, detectPackageManager, ensureGitignored, getVersion, loadEnvFiles, runCommand } from "../utils.js";
2
+ import { addDependencyArgs, detectImportAlias, detectPackageManager, ensureGitignored, getVersion, loadEnvFiles, runCommandAsync } from "../utils.js";
3
3
  import { printBanner } from "../banner.js";
4
4
  import { PRESETS, detectPreset, getPreset } from "../presets/index.js";
5
5
  import { fetchTemplate } from "../presets/source.js";
@@ -98,13 +98,13 @@ function isOlder(have, want) {
98
98
  * When the project's kizlo is older, upgrade the project up to it and say so — a deliberate pin is
99
99
  * never changed silently. Never downgrades.
100
100
  */
101
- function alignKizloVersion(cwd, pm, pkg, manifest) {
101
+ async function alignKizloVersion(cwd, pm, pkg, manifest) {
102
102
  const want = manifest.kizloVersion ?? `^${getVersion()}`;
103
103
  const have = kizloDep(pkg);
104
104
  if (!have || !isOlder(have, want)) return;
105
105
  const s = p.spinner();
106
106
  s.start(`Upgrading kizlo from ${have} to ${want}`);
107
- const ok = runCommand(addDependencyArgs(pm, `kizlo@${want}`), cwd, "ignore");
107
+ const ok = await runCommandAsync(addDependencyArgs(pm, `kizlo@${want}`), cwd, "ignore");
108
108
  s.stop(ok ? `Upgraded kizlo to ${want}` : `Could not upgrade kizlo automatically — install kizlo@${want} yourself`);
109
109
  }
110
110
  const init = defineCommand({
@@ -183,6 +183,10 @@ const init = defineCommand({
183
183
  });
184
184
  if (args.alias !== void 0) setup.alias = String(args.alias).trim();
185
185
  setup.alias = aliasWithSlash(setup.alias);
186
+ const includeStarter = preset.template ? yes || orCancel(await p.confirm({
187
+ message: "Add example pages?",
188
+ initialValue: true
189
+ })) : false;
186
190
  if (setup.mode === "local" && !await dockerAvailable()) {
187
191
  p.cancel("Docker isn't available — start Docker (or install it) and re-run, or choose “Use my own WordPress”.");
188
192
  process.exit(1);
@@ -191,7 +195,7 @@ const init = defineCommand({
191
195
  const spec = `kizlo@^${getVersion()}`;
192
196
  const s = p.spinner();
193
197
  s.start(`Installing kizlo with ${pm}`);
194
- const ok = runCommand(addDependencyArgs(pm, spec), cwd, "ignore");
198
+ const ok = await runCommandAsync(addDependencyArgs(pm, spec), cwd, "ignore");
195
199
  s.stop(ok ? "Installed kizlo" : "Could not install kizlo automatically");
196
200
  if (!ok) p.log.warn(`Install it yourself: ${addDependencyArgs(pm, spec).join(" ")}`);
197
201
  }
@@ -221,8 +225,8 @@ const init = defineCommand({
221
225
  const fetched = await fetchTemplate(preset.template);
222
226
  try {
223
227
  manifest = readManifest(fetched.dir);
224
- alignKizloVersion(cwd, pm, pkg, manifest);
225
- for (const entry of ownEntries(manifest)) files.push(adaptOwnFile(fetched.dir, entry, manifest.tokens, scaffold));
228
+ await alignKizloVersion(cwd, pm, pkg, manifest);
229
+ for (const entry of ownEntries(manifest, { includeStarter })) files.push(adaptOwnFile(fetched.dir, entry, manifest.tokens, scaffold));
226
230
  } finally {
227
231
  fetched.cleanup();
228
232
  }
package/dist/cli/utils.js CHANGED
@@ -180,15 +180,6 @@ function frameworkCreateArgs(pm, initializer, name, flags) {
180
180
  ];
181
181
  }
182
182
  }
183
- function runCommand(args, cwd, stdio = "inherit") {
184
- const [command, ...rest] = args;
185
- if (!command) return false;
186
- return spawnSync(command, rest, {
187
- cwd,
188
- stdio,
189
- shell: process.platform === "win32"
190
- }).status === 0;
191
- }
192
183
  /**
193
184
  * Async sibling of {@link runCommand}: runs a command without blocking the event loop, so a clack
194
185
  * spinner can keep animating while it works (a synchronous `spawnSync` would freeze it on the first
@@ -363,4 +354,4 @@ function groupDefault(subCommandNames, run) {
363
354
  }
364
355
 
365
356
  //#endregion
366
- export { addDependencyArgs, availablePackageManagers, detectImportAlias, detectInvokingPackageManager, detectPackageManager, ensureGitignored, envGroups, envKeysPresent, frameworkCreateArgs, getVersion, groupDefault, installArgs, loadEnvFiles, mergeEnv, pickStackPort, resolveModuleImport, runCommand, runCommandAsync, runCommandCaptured, withSpinner, writeFileIfAbsent };
357
+ export { addDependencyArgs, availablePackageManagers, detectImportAlias, detectInvokingPackageManager, detectPackageManager, ensureGitignored, envGroups, envKeysPresent, frameworkCreateArgs, getVersion, groupDefault, installArgs, loadEnvFiles, mergeEnv, pickStackPort, resolveModuleImport, runCommandAsync, runCommandCaptured, withSpinner, writeFileIfAbsent };
@@ -1,6 +1,6 @@
1
1
  import { WordPressService } from "../../wordpress/service.js";
2
2
  import { DEFAULT_PLUGINS, TEST_ADMIN } from "./constants.js";
3
- import { compose, composeUp, wpCli } from "./docker.js";
3
+ import { compose, composePull, composeUp, wpCli } from "./docker.js";
4
4
  import { ensurePlugins } from "./utils.js";
5
5
  import { createAdminAppPassword, seedUsers } from "./bootstrap.js";
6
6
  import { prepareByo } from "./byo.js";
@@ -74,7 +74,9 @@ async function seedDevFixtures(cfg, url) {
74
74
  */
75
75
  async function bootstrapDev(cfg) {
76
76
  const url = devUrl(cfg.port);
77
- const byo = !existsSync(join(cfg.wordpressDir, "wp-includes", "version.php")) && cfg.byo ? await prepareByo(cfg.byo, cfg.wordpressDir, cfg.configDir) : void 0;
77
+ const fresh = !existsSync(join(cfg.wordpressDir, "wp-includes", "version.php"));
78
+ const byo = fresh && cfg.byo ? await prepareByo(cfg.byo, cfg.wordpressDir, cfg.configDir) : void 0;
79
+ if (fresh && !byo) await composePull(["wordpress", "wp-cli"]).catch(() => void 0);
78
80
  await composeUp();
79
81
  const installed = (await compose([
80
82
  "exec",
@@ -22,6 +22,8 @@ interface Stack {
22
22
  /** Stack-bound docker helpers. */
23
23
  interface DockerStack {
24
24
  compose(args: string[], opts?: RunInput): Promise<RunResult>;
25
+ /** Pull the latest images for the named services (all when omitted) — refreshes a cached tag like `wordpress:latest`. */
26
+ composePull(services?: string[]): Promise<RunResult>;
25
27
  composeUp(): Promise<void>;
26
28
  composeStop(opts?: {
27
29
  detached?: boolean;
@@ -48,6 +50,8 @@ declare function dockerAvailable(): Promise<boolean>;
48
50
  declare function createStack(stack: Stack): DockerStack;
49
51
  /** `docker compose <args>` against the active stack. */
50
52
  declare const compose: DockerStack["compose"];
53
+ /** Pull the latest images for the active stack's named services (all when omitted). */
54
+ declare const composePull: (services?: string[]) => Promise<RunResult>;
51
55
  /** Bring the active stack's services up detached and wait for health checks. */
52
56
  declare const composeUp: () => Promise<void>;
53
57
  /** Tear the active stack down, optionally removing volumes. */
@@ -61,4 +65,4 @@ declare const composeStop: (opts?: {
61
65
  /** Run a wp-cli command against the active stack's warm `wp-cli` container. */
62
66
  declare const wpCli: (args: string[]) => Promise<string>;
63
67
  //#endregion
64
- export { DockerStack, RunResult, Stack, compose, composeDown, composeStop, composeUp, createStack, dockerAvailable, wpCli };
68
+ export { DockerStack, RunResult, Stack, compose, composeDown, composePull, composeStop, composeUp, createStack, dockerAvailable, wpCli };
@@ -56,6 +56,7 @@ function bind(stack) {
56
56
  WP_PORT: String(stack.port)
57
57
  };
58
58
  const compose$1 = (args, opts) => run("docker", [...base, ...args], env, opts);
59
+ const composePull$1 = (services = []) => compose$1(["pull", ...services]);
59
60
  const composeUp$1 = async () => {
60
61
  const res = await compose$1([
61
62
  "up",
@@ -93,6 +94,7 @@ function bind(stack) {
93
94
  };
94
95
  return {
95
96
  compose: compose$1,
97
+ composePull: composePull$1,
96
98
  composeUp: composeUp$1,
97
99
  composeStop: composeStop$1,
98
100
  composeDown: composeDown$1,
@@ -117,6 +119,8 @@ function activeStack() {
117
119
  }
118
120
  /** `docker compose <args>` against the active stack. */
119
121
  const compose = (args, opts) => activeStack().compose(args, opts);
122
+ /** Pull the latest images for the active stack's named services (all when omitted). */
123
+ const composePull = (services) => activeStack().composePull(services);
120
124
  /** Bring the active stack's services up detached and wait for health checks. */
121
125
  const composeUp = () => activeStack().composeUp();
122
126
  /** Tear the active stack down, optionally removing volumes. */
@@ -127,4 +131,4 @@ const composeStop = (opts) => activeStack().composeStop(opts);
127
131
  const wpCli = (args) => activeStack().wpCli(args);
128
132
 
129
133
  //#endregion
130
- export { compose, composeDown, composeStop, composeUp, createStack, dockerAvailable, wpCli };
134
+ export { compose, composeDown, composePull, composeStop, composeUp, createStack, dockerAvailable, wpCli };
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.8.3";
2
+ var version = "0.8.4";
3
3
 
4
4
  //#endregion
5
5
  export { version };
package/dist/router.d.ts CHANGED
@@ -764,7 +764,7 @@ declare const ROUTER_MAP: {
764
764
  exclude?: string | number | (string | number)[] | undefined;
765
765
  include?: string | number | (string | number)[] | undefined;
766
766
  order?: "asc" | "desc" | undefined;
767
- orderBy?: "count" | "id" | "slug" | "name" | "description" | "include" | "include_slugs" | "term_group" | undefined;
767
+ orderBy?: "id" | "slug" | "name" | "description" | "include" | "include_slugs" | "term_group" | "count" | undefined;
768
768
  hideEmpty?: string | boolean | undefined;
769
769
  parent?: string | number | undefined;
770
770
  post?: string | number | undefined;
@@ -976,7 +976,7 @@ declare const ROUTER_MAP: {
976
976
  exclude?: string | number | (string | number)[] | undefined;
977
977
  include?: string | number | (string | number)[] | undefined;
978
978
  order?: "asc" | "desc" | undefined;
979
- orderBy?: "count" | "id" | "slug" | "name" | "description" | "include" | "include_slugs" | "term_group" | undefined;
979
+ orderBy?: "id" | "slug" | "name" | "description" | "include" | "include_slugs" | "term_group" | "count" | undefined;
980
980
  hideEmpty?: string | boolean | undefined;
981
981
  post?: string | number | undefined;
982
982
  slug?: string | string[] | undefined;
@@ -1135,7 +1135,7 @@ declare const ROUTER_MAP: {
1135
1135
  sitemaps: {
1136
1136
  list: Procedure<"internal", {}, {
1137
1137
  key: string;
1138
- type: "post_type" | "taxonomy" | "author";
1138
+ type: "author" | "post_type" | "taxonomy";
1139
1139
  pages: number;
1140
1140
  lastmod: string;
1141
1141
  }[], DefinedErrorMapLike>;
@@ -1143,7 +1143,7 @@ declare const ROUTER_MAP: {
1143
1143
  origin: string;
1144
1144
  sitemaps: {
1145
1145
  key: string;
1146
- type: "post_type" | "taxonomy" | "author";
1146
+ type: "author" | "post_type" | "taxonomy";
1147
1147
  pages: number;
1148
1148
  lastmod: string;
1149
1149
  }[];
@@ -108,17 +108,17 @@ declare const Seo: z.ZodObject<{
108
108
  type Seo = z.infer<typeof Seo>;
109
109
  declare const CONTENT_TYPES: readonly ["post_type", "taxonomy", "author"];
110
110
  declare const ContentType: z.ZodEnum<{
111
+ author: "author";
111
112
  post_type: "post_type";
112
113
  taxonomy: "taxonomy";
113
- author: "author";
114
114
  }>;
115
115
  type ContentType = z.infer<typeof ContentType>;
116
116
  declare const Sitemap: z.ZodObject<{
117
117
  key: z.ZodString;
118
118
  type: z.ZodEnum<{
119
+ author: "author";
119
120
  post_type: "post_type";
120
121
  taxonomy: "taxonomy";
121
- author: "author";
122
122
  }>;
123
123
  pages: z.ZodNumber;
124
124
  lastmod: z.ZodString;
@@ -127,9 +127,9 @@ type Sitemap = z.infer<typeof Sitemap>;
127
127
  declare const SitemapList: z.ZodArray<z.ZodObject<{
128
128
  key: z.ZodString;
129
129
  type: z.ZodEnum<{
130
+ author: "author";
130
131
  post_type: "post_type";
131
132
  taxonomy: "taxonomy";
132
- author: "author";
133
133
  }>;
134
134
  pages: z.ZodNumber;
135
135
  lastmod: z.ZodString;
@@ -140,9 +140,9 @@ declare const SitemapIndex: z.ZodObject<{
140
140
  sitemaps: z.ZodArray<z.ZodObject<{
141
141
  key: z.ZodString;
142
142
  type: z.ZodEnum<{
143
+ author: "author";
143
144
  post_type: "post_type";
144
145
  taxonomy: "taxonomy";
145
- author: "author";
146
146
  }>;
147
147
  pages: z.ZodNumber;
148
148
  lastmod: z.ZodString;
@@ -174,9 +174,9 @@ declare const SitemapUrlList: z.ZodArray<z.ZodObject<{
174
174
  type SitemapUrlList = z.infer<typeof SitemapUrlList>;
175
175
  declare const ListSitemapUrlInputBase: z.ZodObject<{
176
176
  type: z.ZodEnum<{
177
+ author: "author";
177
178
  post_type: "post_type";
178
179
  taxonomy: "taxonomy";
179
- author: "author";
180
180
  }>;
181
181
  page: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>>;
182
182
  }, z.core.$strip>;
package/dist/test.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DevPluginSource, Fixture, FixtureCleanupFn, FixtureSeedFn, JsonValue, LocalPlugin, PluginSource, SeedContext, TestAdminUser, TestCredentials, TestUser, defineFixture, isLocalPlugin } from "./cli/wp/types.js";
2
2
  import { COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, githubRelease, kizloRelease } from "./cli/wp/constants.js";
3
- import { DockerStack, RunResult, Stack, compose, composeDown, composeStop, composeUp, createStack, dockerAvailable, wpCli } from "./cli/wp/docker.js";
3
+ import { DockerStack, RunResult, Stack, compose, composeDown, composePull, composeStop, composeUp, createStack, dockerAvailable, wpCli } from "./cli/wp/docker.js";
4
4
  import { activateLocalPlugin, credentialsPath, ensurePlugin, ensurePlugins, findConfigDir, getTestCredentials, isSeeded, recordedPort, resolvePluginSource } from "./cli/wp/utils.js";
5
5
  import { TestAuthAdapterUser, toTestUser } from "./test/users.js";
6
6
  import { testAuthAdapter } from "./test/auth.js";
@@ -10,4 +10,4 @@ import { KizloClientTestInstance, getKizloClientTestInstance } from "./test/clie
10
10
  import { menuFixture } from "./menu/fixture.js";
11
11
  import { postFixture } from "./post/fixture.js";
12
12
  import { coreFixtures } from "./test/fixtures.js";
13
- export { CAPTCHA_TEST_TOKEN_PASS, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DevPluginSource, DockerStack, Fixture, FixtureCleanupFn, FixtureSeedFn, JsonValue, KizloClientTestInstance, KizloTestInstance, LocalPlugin, OPCACHE_INI, PluginSource, REMAP_ENTRYPOINT, RunResult, SEED_MARKER_OPTION, SEED_VERSION, SeedContext, Stack, TEST_ADMIN, TEST_USER, TestAdminUser, TestAuthAdapterUser, TestCredentials, TestUser, activateLocalPlugin, captchaMock, compose, composeDown, composeStop, composeUp, coreFixtures, createStack, credentialsPath, defineFixture, dockerAvailable, ensurePlugin, ensurePlugins, findConfigDir, getKizloClientTestInstance, getKizloTestInstance, getTestCredentials, githubRelease, isLocalPlugin, isSeeded, kizloRelease, menuFixture, postFixture, recordedPort, resolvePluginSource, testAuthAdapter, toTestUser, wpCli };
13
+ export { CAPTCHA_TEST_TOKEN_PASS, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, DevPluginSource, DockerStack, Fixture, FixtureCleanupFn, FixtureSeedFn, JsonValue, KizloClientTestInstance, KizloTestInstance, LocalPlugin, OPCACHE_INI, PluginSource, REMAP_ENTRYPOINT, RunResult, SEED_MARKER_OPTION, SEED_VERSION, SeedContext, Stack, TEST_ADMIN, TEST_USER, TestAdminUser, TestAuthAdapterUser, TestCredentials, TestUser, activateLocalPlugin, captchaMock, compose, composeDown, composePull, composeStop, composeUp, coreFixtures, createStack, credentialsPath, defineFixture, dockerAvailable, ensurePlugin, ensurePlugins, findConfigDir, getKizloClientTestInstance, getKizloTestInstance, getTestCredentials, githubRelease, isLocalPlugin, isSeeded, kizloRelease, menuFixture, postFixture, recordedPort, resolvePluginSource, testAuthAdapter, toTestUser, wpCli };
package/dist/test.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineFixture, isLocalPlugin } from "./cli/wp/types.js";
2
2
  import { COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, githubRelease, kizloRelease } from "./cli/wp/constants.js";
3
- import { compose, composeDown, composeStop, composeUp, createStack, dockerAvailable, wpCli } from "./cli/wp/docker.js";
3
+ import { compose, composeDown, composePull, composeStop, composeUp, createStack, dockerAvailable, wpCli } from "./cli/wp/docker.js";
4
4
  import { activateLocalPlugin, credentialsPath, ensurePlugin, ensurePlugins, findConfigDir, getTestCredentials, isSeeded, recordedPort, resolvePluginSource } from "./cli/wp/utils.js";
5
5
  import { testAuthAdapter } from "./test/auth.js";
6
6
  import { CAPTCHA_TEST_TOKEN_PASS, captchaMock } from "./test/captcha.js";
@@ -11,4 +11,4 @@ import { coreFixtures } from "./test/fixtures.js";
11
11
  import { toTestUser } from "./test/users.js";
12
12
  import { getKizloTestInstance } from "./test/server.js";
13
13
 
14
- export { CAPTCHA_TEST_TOKEN_PASS, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, activateLocalPlugin, captchaMock, compose, composeDown, composeStop, composeUp, coreFixtures, createStack, credentialsPath, defineFixture, dockerAvailable, ensurePlugin, ensurePlugins, findConfigDir, getKizloClientTestInstance, getKizloTestInstance, getTestCredentials, githubRelease, isLocalPlugin, isSeeded, kizloRelease, menuFixture, postFixture, recordedPort, resolvePluginSource, testAuthAdapter, toTestUser, wpCli };
14
+ export { CAPTCHA_TEST_TOKEN_PASS, COMPOSE_FILE, CONFIG_FILES, CREDENTIALS_REL, DEFAULT_PLUGINS, DEFAULT_PORT, OPCACHE_INI, REMAP_ENTRYPOINT, SEED_MARKER_OPTION, SEED_VERSION, TEST_ADMIN, TEST_USER, activateLocalPlugin, captchaMock, compose, composeDown, composePull, composeStop, composeUp, coreFixtures, createStack, credentialsPath, defineFixture, dockerAvailable, ensurePlugin, ensurePlugins, findConfigDir, getKizloClientTestInstance, getKizloTestInstance, getTestCredentials, githubRelease, isLocalPlugin, isSeeded, kizloRelease, menuFixture, postFixture, recordedPort, resolvePluginSource, testAuthAdapter, toTestUser, wpCli };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kizlo",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
4
4
  "type": "module",
5
5
  "description": "A headless WordPress framework for TypeScript.",
6
6
  "keywords": [