@jujulego/jill 2.0.0-alpha.1 → 2.0.0-alpha.2
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/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +14 -14
- package/dist/commands/list.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +5 -2
- package/dist/main.js.map +1 -1
- package/dist/middlewares/global-config.d.ts +5 -0
- package/dist/middlewares/global-config.d.ts.map +1 -0
- package/dist/middlewares/global-config.js +26 -0
- package/dist/middlewares/global-config.js.map +1 -0
- package/dist/{modifiers → middlewares}/index.d.ts +0 -0
- package/dist/middlewares/index.d.ts.map +1 -0
- package/dist/{modifiers → middlewares}/index.js +0 -0
- package/dist/middlewares/index.js.map +1 -0
- package/dist/{modifiers → middlewares}/load-project.d.ts +1 -2
- package/dist/middlewares/load-project.d.ts.map +1 -0
- package/dist/{modifiers → middlewares}/load-project.js +19 -17
- package/dist/middlewares/load-project.js.map +1 -0
- package/dist/middlewares/setup-ink.d.ts +1 -0
- package/dist/middlewares/setup-ink.d.ts.map +1 -0
- package/dist/{modifiers → middlewares}/setup-ink.js +9 -6
- package/dist/middlewares/setup-ink.js.map +1 -0
- package/dist/services/logger.service.d.ts +3 -2
- package/dist/services/logger.service.d.ts.map +1 -1
- package/dist/services/logger.service.js +32 -15
- package/dist/services/logger.service.js.map +1 -1
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +1 -0
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/layout.d.ts.map +1 -1
- package/dist/ui/layout.js +3 -2
- package/dist/ui/layout.js.map +1 -1
- package/dist/ui/list.d.ts +6 -0
- package/dist/ui/list.d.ts.map +1 -0
- package/dist/ui/list.js +30 -0
- package/dist/ui/list.js.map +1 -0
- package/dist/ui/static-logs.d.ts.map +1 -1
- package/dist/ui/static-logs.js +13 -36
- package/dist/ui/static-logs.js.map +1 -1
- package/dist/utils.d.ts +9 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +16 -5
- package/dist/utils.js.map +1 -1
- package/package.json +2 -1
- package/dist/modifiers/global-config.d.ts +0 -6
- package/dist/modifiers/global-config.d.ts.map +0 -1
- package/dist/modifiers/global-config.js +0 -24
- package/dist/modifiers/global-config.js.map +0 -1
- package/dist/modifiers/index.d.ts.map +0 -1
- package/dist/modifiers/index.js.map +0 -1
- package/dist/modifiers/load-project.d.ts.map +0 -1
- package/dist/modifiers/load-project.js.map +0 -1
- package/dist/modifiers/setup-ink.d.ts +0 -2
- package/dist/modifiers/setup-ink.d.ts.map +0 -1
- package/dist/modifiers/setup-ink.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["commands/list.
|
|
1
|
+
{"version":3,"sources":["commands/list.tsx"],"names":[],"mappings":";AAaA,oBAAY,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAC7D,oBAAY,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;AA8BtD,wBAiIG","file":"list.d.ts","sourcesContent":["import chalk from 'chalk';\nimport path from 'node:path';\nimport ink from 'ink';\nimport slugify from 'slugify';\n\nimport { AffectedFilter, Pipeline, PrivateFilter, ScriptsFilter } from '../filters';\nimport { loadProject, setupInk } from '../middlewares';\nimport { Project, Workspace } from '../project';\nimport { container, CURRENT_PROJECT, INK_APP } from '../services';\nimport { Layout, List } from '../ui';\nimport { applyMiddlewares, defineCommand } from '../utils';\n\n// Types\nexport type Attribute = 'name' | 'version' | 'root' | 'slug';\nexport type Data = Partial<Record<Attribute, string>>;\n\ntype Extractor<T> = (wks: Workspace, json: boolean) => T;\n\n// Constants\nconst LONG_ATTRIBUTES: Attribute[] = ['name', 'version', 'root'];\nconst JSON_ATTRIBUTES: Attribute[] = ['name', 'version', 'slug', 'root'];\nconst DEFAULT_ATTRIBUTES: Attribute[] = ['name'];\n\nconst EXTRACTORS: Record<Attribute, Extractor<string | undefined>> = {\n name: wks => wks.name,\n version: (wks, json) => wks.manifest.version || (json ? undefined : chalk.grey('unset')),\n root: wks => wks.cwd,\n slug: wks => slugify(wks.name)\n};\n\n// Utils\nfunction buildExtractor(attrs: Attribute[]): Extractor<Data> {\n return (wks, json: boolean) => {\n const data: Data = {};\n\n for (const attr of attrs) {\n data[attr] = EXTRACTORS[attr](wks, json);\n }\n\n return data;\n };\n}\n\n// Command\nexport default defineCommand({\n command: ['list', 'ls'],\n describe: 'List workspaces',\n builder: (yargs) => applyMiddlewares(yargs, [\n setupInk,\n loadProject,\n ])\n // Filters\n .option('private', {\n type: 'boolean',\n group: 'Filters:',\n desc: 'Print only private workspaces',\n })\n .option('with-script', {\n type: 'array',\n string: true,\n group: 'Filters:',\n desc: 'Print only workspaces having the given script',\n })\n\n // Affected filter\n .option('affected', {\n alias: 'a',\n type: 'string',\n coerce: (rev: string) => rev === '' ? 'master' : rev,\n group: 'Affected:',\n desc: 'Print only affected workspaces towards given git revision. If no revision is given, it will check towards master.\\n' +\n 'Replaces %name by workspace name.',\n })\n .option('affected-rev-sort', {\n type: 'string',\n group: 'Affected:',\n desc: 'Sort applied to git tag / git branch command',\n })\n .option('affected-rev-fallback', {\n type: 'string',\n default: 'master',\n group: 'Affected:',\n desc: 'Fallback revision, used if no revision matching the given format is found',\n })\n .option('attrs', {\n type: 'array',\n choices: ['name', 'version', 'root', 'slug'],\n default: [] as Attribute[],\n group: 'Format:',\n desc: 'Select printed attributes'\n })\n .option('headers', {\n type: 'boolean',\n group: 'Format:',\n desc: 'Prints columns headers'\n })\n .option('long', {\n alias: 'l',\n type: 'boolean',\n group: 'Format:',\n desc: 'Prints name, version and root of all workspaces',\n })\n .option('json', {\n type: 'boolean',\n group: 'Format:',\n desc: 'Prints data as a JSON array',\n }),\n async handler(args) {\n // Setup pipeline\n const pipeline = new Pipeline();\n\n if (args.private !== undefined) {\n pipeline.add(new PrivateFilter(args.private));\n }\n\n if (args.withScript) {\n pipeline.add(new ScriptsFilter(args.withScript));\n }\n\n if (args.affected !== undefined) {\n pipeline.add(new AffectedFilter(\n args.affected,\n args.affectedRevFallback,\n args.affectedRevSort\n ));\n }\n\n // Load workspaces\n const project = container.get<Project>(CURRENT_PROJECT);\n const workspaces: Workspace[] = [];\n\n for await (const wks of pipeline.filter(project.workspaces())) {\n workspaces.push(wks);\n }\n\n // Build data\n let attrs = args.attrs;\n\n if (args.attrs.length === 0) {\n if (args.long) {\n attrs = LONG_ATTRIBUTES;\n } else if (args.json) {\n attrs = JSON_ATTRIBUTES;\n } else {\n attrs = DEFAULT_ATTRIBUTES;\n }\n }\n\n const data = workspaces.map(wks => buildExtractor(attrs)(wks, args.json || false));\n\n // Print list\n if (args.json) {\n if (process.stdout.isTTY) { // Pretty print for ttys\n console.log(JSON.stringify(data, null, 2));\n } else {\n console.log(JSON.stringify(data));\n }\n } else {\n const app = container.get<ink.Instance>(INK_APP);\n\n for (const d of data) {\n if (d.root) {\n d.root = path.relative(process.cwd(), d.root) ?? '.';\n }\n }\n\n app.rerender(\n <Layout>\n <List items={data} headers={args.headers ?? (attrs.length > 1)} />\n </Layout>\n );\n }\n }\n});\n"]}
|
package/dist/commands/list.js
CHANGED
|
@@ -7,14 +7,15 @@ Object.defineProperty(exports, // Command
|
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: ()=>_default
|
|
9
9
|
});
|
|
10
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
10
11
|
const _chalk = /*#__PURE__*/ _interopRequireDefault(require("chalk"));
|
|
11
12
|
const _nodePath = /*#__PURE__*/ _interopRequireDefault(require("node:path"));
|
|
12
13
|
const _slugify = /*#__PURE__*/ _interopRequireDefault(require("slugify"));
|
|
13
14
|
const _filters = require("../filters");
|
|
14
|
-
const
|
|
15
|
+
const _middlewares = require("../middlewares");
|
|
15
16
|
const _services = require("../services");
|
|
16
|
-
const _utils = require("../utils");
|
|
17
17
|
const _ui = require("../ui");
|
|
18
|
+
const _utils = require("../utils");
|
|
18
19
|
function _interopRequireDefault(obj) {
|
|
19
20
|
return obj && obj.__esModule ? obj : {
|
|
20
21
|
default: obj
|
|
@@ -57,9 +58,9 @@ const _default = (0, _utils.defineCommand)({
|
|
|
57
58
|
'ls'
|
|
58
59
|
],
|
|
59
60
|
describe: 'List workspaces',
|
|
60
|
-
builder: (yargs)=>(0, _utils.
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
builder: (yargs)=>(0, _utils.applyMiddlewares)(yargs, [
|
|
62
|
+
_middlewares.setupInk,
|
|
63
|
+
_middlewares.loadProject
|
|
63
64
|
])// Filters
|
|
64
65
|
.option('private', {
|
|
65
66
|
type: 'boolean',
|
|
@@ -149,19 +150,18 @@ const _default = (0, _utils.defineCommand)({
|
|
|
149
150
|
console.log(JSON.stringify(data));
|
|
150
151
|
}
|
|
151
152
|
} else {
|
|
152
|
-
const
|
|
153
|
-
if (args.headers ?? attrs.length > 1) {
|
|
154
|
-
list.setHeaders(attrs);
|
|
155
|
-
}
|
|
153
|
+
const app = _services.container.get(_services.INK_APP);
|
|
156
154
|
for (const d of data){
|
|
157
155
|
if (d.root) {
|
|
158
|
-
d.root = _nodePath.default.relative(process.cwd(), d.root)
|
|
156
|
+
d.root = _nodePath.default.relative(process.cwd(), d.root) ?? '.';
|
|
159
157
|
}
|
|
160
|
-
list.add(attrs.map((attr)=>d[attr] || ''));
|
|
161
|
-
}
|
|
162
|
-
for (const d1 of list.lines()){
|
|
163
|
-
console.log(d1);
|
|
164
158
|
}
|
|
159
|
+
app.rerender(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_ui.Layout, {
|
|
160
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_ui.List, {
|
|
161
|
+
items: data,
|
|
162
|
+
headers: args.headers ?? attrs.length > 1
|
|
163
|
+
})
|
|
164
|
+
}));
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["commands/list.js"],"sourcesContent":["import chalk from 'chalk';\nimport path from 'node:path';\nimport slugify from 'slugify';\n\nimport { AffectedFilter, Pipeline, PrivateFilter, ScriptsFilter } from '../filters';\nimport { loadProject, setupInk } from '../
|
|
1
|
+
{"version":3,"sources":["commands/list.js"],"sourcesContent":["import chalk from 'chalk';\nimport path from 'node:path';\nimport ink from 'ink';\nimport slugify from 'slugify';\n\nimport { AffectedFilter, Pipeline, PrivateFilter, ScriptsFilter } from '../filters';\nimport { loadProject, setupInk } from '../middlewares';\nimport { Project, Workspace } from '../project';\nimport { container, CURRENT_PROJECT, INK_APP } from '../services';\nimport { Layout, List } from '../ui';\nimport { applyMiddlewares, defineCommand } from '../utils';\n\n// Types\nexport type Attribute = 'name' | 'version' | 'root' | 'slug';\nexport type Data = Partial<Record<Attribute, string>>;\n\ntype Extractor<T> = (wks: Workspace, json: boolean) => T;\n\n// Constants\nconst LONG_ATTRIBUTES: Attribute[] = ['name', 'version', 'root'];\nconst JSON_ATTRIBUTES: Attribute[] = ['name', 'version', 'slug', 'root'];\nconst DEFAULT_ATTRIBUTES: Attribute[] = ['name'];\n\nconst EXTRACTORS: Record<Attribute, Extractor<string | undefined>> = {\n name: wks => wks.name,\n version: (wks, json) => wks.manifest.version || (json ? undefined : chalk.grey('unset')),\n root: wks => wks.cwd,\n slug: wks => slugify(wks.name)\n};\n\n// Utils\nfunction buildExtractor(attrs: Attribute[]): Extractor<Data> {\n return (wks, json: boolean) => {\n const data: Data = {};\n\n for (const attr of attrs) {\n data[attr] = EXTRACTORS[attr](wks, json);\n }\n\n return data;\n };\n}\n\n// Command\nexport default defineCommand({\n command: ['list', 'ls'],\n describe: 'List workspaces',\n builder: (yargs) => applyMiddlewares(yargs, [\n setupInk,\n loadProject,\n ])\n // Filters\n .option('private', {\n type: 'boolean',\n group: 'Filters:',\n desc: 'Print only private workspaces',\n })\n .option('with-script', {\n type: 'array',\n string: true,\n group: 'Filters:',\n desc: 'Print only workspaces having the given script',\n })\n\n // Affected filter\n .option('affected', {\n alias: 'a',\n type: 'string',\n coerce: (rev: string) => rev === '' ? 'master' : rev,\n group: 'Affected:',\n desc: 'Print only affected workspaces towards given git revision. If no revision is given, it will check towards master.\\n' +\n 'Replaces %name by workspace name.',\n })\n .option('affected-rev-sort', {\n type: 'string',\n group: 'Affected:',\n desc: 'Sort applied to git tag / git branch command',\n })\n .option('affected-rev-fallback', {\n type: 'string',\n default: 'master',\n group: 'Affected:',\n desc: 'Fallback revision, used if no revision matching the given format is found',\n })\n .option('attrs', {\n type: 'array',\n choices: ['name', 'version', 'root', 'slug'],\n default: [] as Attribute[],\n group: 'Format:',\n desc: 'Select printed attributes'\n })\n .option('headers', {\n type: 'boolean',\n group: 'Format:',\n desc: 'Prints columns headers'\n })\n .option('long', {\n alias: 'l',\n type: 'boolean',\n group: 'Format:',\n desc: 'Prints name, version and root of all workspaces',\n })\n .option('json', {\n type: 'boolean',\n group: 'Format:',\n desc: 'Prints data as a JSON array',\n }),\n async handler(args) {\n // Setup pipeline\n const pipeline = new Pipeline();\n\n if (args.private !== undefined) {\n pipeline.add(new PrivateFilter(args.private));\n }\n\n if (args.withScript) {\n pipeline.add(new ScriptsFilter(args.withScript));\n }\n\n if (args.affected !== undefined) {\n pipeline.add(new AffectedFilter(\n args.affected,\n args.affectedRevFallback,\n args.affectedRevSort\n ));\n }\n\n // Load workspaces\n const project = container.get<Project>(CURRENT_PROJECT);\n const workspaces: Workspace[] = [];\n\n for await (const wks of pipeline.filter(project.workspaces())) {\n workspaces.push(wks);\n }\n\n // Build data\n let attrs = args.attrs;\n\n if (args.attrs.length === 0) {\n if (args.long) {\n attrs = LONG_ATTRIBUTES;\n } else if (args.json) {\n attrs = JSON_ATTRIBUTES;\n } else {\n attrs = DEFAULT_ATTRIBUTES;\n }\n }\n\n const data = workspaces.map(wks => buildExtractor(attrs)(wks, args.json || false));\n\n // Print list\n if (args.json) {\n if (process.stdout.isTTY) { // Pretty print for ttys\n console.log(JSON.stringify(data, null, 2));\n } else {\n console.log(JSON.stringify(data));\n }\n } else {\n const app = container.get<ink.Instance>(INK_APP);\n\n for (const d of data) {\n if (d.root) {\n d.root = path.relative(process.cwd(), d.root) ?? '.';\n }\n }\n\n app.rerender(\n <Layout>\n <List items={data} headers={args.headers ?? (attrs.length > 1)} />\n </Layout>\n );\n }\n }\n});\n"],"names":["LONG_ATTRIBUTES","JSON_ATTRIBUTES","DEFAULT_ATTRIBUTES","EXTRACTORS","name","wks","version","json","manifest","undefined","chalk","grey","root","cwd","slug","slugify","buildExtractor","attrs","data","attr","defineCommand","command","describe","builder","yargs","applyMiddlewares","setupInk","loadProject","option","type","group","desc","string","alias","coerce","rev","default","choices","handler","args","pipeline","Pipeline","private","add","PrivateFilter","withScript","ScriptsFilter","affected","AffectedFilter","affectedRevFallback","affectedRevSort","project","container","get","CURRENT_PROJECT","workspaces","filter","push","length","long","map","process","stdout","isTTY","console","log","JSON","stringify","app","INK_APP","d","path","relative","rerender","Layout","List","items","headers"],"mappings":"AAAA;;;;+BA2CA,UAAU;AACV;;aAAA;;;4DA5CkB;+DACD;8DAEG;yBAEmD;6BACjC;0BAEc;oBACvB;uBACmB;;;;;;AAQhD,YAAY;AACZ,MAAMA,kBAA+B;IAAC;IAAQ;IAAW;CAAO;AAChE,MAAMC,kBAA+B;IAAC;IAAQ;IAAW;IAAQ;CAAO;AACxE,MAAMC,qBAAkC;IAAC;CAAO;AAEhD,MAAMC,aAA+D;IACnEC,MAAMC,CAAAA,MAAOA,IAAID,IAAI;IACrBE,SAAS,CAACD,KAAKE,OAASF,IAAIG,QAAQ,CAACF,OAAO,IAAKC,CAAAA,OAAOE,YAAYC,cAAK,CAACC,IAAI,CAAC,QAAQ,AAAD;IACtFC,MAAMP,CAAAA,MAAOA,IAAIQ,GAAG;IACpBC,MAAMT,CAAAA,MAAOU,IAAAA,gBAAO,EAACV,IAAID,IAAI;AAC/B;AAEA,QAAQ;AACR,SAASY,eAAeC,KAAkB,EAAmB;IAC3D,OAAO,CAACZ,KAAKE,OAAkB;QAC7B,MAAMW,OAAa,CAAC;QAEpB,KAAK,MAAMC,QAAQF,MAAO;YACxBC,IAAI,CAACC,KAAK,GAAGhB,UAAU,CAACgB,KAAK,CAACd,KAAKE;QACrC;QAEA,OAAOW;IACT;AACF;MAGA,WAAeE,IAAAA,oBAAa,EAAC;IAC3BC,SAAS;QAAC;QAAQ;KAAK;IACvBC,UAAU;IACVC,SAAS,CAACC,QAAUC,IAAAA,uBAAgB,EAACD,OAAO;YAC1CE,qBAAQ;YACRC,wBAAW;SACZ,CACC,UAAU;SACTC,MAAM,CAAC,WAAW;YACjBC,MAAM;YACNC,OAAO;YACPC,MAAM;QACR,GACCH,MAAM,CAAC,eAAe;YACrBC,MAAM;YACNG,QAAQ,IAAI;YACZF,OAAO;YACPC,MAAM;QACR,EAEA,kBAAkB;SACjBH,MAAM,CAAC,YAAY;YAClBK,OAAO;YACPJ,MAAM;YACNK,QAAQ,CAACC,MAAgBA,QAAQ,KAAK,WAAWA,GAAG;YACpDL,OAAO;YACPC,MAAM,wHACJ;QACJ,GACCH,MAAM,CAAC,qBAAqB;YAC3BC,MAAM;YACNC,OAAO;YACPC,MAAM;QACR,GACCH,MAAM,CAAC,yBAAyB;YAC/BC,MAAM;YACNO,SAAS;YACTN,OAAO;YACPC,MAAM;QACR,GACCH,MAAM,CAAC,SAAS;YACfC,MAAM;YACNQ,SAAS;gBAAC;gBAAQ;gBAAW;gBAAQ;aAAO;YAC5CD,SAAS,EAAE;YACXN,OAAO;YACPC,MAAM;QACR,GACCH,MAAM,CAAC,WAAW;YACjBC,MAAM;YACNC,OAAO;YACPC,MAAM;QACR,GACCH,MAAM,CAAC,QAAQ;YACdK,OAAO;YACPJ,MAAM;YACNC,OAAO;YACPC,MAAM;QACR,GACCH,MAAM,CAAC,QAAQ;YACdC,MAAM;YACNC,OAAO;YACPC,MAAM;QACR;IACF,MAAMO,SAAQC,IAAI,EAAE;QAClB,iBAAiB;QACjB,MAAMC,WAAW,IAAIC,iBAAQ;QAE7B,IAAIF,KAAKG,OAAO,KAAKjC,WAAW;YAC9B+B,SAASG,GAAG,CAAC,IAAIC,sBAAa,CAACL,KAAKG,OAAO;QAC7C,CAAC;QAED,IAAIH,KAAKM,UAAU,EAAE;YACnBL,SAASG,GAAG,CAAC,IAAIG,sBAAa,CAACP,KAAKM,UAAU;QAChD,CAAC;QAED,IAAIN,KAAKQ,QAAQ,KAAKtC,WAAW;YAC/B+B,SAASG,GAAG,CAAC,IAAIK,uBAAc,CAC7BT,KAAKQ,QAAQ,EACbR,KAAKU,mBAAmB,EACxBV,KAAKW,eAAe;QAExB,CAAC;QAED,kBAAkB;QAClB,MAAMC,UAAUC,mBAAS,CAACC,GAAG,CAAUC,yBAAe;QACtD,MAAMC,aAA0B,EAAE;QAElC,WAAW,MAAMlD,OAAOmC,SAASgB,MAAM,CAACL,QAAQI,UAAU,IAAK;YAC7DA,WAAWE,IAAI,CAACpD;QAClB;QAEA,aAAa;QACb,IAAIY,QAAQsB,KAAKtB,KAAK;QAEtB,IAAIsB,KAAKtB,KAAK,CAACyC,MAAM,KAAK,GAAG;YAC3B,IAAInB,KAAKoB,IAAI,EAAE;gBACb1C,QAAQjB;YACV,OAAO,IAAIuC,KAAKhC,IAAI,EAAE;gBACpBU,QAAQhB;YACV,OAAO;gBACLgB,QAAQf;YACV,CAAC;QACH,CAAC;QAED,MAAMgB,OAAOqC,WAAWK,GAAG,CAACvD,CAAAA,MAAOW,eAAeC,OAAOZ,KAAKkC,KAAKhC,IAAI,IAAI,KAAK;QAEhF,aAAa;QACb,IAAIgC,KAAKhC,IAAI,EAAE;YACb,IAAIsD,QAAQC,MAAM,CAACC,KAAK,EAAE;gBACxBC,QAAQC,GAAG,CAACC,KAAKC,SAAS,CAACjD,MAAM,IAAI,EAAE;YACzC,OAAO;gBACL8C,QAAQC,GAAG,CAACC,KAAKC,SAAS,CAACjD;YAC7B,CAAC;QACH,OAAO;YACL,MAAMkD,MAAMhB,mBAAS,CAACC,GAAG,CAAegB,iBAAO;YAE/C,KAAK,MAAMC,KAAKpD,KAAM;gBACpB,IAAIoD,EAAE1D,IAAI,EAAE;oBACV0D,EAAE1D,IAAI,GAAG2D,iBAAI,CAACC,QAAQ,CAACX,QAAQhD,GAAG,IAAIyD,EAAE1D,IAAI,KAAK;gBACnD,CAAC;YACH;YAEAwD,IAAIK,QAAQ,eACV,qBAACC,UAAM;0BACL,cAAA,qBAACC,QAAI;oBAACC,OAAO1D;oBAAM2D,SAAStC,KAAKsC,OAAO,IAAK5D,MAAMyC,MAAM,GAAG;;;QAGlE,CAAC;IACH;AACF","file":"list.js"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC","file":"index.d.ts","sourcesContent":["export * from './filters';\nexport * from './git';\nexport * from './middlewares';\nexport * from './project';\nexport * from './services';\nexport * from './ui';\nexport * from './utils';\n"]}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
_exportStar(require("./filters"), exports);
|
|
6
6
|
_exportStar(require("./git"), exports);
|
|
7
|
-
_exportStar(require("./
|
|
7
|
+
_exportStar(require("./middlewares"), exports);
|
|
8
8
|
_exportStar(require("./project"), exports);
|
|
9
9
|
_exportStar(require("./services"), exports);
|
|
10
10
|
_exportStar(require("./ui"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './filters';\nexport * from './git';\nexport * from './
|
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './filters';\nexport * from './git';\nexport * from './middlewares';\nexport * from './project';\nexport * from './services';\nexport * from './ui';\nexport * from './utils';\n"],"names":[],"mappings":"AAAA;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA","file":"index.js"}
|
package/dist/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["main.ts"],"names":[],"mappings":"","file":"main.d.ts","sourcesContent":["import yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nimport { globalConfig } from './
|
|
1
|
+
{"version":3,"sources":["main.ts"],"names":[],"mappings":"","file":"main.d.ts","sourcesContent":["import yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nimport pkg from '../package.json';\nimport { globalConfig } from './middlewares';\nimport { applyMiddlewares } from './utils';\n\n// Bootstrap\n(async () => {\n // Setup yargs\n const parser = yargs(hideBin(process.argv))\n .scriptName('jill')\n .completion('completion', 'Generate bash completion script')\n .help('help', 'Show help for a command')\n .version('version', 'Show version', pkg.version)\n .wrap(yargs.terminalWidth());\n\n // Middlewares\n applyMiddlewares(parser, [globalConfig]);\n\n // Parse !\n await parser\n .commandDir('commands', {\n visit: obj => obj.default\n })\n .demandCommand()\n .recommendCommands()\n .strict()\n .parse();\n})();\n"]}
|
package/dist/main.js
CHANGED
|
@@ -4,8 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
const _yargs = /*#__PURE__*/ _interopRequireDefault(require("yargs"));
|
|
6
6
|
const _helpers = require("yargs/helpers");
|
|
7
|
-
const _modifiers = require("./modifiers");
|
|
8
7
|
const _packageJson = /*#__PURE__*/ _interopRequireDefault(require("../package.json"));
|
|
8
|
+
const _middlewares = require("./middlewares");
|
|
9
|
+
const _utils = require("./utils");
|
|
9
10
|
function _interopRequireDefault(obj) {
|
|
10
11
|
return obj && obj.__esModule ? obj : {
|
|
11
12
|
default: obj
|
|
@@ -16,7 +17,9 @@ function _interopRequireDefault(obj) {
|
|
|
16
17
|
// Setup yargs
|
|
17
18
|
const parser = (0, _yargs.default)((0, _helpers.hideBin)(process.argv)).scriptName('jill').completion('completion', 'Generate bash completion script').help('help', 'Show help for a command').version('version', 'Show version', _packageJson.default.version).wrap(_yargs.default.terminalWidth());
|
|
18
19
|
// Middlewares
|
|
19
|
-
(0,
|
|
20
|
+
(0, _utils.applyMiddlewares)(parser, [
|
|
21
|
+
_middlewares.globalConfig
|
|
22
|
+
]);
|
|
20
23
|
// Parse !
|
|
21
24
|
await parser.commandDir('commands', {
|
|
22
25
|
visit: (obj)=>obj.default
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["main.js"],"sourcesContent":["import yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nimport { globalConfig } from './
|
|
1
|
+
{"version":3,"sources":["main.js"],"sourcesContent":["import yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nimport pkg from '../package.json';\nimport { globalConfig } from './middlewares';\nimport { applyMiddlewares } from './utils';\n\n// Bootstrap\n(async () => {\n // Setup yargs\n const parser = yargs(hideBin(process.argv))\n .scriptName('jill')\n .completion('completion', 'Generate bash completion script')\n .help('help', 'Show help for a command')\n .version('version', 'Show version', pkg.version)\n .wrap(yargs.terminalWidth());\n\n // Middlewares\n applyMiddlewares(parser, [globalConfig]);\n\n // Parse !\n await parser\n .commandDir('commands', {\n visit: obj => obj.default\n })\n .demandCommand()\n .recommendCommands()\n .strict()\n .parse();\n})();\n"],"names":["parser","yargs","hideBin","process","argv","scriptName","completion","help","version","pkg","wrap","terminalWidth","applyMiddlewares","globalConfig","commandDir","visit","obj","default","demandCommand","recommendCommands","strict","parse"],"mappings":"AAAA;;;;4DAAkB;yBACM;kEAER;6BACa;uBACI;;;;;;AAEjC,YAAY;AACX,CAAA,UAAY;IACX,cAAc;IACd,MAAMA,SAASC,IAAAA,cAAK,EAACC,IAAAA,gBAAO,EAACC,QAAQC,IAAI,GACtCC,UAAU,CAAC,QACXC,UAAU,CAAC,cAAc,mCACzBC,IAAI,CAAC,QAAQ,2BACbC,OAAO,CAAC,WAAW,gBAAgBC,oBAAG,CAACD,OAAO,EAC9CE,IAAI,CAACT,cAAK,CAACU,aAAa;IAE3B,cAAc;IACdC,IAAAA,uBAAgB,EAACZ,QAAQ;QAACa,yBAAY;KAAC;IAEvC,UAAU;IACV,MAAMb,OACHc,UAAU,CAAC,YAAY;QACtBC,OAAOC,CAAAA,MAAOA,IAAIC,OAAO;IAC3B,GACCC,aAAa,GACbC,iBAAiB,GACjBC,MAAM,GACNC,KAAK;AACV,CAAA","file":"main.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["middlewares/global-config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY;;;;EAevB,CAAC","file":"global-config.d.ts","sourcesContent":["import { container, GLOBAL_CONFIG } from '../services';\nimport { defineMiddleware } from '../utils';\n\n// Middleware\nexport const globalConfig = defineMiddleware({\n builder: (yargs) => yargs\n .option('verbose', {\n alias: 'v',\n type: 'count',\n description: 'Set verbosity level',\n })\n .option('jobs', {\n alias: 'j',\n type: 'number',\n description: 'Set maximum parallel job number',\n }),\n handler(args) {\n container.bind(GLOBAL_CONFIG).toConstantValue(args);\n }\n});\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "globalConfig", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>globalConfig
|
|
8
|
+
});
|
|
9
|
+
const _services = require("../services");
|
|
10
|
+
const _utils = require("../utils");
|
|
11
|
+
const globalConfig = (0, _utils.defineMiddleware)({
|
|
12
|
+
builder: (yargs)=>yargs.option('verbose', {
|
|
13
|
+
alias: 'v',
|
|
14
|
+
type: 'count',
|
|
15
|
+
description: 'Set verbosity level'
|
|
16
|
+
}).option('jobs', {
|
|
17
|
+
alias: 'j',
|
|
18
|
+
type: 'number',
|
|
19
|
+
description: 'Set maximum parallel job number'
|
|
20
|
+
}),
|
|
21
|
+
handler (args) {
|
|
22
|
+
_services.container.bind(_services.GLOBAL_CONFIG).toConstantValue(args);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=global-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["middlewares/global-config.js"],"sourcesContent":["import { container, GLOBAL_CONFIG } from '../services';\nimport { defineMiddleware } from '../utils';\n\n// Middleware\nexport const globalConfig = defineMiddleware({\n builder: (yargs) => yargs\n .option('verbose', {\n alias: 'v',\n type: 'count',\n description: 'Set verbosity level',\n })\n .option('jobs', {\n alias: 'j',\n type: 'number',\n description: 'Set maximum parallel job number',\n }),\n handler(args) {\n container.bind(GLOBAL_CONFIG).toConstantValue(args);\n }\n});\n"],"names":["globalConfig","defineMiddleware","builder","yargs","option","alias","type","description","handler","args","container","bind","GLOBAL_CONFIG","toConstantValue"],"mappings":"AAAA;;;;+BAIaA;;aAAAA;;0BAJ4B;uBACR;AAG1B,MAAMA,eAAeC,IAAAA,uBAAgB,EAAC;IAC3CC,SAAS,CAACC,QAAUA,MACjBC,MAAM,CAAC,WAAW;YACjBC,OAAO;YACPC,MAAM;YACNC,aAAa;QACf,GACCH,MAAM,CAAC,QAAQ;YACdC,OAAO;YACPC,MAAM;YACNC,aAAa;QACf;IACFC,SAAQC,IAAI,EAAE;QACZC,mBAAS,CAACC,IAAI,CAACC,uBAAa,EAAEC,eAAe,CAACJ;IAChD;AACF","file":"global-config.js"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["middlewares/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC","file":"index.d.ts","sourcesContent":["export * from './load-project';\nexport * from './global-config';\nexport * from './setup-ink';\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["middlewares/index.js"],"sourcesContent":["export * from './load-project';\nexport * from './global-config';\nexport * from './setup-ink';\n"],"names":[],"mappings":"AAAA;;;;oBAAc;oBACA;oBACA","file":"index.js"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Argv } from 'yargs';
|
|
2
1
|
import { PackageManager } from '../project';
|
|
3
|
-
export declare
|
|
2
|
+
export declare const loadProject: import("../utils").Middleware<unknown, {
|
|
4
3
|
project: string;
|
|
5
4
|
} & {
|
|
6
5
|
"package-manager": PackageManager | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["middlewares/load-project.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAW,MAAM,YAAY,CAAC;AAIrD,eAAO,MAAM,WAAW;;;;EA6BtB,CAAC","file":"load-project.d.ts","sourcesContent":["import { container, CURRENT_PROJECT, SpinnerService } from '../services';\nimport { PackageManager, Project } from '../project';\nimport { defineMiddleware } from '../utils';\n\n// Middleware\nexport const loadProject = defineMiddleware({\n builder: (yargs) => yargs\n .option('project', {\n alias: 'p',\n type: 'string',\n default: process.cwd(),\n description: 'Project root directory'\n })\n .option('package-manager', {\n choices: ['yarn', 'npm'],\n default: undefined as PackageManager | undefined,\n type: 'string',\n description: 'Force package manager'\n }),\n async handler(args) {\n const spinner = container.get(SpinnerService);\n\n try {\n spinner.spin('Loading project ...');\n const root = args.project = await Project.searchProjectRoot(args.project);\n\n container.bind(CURRENT_PROJECT)\n .toDynamicValue(() => new Project(root, {\n packageManager: args['package-manager']\n }));\n } finally {\n spinner.stop();\n }\n }\n});\n"]}
|
|
@@ -8,21 +8,23 @@ Object.defineProperty(exports, "loadProject", {
|
|
|
8
8
|
});
|
|
9
9
|
const _services = require("../services");
|
|
10
10
|
const _project = require("../project");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
const _utils = require("../utils");
|
|
12
|
+
const loadProject = (0, _utils.defineMiddleware)({
|
|
13
|
+
builder: (yargs)=>yargs.option('project', {
|
|
14
|
+
alias: 'p',
|
|
15
|
+
type: 'string',
|
|
16
|
+
default: process.cwd(),
|
|
17
|
+
description: 'Project root directory'
|
|
18
|
+
}).option('package-manager', {
|
|
19
|
+
choices: [
|
|
20
|
+
'yarn',
|
|
21
|
+
'npm'
|
|
22
|
+
],
|
|
23
|
+
default: undefined,
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'Force package manager'
|
|
26
|
+
}),
|
|
27
|
+
async handler (args) {
|
|
26
28
|
const spinner = _services.container.get(_services.SpinnerService);
|
|
27
29
|
try {
|
|
28
30
|
spinner.spin('Loading project ...');
|
|
@@ -33,7 +35,7 @@ function loadProject(yargs) {
|
|
|
33
35
|
} finally{
|
|
34
36
|
spinner.stop();
|
|
35
37
|
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
38
40
|
|
|
39
41
|
//# sourceMappingURL=load-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["middlewares/load-project.js"],"sourcesContent":["import { container, CURRENT_PROJECT, SpinnerService } from '../services';\nimport { PackageManager, Project } from '../project';\nimport { defineMiddleware } from '../utils';\n\n// Middleware\nexport const loadProject = defineMiddleware({\n builder: (yargs) => yargs\n .option('project', {\n alias: 'p',\n type: 'string',\n default: process.cwd(),\n description: 'Project root directory'\n })\n .option('package-manager', {\n choices: ['yarn', 'npm'],\n default: undefined as PackageManager | undefined,\n type: 'string',\n description: 'Force package manager'\n }),\n async handler(args) {\n const spinner = container.get(SpinnerService);\n\n try {\n spinner.spin('Loading project ...');\n const root = args.project = await Project.searchProjectRoot(args.project);\n\n container.bind(CURRENT_PROJECT)\n .toDynamicValue(() => new Project(root, {\n packageManager: args['package-manager']\n }));\n } finally {\n spinner.stop();\n }\n }\n});\n"],"names":["loadProject","defineMiddleware","builder","yargs","option","alias","type","default","process","cwd","description","choices","undefined","handler","args","spinner","container","get","SpinnerService","spin","root","project","Project","searchProjectRoot","bind","CURRENT_PROJECT","toDynamicValue","packageManager","stop"],"mappings":"AAAA;;;;+BAKaA;;aAAAA;;0BAL8C;yBACnB;uBACP;AAG1B,MAAMA,cAAcC,IAAAA,uBAAgB,EAAC;IAC1CC,SAAS,CAACC,QAAUA,MACjBC,MAAM,CAAC,WAAW;YACjBC,OAAO;YACPC,MAAM;YACNC,SAASC,QAAQC,GAAG;YACpBC,aAAa;QACf,GACCN,MAAM,CAAC,mBAAmB;YACzBO,SAAS;gBAAC;gBAAQ;aAAM;YACxBJ,SAASK;YACTN,MAAM;YACNI,aAAa;QACf;IACF,MAAMG,SAAQC,IAAI,EAAE;QAClB,MAAMC,UAAUC,mBAAS,CAACC,GAAG,CAACC,wBAAc;QAE5C,IAAI;YACFH,QAAQI,IAAI,CAAC;YACb,MAAMC,OAAON,KAAKO,OAAO,GAAG,MAAMC,gBAAO,CAACC,iBAAiB,CAACT,KAAKO,OAAO;YAExEL,mBAAS,CAACQ,IAAI,CAACC,yBAAe,EAC3BC,cAAc,CAAC,IAAM,IAAIJ,gBAAO,CAACF,MAAM;oBACtCO,gBAAgBb,IAAI,CAAC,kBAAkB;gBACzC;QACJ,SAAU;YACRC,QAAQa,IAAI;QACd;IACF;AACF","file":"load-project.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const setupInk: import("../utils").Middleware<unknown, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["middlewares/setup-ink.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,QAAQ,iDAOnB,CAAC","file":"setup-ink.d.ts","sourcesContent":["import { render } from 'ink';\n\nimport { container, INK_APP } from '../services';\nimport { Layout } from '../ui';\nimport { defineMiddleware } from '../utils';\n\n// Middleware\nexport const setupInk = defineMiddleware({\n handler() {\n container.bind(INK_APP)\n .toConstantValue(render(<Layout/>, {\n stdout: process.stdout.isTTY ? process.stdout : process.stderr,\n }));\n }\n});\n"]}
|
|
@@ -7,13 +7,16 @@ Object.defineProperty(exports, "setupInk", {
|
|
|
7
7
|
get: ()=>setupInk
|
|
8
8
|
});
|
|
9
9
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
const _ink = require("ink");
|
|
10
11
|
const _services = require("../services");
|
|
11
12
|
const _ui = require("../ui");
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
_services.container.bind(_services.INK_APP).toConstantValue((0, _ink.render)(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_ui.Layout, {})
|
|
16
|
-
|
|
17
|
-
}
|
|
13
|
+
const _utils = require("../utils");
|
|
14
|
+
const setupInk = (0, _utils.defineMiddleware)({
|
|
15
|
+
handler () {
|
|
16
|
+
_services.container.bind(_services.INK_APP).toConstantValue((0, _ink.render)(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_ui.Layout, {}), {
|
|
17
|
+
stdout: process.stdout.isTTY ? process.stdout : process.stderr
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
});
|
|
18
21
|
|
|
19
22
|
//# sourceMappingURL=setup-ink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["middlewares/setup-ink.js"],"sourcesContent":["import { render } from 'ink';\n\nimport { container, INK_APP } from '../services';\nimport { Layout } from '../ui';\nimport { defineMiddleware } from '../utils';\n\n// Middleware\nexport const setupInk = defineMiddleware({\n handler() {\n container.bind(INK_APP)\n .toConstantValue(render(<Layout/>, {\n stdout: process.stdout.isTTY ? process.stdout : process.stderr,\n }));\n }\n});\n"],"names":["setupInk","defineMiddleware","handler","container","bind","INK_APP","toConstantValue","render","Layout","stdout","process","isTTY","stderr"],"mappings":"AAAA;;;;+BAOaA;;aAAAA;;;qBAPU;0BAEY;oBACZ;uBACU;AAG1B,MAAMA,WAAWC,IAAAA,uBAAgB,EAAC;IACvCC,WAAU;QACRC,mBAAS,CAACC,IAAI,CAACC,iBAAO,EACnBC,eAAe,CAACC,IAAAA,WAAM,gBAAC,qBAACC,UAAM,OAAI;YACjCC,QAAQC,QAAQD,MAAM,CAACE,KAAK,GAAGD,QAAQD,MAAM,GAAGC,QAAQE,MAAM;QAChE;IACJ;AACF","file":"setup-ink.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["services/logger.service.ts"],"names":[],"mappings":"AAEA,OAAO,OAAO,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"sources":["services/logger.service.ts"],"names":[],"mappings":"AAEA,OAAO,OAAO,MAAM,SAAS,CAAC;AAW9B,eAAO,MAAM,aAAa,wBAwBzB,CAAC;AAGF,qBACa,MAAM;CAAG;AAGtB,MAAM,WAAW,MAAO,SAAQ,OAAO,CAAC,MAAM;CAAG","file":"logger.service.d.ts","sourcesContent":["import chalk from 'chalk';\nimport { injectable } from 'inversify';\nimport winston from 'winston';\n\nimport { type GlobalConfig, GLOBAL_CONFIG, container } from './inversify.config';\n\n// Constants\nconst VERBOSITY_LEVEL: Record<number, string> = {\n 1: 'verbose',\n 2: 'debug',\n};\n\n// Utils\nexport const consoleFormat = winston.format.combine(\n winston.format.errors(),\n winston.format.colorize({\n message: true,\n colors: { debug: 'grey', verbose: 'blue', info: 'white', error: 'red' }\n }),\n winston.format.printf(({ label, message, ms }) => {\n const lines = message.split('\\n');\n\n // Format\n let spaces = '';\n let formatted = `${lines[0]} ${chalk.magenta(ms)}`;\n\n if (label) {\n spaces = ' '.repeat(label.length + 3);\n formatted = `${chalk.grey(`[${label}]`)} ${lines[0]} ${chalk.magenta(ms)}`;\n }\n\n for (let i = 1; i < lines.length; ++i) {\n formatted += `\\n${spaces}${lines[i]}`;\n }\n\n return formatted;\n }),\n);\n\n// Service\n@injectable()\nexport class Logger {}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Logger extends winston.Logger {}\n\ncontainer.bind(Logger)\n .toDynamicValue((context) => {\n const config = context.container.get<GlobalConfig>(GLOBAL_CONFIG);\n\n return winston.createLogger({\n level: VERBOSITY_LEVEL[Math.min(config.verbose, 2)],\n format: winston.format.combine(\n winston.format.timestamp(),\n winston.format.ms(),\n ),\n transports: [\n new winston.transports.Console({\n format: consoleFormat\n })\n ]\n });\n })\n .inSingletonScope();\n"]}
|
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
consoleFormat: ()=>consoleFormat,
|
|
13
|
+
Logger: ()=>Logger
|
|
8
14
|
});
|
|
9
15
|
const _chalk = /*#__PURE__*/ _interopRequireDefault(require("chalk"));
|
|
10
16
|
const _inversify = require("inversify");
|
|
@@ -26,6 +32,28 @@ const VERBOSITY_LEVEL = {
|
|
|
26
32
|
1: 'verbose',
|
|
27
33
|
2: 'debug'
|
|
28
34
|
};
|
|
35
|
+
const consoleFormat = _winston.default.format.combine(_winston.default.format.errors(), _winston.default.format.colorize({
|
|
36
|
+
message: true,
|
|
37
|
+
colors: {
|
|
38
|
+
debug: 'grey',
|
|
39
|
+
verbose: 'blue',
|
|
40
|
+
info: 'white',
|
|
41
|
+
error: 'red'
|
|
42
|
+
}
|
|
43
|
+
}), _winston.default.format.printf(({ label , message , ms })=>{
|
|
44
|
+
const lines = message.split('\n');
|
|
45
|
+
// Format
|
|
46
|
+
let spaces = '';
|
|
47
|
+
let formatted = `${lines[0]} ${_chalk.default.magenta(ms)}`;
|
|
48
|
+
if (label) {
|
|
49
|
+
spaces = ' '.repeat(label.length + 3);
|
|
50
|
+
formatted = `${_chalk.default.grey(`[${label}]`)} ${lines[0]} ${_chalk.default.magenta(ms)}`;
|
|
51
|
+
}
|
|
52
|
+
for(let i = 1; i < lines.length; ++i){
|
|
53
|
+
formatted += `\n${spaces}${lines[i]}`;
|
|
54
|
+
}
|
|
55
|
+
return formatted;
|
|
56
|
+
}));
|
|
29
57
|
let Logger = class Logger {
|
|
30
58
|
};
|
|
31
59
|
Logger = __decorate([
|
|
@@ -38,18 +66,7 @@ _inversifyConfig.container.bind(Logger).toDynamicValue((context)=>{
|
|
|
38
66
|
format: _winston.default.format.combine(_winston.default.format.timestamp(), _winston.default.format.ms()),
|
|
39
67
|
transports: [
|
|
40
68
|
new _winston.default.transports.Console({
|
|
41
|
-
format:
|
|
42
|
-
message: true,
|
|
43
|
-
colors: {
|
|
44
|
-
debug: 'grey',
|
|
45
|
-
verbose: 'blue',
|
|
46
|
-
info: 'white',
|
|
47
|
-
error: 'red'
|
|
48
|
-
}
|
|
49
|
-
}), _winston.default.format.printf(({ label , message })=>message.split('\n').map((line)=>[
|
|
50
|
-
label && _chalk.default.grey(`[${label}]`),
|
|
51
|
-
line
|
|
52
|
-
].filter((p)=>p).join(' ')).join('\n')))
|
|
69
|
+
format: consoleFormat
|
|
53
70
|
})
|
|
54
71
|
]
|
|
55
72
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["services/logger.service.js"],"sourcesContent":["import chalk from 'chalk';\nimport { injectable } from 'inversify';\nimport winston from 'winston';\n\nimport { type GlobalConfig, GLOBAL_CONFIG, container } from './inversify.config';\n\n// Constants\nconst VERBOSITY_LEVEL: Record<number, string> = {\n 1: 'verbose',\n 2: 'debug',\n};\n\n//
|
|
1
|
+
{"version":3,"sources":["services/logger.service.js"],"sourcesContent":["import chalk from 'chalk';\nimport { injectable } from 'inversify';\nimport winston from 'winston';\n\nimport { type GlobalConfig, GLOBAL_CONFIG, container } from './inversify.config';\n\n// Constants\nconst VERBOSITY_LEVEL: Record<number, string> = {\n 1: 'verbose',\n 2: 'debug',\n};\n\n// Utils\nexport const consoleFormat = winston.format.combine(\n winston.format.errors(),\n winston.format.colorize({\n message: true,\n colors: { debug: 'grey', verbose: 'blue', info: 'white', error: 'red' }\n }),\n winston.format.printf(({ label, message, ms }) => {\n const lines = message.split('\\n');\n\n // Format\n let spaces = '';\n let formatted = `${lines[0]} ${chalk.magenta(ms)}`;\n\n if (label) {\n spaces = ' '.repeat(label.length + 3);\n formatted = `${chalk.grey(`[${label}]`)} ${lines[0]} ${chalk.magenta(ms)}`;\n }\n\n for (let i = 1; i < lines.length; ++i) {\n formatted += `\\n${spaces}${lines[i]}`;\n }\n\n return formatted;\n }),\n);\n\n// Service\n@injectable()\nexport class Logger {}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Logger extends winston.Logger {}\n\ncontainer.bind(Logger)\n .toDynamicValue((context) => {\n const config = context.container.get<GlobalConfig>(GLOBAL_CONFIG);\n\n return winston.createLogger({\n level: VERBOSITY_LEVEL[Math.min(config.verbose, 2)],\n format: winston.format.combine(\n winston.format.timestamp(),\n winston.format.ms(),\n ),\n transports: [\n new winston.transports.Console({\n format: consoleFormat\n })\n ]\n });\n })\n .inSingletonScope();\n"],"names":["consoleFormat","Logger","VERBOSITY_LEVEL","winston","format","combine","errors","colorize","message","colors","debug","verbose","info","error","printf","label","ms","lines","split","spaces","formatted","chalk","magenta","repeat","length","grey","i","injectable","container","bind","toDynamicValue","context","config","get","GLOBAL_CONFIG","createLogger","level","Math","min","timestamp","transports","Console","inSingletonScope"],"mappings":"AAAA;;;;;;;;;;;IAaaA,aAAa,MAAbA;IA4BAC,MAAM,MAANA;;4DAzCK;2BACS;8DACP;iCAEwC;;;;;;;;;;;;AAE5D,YAAY;AACZ,MAAMC,kBAA0C;IAC9C,GAAG;IACH,GAAG;AACL;AAGO,MAAMF,gBAAgBG,gBAAO,CAACC,MAAM,CAACC,OAAO,CACjDF,gBAAO,CAACC,MAAM,CAACE,MAAM,IACrBH,gBAAO,CAACC,MAAM,CAACG,QAAQ,CAAC;IACtBC,SAAS,IAAI;IACbC,QAAQ;QAAEC,OAAO;QAAQC,SAAS;QAAQC,MAAM;QAASC,OAAO;IAAM;AACxE,IACAV,gBAAO,CAACC,MAAM,CAACU,MAAM,CAAC,CAAC,EAAEC,MAAK,EAAEP,QAAO,EAAEQ,GAAE,EAAE,GAAK;IAChD,MAAMC,QAAQT,QAAQU,KAAK,CAAC;IAE5B,SAAS;IACT,IAAIC,SAAS;IACb,IAAIC,YAAY,CAAC,EAAEH,KAAK,CAAC,EAAE,CAAC,CAAC,EAAEI,cAAK,CAACC,OAAO,CAACN,IAAI,CAAC;IAElD,IAAID,OAAO;QACTI,SAAS,IAAII,MAAM,CAACR,MAAMS,MAAM,GAAG;QACnCJ,YAAY,CAAC,EAAEC,cAAK,CAACI,IAAI,CAAC,CAAC,CAAC,EAAEV,MAAM,CAAC,CAAC,EAAE,CAAC,EAAEE,KAAK,CAAC,EAAE,CAAC,CAAC,EAAEI,cAAK,CAACC,OAAO,CAACN,IAAI,CAAC;IAC5E,CAAC;IAED,IAAK,IAAIU,IAAI,GAAGA,IAAIT,MAAMO,MAAM,EAAE,EAAEE,EAAG;QACrCN,aAAa,CAAC,EAAE,EAAED,OAAO,EAAEF,KAAK,CAACS,EAAE,CAAC,CAAC;IACvC;IAEA,OAAON;AACT;IAKWnB,SAAN;AAAc;AAARA;IADZ0B,IAAAA,qBAAU;GACE1B;AAKb2B,0BAAS,CAACC,IAAI,CAAC5B,QACZ6B,cAAc,CAAC,CAACC,UAAY;IAC3B,MAAMC,SAASD,QAAQH,SAAS,CAACK,GAAG,CAAeC,8BAAa;IAEhE,OAAO/B,gBAAO,CAACgC,YAAY,CAAC;QAC1BC,OAAOlC,eAAe,CAACmC,KAAKC,GAAG,CAACN,OAAOrB,OAAO,EAAE,GAAG;QACnDP,QAAQD,gBAAO,CAACC,MAAM,CAACC,OAAO,CAC5BF,gBAAO,CAACC,MAAM,CAACmC,SAAS,IACxBpC,gBAAO,CAACC,MAAM,CAACY,EAAE;QAEnBwB,YAAY;YACV,IAAIrC,gBAAO,CAACqC,UAAU,CAACC,OAAO,CAAC;gBAC7BrC,QAAQJ;YACV;SACD;IACH;AACF,GACC0C,gBAAgB","file":"logger.service.js"}
|
package/dist/ui/index.d.ts
CHANGED
package/dist/ui/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC","file":"index.d.ts","sourcesContent":["export * from './cli-list';\nexport * from './global-spinner';\nexport * from './layout';\nexport * from './static-logs';\n"]}
|
|
1
|
+
{"version":3,"sources":["ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC","file":"index.d.ts","sourcesContent":["export * from './cli-list';\nexport * from './global-spinner';\nexport * from './layout';\nexport * from './list';\nexport * from './static-logs';\n"]}
|
package/dist/ui/index.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
_exportStar(require("./cli-list"), exports);
|
|
6
6
|
_exportStar(require("./global-spinner"), exports);
|
|
7
7
|
_exportStar(require("./layout"), exports);
|
|
8
|
+
_exportStar(require("./list"), exports);
|
|
8
9
|
_exportStar(require("./static-logs"), exports);
|
|
9
10
|
function _exportStar(from, to) {
|
|
10
11
|
Object.keys(from).forEach(function(k) {
|
package/dist/ui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ui/index.js"],"sourcesContent":["export * from './cli-list';\nexport * from './global-spinner';\nexport * from './layout';\nexport * from './static-logs';\n"],"names":[],"mappings":"AAAA;;;;oBAAc;oBACA;oBACA;oBACA","file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["ui/index.js"],"sourcesContent":["export * from './cli-list';\nexport * from './global-spinner';\nexport * from './layout';\nexport * from './list';\nexport * from './static-logs';\n"],"names":[],"mappings":"AAAA;;;;oBAAc;oBACA;oBACA;oBACA;oBACA","file":"index.js"}
|
package/dist/ui/layout.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ui/layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAM3B,eAAO,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"sources":["ui/layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAM3B,eAAO,MAAM,MAAM,EAAE,EAMpB,CAAC","file":"layout.d.ts","sourcesContent":["import { FC } from 'react';\n\nimport { GlobalSpinner } from './global-spinner';\nimport { StaticLogs } from './static-logs';\n\n// Component\nexport const Layout: FC = ({ children }) => (\n <>\n <StaticLogs />\n <GlobalSpinner />\n { children }\n </>\n);\n"]}
|
package/dist/ui/layout.js
CHANGED
|
@@ -9,10 +9,11 @@ Object.defineProperty(exports, "Layout", {
|
|
|
9
9
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
const _globalSpinner = require("./global-spinner");
|
|
11
11
|
const _staticLogs = require("./static-logs");
|
|
12
|
-
const Layout = ()=>/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
12
|
+
const Layout = ({ children })=>/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
13
13
|
children: [
|
|
14
14
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_staticLogs.StaticLogs, {}),
|
|
15
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_globalSpinner.GlobalSpinner, {})
|
|
15
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_globalSpinner.GlobalSpinner, {}),
|
|
16
|
+
children
|
|
16
17
|
]
|
|
17
18
|
});
|
|
18
19
|
|
package/dist/ui/layout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ui/layout.js"],"sourcesContent":["import { FC } from 'react';\n\nimport { GlobalSpinner } from './global-spinner';\nimport { StaticLogs } from './static-logs';\n\n// Component\nexport const Layout: FC = () => (\n <>\n <StaticLogs />\n <GlobalSpinner />\n </>\n);\n"],"names":["Layout","StaticLogs","GlobalSpinner"],"mappings":"AAAA;;;;+BAMaA;;aAAAA;;;+BAJiB;4BACH;AAGpB,MAAMA,SAAa,
|
|
1
|
+
{"version":3,"sources":["ui/layout.js"],"sourcesContent":["import { FC } from 'react';\n\nimport { GlobalSpinner } from './global-spinner';\nimport { StaticLogs } from './static-logs';\n\n// Component\nexport const Layout: FC = ({ children }) => (\n <>\n <StaticLogs />\n <GlobalSpinner />\n { children }\n </>\n);\n"],"names":["Layout","children","StaticLogs","GlobalSpinner"],"mappings":"AAAA;;;;+BAMaA;;aAAAA;;;+BAJiB;4BACH;AAGpB,MAAMA,SAAa,CAAC,EAAEC,SAAQ,EAAE,iBACrC;;0BACE,qBAACC,sBAAU;0BACX,qBAACC,4BAAa;YACZF","file":"layout.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ui/list.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAKrC,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC1D,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAGD,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,YAAY,CAetG","file":"list.d.ts","sourcesContent":["import { Box, Text } from 'ink';\nimport { ReactElement } from 'react';\n\nimport { capitalize } from '../utils';\n\n// Types\nexport interface ListProps<T extends Record<string, unknown>> {\n items: T[];\n headers?: boolean;\n}\n\n// Component\nexport function List<T extends Record<string, unknown>>({ items, headers }: ListProps<T>): ReactElement {\n return (\n <Box>\n { Object.keys(items[0]).map((key) => (\n <Box key={key} flexDirection=\"column\" marginRight={2}>\n { headers && (\n <Text bold>{ capitalize(key) }</Text>\n ) }\n { items.map((item, idx) => (\n <Text key={idx}>{ item[key] }</Text>\n )) }\n </Box>\n )) }\n </Box>\n );\n}\n"]}
|
package/dist/ui/list.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "List", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>List
|
|
8
|
+
});
|
|
9
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
const _ink = require("ink");
|
|
11
|
+
const _utils = require("../utils");
|
|
12
|
+
function List({ items , headers }) {
|
|
13
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_ink.Box, {
|
|
14
|
+
children: Object.keys(items[0]).map((key)=>/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_ink.Box, {
|
|
15
|
+
flexDirection: "column",
|
|
16
|
+
marginRight: 2,
|
|
17
|
+
children: [
|
|
18
|
+
headers && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_ink.Text, {
|
|
19
|
+
bold: true,
|
|
20
|
+
children: (0, _utils.capitalize)(key)
|
|
21
|
+
}),
|
|
22
|
+
items.map((item, idx)=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_ink.Text, {
|
|
23
|
+
children: item[key]
|
|
24
|
+
}, idx))
|
|
25
|
+
]
|
|
26
|
+
}, key))
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ui/list.js"],"sourcesContent":["import { Box, Text } from 'ink';\nimport { ReactElement } from 'react';\n\nimport { capitalize } from '../utils';\n\n// Types\nexport interface ListProps<T extends Record<string, unknown>> {\n items: T[];\n headers?: boolean;\n}\n\n// Component\nexport function List<T extends Record<string, unknown>>({ items, headers }: ListProps<T>): ReactElement {\n return (\n <Box>\n { Object.keys(items[0]).map((key) => (\n <Box key={key} flexDirection=\"column\" marginRight={2}>\n { headers && (\n <Text bold>{ capitalize(key) }</Text>\n ) }\n { items.map((item, idx) => (\n <Text key={idx}>{ item[key] }</Text>\n )) }\n </Box>\n )) }\n </Box>\n );\n}\n"],"names":["List","items","headers","Box","Object","keys","map","key","flexDirection","marginRight","Text","bold","capitalize","item","idx"],"mappings":"AAAA;;;;+BAYgBA;;aAAAA;;;qBAZU;uBAGC;AASpB,SAASA,KAAwC,EAAEC,MAAK,EAAEC,QAAO,EAAgB,EAAgB;IACtG,qBACE,qBAACC,QAAG;kBACAC,OAAOC,IAAI,CAACJ,KAAK,CAAC,EAAE,EAAEK,GAAG,CAAC,CAACC,oBAC3B,sBAACJ,QAAG;gBAAWK,eAAc;gBAASC,aAAa;;oBAC/CP,yBACA,qBAACQ,SAAI;wBAACC,IAAI;kCAAGC,IAAAA,iBAAU,EAACL;;oBAExBN,MAAMK,GAAG,CAAC,CAACO,MAAMC,oBACjB,qBAACJ,SAAI;sCAAaG,IAAI,CAACN,IAAI;2BAAhBO;;eALLP;;AAWlB","file":"list.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ui/static-logs.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,
|
|
1
|
+
{"version":3,"sources":["ui/static-logs.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAoB,MAAM,OAAO,CAAC;AAc7C,eAAO,MAAM,UAAU,EAAE,EAwCxB,CAAC","file":"static-logs.d.ts","sourcesContent":["import { useStderr } from 'ink';\nimport { FC, useLayoutEffect, } from 'react';\nimport Transport from 'winston-transport';\n\nimport { consoleFormat, container, Logger } from '../services';\n\n// Constants\nconst MESSAGE = Symbol.for('message');\n\n// Types\ninterface Info extends Record<string, unknown> {\n [MESSAGE]: string;\n}\n\n// Component\nexport const StaticLogs: FC = () => {\n // State\n const { write } = useStderr();\n\n // Effect\n useLayoutEffect(() => {\n const logger = container.get(Logger);\n const olds = logger.transports;\n\n logger.clear();\n logger.add(new class extends Transport {\n // Constructor\n constructor() {\n super({\n format: consoleFormat\n });\n }\n\n // Methods\n log(info: Info, next: () => void): void {\n setTimeout(() => {\n this.emit('logged', info);\n }, 0);\n\n write(info[MESSAGE] + '\\n');\n\n next();\n }\n });\n\n return () => {\n logger.clear();\n\n for (const transport of olds) {\n logger.add(transport);\n }\n };\n }, [write]);\n\n return null;\n};\n"]}
|
package/dist/ui/static-logs.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "StaticLogs", {
|
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: ()=>StaticLogs
|
|
8
8
|
});
|
|
9
|
-
const _jsxRuntime = require("react/jsx-runtime");
|
|
10
9
|
const _ink = require("ink");
|
|
11
10
|
const _react = require("react");
|
|
12
11
|
const _winstonTransport = /*#__PURE__*/ _interopRequireDefault(require("winston-transport"));
|
|
@@ -17,35 +16,28 @@ function _interopRequireDefault(obj) {
|
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
18
|
// Constants
|
|
20
|
-
const
|
|
21
|
-
debug: 'grey',
|
|
22
|
-
verbose: 'blue',
|
|
23
|
-
warn: 'yellow',
|
|
24
|
-
error: 'red'
|
|
25
|
-
};
|
|
26
|
-
// Utils
|
|
27
|
-
let id = 0;
|
|
19
|
+
const MESSAGE = Symbol.for('message');
|
|
28
20
|
const StaticLogs = ()=>{
|
|
29
21
|
// State
|
|
30
|
-
const
|
|
22
|
+
const { write } = (0, _ink.useStderr)();
|
|
31
23
|
// Effect
|
|
32
24
|
(0, _react.useLayoutEffect)(()=>{
|
|
33
25
|
const logger = _services.container.get(_services.Logger);
|
|
34
26
|
const olds = logger.transports;
|
|
35
27
|
logger.clear();
|
|
36
28
|
logger.add(new class extends _winstonTransport.default {
|
|
29
|
+
// Constructor
|
|
30
|
+
constructor(){
|
|
31
|
+
super({
|
|
32
|
+
format: _services.consoleFormat
|
|
33
|
+
});
|
|
34
|
+
}
|
|
37
35
|
// Methods
|
|
38
36
|
log(info, next) {
|
|
39
37
|
setTimeout(()=>{
|
|
40
38
|
this.emit('logged', info);
|
|
41
39
|
}, 0);
|
|
42
|
-
|
|
43
|
-
...old,
|
|
44
|
-
{
|
|
45
|
-
id: ++id,
|
|
46
|
-
...info
|
|
47
|
-
}
|
|
48
|
-
]);
|
|
40
|
+
write(info[MESSAGE] + '\n');
|
|
49
41
|
next();
|
|
50
42
|
}
|
|
51
43
|
});
|
|
@@ -55,25 +47,10 @@ const StaticLogs = ()=>{
|
|
|
55
47
|
logger.add(transport);
|
|
56
48
|
}
|
|
57
49
|
};
|
|
58
|
-
}, [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
color: COLORS[log.level],
|
|
63
|
-
children: [
|
|
64
|
-
log.label && /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_ink.Text, {
|
|
65
|
-
color: "grey",
|
|
66
|
-
children: [
|
|
67
|
-
"[",
|
|
68
|
-
log.label,
|
|
69
|
-
"]",
|
|
70
|
-
' '
|
|
71
|
-
]
|
|
72
|
-
}),
|
|
73
|
-
log.message
|
|
74
|
-
]
|
|
75
|
-
}, log.id)
|
|
76
|
-
});
|
|
50
|
+
}, [
|
|
51
|
+
write
|
|
52
|
+
]);
|
|
53
|
+
return null;
|
|
77
54
|
};
|
|
78
55
|
|
|
79
56
|
//# sourceMappingURL=static-logs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ui/static-logs.js"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["ui/static-logs.js"],"sourcesContent":["import { useStderr } from 'ink';\nimport { FC, useLayoutEffect, } from 'react';\nimport Transport from 'winston-transport';\n\nimport { consoleFormat, container, Logger } from '../services';\n\n// Constants\nconst MESSAGE = Symbol.for('message');\n\n// Types\ninterface Info extends Record<string, unknown> {\n [MESSAGE]: string;\n}\n\n// Component\nexport const StaticLogs: FC = () => {\n // State\n const { write } = useStderr();\n\n // Effect\n useLayoutEffect(() => {\n const logger = container.get(Logger);\n const olds = logger.transports;\n\n logger.clear();\n logger.add(new class extends Transport {\n // Constructor\n constructor() {\n super({\n format: consoleFormat\n });\n }\n\n // Methods\n log(info: Info, next: () => void): void {\n setTimeout(() => {\n this.emit('logged', info);\n }, 0);\n\n write(info[MESSAGE] + '\\n');\n\n next();\n }\n });\n\n return () => {\n logger.clear();\n\n for (const transport of olds) {\n logger.add(transport);\n }\n };\n }, [write]);\n\n return null;\n};\n"],"names":["StaticLogs","MESSAGE","Symbol","for","write","useStderr","useLayoutEffect","logger","container","get","Logger","olds","transports","clear","add","Transport","constructor","format","consoleFormat","log","info","next","setTimeout","emit","transport"],"mappings":"AAAA;;;;+BAeaA;;aAAAA;;qBAfa;uBACW;uEACf;0BAE2B;;;;;;AAEjD,YAAY;AACZ,MAAMC,UAAUC,OAAOC,GAAG,CAAC;AAQpB,MAAMH,aAAiB,IAAM;IAClC,QAAQ;IACR,MAAM,EAAEI,MAAK,EAAE,GAAGC,IAAAA,cAAS;IAE3B,SAAS;IACTC,IAAAA,sBAAe,EAAC,IAAM;QACpB,MAAMC,SAASC,mBAAS,CAACC,GAAG,CAACC,gBAAM;QACnC,MAAMC,OAAOJ,OAAOK,UAAU;QAE9BL,OAAOM,KAAK;QACZN,OAAOO,GAAG,CAAC,IAAI,cAAcC,yBAAS;YACpC,cAAc;YACdC,aAAc;gBACZ,KAAK,CAAC;oBACJC,QAAQC,uBAAa;gBACvB;YACF;YAEA,UAAU;YACVC,IAAIC,IAAU,EAAEC,IAAgB,EAAQ;gBACtCC,WAAW,IAAM;oBACf,IAAI,CAACC,IAAI,CAAC,UAAUH;gBACtB,GAAG;gBAEHhB,MAAMgB,IAAI,CAACnB,QAAQ,GAAG;gBAEtBoB;YACF;QACF;QAEA,OAAO,IAAM;YACXd,OAAOM,KAAK;YAEZ,KAAK,MAAMW,aAAab,KAAM;gBAC5BJ,OAAOO,GAAG,CAACU;YACb;QACF;IACF,GAAG;QAACpB;KAAM;IAEV,OAAO,IAAI;AACb","file":"static-logs.js"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { SpawnTask, SpawnTaskStream } from '@jujulego/tasks';
|
|
2
|
-
import { Argv, CommandModule } from 'yargs';
|
|
2
|
+
import { Arguments, Argv, CommandModule } from 'yargs';
|
|
3
|
+
import { Awaitable } from './types';
|
|
3
4
|
export declare function combine<T>(...generators: AsyncGenerator<T>[]): AsyncGenerator<T>;
|
|
4
5
|
export declare function streamLines(task: SpawnTask, stream: SpawnTaskStream): AsyncGenerator<string>;
|
|
5
|
-
export
|
|
6
|
-
|
|
6
|
+
export interface Middleware<T = unknown, U = unknown> {
|
|
7
|
+
builder?: (yargs: Argv<T>) => Argv<U>;
|
|
8
|
+
handler(args: Arguments<U>): Awaitable<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare function applyMiddlewares<T>(yargs: Argv<T>, middlewares: Middleware[]): Argv<T>;
|
|
7
11
|
export declare function defineCommand<T, U>(command: CommandModule<T, U>): CommandModule<T, U>;
|
|
12
|
+
export declare function defineMiddleware<T, U>(middleware: Middleware<T, U>): Middleware<T, U>;
|
|
13
|
+
export declare function capitalize(txt: string): string;
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"sources":["utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,wBAAuB,OAAO,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,GAAG,cAAc,CAAC,CAAC,CAAC,CAIvF;AAED,wBAAuB,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,GAAG,cAAc,CAAC,MAAM,CAAC,CA8BnG;AAGD,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO;IAClD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;CAC9C;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAYtF;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAErF;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAErF;AAGD,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C","file":"utils.d.ts","sourcesContent":["import { streamEvents } from '@jujulego/event-tree';\nimport { SpawnTask, SpawnTaskStream } from '@jujulego/tasks';\nimport { Arguments, Argv, CommandModule } from 'yargs';\nimport { Awaitable } from './types';\n\n// Stream utils\nexport async function* combine<T>(...generators: AsyncGenerator<T>[]): AsyncGenerator<T> {\n for (const gen of generators) {\n yield* gen;\n }\n}\n\nexport async function *streamLines(task: SpawnTask, stream: SpawnTaskStream): AsyncGenerator<string> {\n // Abort\n const ctrl = new AbortController();\n\n task.subscribe('status.done', () => ctrl.abort());\n task.subscribe('status.failed', () => ctrl.abort());\n\n // Stream\n let current = '';\n\n try {\n for await (const chunk of streamEvents(task, `stream.${stream}`, { signal: ctrl.signal })) {\n const data = current + chunk.data.toString('utf-8');\n const lines = data.split(/\\r?\\n/g);\n\n current = lines.pop() ?? '';\n\n for (const line of lines) {\n yield line;\n }\n }\n } catch (err) {\n if (task.exitCode !== 0) {\n throw err;\n }\n\n if (current) {\n yield current;\n }\n }\n}\n\n// Command utils\nexport interface Middleware<T = unknown, U = unknown> {\n builder?: (yargs: Argv<T>) => Argv<U>;\n handler(args: Arguments<U>): Awaitable<void>;\n}\n\nexport function applyMiddlewares<T>(yargs: Argv<T>, middlewares: Middleware[]): Argv<T> {\n let tmp: Argv<unknown> = yargs;\n\n for (const middleware of middlewares) {\n if (middleware.builder) {\n tmp = middleware.builder(tmp);\n }\n\n tmp.middleware(middleware.handler);\n }\n\n return tmp as Argv<T>;\n}\n\nexport function defineCommand<T, U>(command: CommandModule<T, U>): CommandModule<T, U> {\n return command;\n}\n\nexport function defineMiddleware<T, U>(middleware: Middleware<T, U>): Middleware<T, U> {\n return middleware;\n}\n\n// String utils\nexport function capitalize(txt: string): string {\n return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase();\n}\n"]}
|
package/dist/utils.js
CHANGED
|
@@ -11,8 +11,10 @@ function _export(target, all) {
|
|
|
11
11
|
_export(exports, {
|
|
12
12
|
combine: ()=>combine,
|
|
13
13
|
streamLines: ()=>streamLines,
|
|
14
|
-
|
|
15
|
-
defineCommand: ()=>defineCommand
|
|
14
|
+
applyMiddlewares: ()=>applyMiddlewares,
|
|
15
|
+
defineCommand: ()=>defineCommand,
|
|
16
|
+
defineMiddleware: ()=>defineMiddleware,
|
|
17
|
+
capitalize: ()=>capitalize
|
|
16
18
|
});
|
|
17
19
|
const _eventTree = require("@jujulego/event-tree");
|
|
18
20
|
async function* combine(...generators) {
|
|
@@ -47,15 +49,24 @@ async function* streamLines(task, stream) {
|
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
|
-
function
|
|
52
|
+
function applyMiddlewares(yargs, middlewares) {
|
|
51
53
|
let tmp = yargs;
|
|
52
|
-
for (const
|
|
53
|
-
|
|
54
|
+
for (const middleware of middlewares){
|
|
55
|
+
if (middleware.builder) {
|
|
56
|
+
tmp = middleware.builder(tmp);
|
|
57
|
+
}
|
|
58
|
+
tmp.middleware(middleware.handler);
|
|
54
59
|
}
|
|
55
60
|
return tmp;
|
|
56
61
|
}
|
|
57
62
|
function defineCommand(command) {
|
|
58
63
|
return command;
|
|
59
64
|
}
|
|
65
|
+
function defineMiddleware(middleware) {
|
|
66
|
+
return middleware;
|
|
67
|
+
}
|
|
68
|
+
function capitalize(txt) {
|
|
69
|
+
return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase();
|
|
70
|
+
}
|
|
60
71
|
|
|
61
72
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["utils.js"],"sourcesContent":["import { streamEvents } from '@jujulego/event-tree';\nimport { SpawnTask, SpawnTaskStream } from '@jujulego/tasks';\nimport { Argv, CommandModule } from 'yargs';\n\n// Stream utils\nexport async function* combine<T>(...generators: AsyncGenerator<T>[]): AsyncGenerator<T> {\n for (const gen of generators) {\n yield* gen;\n }\n}\n\nexport async function *streamLines(task: SpawnTask, stream: SpawnTaskStream): AsyncGenerator<string> {\n // Abort\n const ctrl = new AbortController();\n\n task.subscribe('status.done', () => ctrl.abort());\n task.subscribe('status.failed', () => ctrl.abort());\n\n // Stream\n let current = '';\n\n try {\n for await (const chunk of streamEvents(task, `stream.${stream}`, { signal: ctrl.signal })) {\n const data = current + chunk.data.toString('utf-8');\n const lines = data.split(/\\r?\\n/g);\n\n current = lines.pop() ?? '';\n\n for (const line of lines) {\n yield line;\n }\n }\n } catch (err) {\n if (task.exitCode !== 0) {\n throw err;\n }\n\n if (current) {\n yield current;\n }\n }\n}\n\n// Command utils\nexport
|
|
1
|
+
{"version":3,"sources":["utils.js"],"sourcesContent":["import { streamEvents } from '@jujulego/event-tree';\nimport { SpawnTask, SpawnTaskStream } from '@jujulego/tasks';\nimport { Arguments, Argv, CommandModule } from 'yargs';\nimport { Awaitable } from './types';\n\n// Stream utils\nexport async function* combine<T>(...generators: AsyncGenerator<T>[]): AsyncGenerator<T> {\n for (const gen of generators) {\n yield* gen;\n }\n}\n\nexport async function *streamLines(task: SpawnTask, stream: SpawnTaskStream): AsyncGenerator<string> {\n // Abort\n const ctrl = new AbortController();\n\n task.subscribe('status.done', () => ctrl.abort());\n task.subscribe('status.failed', () => ctrl.abort());\n\n // Stream\n let current = '';\n\n try {\n for await (const chunk of streamEvents(task, `stream.${stream}`, { signal: ctrl.signal })) {\n const data = current + chunk.data.toString('utf-8');\n const lines = data.split(/\\r?\\n/g);\n\n current = lines.pop() ?? '';\n\n for (const line of lines) {\n yield line;\n }\n }\n } catch (err) {\n if (task.exitCode !== 0) {\n throw err;\n }\n\n if (current) {\n yield current;\n }\n }\n}\n\n// Command utils\nexport interface Middleware<T = unknown, U = unknown> {\n builder?: (yargs: Argv<T>) => Argv<U>;\n handler(args: Arguments<U>): Awaitable<void>;\n}\n\nexport function applyMiddlewares<T>(yargs: Argv<T>, middlewares: Middleware[]): Argv<T> {\n let tmp: Argv<unknown> = yargs;\n\n for (const middleware of middlewares) {\n if (middleware.builder) {\n tmp = middleware.builder(tmp);\n }\n\n tmp.middleware(middleware.handler);\n }\n\n return tmp as Argv<T>;\n}\n\nexport function defineCommand<T, U>(command: CommandModule<T, U>): CommandModule<T, U> {\n return command;\n}\n\nexport function defineMiddleware<T, U>(middleware: Middleware<T, U>): Middleware<T, U> {\n return middleware;\n}\n\n// String utils\nexport function capitalize(txt: string): string {\n return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase();\n}\n"],"names":["combine","streamLines","applyMiddlewares","defineCommand","defineMiddleware","capitalize","generators","gen","task","stream","ctrl","AbortController","subscribe","abort","current","chunk","streamEvents","signal","data","toString","lines","split","pop","line","err","exitCode","yargs","middlewares","tmp","middleware","builder","handler","command","txt","charAt","toUpperCase","substring","toLowerCase"],"mappings":"AAAA;;;;;;;;;;;IAMuBA,OAAO,MAAPA;IAMAC,WAAW,MAAXA;IAsCPC,gBAAgB,MAAhBA;IAcAC,aAAa,MAAbA;IAIAC,gBAAgB,MAAhBA;IAKAC,UAAU,MAAVA;;2BAzEa;AAMtB,gBAAgBL,QAAW,GAAGM,UAA+B,EAAqB;IACvF,KAAK,MAAMC,OAAOD,WAAY;QAC5B,OAAOC;IACT;AACF;AAEO,gBAAgBN,YAAYO,IAAe,EAAEC,MAAuB,EAA0B;IACnG,QAAQ;IACR,MAAMC,OAAO,IAAIC;IAEjBH,KAAKI,SAAS,CAAC,eAAe,IAAMF,KAAKG,KAAK;IAC9CL,KAAKI,SAAS,CAAC,iBAAiB,IAAMF,KAAKG,KAAK;IAEhD,SAAS;IACT,IAAIC,UAAU;IAEd,IAAI;QACF,WAAW,MAAMC,SAASC,IAAAA,uBAAY,EAACR,MAAM,CAAC,OAAO,EAAEC,OAAO,CAAC,EAAE;YAAEQ,QAAQP,KAAKO,MAAM;QAAC,GAAI;YACzF,MAAMC,OAAOJ,UAAUC,MAAMG,IAAI,CAACC,QAAQ,CAAC;YAC3C,MAAMC,QAAQF,KAAKG,KAAK,CAAC;YAEzBP,UAAUM,MAAME,GAAG,MAAM;YAEzB,KAAK,MAAMC,QAAQH,MAAO;gBACxB,MAAMG;YACR;QACF;IACF,EAAE,OAAOC,KAAK;QACZ,IAAIhB,KAAKiB,QAAQ,KAAK,GAAG;YACvB,MAAMD,IAAI;QACZ,CAAC;QAED,IAAIV,SAAS;YACX,MAAMA;QACR,CAAC;IACH;AACF;AAQO,SAASZ,iBAAoBwB,KAAc,EAAEC,WAAyB,EAAW;IACtF,IAAIC,MAAqBF;IAEzB,KAAK,MAAMG,cAAcF,YAAa;QACpC,IAAIE,WAAWC,OAAO,EAAE;YACtBF,MAAMC,WAAWC,OAAO,CAACF;QAC3B,CAAC;QAEDA,IAAIC,UAAU,CAACA,WAAWE,OAAO;IACnC;IAEA,OAAOH;AACT;AAEO,SAASzB,cAAoB6B,OAA4B,EAAuB;IACrF,OAAOA;AACT;AAEO,SAAS5B,iBAAuByB,UAA4B,EAAoB;IACrF,OAAOA;AACT;AAGO,SAASxB,WAAW4B,GAAW,EAAU;IAC9C,OAAOA,IAAIC,MAAM,CAAC,GAAGC,WAAW,KAAKF,IAAIG,SAAS,CAAC,GAAGC,WAAW;AACnE","file":"utils.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jujulego/jill",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"gulp-sourcemaps": "3.0.0",
|
|
77
77
|
"gulp-swc": "1.2.3",
|
|
78
78
|
"gulp-typescript": "6.0.0-alpha.1",
|
|
79
|
+
"ink-testing-library": "2.1.0",
|
|
79
80
|
"jest": "28.1.2",
|
|
80
81
|
"ts-node": "10.9.1",
|
|
81
82
|
"typescript": "4.8.4",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["modifiers/global-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAK7B,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;;;;GAe7C","file":"global-config.d.ts","sourcesContent":["import { Argv } from 'yargs';\n\nimport { container, GLOBAL_CONFIG } from '../services';\n\n// Middleware\nexport function globalConfig<T>(yargs: Argv<T>) {\n return yargs\n .option('verbose', {\n alias: 'v',\n type: 'count',\n description: 'Set verbosity level',\n })\n .option('jobs', {\n alias: 'j',\n type: 'number',\n description: 'Set maximum parallel job number',\n })\n .middleware((config) => {\n container.bind(GLOBAL_CONFIG).toConstantValue(config);\n });\n}\n"]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "globalConfig", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: ()=>globalConfig
|
|
8
|
-
});
|
|
9
|
-
const _services = require("../services");
|
|
10
|
-
function globalConfig(yargs) {
|
|
11
|
-
return yargs.option('verbose', {
|
|
12
|
-
alias: 'v',
|
|
13
|
-
type: 'count',
|
|
14
|
-
description: 'Set verbosity level'
|
|
15
|
-
}).option('jobs', {
|
|
16
|
-
alias: 'j',
|
|
17
|
-
type: 'number',
|
|
18
|
-
description: 'Set maximum parallel job number'
|
|
19
|
-
}).middleware((config)=>{
|
|
20
|
-
_services.container.bind(_services.GLOBAL_CONFIG).toConstantValue(config);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=global-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["modifiers/global-config.js"],"sourcesContent":["import { Argv } from 'yargs';\n\nimport { container, GLOBAL_CONFIG } from '../services';\n\n// Middleware\nexport function globalConfig<T>(yargs: Argv<T>) {\n return yargs\n .option('verbose', {\n alias: 'v',\n type: 'count',\n description: 'Set verbosity level',\n })\n .option('jobs', {\n alias: 'j',\n type: 'number',\n description: 'Set maximum parallel job number',\n })\n .middleware((config) => {\n container.bind(GLOBAL_CONFIG).toConstantValue(config);\n });\n}\n"],"names":["globalConfig","yargs","option","alias","type","description","middleware","config","container","bind","GLOBAL_CONFIG","toConstantValue"],"mappings":"AAAA;;;;+BAKgBA;;aAAAA;;0BAHyB;AAGlC,SAASA,aAAgBC,KAAc,EAAE;IAC9C,OAAOA,MACJC,MAAM,CAAC,WAAW;QACjBC,OAAO;QACPC,MAAM;QACNC,aAAa;IACf,GACCH,MAAM,CAAC,QAAQ;QACdC,OAAO;QACPC,MAAM;QACNC,aAAa;IACf,GACCC,UAAU,CAAC,CAACC,SAAW;QACtBC,mBAAS,CAACC,IAAI,CAACC,uBAAa,EAAEC,eAAe,CAACJ;IAChD;AACJ","file":"global-config.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["modifiers/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC","file":"index.d.ts","sourcesContent":["export * from './load-project';\nexport * from './global-config';\nexport * from './setup-ink';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["modifiers/index.js"],"sourcesContent":["export * from './load-project';\nexport * from './global-config';\nexport * from './setup-ink';\n"],"names":[],"mappings":"AAAA;;;;oBAAc;oBACA;oBACA","file":"index.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["modifiers/load-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAG7B,OAAO,EAAE,cAAc,EAAW,MAAM,YAAY,CAAC;AAGrD,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;;;;GA6B5C","file":"load-project.d.ts","sourcesContent":["import { Argv } from 'yargs';\n\nimport { container, CURRENT_PROJECT, SpinnerService } from '../services';\nimport { PackageManager, Project } from '../project';\n\n// Middleware\nexport function loadProject<T>(yargs: Argv<T>) {\n return yargs\n .option('project', {\n alias: 'p',\n type: 'string',\n default: process.cwd(),\n description: 'Project root directory'\n })\n .option('package-manager', {\n choices: ['yarn', 'npm'],\n default: undefined as PackageManager | undefined,\n type: 'string',\n description: 'Force package manager'\n })\n .middleware(async (args) => {\n const spinner = container.get(SpinnerService);\n\n try {\n spinner.spin('Loading project ...');\n const root = args.project = await Project.searchProjectRoot(args.project);\n\n container.bind(CURRENT_PROJECT)\n .toDynamicValue(() => new Project(root, {\n packageManager: args['package-manager']\n }));\n } finally {\n spinner.stop();\n }\n });\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["modifiers/load-project.js"],"sourcesContent":["import { Argv } from 'yargs';\n\nimport { container, CURRENT_PROJECT, SpinnerService } from '../services';\nimport { PackageManager, Project } from '../project';\n\n// Middleware\nexport function loadProject<T>(yargs: Argv<T>) {\n return yargs\n .option('project', {\n alias: 'p',\n type: 'string',\n default: process.cwd(),\n description: 'Project root directory'\n })\n .option('package-manager', {\n choices: ['yarn', 'npm'],\n default: undefined as PackageManager | undefined,\n type: 'string',\n description: 'Force package manager'\n })\n .middleware(async (args) => {\n const spinner = container.get(SpinnerService);\n\n try {\n spinner.spin('Loading project ...');\n const root = args.project = await Project.searchProjectRoot(args.project);\n\n container.bind(CURRENT_PROJECT)\n .toDynamicValue(() => new Project(root, {\n packageManager: args['package-manager']\n }));\n } finally {\n spinner.stop();\n }\n });\n}\n"],"names":["loadProject","yargs","option","alias","type","default","process","cwd","description","choices","undefined","middleware","args","spinner","container","get","SpinnerService","spin","root","project","Project","searchProjectRoot","bind","CURRENT_PROJECT","toDynamicValue","packageManager","stop"],"mappings":"AAAA;;;;+BAMgBA;;aAAAA;;0BAJ2C;yBACnB;AAGjC,SAASA,YAAeC,KAAc,EAAE;IAC7C,OAAOA,MACJC,MAAM,CAAC,WAAW;QACjBC,OAAO;QACPC,MAAM;QACNC,SAASC,QAAQC,GAAG;QACpBC,aAAa;IACf,GACCN,MAAM,CAAC,mBAAmB;QACzBO,SAAS;YAAC;YAAQ;SAAM;QACxBJ,SAASK;QACTN,MAAM;QACNI,aAAa;IACf,GACCG,UAAU,CAAC,OAAOC,OAAS;QAC1B,MAAMC,UAAUC,mBAAS,CAACC,GAAG,CAACC,wBAAc;QAE5C,IAAI;YACFH,QAAQI,IAAI,CAAC;YACb,MAAMC,OAAON,KAAKO,OAAO,GAAG,MAAMC,gBAAO,CAACC,iBAAiB,CAACT,KAAKO,OAAO;YAExEL,mBAAS,CAACQ,IAAI,CAACC,yBAAe,EAC3BC,cAAc,CAAC,IAAM,IAAIJ,gBAAO,CAACF,MAAM;oBACtCO,gBAAgBb,IAAI,CAAC,kBAAkB;gBACzC;QACJ,SAAU;YACRC,QAAQa,IAAI;QACd;IACF;AACJ","file":"load-project.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["modifiers/setup-ink.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAO7B,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,WAKzC","file":"setup-ink.d.ts","sourcesContent":["import { Argv } from 'yargs';\n\nimport { container, INK_APP } from '../services';\nimport { Layout } from '../ui';\nimport { render } from 'ink';\n\n// Middleware\nexport function setupInk<T>(yargs: Argv<T>) {\n return yargs.middleware(async () => {\n container.bind(INK_APP)\n .toConstantValue(render(<Layout />));\n });\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["modifiers/setup-ink.js"],"sourcesContent":["import { Argv } from 'yargs';\n\nimport { container, INK_APP } from '../services';\nimport { Layout } from '../ui';\nimport { render } from 'ink';\n\n// Middleware\nexport function setupInk<T>(yargs: Argv<T>) {\n return yargs.middleware(async () => {\n container.bind(INK_APP)\n .toConstantValue(render(<Layout />));\n });\n}\n"],"names":["setupInk","yargs","middleware","container","bind","INK_APP","toConstantValue","render","Layout"],"mappings":"AAAA;;;;+BAOgBA;;aAAAA;;;0BALmB;oBACZ;qBACA;AAGhB,SAASA,SAAYC,KAAc,EAAE;IAC1C,OAAOA,MAAMC,UAAU,CAAC,UAAY;QAClCC,mBAAS,CAACC,IAAI,CAACC,iBAAO,EACnBC,eAAe,CAACC,IAAAA,WAAM,gBAAC,qBAACC,UAAM;IACnC;AACF","file":"setup-ink.js"}
|