@shell-shock/core 0.1.1 → 0.2.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/dist/api.cjs +1 -1
- package/dist/api.d.cts +7 -0
- package/dist/api.d.mts +7 -0
- package/dist/api.mjs +1 -1
- package/dist/helpers/get-default-options.cjs +1 -0
- package/dist/helpers/get-default-options.d.cts +15 -0
- package/dist/helpers/get-default-options.d.mts +15 -0
- package/dist/helpers/get-default-options.mjs +1 -0
- package/dist/helpers/persistence.cjs +1 -0
- package/dist/helpers/persistence.mjs +1 -0
- package/dist/helpers/resolve-command.cjs +1 -1
- package/dist/helpers/resolve-command.mjs +1 -1
- package/dist/helpers/update-package-json.cjs +1 -1
- package/dist/helpers/update-package-json.mjs +1 -1
- package/dist/helpers/utilities.cjs +1 -0
- package/dist/helpers/utilities.mjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +16 -2
- package/dist/index.d.mts +16 -2
- package/dist/index.mjs +1 -1
- package/dist/powerlines.cjs +3 -2
- package/dist/powerlines.d.cts +2 -2
- package/dist/powerlines.d.mts +2 -2
- package/dist/powerlines.mjs +3 -2
- package/dist/types/command.d.cts +63 -0
- package/dist/types/command.d.mts +63 -0
- package/dist/types/config.d.cts +5 -7
- package/dist/types/config.d.mts +5 -7
- package/dist/types/context.cjs +0 -0
- package/dist/types/context.d.cts +25 -0
- package/dist/types/context.d.mts +25 -0
- package/dist/types/context.mjs +1 -0
- package/dist/types/index.d.cts +4 -2
- package/dist/types/index.d.mts +4 -2
- package/dist/types/options.cjs +0 -0
- package/dist/types/options.d.cts +7 -0
- package/dist/types/options.d.mts +7 -0
- package/dist/types/options.mjs +1 -0
- package/package.json +9 -6
- package/dist/types/build.d.cts +0 -66
- package/dist/types/build.d.mts +0 -66
- /package/dist/types/{build.cjs → command.cjs} +0 -0
- /package/dist/types/{build.mjs → command.mjs} +0 -0
package/dist/api.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./powerlines.cjs`);let n=require(`powerlines`);var
|
|
1
|
+
const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./powerlines.cjs`);let n=require(`@powerlines/plugin-tsdown`);n=e.__toESM(n);let r=require(`powerlines`);var i=class e{#e;static async from(i={}){return new e(await(0,r.createPowerlines)({...i,plugins:[(0,n.default)(),t.shellShock(),...i.plugins??[]]}))}constructor(e){this.#e=e}async clean(e){return this.#e.clean(e)}async prepare(e){return this.#e.prepare(e)}async lint(e){return this.#e.lint(e)}async build(e){return this.#e.build(e)}async docs(e){return this.#e.docs(e)}async finalize(){return this.#e.finalize()}};exports.ShellShockAPI=i;
|
package/dist/api.d.cts
CHANGED
|
@@ -2,6 +2,13 @@ import { UserConfig } from "./types/config.cjs";
|
|
|
2
2
|
import { BuildInlineConfig, CleanInlineConfig, DocsInlineConfig, LintInlineConfig, PrepareInlineConfig } from "powerlines/types/config";
|
|
3
3
|
|
|
4
4
|
//#region src/api.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The Shell Shock API class.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This class provides methods to interact with the Shell Shock build system, including cleaning, preparing, linting, building, generating documentation, and finalizing projects.
|
|
11
|
+
*/
|
|
5
12
|
declare class ShellShockAPI {
|
|
6
13
|
#private;
|
|
7
14
|
static from(config?: UserConfig): Promise<ShellShockAPI>;
|
package/dist/api.d.mts
CHANGED
|
@@ -2,6 +2,13 @@ import { UserConfig } from "./types/config.mjs";
|
|
|
2
2
|
import { BuildInlineConfig, CleanInlineConfig, DocsInlineConfig, LintInlineConfig, PrepareInlineConfig } from "powerlines/types/config";
|
|
3
3
|
|
|
4
4
|
//#region src/api.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The Shell Shock API class.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This class provides methods to interact with the Shell Shock build system, including cleaning, preparing, linting, building, generating documentation, and finalizing projects.
|
|
11
|
+
*/
|
|
5
12
|
declare class ShellShockAPI {
|
|
6
13
|
#private;
|
|
7
14
|
static from(config?: UserConfig): Promise<ShellShockAPI>;
|
package/dist/api.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{shellShock as e}from"./powerlines.mjs";import{createPowerlines as
|
|
1
|
+
import{shellShock as e}from"./powerlines.mjs";import t from"@powerlines/plugin-tsdown";import{createPowerlines as n}from"powerlines";var r=class r{#e;static async from(i={}){return new r(await n({...i,plugins:[t(),e(),...i.plugins??[]]}))}constructor(e){this.#e=e}async clean(e){return this.#e.clean(e)}async prepare(e){return this.#e.prepare(e)}async lint(e){return this.#e.lint(e)}async build(e){return this.#e.build(e)}async docs(e){return this.#e.docs(e)}async finalize(){return this.#e.finalize()}};export{r as ShellShockAPI};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@powerlines/deepkit/vendor/type`),n=require(`@stryke/type-checks/is-function`);function r(e,r){return e.config.defaultOptions===!1?[]:Array.isArray(e.config.defaultOptions)?e.config.defaultOptions:(0,n.isFunction)(e.config.defaultOptions)?e.config.defaultOptions(e,r):[{name:`help`,title:`Help`,description:`Show help information.`,alias:[`h`,`?`],kind:t.ReflectionKind.boolean,optional:!0,default:!1,skipAddingNegative:!0},{name:`version`,title:`Version`,description:`Show the version of the application.`,alias:[`v`],kind:t.ReflectionKind.boolean,optional:!0,default:!1,skipAddingNegative:!0}]}exports.getDefaultOptions=r;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CommandBase, CommandOption } from "../types/command.cjs";
|
|
2
|
+
import { Context } from "../types/context.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/get-default-options.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Get the default command options.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The build context.
|
|
10
|
+
* @param command - The command input.
|
|
11
|
+
* @returns The default command options.
|
|
12
|
+
*/
|
|
13
|
+
declare function getDefaultOptions(context: Context, command: CommandBase): CommandOption[];
|
|
14
|
+
//#endregion
|
|
15
|
+
export { getDefaultOptions };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CommandBase, CommandOption } from "../types/command.mjs";
|
|
2
|
+
import { Context } from "../types/context.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/get-default-options.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Get the default command options.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The build context.
|
|
10
|
+
* @param command - The command input.
|
|
11
|
+
* @returns The default command options.
|
|
12
|
+
*/
|
|
13
|
+
declare function getDefaultOptions(context: Context, command: CommandBase): CommandOption[];
|
|
14
|
+
//#endregion
|
|
15
|
+
export { getDefaultOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ReflectionKind as e}from"@powerlines/deepkit/vendor/type";import{isFunction as t}from"@stryke/type-checks/is-function";function n(n,r){return n.config.defaultOptions===!1?[]:Array.isArray(n.config.defaultOptions)?n.config.defaultOptions:t(n.config.defaultOptions)?n.config.defaultOptions(n,r):[{name:`help`,title:`Help`,description:`Show help information.`,alias:[`h`,`?`],kind:e.boolean,optional:!0,default:!1,skipAddingNegative:!0},{name:`version`,title:`Version`,description:`Show the version of the application.`,alias:[`v`],kind:e.boolean,optional:!0,default:!1,skipAddingNegative:!0}]}export{n as getDefaultOptions};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/join-paths`);function n(e){return(0,t.joinPaths)(e.dataPath,`commands.json`)}function r(e){let t=(e,n=null)=>{let r={...e,parent:n,children:{}};for(let[n,i]of Object.entries(e.children||{}))r.children[n]=t(i,e.id);return r},n={};for(let[r,i]of Object.entries(e))n[r]=t(i,null);return n}function i(e){let t=(e,n=null)=>{let r={...e,parent:n,children:{}};for(let[n,i]of Object.entries(e.children||{}))r.children[n]=t(i,r);return r},n={};for(let[r,i]of Object.entries(e))n[r]=t(i,null);return n}async function a(e){let t=await e.fs.read(n(e));if(!t||!t.length)throw Error(`CLI Command reflection file ${n(e)} is empty`);e.commands=i(JSON.parse(t))}async function o(e){let t=n(e);await e.fs.write(t,JSON.stringify(r(e.commands),null,e.config.mode===`development`?2:0))}exports.getCommandsPersistencePath=n,exports.readCommandsPersistence=a,exports.writeCommandsPersistence=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{joinPaths as e}from"@stryke/path/join-paths";function t(t){return e(t.dataPath,`commands.json`)}function n(e){let t=(e,n=null)=>{let r={...e,parent:n,children:{}};for(let[n,i]of Object.entries(e.children||{}))r.children[n]=t(i,e.id);return r},n={};for(let[r,i]of Object.entries(e))n[r]=t(i,null);return n}function r(e){let t=(e,n=null)=>{let r={...e,parent:n,children:{}};for(let[n,i]of Object.entries(e.children||{}))r.children[n]=t(i,r);return r},n={};for(let[r,i]of Object.entries(e))n[r]=t(i,null);return n}async function i(e){let n=await e.fs.read(t(e));if(!n||!n.length)throw Error(`CLI Command reflection file ${t(e)} is empty`);e.commands=r(JSON.parse(n))}async function a(e){let r=t(e);await e.fs.write(r,JSON.stringify(n(e.commands),null,e.config.mode===`development`?2:0))}export{t as getCommandsPersistencePath,i as readCommandsPersistence,a as writeCommandsPersistence};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../_virtual/rolldown_runtime.cjs`);let
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`./get-default-options.cjs`);let n=require(`@stryke/path/append`),r=require(`@stryke/path/file-path-fns`),i=require(`@stryke/path/replace`),a=require(`@stryke/path/resolve-parent-path`),o=require(`@stryke/string-format/title-case`),s=require(`@stryke/type-checks/is-set-object`),c=require(`@powerlines/deepkit/vendor/type`),l=require(`@powerlines/deepkit/reflect-type`),u=require(`@stryke/path/common`),d=require(`@stryke/path/normalize`),f=require(`@stryke/type-checks/is-set-string`);function p(e,t){return(0,i.replacePath)((0,r.findFilePath)(t),e.commandsPath).replaceAll(/^\/+/g,``).replaceAll(/\/+$/g,``)}function m(e){return(0,f.isSetString)(e.config.entry)?(0,n.appendPath)((0,n.appendPath)((0,d.stripStars)(e.config.entry),e.config.projectRoot),e.workspaceConfig.workspaceRoot):(0,s.isSetObject)(e.config.entry)&&`file`in e.config.entry?(0,n.appendPath)((0,n.appendPath)((0,d.stripStars)(e.config.entry.file),e.config.projectRoot),e.workspaceConfig.workspaceRoot):Array.isArray(e.config.entry)&&e.config.entry.length>0?(0,u.commonPath)(e.config.entry.map(t=>(0,n.appendPath)((0,n.appendPath)((0,d.stripStars)((0,f.isSetString)(t)?t:t.file),e.config.projectRoot),e.workspaceConfig.workspaceRoot))):(0,n.appendPath)(e.config.sourceRoot||e.config.projectRoot,e.workspaceConfig.workspaceRoot)}function h(e){let t=(0,r.findFolderName)(e),n=1;for(;t.startsWith(`[`)&&t.endsWith(`]`);)t=(0,r.findFolderName)((0,a.resolveParentPath)(e,n++));return t}async function g(e,n,r){let i=n.title||`${r?.title?`${r.title} - `:``}${(0,o.titleCase)(n.name)}`,a={...n,title:i,description:n.description||`The ${i} ${r?`sub-`:``}command.`,options:Object.fromEntries(t.getDefaultOptions(e,n).map(e=>[e.name,e])),params:[],parent:r??null,children:{}};if(n.isVirtual)e.trace(`Adding reflection for virtual command: ${n.id}`);else{if(!n.entry.input?.file||!e.fs.existsSync(n.entry.input.file))throw Error(`${n.entry.input?.file?`Non-existent`:`Missing`} command entry file for "${n.name}"`);e.trace(`Adding reflection for user-defined command: ${n.id} (file: ${n.entry.input.file})`);let t=await(0,l.reflectType)(e,n.entry.input);if(t.kind!==c.ReflectionKind.function)throw Error(`The command entry file "${n.entry.input.file}" does not export a valid function.`);if(t.parameters.length>0&&t.parameters[0]){let e=t.parameters[0];if(e.type.kind===c.ReflectionKind.objectLiteral||e.type.kind===c.ReflectionKind.class){let t=c.ReflectionClass.from(e.type);for(let e of t.getProperties()){let t=e.getType();if(a.options[e.getNameAsString()]={name:e.getNameAsString(),alias:e.getTags().alias??[],title:e.getTags().title||(0,o.titleCase)(e.getNameAsString()),description:e.getDescription(),kind:t.kind,optional:e.isOptional(),default:e.getDefaultValue(),variadic:!1},a.options[e.getNameAsString()].description??=`The ${a.options[e.getNameAsString()].title} option.`,t.kind===c.ReflectionKind.array)if(t.type.kind===c.ReflectionKind.string||t.type.kind===c.ReflectionKind.number)a.options[e.getNameAsString()].variadic=!0,a.options[e.getNameAsString()].kind=t.type.kind;else throw Error(`Unsupported array type for option "${e.getNameAsString()}" in command "${n.name}". Only string[] and number[] are supported.`);else if(t.kind!==c.ReflectionKind.boolean&&t.kind!==c.ReflectionKind.string&&t.kind!==c.ReflectionKind.number)throw Error(`Unsupported type for option "${e.getNameAsString()}" in command "${n.name}". Only string, number, boolean, string[] and number[] are supported, received ${(0,c.stringifyType)(t).trim().replaceAll(` | `,`, or `)}.`)}}}}for(let t of e.inputs.filter(e=>e.path.length===n.path.length+1&&e.path.slice(0,n.path.length).every((e,t)=>e===n.path[t])))a.children[t.name]=await g(e,t,a);return a}exports.findCommandName=h,exports.findCommandsRoot=m,exports.reflectCommandTree=g,exports.resolveCommandPath=p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getDefaultOptions as e}from"./get-default-options.mjs";import{appendPath as t}from"@stryke/path/append";import{findFilePath as n,findFolderName as r}from"@stryke/path/file-path-fns";import{replacePath as i}from"@stryke/path/replace";import{resolveParentPath as a}from"@stryke/path/resolve-parent-path";import{titleCase as o}from"@stryke/string-format/title-case";import{isSetObject as s}from"@stryke/type-checks/is-set-object";import{ReflectionClass as c,ReflectionKind as l,stringifyType as u}from"@powerlines/deepkit/vendor/type";import{reflectType as d}from"@powerlines/deepkit/reflect-type";import{commonPath as f}from"@stryke/path/common";import{stripStars as p}from"@stryke/path/normalize";import{isSetString as m}from"@stryke/type-checks/is-set-string";function h(e,t){return i(n(t),e.commandsPath).replaceAll(/^\/+/g,``).replaceAll(/\/+$/g,``)}function g(e){return m(e.config.entry)?t(t(p(e.config.entry),e.config.projectRoot),e.workspaceConfig.workspaceRoot):s(e.config.entry)&&`file`in e.config.entry?t(t(p(e.config.entry.file),e.config.projectRoot),e.workspaceConfig.workspaceRoot):Array.isArray(e.config.entry)&&e.config.entry.length>0?f(e.config.entry.map(n=>t(t(p(m(n)?n:n.file),e.config.projectRoot),e.workspaceConfig.workspaceRoot))):t(e.config.sourceRoot||e.config.projectRoot,e.workspaceConfig.workspaceRoot)}function _(e){let t=r(e),n=1;for(;t.startsWith(`[`)&&t.endsWith(`]`);)t=r(a(e,n++));return t}async function v(t,n,r){let i=n.title||`${r?.title?`${r.title} - `:``}${o(n.name)}`,a={...n,title:i,description:n.description||`The ${i} ${r?`sub-`:``}command.`,options:Object.fromEntries(e(t,n).map(e=>[e.name,e])),params:[],parent:r??null,children:{}};if(n.isVirtual)t.trace(`Adding reflection for virtual command: ${n.id}`);else{if(!n.entry.input?.file||!t.fs.existsSync(n.entry.input.file))throw Error(`${n.entry.input?.file?`Non-existent`:`Missing`} command entry file for "${n.name}"`);t.trace(`Adding reflection for user-defined command: ${n.id} (file: ${n.entry.input.file})`);let e=await d(t,n.entry.input);if(e.kind!==l.function)throw Error(`The command entry file "${n.entry.input.file}" does not export a valid function.`);if(e.parameters.length>0&&e.parameters[0]){let t=e.parameters[0];if(t.type.kind===l.objectLiteral||t.type.kind===l.class){let e=c.from(t.type);for(let t of e.getProperties()){let e=t.getType();if(a.options[t.getNameAsString()]={name:t.getNameAsString(),alias:t.getTags().alias??[],title:t.getTags().title||o(t.getNameAsString()),description:t.getDescription(),kind:e.kind,optional:t.isOptional(),default:t.getDefaultValue(),variadic:!1},a.options[t.getNameAsString()].description??=`The ${a.options[t.getNameAsString()].title} option.`,e.kind===l.array)if(e.type.kind===l.string||e.type.kind===l.number)a.options[t.getNameAsString()].variadic=!0,a.options[t.getNameAsString()].kind=e.type.kind;else throw Error(`Unsupported array type for option "${t.getNameAsString()}" in command "${n.name}". Only string[] and number[] are supported.`);else if(e.kind!==l.boolean&&e.kind!==l.string&&e.kind!==l.number)throw Error(`Unsupported type for option "${t.getNameAsString()}" in command "${n.name}". Only string, number, boolean, string[] and number[] are supported, received ${u(e).trim().replaceAll(` | `,`, or `)}.`)}}}}for(let e of t.inputs.filter(e=>e.path.length===n.path.length+1&&e.path.slice(0,n.path.length).every((e,t)=>e===n.path[t])))a.children[e.name]=await v(t,e,a);return a}export{_ as findCommandName,g as findCommandsRoot,v as reflectCommandTree,h as resolveCommandPath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/join-paths`),n=require(`@stryke/
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/join-paths`),n=require(`@stryke/path/replace`),r=require(`@stryke/type-checks/is-set-object`),i=require(`@stryke/convert/to-array`),a=require(`@stryke/helpers/get-unique`),o=require(`@stryke/json/storm-json`),s=require(`@stryke/string-format/kebab-case`);function c(e,t){return`./bin/${(0,s.kebabCase)((0,n.replaceExtension)(e))}.${t===`cjs`||Array.isArray(t)&&t.includes(`cjs`)?`cjs`:`mjs`}`}async function l(e){let n=(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`package.json`);if(e.config.bin&&Array.isArray(e.config.bin)&&e.config.bin.length>0?(e.packageJson.bin=Object.fromEntries((0,a.getUnique)((0,i.toArray)(e.config.bin)).map(t=>[t,c(t,e.config.output.format)])),await e.fs.write(n,o.StormJSON.stringify(e.packageJson))):!(0,r.isSetObject)(e.packageJson.bin)&&(e.config.name||e.packageJson.name)&&(e.packageJson.bin={[e.config.name||e.packageJson.name]:c(e.config.name||e.packageJson.name,e.config.output.format)},await e.fs.write(n,o.StormJSON.stringify(e.packageJson))),!(0,r.isSetObject)(e.packageJson.bin))throw Error("Unable to determine the CLI binary name. Please specify the `bin` option in your Shell Shock configuration or ensure that the `name` field is set in your package.json.");e.config.bin=Object.keys(e.packageJson.bin)}exports.updatePackageJsonBinary=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{joinPaths as e}from"@stryke/path/join-paths";import{
|
|
1
|
+
import{joinPaths as e}from"@stryke/path/join-paths";import{replaceExtension as t}from"@stryke/path/replace";import{isSetObject as n}from"@stryke/type-checks/is-set-object";import{toArray as r}from"@stryke/convert/to-array";import{getUnique as i}from"@stryke/helpers/get-unique";import{StormJSON as a}from"@stryke/json/storm-json";import{kebabCase as o}from"@stryke/string-format/kebab-case";function s(e,n){return`./bin/${o(t(e))}.${n===`cjs`||Array.isArray(n)&&n.includes(`cjs`)?`cjs`:`mjs`}`}async function c(t){let o=e(t.workspaceConfig.workspaceRoot,t.config.projectRoot,`package.json`);if(t.config.bin&&Array.isArray(t.config.bin)&&t.config.bin.length>0?(t.packageJson.bin=Object.fromEntries(i(r(t.config.bin)).map(e=>[e,s(e,t.config.output.format)])),await t.fs.write(o,a.stringify(t.packageJson))):!n(t.packageJson.bin)&&(t.config.name||t.packageJson.name)&&(t.packageJson.bin={[t.config.name||t.packageJson.name]:s(t.config.name||t.packageJson.name,t.config.output.format)},await t.fs.write(o,a.stringify(t.packageJson))),!n(t.packageJson.bin))throw Error("Unable to determine the CLI binary name. Please specify the `bin` option in your Shell Shock configuration or ensure that the `name` field is set in your package.json.");t.config.bin=Object.keys(t.packageJson.bin)}export{c as updatePackageJsonBinary};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/string-format/title-case`),n=require(`@stryke/type-checks/is-set-string`),r=require(`@stryke/string-format/kebab-case`);function i(e){let t=e.config.bin&&((0,n.isSetString)(e.config.bin)||Array.isArray(e.config.bin)&&e.config.bin.length>0&&e.config.bin[0])?(0,n.isSetString)(e.config.bin)?e.config.bin:e.config.bin[0]:e.config.name||e.packageJson?.name;if(!(0,n.isSetString)(t))throw Error(`No application name found. Please provide a 'bin' option in the configuration or ensure the package.json has a valid 'name' field.`);return(0,r.kebabCase)(t)}function a(e){return(0,t.titleCase)(e.config.name||i(e))}function o(e){return e.config.description||e.packageJson?.description||`The ${a(e)} command-line interface application.`}exports.getAppDescription=o,exports.getAppName=i,exports.getAppTitle=a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{titleCase as e}from"@stryke/string-format/title-case";import{isSetString as t}from"@stryke/type-checks/is-set-string";import{kebabCase as n}from"@stryke/string-format/kebab-case";function r(e){let r=e.config.bin&&(t(e.config.bin)||Array.isArray(e.config.bin)&&e.config.bin.length>0&&e.config.bin[0])?t(e.config.bin)?e.config.bin:e.config.bin[0]:e.config.name||e.packageJson?.name;if(!t(r))throw Error(`No application name found. Please provide a 'bin' option in the configuration or ensure the package.json has a valid 'name' field.`);return n(r)}function i(t){return e(t.config.name||r(t))}function a(e){return e.config.description||e.packageJson?.description||`The ${i(e)} command-line interface application.`}export{a as getAppDescription,r as getAppName,i as getAppTitle};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./
|
|
1
|
+
Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./helpers/get-default-options.cjs`),t=require(`./powerlines.cjs`),n=require(`./api.cjs`),r=require(`./config.cjs`);async function i(e={}){return e.root??=process.cwd(),n.ShellShockAPI.from(e)}var a=n.ShellShockAPI;exports.ShellShockAPI=n.ShellShockAPI,exports.createShellShock=i,exports.default=a,exports.defineConfig=r.defineConfig,exports.getDefaultOptions=e.getDefaultOptions,exports.shellShock=t.shellShock;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
+
import { BaseCommandOption, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, NumberCommandOption, SerializedCommandTree, StringCommandOption } from "./types/command.cjs";
|
|
2
|
+
import { Context } from "./types/context.cjs";
|
|
1
3
|
import { Options, ResolvedConfig, UserConfig } from "./types/config.cjs";
|
|
2
4
|
import { ShellShockAPI } from "./api.cjs";
|
|
3
5
|
import { defineConfig } from "./config.cjs";
|
|
4
|
-
import {
|
|
6
|
+
import { getDefaultOptions } from "./helpers/get-default-options.cjs";
|
|
5
7
|
import shellShock from "./powerlines.cjs";
|
|
6
|
-
|
|
8
|
+
import { BaseCommandOptions } from "./types/options.cjs";
|
|
9
|
+
|
|
10
|
+
//#region src/index.d.ts
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new {@link ShellShockAPI} instance.
|
|
14
|
+
*
|
|
15
|
+
* @param options - The user configuration options.
|
|
16
|
+
* @returns A promise that resolves to a {@link ShellShockAPI} instance.
|
|
17
|
+
*/
|
|
18
|
+
declare function createShellShock(options?: Partial<UserConfig>): Promise<ShellShockAPI>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { BaseCommandOption, BaseCommandOptions, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, Context, NumberCommandOption, Options, ResolvedConfig, SerializedCommandTree, ShellShockAPI, ShellShockAPI as default, StringCommandOption, UserConfig, createShellShock, defineConfig, getDefaultOptions, shellShock };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
+
import { BaseCommandOption, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, NumberCommandOption, SerializedCommandTree, StringCommandOption } from "./types/command.mjs";
|
|
2
|
+
import { Context } from "./types/context.mjs";
|
|
1
3
|
import { Options, ResolvedConfig, UserConfig } from "./types/config.mjs";
|
|
2
4
|
import { ShellShockAPI } from "./api.mjs";
|
|
3
5
|
import { defineConfig } from "./config.mjs";
|
|
4
|
-
import {
|
|
6
|
+
import { getDefaultOptions } from "./helpers/get-default-options.mjs";
|
|
5
7
|
import shellShock from "./powerlines.mjs";
|
|
8
|
+
import { BaseCommandOptions } from "./types/options.mjs";
|
|
6
9
|
import "./types/index.mjs";
|
|
7
|
-
|
|
10
|
+
|
|
11
|
+
//#region src/index.d.ts
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new {@link ShellShockAPI} instance.
|
|
15
|
+
*
|
|
16
|
+
* @param options - The user configuration options.
|
|
17
|
+
* @returns A promise that resolves to a {@link ShellShockAPI} instance.
|
|
18
|
+
*/
|
|
19
|
+
declare function createShellShock(options?: Partial<UserConfig>): Promise<ShellShockAPI>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { BaseCommandOption, BaseCommandOptions, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, Context, NumberCommandOption, Options, ResolvedConfig, SerializedCommandTree, ShellShockAPI, ShellShockAPI as default, StringCommandOption, UserConfig, createShellShock, defineConfig, getDefaultOptions, shellShock };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getDefaultOptions as e}from"./helpers/get-default-options.mjs";import{shellShock as t}from"./powerlines.mjs";import{ShellShockAPI as n}from"./api.mjs";import{defineConfig as r}from"./config.mjs";async function i(e={}){return e.root??=process.cwd(),n.from(e)}var a=n;export{n as ShellShockAPI,i as createShellShock,a as default,r as defineConfig,e as getDefaultOptions,t as shellShock};
|
package/dist/powerlines.cjs
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./helpers/resolve-command.cjs`),
|
|
2
|
-
`)}`),this.
|
|
1
|
+
Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./helpers/get-default-options.cjs`),n=require(`./helpers/persistence.cjs`),r=require(`./helpers/resolve-command.cjs`),i=require(`./helpers/update-package-json.cjs`),a=require(`./helpers/utilities.cjs`);let o=require(`@stryke/fs/chmod-x`),s=require(`@stryke/path/append`),c=require(`@stryke/path/file-path-fns`),l=require(`@stryke/path/is-parent-path`),u=require(`@stryke/path/join-paths`),d=require(`@stryke/path/replace`),f=require(`@stryke/path/resolve-parent-path`),p=require(`@stryke/string-format/title-case`),m=require(`@stryke/type-checks/is-set-object`),h=require(`defu`),g=require(`node:fs`);const _=50,v=(e={})=>[{name:`shell-shock:config`,async config(){return this.trace(`Resolving the Shell Shock configuration.`),(0,h.defu)(e,{entry:!this.config.entry||Array.isArray(this.config.entry)&&this.config.entry.length===0?[(0,u.joinPaths)(this.config.sourceRoot,`**/*`)]:void 0,build:{target:`node22`,platform:`node`},interactive:!0,type:`application`,framework:`shell-shock`})},configResolved:{order:`pre`,async handler(){this.trace(`Shell Shock configuration has been resolved.`),await i.updatePackageJsonBinary(this),this.config.name=a.getAppName(this),this.config.title=a.getAppTitle(this),this.config.description=a.getAppDescription(this),this.options=t.getDefaultOptions(this,{id:null,name:this.config.name,title:this.config.title,description:this.config.description,path:[],isVirtual:!1}),this.inputs??=[]}}},{name:`shell-shock:inputs`,async configResolved(){this.trace(`Finding command entry points.`),this.commandsPath=r.findCommandsRoot(this),this.inputs=this.entry.filter(e=>(0,c.findFileName)(e.file,{withExtension:!1})===`command`).reduce((e,t)=>{let n=(0,s.appendPath)((0,s.appendPath)(t.file,this.config.projectRoot),this.workspaceConfig.workspaceRoot);if(!(0,l.isParentPath)(n,this.commandsPath))throw Error(`Command entry point "${n}" is not located within the commands root "${this.commandsPath}". Please ensure that all command entry points are located within the current project.`);let i=r.resolveCommandPath(this,n),a=i.replaceAll(`/`,`-`);if(!e.some(e=>e.id===a)){let o=r.findCommandName(n);e.push({id:a,path:i.split(`/`).filter(Boolean),name:o,title:(0,p.titleCase)(o),isVirtual:!1,entry:{...t,file:n,input:{file:t.file,name:t.name},output:o}})}return e},this.inputs)}},{name:`shell-shock:virtual-inputs`,configResolved:{order:`post`,async handler(){this.inputs.length===0?this.warn(`No commands were found in the project. Please ensure at least one command exists.`):(this.info(`Shell Shock will create an application with the following commands: \n${this.inputs.filter(e=>!e.isVirtual).map(e=>` - ${e.id}: ${(0,d.replacePath)(e.entry.file,this.commandsPath)}${e.isVirtual?` (virtual)`:``}`).join(`
|
|
2
|
+
`)}`),this.trace(`Finding and adding virtual command inputs for each command previously found.`),this.inputs=this.inputs.reduce((e,t)=>{let n=0,i=(0,f.resolveParentPath)((0,c.findFilePath)(t.entry.file));for(;i!==this.commandsPath;){if(n++>50)throw Error(`Maximum command virtual parent depth of 50 exceeded while processing command: ${t.name}`);if(!e.some(e=>(0,c.findFilePath)(e.entry.file)===i)){let t=(0,u.joinPaths)(i,`command.ts`),n=r.resolveCommandPath(this,t),a=n.replaceAll(`/`,`-`);if(!e.some(e=>e.id===a)){let i=r.findCommandName(t);e.push({id:a,path:n.split(`/`).filter(Boolean),name:i,title:(0,p.titleCase)(i),isVirtual:!0,entry:{file:t,input:{file:t}}})}}i=(0,f.resolveParentPath)(i)}return e},this.inputs).sort((e,t)=>e.path.length-t.path.length),this.trace(`Final command input list: \n${this.inputs.map(e=>` - ${e.id}: ${(0,d.replacePath)(e.entry.file,this.commandsPath)}${e.isVirtual?` (virtual)`:``}`).join(`
|
|
3
|
+
`)}`))}}},{name:`shell-shock:reflect-commands`,async prepare(){if(this.entry=[],this.commands={},this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&this.fs.existsSync(n.getCommandsPersistencePath(this)))this.debug(`Skipping reflection initialization as the meta checksum has not changed.`),await n.readCommandsPersistence(this);else{for(let e of this.inputs.filter(e=>e.path.length===1))this.commands[e.name]=await r.reflectCommandTree(this,e);await n.writeCommandsPersistence(this)}}},{name:`shell-shock:chmod+x`,async buildEnd(){if(!(0,m.isSetObject)(this.packageJson.bin)){this.warn(`No binaries were found in package.json. Please ensure the binaries are correctly configured.`);return}this.debug(`Adding executable permissions to binaries.`);for(let e of Object.values(this.packageJson.bin))(0,g.existsSync)((0,s.appendPath)(e,this.config.output.buildPath))&&await(0,o.chmodX)((0,s.appendPath)(e,this.config.output.buildPath))}}];var y=v;exports.default=y,exports.shellShock=v;
|
package/dist/powerlines.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Context } from "./types/context.cjs";
|
|
1
2
|
import { Options } from "./types/config.cjs";
|
|
2
|
-
import { BuildContext } from "./types/build.cjs";
|
|
3
3
|
import { Plugin } from "powerlines";
|
|
4
4
|
|
|
5
5
|
//#region src/powerlines.d.ts
|
|
@@ -7,6 +7,6 @@ import { Plugin } from "powerlines";
|
|
|
7
7
|
/**
|
|
8
8
|
* The core Powerlines plugin to build Shell Shock projects.
|
|
9
9
|
*/
|
|
10
|
-
declare const shellShock: <TContext extends
|
|
10
|
+
declare const shellShock: <TContext extends Context = Context>(options?: Options) => Plugin<TContext>[];
|
|
11
11
|
//#endregion
|
|
12
12
|
export { shellShock as default, shellShock };
|
package/dist/powerlines.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Context } from "./types/context.mjs";
|
|
1
2
|
import { Options } from "./types/config.mjs";
|
|
2
|
-
import { BuildContext } from "./types/build.mjs";
|
|
3
3
|
import { Plugin } from "powerlines";
|
|
4
4
|
|
|
5
5
|
//#region src/powerlines.d.ts
|
|
@@ -7,6 +7,6 @@ import { Plugin } from "powerlines";
|
|
|
7
7
|
/**
|
|
8
8
|
* The core Powerlines plugin to build Shell Shock projects.
|
|
9
9
|
*/
|
|
10
|
-
declare const shellShock: <TContext extends
|
|
10
|
+
declare const shellShock: <TContext extends Context = Context>(options?: Options) => Plugin<TContext>[];
|
|
11
11
|
//#endregion
|
|
12
12
|
export { shellShock as default, shellShock };
|
package/dist/powerlines.mjs
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`)}`),this.
|
|
1
|
+
import{getDefaultOptions as e}from"./helpers/get-default-options.mjs";import{getCommandsPersistencePath as t,readCommandsPersistence as n,writeCommandsPersistence as r}from"./helpers/persistence.mjs";import{findCommandName as i,findCommandsRoot as a,reflectCommandTree as o,resolveCommandPath as s}from"./helpers/resolve-command.mjs";import{updatePackageJsonBinary as c}from"./helpers/update-package-json.mjs";import{getAppDescription as l,getAppName as u,getAppTitle as d}from"./helpers/utilities.mjs";import{chmodX as f}from"@stryke/fs/chmod-x";import{appendPath as p}from"@stryke/path/append";import{findFileName as m,findFilePath as h}from"@stryke/path/file-path-fns";import{isParentPath as g}from"@stryke/path/is-parent-path";import{joinPaths as _}from"@stryke/path/join-paths";import{replacePath as v}from"@stryke/path/replace";import{resolveParentPath as y}from"@stryke/path/resolve-parent-path";import{titleCase as b}from"@stryke/string-format/title-case";import{isSetObject as x}from"@stryke/type-checks/is-set-object";import{defu as S}from"defu";import{existsSync as C}from"node:fs";const w=(w={})=>[{name:`shell-shock:config`,async config(){return this.trace(`Resolving the Shell Shock configuration.`),S(w,{entry:!this.config.entry||Array.isArray(this.config.entry)&&this.config.entry.length===0?[_(this.config.sourceRoot,`**/*`)]:void 0,build:{target:`node22`,platform:`node`},interactive:!0,type:`application`,framework:`shell-shock`})},configResolved:{order:`pre`,async handler(){this.trace(`Shell Shock configuration has been resolved.`),await c(this),this.config.name=u(this),this.config.title=d(this),this.config.description=l(this),this.options=e(this,{id:null,name:this.config.name,title:this.config.title,description:this.config.description,path:[],isVirtual:!1}),this.inputs??=[]}}},{name:`shell-shock:inputs`,async configResolved(){this.trace(`Finding command entry points.`),this.commandsPath=a(this),this.inputs=this.entry.filter(e=>m(e.file,{withExtension:!1})===`command`).reduce((e,t)=>{let n=p(p(t.file,this.config.projectRoot),this.workspaceConfig.workspaceRoot);if(!g(n,this.commandsPath))throw Error(`Command entry point "${n}" is not located within the commands root "${this.commandsPath}". Please ensure that all command entry points are located within the current project.`);let r=s(this,n),a=r.replaceAll(`/`,`-`);if(!e.some(e=>e.id===a)){let o=i(n);e.push({id:a,path:r.split(`/`).filter(Boolean),name:o,title:b(o),isVirtual:!1,entry:{...t,file:n,input:{file:t.file,name:t.name},output:o}})}return e},this.inputs)}},{name:`shell-shock:virtual-inputs`,configResolved:{order:`post`,async handler(){this.inputs.length===0?this.warn(`No commands were found in the project. Please ensure at least one command exists.`):(this.info(`Shell Shock will create an application with the following commands: \n${this.inputs.filter(e=>!e.isVirtual).map(e=>` - ${e.id}: ${v(e.entry.file,this.commandsPath)}${e.isVirtual?` (virtual)`:``}`).join(`
|
|
2
|
+
`)}`),this.trace(`Finding and adding virtual command inputs for each command previously found.`),this.inputs=this.inputs.reduce((e,t)=>{let n=0,r=y(h(t.entry.file));for(;r!==this.commandsPath;){if(n++>50)throw Error(`Maximum command virtual parent depth of 50 exceeded while processing command: ${t.name}`);if(!e.some(e=>h(e.entry.file)===r)){let t=_(r,`command.ts`),n=s(this,t),a=n.replaceAll(`/`,`-`);if(!e.some(e=>e.id===a)){let r=i(t);e.push({id:a,path:n.split(`/`).filter(Boolean),name:r,title:b(r),isVirtual:!0,entry:{file:t,input:{file:t}}})}}r=y(r)}return e},this.inputs).sort((e,t)=>e.path.length-t.path.length),this.trace(`Final command input list: \n${this.inputs.map(e=>` - ${e.id}: ${v(e.entry.file,this.commandsPath)}${e.isVirtual?` (virtual)`:``}`).join(`
|
|
3
|
+
`)}`))}}},{name:`shell-shock:reflect-commands`,async prepare(){if(this.entry=[],this.commands={},this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&this.fs.existsSync(t(this)))this.debug(`Skipping reflection initialization as the meta checksum has not changed.`),await n(this);else{for(let e of this.inputs.filter(e=>e.path.length===1))this.commands[e.name]=await o(this,e);await r(this)}}},{name:`shell-shock:chmod+x`,async buildEnd(){if(!x(this.packageJson.bin)){this.warn(`No binaries were found in package.json. Please ensure the binaries are correctly configured.`);return}this.debug(`Adding executable permissions to binaries.`);for(let e of Object.values(this.packageJson.bin))C(p(e,this.config.output.buildPath))&&await f(p(e,this.config.output.buildPath))}}];var T=w;export{T as default,w as shellShock};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
2
|
+
import { ResolvedEntryTypeDefinition } from "powerlines/types/resolved";
|
|
3
|
+
|
|
4
|
+
//#region src/types/command.d.ts
|
|
5
|
+
interface BaseCommandOption {
|
|
6
|
+
name: string;
|
|
7
|
+
kind: ReflectionKind;
|
|
8
|
+
title: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
alias: string[];
|
|
11
|
+
optional: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface StringCommandOption extends BaseCommandOption {
|
|
14
|
+
kind: ReflectionKind.string;
|
|
15
|
+
format?: "path" | "url" | "date" | "time" | "datetime" | "json" | "regex" | string;
|
|
16
|
+
default?: string;
|
|
17
|
+
variadic: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface NumberCommandOption extends BaseCommandOption {
|
|
20
|
+
kind: ReflectionKind.number;
|
|
21
|
+
default?: number;
|
|
22
|
+
variadic: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface BooleanCommandOption extends BaseCommandOption {
|
|
25
|
+
kind: ReflectionKind.boolean;
|
|
26
|
+
default?: boolean;
|
|
27
|
+
isNegativeOf?: string;
|
|
28
|
+
skipAddingNegative?: boolean;
|
|
29
|
+
}
|
|
30
|
+
type CommandOption = StringCommandOption | NumberCommandOption | BooleanCommandOption;
|
|
31
|
+
interface CommandParam {
|
|
32
|
+
name: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
default?: string;
|
|
35
|
+
optional: boolean;
|
|
36
|
+
variadic: boolean;
|
|
37
|
+
}
|
|
38
|
+
interface CommandBase {
|
|
39
|
+
id: string | null;
|
|
40
|
+
name: string;
|
|
41
|
+
title?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
path: string[];
|
|
44
|
+
isVirtual: boolean;
|
|
45
|
+
}
|
|
46
|
+
interface CommandInput extends CommandBase {
|
|
47
|
+
id: string;
|
|
48
|
+
entry: ResolvedEntryTypeDefinition;
|
|
49
|
+
}
|
|
50
|
+
type CommandTree = CommandInput & {
|
|
51
|
+
title: string;
|
|
52
|
+
description: string;
|
|
53
|
+
options: Record<string, CommandOption>;
|
|
54
|
+
params: CommandParam[];
|
|
55
|
+
parent: null | CommandTree;
|
|
56
|
+
children: Record<string, CommandTree>;
|
|
57
|
+
};
|
|
58
|
+
type SerializedCommandTree = Omit<CommandTree, "parent" | "children"> & {
|
|
59
|
+
parent: null | string;
|
|
60
|
+
children: Record<string, SerializedCommandTree>;
|
|
61
|
+
};
|
|
62
|
+
//#endregion
|
|
63
|
+
export { BaseCommandOption, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, NumberCommandOption, SerializedCommandTree, StringCommandOption };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
2
|
+
import { ResolvedEntryTypeDefinition } from "powerlines/types/resolved";
|
|
3
|
+
|
|
4
|
+
//#region src/types/command.d.ts
|
|
5
|
+
interface BaseCommandOption {
|
|
6
|
+
name: string;
|
|
7
|
+
kind: ReflectionKind;
|
|
8
|
+
title: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
alias: string[];
|
|
11
|
+
optional: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface StringCommandOption extends BaseCommandOption {
|
|
14
|
+
kind: ReflectionKind.string;
|
|
15
|
+
format?: "path" | "url" | "date" | "time" | "datetime" | "json" | "regex" | string;
|
|
16
|
+
default?: string;
|
|
17
|
+
variadic: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface NumberCommandOption extends BaseCommandOption {
|
|
20
|
+
kind: ReflectionKind.number;
|
|
21
|
+
default?: number;
|
|
22
|
+
variadic: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface BooleanCommandOption extends BaseCommandOption {
|
|
25
|
+
kind: ReflectionKind.boolean;
|
|
26
|
+
default?: boolean;
|
|
27
|
+
isNegativeOf?: string;
|
|
28
|
+
skipAddingNegative?: boolean;
|
|
29
|
+
}
|
|
30
|
+
type CommandOption = StringCommandOption | NumberCommandOption | BooleanCommandOption;
|
|
31
|
+
interface CommandParam {
|
|
32
|
+
name: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
default?: string;
|
|
35
|
+
optional: boolean;
|
|
36
|
+
variadic: boolean;
|
|
37
|
+
}
|
|
38
|
+
interface CommandBase {
|
|
39
|
+
id: string | null;
|
|
40
|
+
name: string;
|
|
41
|
+
title?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
path: string[];
|
|
44
|
+
isVirtual: boolean;
|
|
45
|
+
}
|
|
46
|
+
interface CommandInput extends CommandBase {
|
|
47
|
+
id: string;
|
|
48
|
+
entry: ResolvedEntryTypeDefinition;
|
|
49
|
+
}
|
|
50
|
+
type CommandTree = CommandInput & {
|
|
51
|
+
title: string;
|
|
52
|
+
description: string;
|
|
53
|
+
options: Record<string, CommandOption>;
|
|
54
|
+
params: CommandParam[];
|
|
55
|
+
parent: null | CommandTree;
|
|
56
|
+
children: Record<string, CommandTree>;
|
|
57
|
+
};
|
|
58
|
+
type SerializedCommandTree = Omit<CommandTree, "parent" | "children"> & {
|
|
59
|
+
parent: null | string;
|
|
60
|
+
children: Record<string, SerializedCommandTree>;
|
|
61
|
+
};
|
|
62
|
+
//#endregion
|
|
63
|
+
export { BaseCommandOption, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, NumberCommandOption, SerializedCommandTree, StringCommandOption };
|
package/dist/types/config.d.cts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { CommandBase, CommandOption } from "./command.cjs";
|
|
2
|
+
import { Context } from "./context.cjs";
|
|
1
3
|
import { TsdownPluginResolvedConfig, TsdownPluginUserConfig } from "@powerlines/plugin-tsdown";
|
|
2
4
|
|
|
3
5
|
//#region src/types/config.d.ts
|
|
@@ -15,20 +17,16 @@ interface Options {
|
|
|
15
17
|
*/
|
|
16
18
|
interactive?: boolean | "never";
|
|
17
19
|
/**
|
|
18
|
-
*
|
|
20
|
+
* A set of default command options to apply to each command.
|
|
19
21
|
*
|
|
20
22
|
* @remarks
|
|
21
23
|
* By default, Shell Shock adds the following set of default arguments to each command:
|
|
22
24
|
* - `--help` (`-h`, `-?`): Show help information.
|
|
23
25
|
* - `--version` (`-v`): Show the version of the application.
|
|
24
|
-
* - `--interactive` (`-i`, `--interact`): Enable interactive mode.
|
|
25
|
-
* - `--no-interactive`: Disable interactive mode.
|
|
26
|
-
* - `--no-banner`: Hide the banner displayed while running the CLI application.
|
|
27
|
-
* - `--verbose`: Enable verbose output.
|
|
28
26
|
*
|
|
29
|
-
*
|
|
27
|
+
* To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.
|
|
30
28
|
*/
|
|
31
|
-
|
|
29
|
+
defaultOptions?: CommandOption[] | ((context: Context, input: CommandBase) => CommandOption[]) | false;
|
|
32
30
|
/**
|
|
33
31
|
* The name(s) of the binary that will be generated to run the CLI
|
|
34
32
|
*/
|
package/dist/types/config.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { CommandBase, CommandOption } from "./command.mjs";
|
|
2
|
+
import { Context } from "./context.mjs";
|
|
1
3
|
import { TsdownPluginResolvedConfig, TsdownPluginUserConfig } from "@powerlines/plugin-tsdown";
|
|
2
4
|
|
|
3
5
|
//#region src/types/config.d.ts
|
|
@@ -15,20 +17,16 @@ interface Options {
|
|
|
15
17
|
*/
|
|
16
18
|
interactive?: boolean | "never";
|
|
17
19
|
/**
|
|
18
|
-
*
|
|
20
|
+
* A set of default command options to apply to each command.
|
|
19
21
|
*
|
|
20
22
|
* @remarks
|
|
21
23
|
* By default, Shell Shock adds the following set of default arguments to each command:
|
|
22
24
|
* - `--help` (`-h`, `-?`): Show help information.
|
|
23
25
|
* - `--version` (`-v`): Show the version of the application.
|
|
24
|
-
* - `--interactive` (`-i`, `--interact`): Enable interactive mode.
|
|
25
|
-
* - `--no-interactive`: Disable interactive mode.
|
|
26
|
-
* - `--no-banner`: Hide the banner displayed while running the CLI application.
|
|
27
|
-
* - `--verbose`: Enable verbose output.
|
|
28
26
|
*
|
|
29
|
-
*
|
|
27
|
+
* To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.
|
|
30
28
|
*/
|
|
31
|
-
|
|
29
|
+
defaultOptions?: CommandOption[] | ((context: Context, input: CommandBase) => CommandOption[]) | false;
|
|
32
30
|
/**
|
|
33
31
|
* The name(s) of the binary that will be generated to run the CLI
|
|
34
32
|
*/
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CommandInput, CommandOption, CommandTree } from "./command.cjs";
|
|
2
|
+
import { ResolvedConfig } from "./config.cjs";
|
|
3
|
+
import { TsdownPluginContext } from "@powerlines/plugin-tsdown";
|
|
4
|
+
|
|
5
|
+
//#region src/types/context.d.ts
|
|
6
|
+
type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = TsdownPluginContext<TResolvedConfig> & {
|
|
7
|
+
/**
|
|
8
|
+
* The root path where commands are located.
|
|
9
|
+
*/
|
|
10
|
+
commandsPath: string;
|
|
11
|
+
/**
|
|
12
|
+
* The default command arguments to apply to all application commands.
|
|
13
|
+
*/
|
|
14
|
+
options: CommandOption[];
|
|
15
|
+
/**
|
|
16
|
+
* The list of commands discovered in the project.
|
|
17
|
+
*/
|
|
18
|
+
inputs: CommandInput[];
|
|
19
|
+
/**
|
|
20
|
+
* The command-line application structure.
|
|
21
|
+
*/
|
|
22
|
+
commands: Record<string, CommandTree>;
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { Context };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CommandInput, CommandOption, CommandTree } from "./command.mjs";
|
|
2
|
+
import { ResolvedConfig } from "./config.mjs";
|
|
3
|
+
import { TsdownPluginContext } from "@powerlines/plugin-tsdown";
|
|
4
|
+
|
|
5
|
+
//#region src/types/context.d.ts
|
|
6
|
+
type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = TsdownPluginContext<TResolvedConfig> & {
|
|
7
|
+
/**
|
|
8
|
+
* The root path where commands are located.
|
|
9
|
+
*/
|
|
10
|
+
commandsPath: string;
|
|
11
|
+
/**
|
|
12
|
+
* The default command arguments to apply to all application commands.
|
|
13
|
+
*/
|
|
14
|
+
options: CommandOption[];
|
|
15
|
+
/**
|
|
16
|
+
* The list of commands discovered in the project.
|
|
17
|
+
*/
|
|
18
|
+
inputs: CommandInput[];
|
|
19
|
+
/**
|
|
20
|
+
* The command-line application structure.
|
|
21
|
+
*/
|
|
22
|
+
commands: Record<string, CommandTree>;
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { Context };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { BaseCommandOption, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, NumberCommandOption, SerializedCommandTree, StringCommandOption } from "./command.cjs";
|
|
2
|
+
import { Context } from "./context.cjs";
|
|
1
3
|
import { Options, ResolvedConfig, UserConfig } from "./config.cjs";
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
+
import { BaseCommandOptions } from "./options.cjs";
|
|
5
|
+
export { BaseCommandOption, BaseCommandOptions, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, Context, NumberCommandOption, Options, ResolvedConfig, SerializedCommandTree, StringCommandOption, UserConfig };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { BaseCommandOption, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, NumberCommandOption, SerializedCommandTree, StringCommandOption } from "./command.mjs";
|
|
2
|
+
import { Context } from "./context.mjs";
|
|
1
3
|
import { Options, ResolvedConfig, UserConfig } from "./config.mjs";
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
+
import { BaseCommandOptions } from "./options.mjs";
|
|
5
|
+
export { BaseCommandOption, BaseCommandOptions, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, Context, NumberCommandOption, Options, ResolvedConfig, SerializedCommandTree, StringCommandOption, UserConfig };
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "A package containing
|
|
5
|
+
"description": "A package containing the core Shell Shock functionality used to build and manage a command-line application.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "github",
|
|
8
8
|
"url": "https://github.com/storm-software/shell-shock.git",
|
|
@@ -136,8 +136,9 @@
|
|
|
136
136
|
"files": ["dist/**/*"],
|
|
137
137
|
"keywords": ["shell-shock", "powerlines", "storm-software"],
|
|
138
138
|
"dependencies": {
|
|
139
|
-
"@powerlines/
|
|
140
|
-
"@powerlines/plugin-
|
|
139
|
+
"@powerlines/deepkit": "^0.5.10",
|
|
140
|
+
"@powerlines/plugin-plugin": "^0.12.47",
|
|
141
|
+
"@powerlines/plugin-tsdown": "^0.1.47",
|
|
141
142
|
"@stryke/convert": "^0.6.29",
|
|
142
143
|
"@stryke/helpers": "^0.9.31",
|
|
143
144
|
"@stryke/json": "^0.9.32",
|
|
@@ -145,9 +146,11 @@
|
|
|
145
146
|
"@stryke/string-format": "^0.12.29",
|
|
146
147
|
"@stryke/type-checks": "^0.5.14",
|
|
147
148
|
"defu": "^6.1.4",
|
|
148
|
-
"powerlines": "^0.
|
|
149
|
+
"powerlines": "^0.36.0",
|
|
150
|
+
"@stryke/capnp": "^0.12.51",
|
|
151
|
+
"@stryke/fs": "^0.33.26"
|
|
149
152
|
},
|
|
150
153
|
"devDependencies": { "@types/node": "^24.10.4", "typescript": "^5.9.3" },
|
|
151
154
|
"publishConfig": { "access": "public" },
|
|
152
|
-
"gitHead": "
|
|
155
|
+
"gitHead": "e7794a7d008c5d32b5a999b62421281d370166cd"
|
|
153
156
|
}
|
package/dist/types/build.d.cts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { ResolvedConfig } from "./config.cjs";
|
|
2
|
-
import { TsdownPluginContext } from "@powerlines/plugin-tsdown";
|
|
3
|
-
import { ResolvedEntryTypeDefinition } from "powerlines/types/resolved";
|
|
4
|
-
|
|
5
|
-
//#region src/types/build.d.ts
|
|
6
|
-
type CommandArg = {
|
|
7
|
-
name: string;
|
|
8
|
-
title: string;
|
|
9
|
-
description?: string;
|
|
10
|
-
alias: string[];
|
|
11
|
-
optional: boolean;
|
|
12
|
-
} & (({
|
|
13
|
-
type: "string";
|
|
14
|
-
format?: "path" | "url" | "date" | "time" | "datetime" | "json" | "regex" | string;
|
|
15
|
-
} & ({
|
|
16
|
-
variadic: false;
|
|
17
|
-
default?: string;
|
|
18
|
-
} | {
|
|
19
|
-
variadic: true;
|
|
20
|
-
default?: string[];
|
|
21
|
-
})) | ({
|
|
22
|
-
type: "number";
|
|
23
|
-
} & ({
|
|
24
|
-
variadic: false;
|
|
25
|
-
default?: number;
|
|
26
|
-
} | {
|
|
27
|
-
variadic: true;
|
|
28
|
-
default?: number[];
|
|
29
|
-
})) | {
|
|
30
|
-
type: "boolean";
|
|
31
|
-
default?: boolean;
|
|
32
|
-
isNegativeOf?: string;
|
|
33
|
-
});
|
|
34
|
-
interface CommandEntry {
|
|
35
|
-
path: string[];
|
|
36
|
-
name: string;
|
|
37
|
-
title: string;
|
|
38
|
-
description?: string;
|
|
39
|
-
isVirtual: boolean;
|
|
40
|
-
entry: ResolvedEntryTypeDefinition;
|
|
41
|
-
}
|
|
42
|
-
type CommandTree = CommandEntry & {
|
|
43
|
-
args: CommandArg[];
|
|
44
|
-
parent: null | CommandTree;
|
|
45
|
-
children: Record<string, CommandTree>;
|
|
46
|
-
};
|
|
47
|
-
interface CommandRelations {
|
|
48
|
-
parent: string | null;
|
|
49
|
-
children: string[];
|
|
50
|
-
}
|
|
51
|
-
type BuildContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = TsdownPluginContext<TResolvedConfig> & {
|
|
52
|
-
/**
|
|
53
|
-
* The root path where commands are located.
|
|
54
|
-
*/
|
|
55
|
-
commandsRoot: string;
|
|
56
|
-
/**
|
|
57
|
-
* The list of commands discovered in the project.
|
|
58
|
-
*/
|
|
59
|
-
commands: CommandEntry[];
|
|
60
|
-
/**
|
|
61
|
-
* The command hierarchy tree.
|
|
62
|
-
*/
|
|
63
|
-
tree: CommandTree;
|
|
64
|
-
};
|
|
65
|
-
//#endregion
|
|
66
|
-
export { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree };
|
package/dist/types/build.d.mts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { ResolvedConfig } from "./config.mjs";
|
|
2
|
-
import { TsdownPluginContext } from "@powerlines/plugin-tsdown";
|
|
3
|
-
import { ResolvedEntryTypeDefinition } from "powerlines/types/resolved";
|
|
4
|
-
|
|
5
|
-
//#region src/types/build.d.ts
|
|
6
|
-
type CommandArg = {
|
|
7
|
-
name: string;
|
|
8
|
-
title: string;
|
|
9
|
-
description?: string;
|
|
10
|
-
alias: string[];
|
|
11
|
-
optional: boolean;
|
|
12
|
-
} & (({
|
|
13
|
-
type: "string";
|
|
14
|
-
format?: "path" | "url" | "date" | "time" | "datetime" | "json" | "regex" | string;
|
|
15
|
-
} & ({
|
|
16
|
-
variadic: false;
|
|
17
|
-
default?: string;
|
|
18
|
-
} | {
|
|
19
|
-
variadic: true;
|
|
20
|
-
default?: string[];
|
|
21
|
-
})) | ({
|
|
22
|
-
type: "number";
|
|
23
|
-
} & ({
|
|
24
|
-
variadic: false;
|
|
25
|
-
default?: number;
|
|
26
|
-
} | {
|
|
27
|
-
variadic: true;
|
|
28
|
-
default?: number[];
|
|
29
|
-
})) | {
|
|
30
|
-
type: "boolean";
|
|
31
|
-
default?: boolean;
|
|
32
|
-
isNegativeOf?: string;
|
|
33
|
-
});
|
|
34
|
-
interface CommandEntry {
|
|
35
|
-
path: string[];
|
|
36
|
-
name: string;
|
|
37
|
-
title: string;
|
|
38
|
-
description?: string;
|
|
39
|
-
isVirtual: boolean;
|
|
40
|
-
entry: ResolvedEntryTypeDefinition;
|
|
41
|
-
}
|
|
42
|
-
type CommandTree = CommandEntry & {
|
|
43
|
-
args: CommandArg[];
|
|
44
|
-
parent: null | CommandTree;
|
|
45
|
-
children: Record<string, CommandTree>;
|
|
46
|
-
};
|
|
47
|
-
interface CommandRelations {
|
|
48
|
-
parent: string | null;
|
|
49
|
-
children: string[];
|
|
50
|
-
}
|
|
51
|
-
type BuildContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = TsdownPluginContext<TResolvedConfig> & {
|
|
52
|
-
/**
|
|
53
|
-
* The root path where commands are located.
|
|
54
|
-
*/
|
|
55
|
-
commandsRoot: string;
|
|
56
|
-
/**
|
|
57
|
-
* The list of commands discovered in the project.
|
|
58
|
-
*/
|
|
59
|
-
commands: CommandEntry[];
|
|
60
|
-
/**
|
|
61
|
-
* The command hierarchy tree.
|
|
62
|
-
*/
|
|
63
|
-
tree: CommandTree;
|
|
64
|
-
};
|
|
65
|
-
//#endregion
|
|
66
|
-
export { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree };
|
|
File without changes
|
|
File without changes
|