@maltty/cli 1.0.0-rc.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/LICENSE +21 -0
- package/README.md +88 -0
- package/bin/maltty.js +3 -0
- package/dist/_format-CeQhQTl5.js +23 -0
- package/dist/_format-CeQhQTl5.js.map +1 -0
- package/dist/attemptAsync-BdXzRSIT.js +42 -0
- package/dist/attemptAsync-BdXzRSIT.js.map +1 -0
- package/dist/chunk-DsIazq42.js +26 -0
- package/dist/commands/add/command.d.ts +7 -0
- package/dist/commands/add/command.d.ts.map +1 -0
- package/dist/commands/add/command.js +123 -0
- package/dist/commands/add/command.js.map +1 -0
- package/dist/commands/add/config.d.ts +7 -0
- package/dist/commands/add/config.d.ts.map +1 -0
- package/dist/commands/add/config.js +57 -0
- package/dist/commands/add/config.js.map +1 -0
- package/dist/commands/add/index.d.ts +7 -0
- package/dist/commands/add/index.d.ts.map +1 -0
- package/dist/commands/add/index.js +7 -0
- package/dist/commands/add/index.js.map +1 -0
- package/dist/commands/add/middleware.d.ts +7 -0
- package/dist/commands/add/middleware.d.ts.map +1 -0
- package/dist/commands/add/middleware.js +88 -0
- package/dist/commands/add/middleware.js.map +1 -0
- package/dist/commands/build.d.ts +15 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +246 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/commands.d.ts +14 -0
- package/dist/commands/commands.d.ts.map +1 -0
- package/dist/commands/commands.js +189 -0
- package/dist/commands/commands.js.map +1 -0
- package/dist/commands/dev.d.ts +13 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +58 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/doctor.d.ts +13 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +658 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +7 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +305 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/run.d.ts +19 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +478 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/stories.d.ts +11 -0
- package/dist/commands/stories.d.ts.map +1 -0
- package/dist/commands/stories.js +22 -0
- package/dist/commands/stories.js.map +1 -0
- package/dist/config-helpers-pv_2Spux.js +15 -0
- package/dist/config-helpers-pv_2Spux.js.map +1 -0
- package/dist/defu-BBwssjW3.js +192 -0
- package/dist/defu-BBwssjW3.js.map +1 -0
- package/dist/detect-AOq1ehTE.js +61 -0
- package/dist/detect-AOq1ehTE.js.map +1 -0
- package/dist/dist-DW_gRP7_.js +1119 -0
- package/dist/dist-DW_gRP7_.js.map +1 -0
- package/dist/dist-Xa07jNxS.js +15617 -0
- package/dist/dist-Xa07jNxS.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/jiti-CxWlVmZ_.js +5458 -0
- package/dist/jiti-CxWlVmZ_.js.map +1 -0
- package/dist/json-D7WbuVK1.js +43 -0
- package/dist/json-D7WbuVK1.js.map +1 -0
- package/dist/json5-z-PGDMyy.js +777 -0
- package/dist/json5-z-PGDMyy.js.map +1 -0
- package/dist/jsonc-DqZkfC3S.js +401 -0
- package/dist/jsonc-DqZkfC3S.js.map +1 -0
- package/dist/jsonc-KADMdSjU.js +2 -0
- package/dist/lib/templates/command/command.ts.liquid +12 -0
- package/dist/lib/templates/config/config.ts.liquid +16 -0
- package/dist/lib/templates/middleware/middleware.ts.liquid +9 -0
- package/dist/lib/templates/project/gitignore.liquid +3 -0
- package/dist/lib/templates/project/maltty.config.ts.liquid +6 -0
- package/dist/lib/templates/project/package.json.liquid +30 -0
- package/dist/lib/templates/project/src/commands/hello.ts.liquid +12 -0
- package/dist/lib/templates/project/src/config.ts.liquid +16 -0
- package/dist/lib/templates/project/src/index.ts.liquid +13 -0
- package/dist/lib/templates/project/tsconfig.json.liquid +19 -0
- package/dist/lib/templates/project/vitest.config.ts.liquid +8 -0
- package/dist/main-C_8x2aB3.js +274 -0
- package/dist/main-C_8x2aB3.js.map +1 -0
- package/dist/manifest-BIKVDJML.js +112 -0
- package/dist/manifest-BIKVDJML.js.map +1 -0
- package/dist/multipart-parser-MNkxNO83.js +174 -0
- package/dist/multipart-parser-MNkxNO83.js.map +1 -0
- package/dist/node-C91xGGqn.js +644 -0
- package/dist/node-C91xGGqn.js.map +1 -0
- package/dist/node-Drmc03fL.js +3973 -0
- package/dist/node-Drmc03fL.js.map +1 -0
- package/dist/ohash-BPoV4zBH.js +185 -0
- package/dist/ohash-BPoV4zBH.js.map +1 -0
- package/dist/pnpm-workspace.yaml +26 -0
- package/dist/toml-LuHsHQtV.js +646 -0
- package/dist/toml-LuHsHQtV.js.map +1 -0
- package/dist/utils-DlIJNGLQ.js +1905 -0
- package/dist/utils-DlIJNGLQ.js.map +1 -0
- package/dist/validate-C_SXBoLq.js +18 -0
- package/dist/validate-C_SXBoLq.js.map +1 -0
- package/dist/write-CSwG4Stj.js +152 -0
- package/dist/write-CSwG4Stj.js.map +1 -0
- package/dist/yaml-BS9RDuUr.js +1067 -0
- package/dist/yaml-BS9RDuUr.js.map +1 -0
- package/package.json +65 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { n as err, r as ok } from "./attemptAsync-BdXzRSIT.js";
|
|
2
|
+
import { t as readManifest } from "./manifest-BIKVDJML.js";
|
|
3
|
+
import { cli } from "maltty";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
//#region src/manifest.ts
|
|
6
|
+
/**
|
|
7
|
+
* Read and validate the CLI package manifest.
|
|
8
|
+
*
|
|
9
|
+
* Reads package.json one directory above `baseDir` (the dist output sits
|
|
10
|
+
* one level below the package root) and ensures all required fields are
|
|
11
|
+
* present. Returns an error Result if the manifest cannot be read or any
|
|
12
|
+
* required field is missing.
|
|
13
|
+
*
|
|
14
|
+
* @param baseDir - The directory the CLI entry file lives in (typically `import.meta.dirname`).
|
|
15
|
+
* @returns A Result tuple: error on failure, validated {@link CLIManifest} on success.
|
|
16
|
+
*/
|
|
17
|
+
async function readCLIManifest(baseDir) {
|
|
18
|
+
const [manifestError, manifest] = await readManifest(join(baseDir, ".."));
|
|
19
|
+
if (manifestError) return err(/* @__PURE__ */ new Error(`Failed to read CLI manifest: ${manifestError.message}`));
|
|
20
|
+
if (!manifest.name) return err(/* @__PURE__ */ new Error("CLI manifest is missing required field: name"));
|
|
21
|
+
if (!manifest.version) return err(/* @__PURE__ */ new Error("CLI manifest is missing required field: version"));
|
|
22
|
+
if (!manifest.description) return err(/* @__PURE__ */ new Error("CLI manifest is missing required field: description"));
|
|
23
|
+
return ok({
|
|
24
|
+
description: manifest.description,
|
|
25
|
+
name: manifest.name,
|
|
26
|
+
version: manifest.version
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/index.ts
|
|
31
|
+
const [manifestError, manifest] = await readCLIManifest(import.meta.dirname);
|
|
32
|
+
if (manifestError) {
|
|
33
|
+
console.error(manifestError.message);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
await cli({
|
|
37
|
+
commands: `${import.meta.dirname}/commands`,
|
|
38
|
+
description: manifest.description,
|
|
39
|
+
help: { header: `maltty v${manifest.version}` },
|
|
40
|
+
name: "maltty",
|
|
41
|
+
version: manifest.version
|
|
42
|
+
});
|
|
43
|
+
//#endregion
|
|
44
|
+
export {};
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/manifest.ts","../src/index.ts"],"sourcesContent":["import { join } from 'node:path'\n\nimport type { ResultAsync } from '@maltty/utils/fp'\nimport { err, ok } from '@maltty/utils/fp'\nimport { readManifest } from '@maltty/utils/manifest'\n\n/**\n * Validated CLI manifest with all required fields guaranteed present.\n */\nexport interface CLIManifest {\n readonly name: string\n readonly version: string\n readonly description: string\n}\n\n/**\n * Read and validate the CLI package manifest.\n *\n * Reads package.json one directory above `baseDir` (the dist output sits\n * one level below the package root) and ensures all required fields are\n * present. Returns an error Result if the manifest cannot be read or any\n * required field is missing.\n *\n * @param baseDir - The directory the CLI entry file lives in (typically `import.meta.dirname`).\n * @returns A Result tuple: error on failure, validated {@link CLIManifest} on success.\n */\nexport async function readCLIManifest(baseDir: string): ResultAsync<CLIManifest> {\n const [manifestError, manifest] = await readManifest(join(baseDir, '..'))\n\n if (manifestError) {\n return err(new Error(`Failed to read CLI manifest: ${manifestError.message}`))\n }\n\n if (!manifest.name) {\n return err(new Error('CLI manifest is missing required field: name'))\n }\n\n if (!manifest.version) {\n return err(new Error('CLI manifest is missing required field: version'))\n }\n\n if (!manifest.description) {\n return err(new Error('CLI manifest is missing required field: description'))\n }\n\n return ok({ description: manifest.description, name: manifest.name, version: manifest.version })\n}\n","import { cli } from 'maltty'\n\nimport { readCLIManifest } from './manifest.js'\n\nconst [manifestError, manifest] = await readCLIManifest(import.meta.dirname)\nif (manifestError) {\n console.error(manifestError.message)\n process.exit(1)\n}\n\nawait cli({\n commands: `${import.meta.dirname}/commands`,\n description: manifest.description,\n help: { header: `maltty v${manifest.version}` },\n name: 'maltty',\n version: manifest.version,\n})\n"],"mappings":";;;;;;;;;;;;;;;;AA0BA,eAAsB,gBAAgB,SAA2C;CAC/E,MAAM,CAAC,eAAe,YAAY,MAAM,aAAa,KAAK,SAAS,KAAK,CAAC;AAEzE,KAAI,cACF,QAAO,oBAAI,IAAI,MAAM,gCAAgC,cAAc,UAAU,CAAC;AAGhF,KAAI,CAAC,SAAS,KACZ,QAAO,oBAAI,IAAI,MAAM,+CAA+C,CAAC;AAGvE,KAAI,CAAC,SAAS,QACZ,QAAO,oBAAI,IAAI,MAAM,kDAAkD,CAAC;AAG1E,KAAI,CAAC,SAAS,YACZ,QAAO,oBAAI,IAAI,MAAM,sDAAsD,CAAC;AAG9E,QAAO,GAAG;EAAE,aAAa,SAAS;EAAa,MAAM,SAAS;EAAM,SAAS,SAAS;EAAS,CAAC;;;;ACzClG,MAAM,CAAC,eAAe,YAAY,MAAM,gBAAgB,OAAO,KAAK,QAAQ;AAC5E,IAAI,eAAe;AACjB,SAAQ,MAAM,cAAc,QAAQ;AACpC,SAAQ,KAAK,EAAE;;AAGjB,MAAM,IAAI;CACR,UAAU,GAAG,OAAO,KAAK,QAAQ;CACjC,aAAa,SAAS;CACtB,MAAM,EAAE,QAAQ,WAAW,SAAS,WAAW;CAC/C,MAAM;CACN,SAAS,SAAS;CACnB,CAAC"}
|