@jujulego/jill 1.2.0 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application.context.d.ts +28 -0
- package/dist/application.context.d.ts.map +1 -0
- package/dist/application.context.js +30 -0
- package/dist/application.context.js.map +1 -0
- package/dist/application.d.ts +7 -0
- package/dist/application.d.ts.map +1 -0
- package/dist/application.js +125 -0
- package/dist/application.js.map +1 -0
- package/dist/command.d.ts +8 -0
- package/dist/command.d.ts.map +1 -0
- package/dist/command.js +24 -0
- package/dist/command.js.map +1 -0
- package/dist/commands/each.command.d.ts +14 -12
- package/dist/commands/each.command.d.ts.map +1 -1
- package/dist/commands/each.command.js +91 -116
- package/dist/commands/each.command.js.map +1 -1
- package/dist/commands/list.command.d.ts +17 -13
- package/dist/commands/list.command.d.ts.map +1 -1
- package/dist/commands/list.command.js +148 -145
- package/dist/commands/list.command.js.map +1 -1
- package/dist/commands/run.command.d.ts +10 -10
- package/dist/commands/run.command.d.ts.map +1 -1
- package/dist/commands/run.command.js +46 -63
- package/dist/commands/run.command.js.map +1 -1
- package/dist/commands/tree.command.d.ts +7 -0
- package/dist/commands/tree.command.d.ts.map +1 -0
- package/dist/commands/tree.command.js +35 -0
- package/dist/commands/tree.command.js.map +1 -0
- package/dist/components/List.d.ts +9 -0
- package/dist/components/List.d.ts.map +1 -0
- package/dist/components/List.js +57 -0
- package/dist/components/List.js.map +1 -0
- package/dist/components/StaticLogs.d.ts +2 -0
- package/dist/components/StaticLogs.d.ts.map +1 -0
- package/dist/components/StaticLogs.js +77 -0
- package/dist/components/StaticLogs.js.map +1 -0
- package/dist/components/TaskSetSpinner.d.ts +6 -0
- package/dist/components/TaskSetSpinner.d.ts.map +1 -0
- package/dist/components/TaskSetSpinner.js +41 -0
- package/dist/components/TaskSetSpinner.js.map +1 -0
- package/dist/components/TaskSpinner.d.ts +6 -0
- package/dist/components/TaskSpinner.d.ts.map +1 -0
- package/dist/components/TaskSpinner.js +72 -0
- package/dist/components/TaskSpinner.js.map +1 -0
- package/dist/components/WorkspaceTree.d.ts +8 -0
- package/dist/components/WorkspaceTree.d.ts.map +1 -0
- package/dist/components/WorkspaceTree.js +153 -0
- package/dist/components/WorkspaceTree.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +26 -16
- package/dist/main.js.map +1 -1
- package/dist/wrapper.d.ts +6 -0
- package/dist/wrapper.d.ts.map +1 -0
- package/dist/wrapper.js +30 -0
- package/dist/wrapper.js.map +1 -0
- package/dist/wrappers/project.wrapper.d.ts +7 -0
- package/dist/wrappers/project.wrapper.d.ts.map +1 -0
- package/dist/wrappers/project.wrapper.js +105 -0
- package/dist/wrappers/project.wrapper.js.map +1 -0
- package/dist/wrappers/workspace.wrapper.d.ts +5 -0
- package/dist/wrappers/workspace.wrapper.d.ts.map +1 -0
- package/dist/wrappers/workspace.wrapper.js +108 -0
- package/dist/wrappers/workspace.wrapper.js.map +1 -0
- package/package.json +34 -24
- package/dist/commands/info.command.d.ts +0 -8
- package/dist/commands/info.command.d.ts.map +0 -1
- package/dist/commands/info.command.js +0 -178
- package/dist/commands/info.command.js.map +0 -1
- package/dist/core.plugin.d.ts +0 -2
- package/dist/core.plugin.d.ts.map +0 -1
- package/dist/core.plugin.js +0 -22
- package/dist/core.plugin.js.map +0 -1
- package/dist/task-logger.d.ts +0 -14
- package/dist/task-logger.d.ts.map +0 -1
- package/dist/task-logger.js +0 -76
- package/dist/task-logger.js.map +0 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useWorkspace = useWorkspace;
|
|
7
|
+
exports.withWorkspace = void 0;
|
|
8
|
+
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
|
|
11
|
+
var _ink = require("ink");
|
|
12
|
+
|
|
13
|
+
var _inkSpinner = _interopRequireDefault(require("ink-spinner"));
|
|
14
|
+
|
|
15
|
+
var _react = require("react");
|
|
16
|
+
|
|
17
|
+
var _wrapper = require("../wrapper");
|
|
18
|
+
|
|
19
|
+
var _project = require("./project.wrapper");
|
|
20
|
+
|
|
21
|
+
var _logSymbols = _interopRequireDefault(require("log-symbols"));
|
|
22
|
+
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
+
|
|
25
|
+
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) {
|
|
27
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
28
|
+
resolve(value);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
33
|
+
function fulfilled(value) {
|
|
34
|
+
try {
|
|
35
|
+
step(generator.next(value));
|
|
36
|
+
} catch (e) {
|
|
37
|
+
reject(e);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function rejected(value) {
|
|
42
|
+
try {
|
|
43
|
+
step(generator["throw"](value));
|
|
44
|
+
} catch (e) {
|
|
45
|
+
reject(e);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function step(result) {
|
|
50
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// Context
|
|
58
|
+
const WorkspaceContext = /*#__PURE__*/(0, _react.createContext)(null); // Hooks
|
|
59
|
+
|
|
60
|
+
function useWorkspace() {
|
|
61
|
+
const wks = (0, _react.useContext)(WorkspaceContext);
|
|
62
|
+
|
|
63
|
+
if (!wks) {
|
|
64
|
+
throw new Error('To use the useWorkspace hook you must wrap your command with the withWorkspace wrapper');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return wks;
|
|
68
|
+
} // Wrapper
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
const withWorkspace = (0, _wrapper.commandWrapper)('withWorkspace', yargs => yargs.option('workspace', {
|
|
72
|
+
alias: 'w',
|
|
73
|
+
type: 'string',
|
|
74
|
+
desc: 'Workspace to use'
|
|
75
|
+
}), (useArgs, Wrapped) => {
|
|
76
|
+
const {
|
|
77
|
+
workspace
|
|
78
|
+
} = useArgs();
|
|
79
|
+
const project = (0, _project.useProject)(); // State
|
|
80
|
+
|
|
81
|
+
const [wks, setWks] = (0, _react.useState)(); // Effects
|
|
82
|
+
|
|
83
|
+
(0, _react.useEffect)(() => void (() => __awaiter(void 0, void 0, void 0, function* () {
|
|
84
|
+
setWks(yield workspace ? project.workspace(workspace) : project.currentWorkspace());
|
|
85
|
+
}))(), [workspace]); // Render
|
|
86
|
+
|
|
87
|
+
if (wks === undefined) {
|
|
88
|
+
return (0, _jsxRuntime.jsxs)(_ink.Text, {
|
|
89
|
+
children: [(0, _jsxRuntime.jsx)(_inkSpinner.default, {}), " Loading \"", workspace || '.', "\" workspace"]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (wks === null) {
|
|
94
|
+
return (0, _jsxRuntime.jsxs)(_ink.Text, Object.assign({
|
|
95
|
+
color: "red"
|
|
96
|
+
}, {
|
|
97
|
+
children: [_logSymbols.default.error, " Workspace \"", workspace || '.', "\" not found"]
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return (0, _jsxRuntime.jsx)(WorkspaceContext.Provider, Object.assign({
|
|
102
|
+
value: wks
|
|
103
|
+
}, {
|
|
104
|
+
children: (0, _jsxRuntime.jsx)(Wrapped, {})
|
|
105
|
+
}));
|
|
106
|
+
});
|
|
107
|
+
exports.withWorkspace = withWorkspace;
|
|
108
|
+
//# sourceMappingURL=workspace.wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["wrappers/workspace.wrapper.js","wrappers/workspace.wrapper.tsx"],"names":["__awaiter","thisArg","_arguments","P","generator","adopt","value","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","then","apply","WorkspaceContext","useWorkspace","wks","Error","withWorkspace","yargs","option","alias","type","desc","useArgs","Wrapped","workspace","project","setWks","currentWorkspace","undefined","Text","children","Spinner","Object","assign","color","logSymbols","error","Provider"],"mappings":";;;;;;;;AASA;;ACRA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;ADPA,IAAIA,SAAS,GAAI,UAAQ,SAAKA,SAAd,IAA4B,UAAUC,OAAV,EAAmBC,UAAnB,EAA+BC,CAA/B,EAAkCC,SAAlC,EAA6C;AACrF,WAASC,KAAT,CAAeC,KAAf,EAAsB;AAAE,WAAOA,KAAK,YAAYH,CAAjB,GAAqBG,KAArB,GAA6B,IAAIH,CAAJ,CAAM,UAAUI,OAAV,EAAmB;AAAEA,MAAAA,OAAO,CAACD,KAAD,CAAP;AAAiB,KAA5C,CAApC;AAAoF;;AAC5G,SAAO,KAAKH,CAAC,KAAKA,CAAC,GAAGK,OAAT,CAAN,EAAyB,UAAUD,OAAV,EAAmBE,MAAnB,EAA2B;AACvD,aAASC,SAAT,CAAmBJ,KAAnB,EAA0B;AAAE,UAAI;AAAEK,QAAAA,IAAI,CAACP,SAAS,CAACQ,IAAV,CAAeN,KAAf,CAAD,CAAJ;AAA8B,OAApC,CAAqC,OAAOO,CAAP,EAAU;AAAEJ,QAAAA,MAAM,CAACI,CAAD,CAAN;AAAY;AAAE;;AAC3F,aAASC,QAAT,CAAkBR,KAAlB,EAAyB;AAAE,UAAI;AAAEK,QAAAA,IAAI,CAACP,SAAS,CAAC,OAAD,CAAT,CAAmBE,KAAnB,CAAD,CAAJ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AAA,EAAA,KAAA,CAAA,EAAA,aAAA;AAC/BiC,IAAAA,MAAM,CAAC,MAAOF,SAAS,GAAGC,OAAO,CAACD,SAAR,CAAkBA,SAAlB,CAAH,GAAkCC,OAAO,CAACE,gBAAR,EAAnD,CAAN;AACD,GAFgC,CAAZ,GAArB,EAEM,CAACH,SAAD,CAFN,EARmB,CAYnB;;AACA,MAAIV,GAAG,KAAKc,SAAZ,EAAuB;AACrB,WAAO,sBAACC,SAAD,EAAK;AAAAC,MAAAA,QAAA,EAAA,CAAC,qBAACC,mBAAD,EAAQ,EAAR,CAAD,EAAY,aAAZ,EAAuBP,SAAS,IAAI,GAApC,EAAuC,cAAvC;AAAA,KAAL,CAAP;AACD;;AAED,MAAIV,GAAG,KAAK,IAAZ,EAAkB;AAChB,WAAO,sBAACe,SAAD,EAAKG,MAAA,CAAAC,MAAA,CAAA;AAACC,MAAAA,KAAK,EAAC;AAAP,KAAA,EAAY;AAAAJ,MAAAA,QAAA,EAAA,CAAEK,oBAAWC,KAAb,EAAkB,eAAlB,EAAgCZ,SAAS,IAAI,GAA7C,EAAgD,cAAhD;AAAA,KAAZ,CAAL,CAAP;AACD;;AAED,SACE,qBAACZ,gBAAgB,CAACyB,QAAlB,EAA0BL,MAAA,CAAAC,MAAA,CAAA;AAAClC,IAAAA,KAAK,EAAEe;AAAR,GAAA,EAAW;AAAAgB,IAAAA,QAAA,EACnC,qBAACP,OAAD,EAAQ,EAAR;AADmC,GAAX,CAA1B,CADF;AAKD,CAlC0B,CAAtB","file":"workspace.wrapper.js","sourcesContent":["var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Text } from 'ink';\nimport Spinner from 'ink-spinner';\nimport { createContext, useContext, useEffect, useState } from 'react';\nimport { commandWrapper } from '../wrapper';\nimport { useProject } from './project.wrapper';\nimport logSymbols from 'log-symbols';\n// Context\nconst WorkspaceContext = createContext(null);\n// Hooks\nexport function useWorkspace() {\n const wks = useContext(WorkspaceContext);\n if (!wks) {\n throw new Error('To use the useWorkspace hook you must wrap your command with the withWorkspace wrapper');\n }\n return wks;\n}\n// Wrapper\nexport const withWorkspace = commandWrapper('withWorkspace', (yargs) => yargs\n .option('workspace', {\n alias: 'w',\n type: 'string',\n desc: 'Workspace to use'\n}), (useArgs, Wrapped) => {\n const { workspace } = useArgs();\n const project = useProject();\n // State\n const [wks, setWks] = useState();\n // Effects\n useEffect(() => void (() => __awaiter(void 0, void 0, void 0, function* () {\n setWks(yield (workspace ? project.workspace(workspace) : project.currentWorkspace()));\n }))(), [workspace]);\n // Render\n if (wks === undefined) {\n return _jsxs(Text, { children: [_jsx(Spinner, {}), \" Loading \\\"\", workspace || '.', \"\\\" workspace\"] });\n }\n if (wks === null) {\n return _jsxs(Text, Object.assign({ color: \"red\" }, { children: [logSymbols.error, \" Workspace \\\"\", workspace || '.', \"\\\" not found\"] }));\n }\n return (_jsx(WorkspaceContext.Provider, Object.assign({ value: wks }, { children: _jsx(Wrapped, {}) })));\n});","import { Workspace } from '@jujulego/jill-core';\nimport { Text } from 'ink';\nimport Spinner from 'ink-spinner';\nimport { createContext, useContext, useEffect, useState } from 'react';\n\nimport { commandWrapper } from '../wrapper';\nimport { useProject } from './project.wrapper';\nimport logSymbols from 'log-symbols';\n\n// Context\nconst WorkspaceContext = createContext<Workspace | null>(null);\n\n// Hooks\nexport function useWorkspace(): Workspace {\n const wks = useContext(WorkspaceContext);\n\n if (!wks) {\n throw new Error('To use the useWorkspace hook you must wrap your command with the withWorkspace wrapper');\n }\n\n return wks;\n}\n\n// Wrapper\nexport const withWorkspace = commandWrapper(\n 'withWorkspace',\n (yargs) => yargs\n .option('workspace', {\n alias: 'w',\n type: 'string',\n desc: 'Workspace to use'\n }),\n (useArgs, Wrapped) => {\n const { workspace } = useArgs();\n const project = useProject();\n\n // State\n const [wks, setWks] = useState<Workspace | null>();\n\n // Effects\n useEffect(() => void (async () => {\n setWks(await (workspace ? project.workspace(workspace) : project.currentWorkspace()));\n })(), [workspace]);\n\n // Render\n if (wks === undefined) {\n return <Text><Spinner /> Loading \"{workspace || '.'}\" workspace</Text>;\n }\n\n if (wks === null) {\n return <Text color=\"red\">{logSymbols.error} Workspace \"{workspace || '.'}\" not found</Text>;\n }\n\n return (\n <WorkspaceContext.Provider value={wks}>\n <Wrapped />\n </WorkspaceContext.Provider>\n );\n }\n);\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jujulego/jill",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"clean": "gulp clean",
|
|
19
19
|
"build": "gulp build",
|
|
20
20
|
"watch": "gulp watch",
|
|
21
|
-
"start": "ts-node src/main.
|
|
21
|
+
"start": "ts-node src/main.tsx",
|
|
22
22
|
"test": "jest"
|
|
23
23
|
},
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": "^14"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@jujulego/jill-myr": "1.2.
|
|
28
|
+
"@jujulego/jill-myr": "1.2.1"
|
|
29
29
|
},
|
|
30
30
|
"peerDependenciesMeta": {
|
|
31
31
|
"@jujulego/jill-myr": {
|
|
@@ -33,15 +33,19 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@jujulego/jill-common": "^
|
|
37
|
-
"@jujulego/jill-core": "^
|
|
36
|
+
"@jujulego/jill-common": "^2.0.0-beta.1",
|
|
37
|
+
"@jujulego/jill-core": "^2.0.0-beta.1",
|
|
38
38
|
"@repeaterjs/repeater": "^3.0.4",
|
|
39
39
|
"chalk": "^4.1.1",
|
|
40
|
-
"graphql": "^
|
|
41
|
-
"graphql-request": "^
|
|
40
|
+
"graphql": "^16.0.0",
|
|
41
|
+
"graphql-request": "^4.0.0",
|
|
42
42
|
"graphql-tag": "^2.12.6",
|
|
43
43
|
"graphql-ws": "^5.5.5",
|
|
44
|
+
"ink": "^3.2.0",
|
|
45
|
+
"ink-spinner": "^4.0.3",
|
|
46
|
+
"log-symbols": "^4.1.0",
|
|
44
47
|
"ora": "^5.4.1",
|
|
48
|
+
"react": "^17.0.2",
|
|
45
49
|
"slugify": "^1.6.0",
|
|
46
50
|
"winston": "^3.3.3",
|
|
47
51
|
"winston-transport": "^4.4.0",
|
|
@@ -49,28 +53,34 @@
|
|
|
49
53
|
"yargs": "^17.0.1"
|
|
50
54
|
},
|
|
51
55
|
"devDependencies": {
|
|
52
|
-
"@babel/core": "7.
|
|
56
|
+
"@babel/core": "7.17.5",
|
|
53
57
|
"@babel/plugin-proposal-class-properties": "7.16.7",
|
|
54
|
-
"@babel/preset-env": "7.16.
|
|
55
|
-
"@babel/
|
|
58
|
+
"@babel/preset-env": "7.16.11",
|
|
59
|
+
"@babel/preset-react": "7.16.7",
|
|
60
|
+
"@babel/runtime": "7.17.2",
|
|
56
61
|
"@types/gulp": "4.0.9",
|
|
57
|
-
"@types/jest": "27.4.
|
|
58
|
-
"@types/node": "14.18.
|
|
59
|
-
"@types/
|
|
60
|
-
"@types/
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
62
|
+
"@types/jest": "27.4.1",
|
|
63
|
+
"@types/node": "14.18.12",
|
|
64
|
+
"@types/normalize-package-data": "2.4.1",
|
|
65
|
+
"@types/react": "17.0.39",
|
|
66
|
+
"@types/ws": "8.5.2",
|
|
67
|
+
"@types/yargs": "17.0.9",
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "5.14.0",
|
|
69
|
+
"@typescript-eslint/parser": "5.14.0",
|
|
63
70
|
"del": "6.0.0",
|
|
64
|
-
"eslint": "8.
|
|
65
|
-
"eslint-plugin-jest": "
|
|
71
|
+
"eslint": "8.10.0",
|
|
72
|
+
"eslint-plugin-jest": "26.1.1",
|
|
66
73
|
"eslint-plugin-workspaces": "0.7.0",
|
|
67
74
|
"gulp": "4.0.2",
|
|
68
75
|
"gulp-cli": "2.3.0",
|
|
69
|
-
"
|
|
76
|
+
"ink-testing-library": "2.1.0",
|
|
77
|
+
"jest": "27.5.1",
|
|
70
78
|
"jill-tools": "0.0.0",
|
|
71
|
-
"msw": "0.
|
|
72
|
-
"
|
|
73
|
-
"ts-
|
|
74
|
-
"
|
|
75
|
-
|
|
79
|
+
"msw": "0.39.0",
|
|
80
|
+
"normalize-package-data": "3.0.3",
|
|
81
|
+
"ts-jest": "27.1.3",
|
|
82
|
+
"ts-node": "10.7.0",
|
|
83
|
+
"typescript": "4.6.2"
|
|
84
|
+
},
|
|
85
|
+
"stableVersion": "1.2.0"
|
|
76
86
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Arguments, WorkspaceArgs, WorkspaceCommand } from '@jujulego/jill-common';
|
|
2
|
-
export declare class InfoCommand extends WorkspaceCommand {
|
|
3
|
-
readonly name = "info";
|
|
4
|
-
readonly description = "Print workspace data";
|
|
5
|
-
protected run(args: Arguments<WorkspaceArgs>): Promise<number | void>;
|
|
6
|
-
private printDepsTree;
|
|
7
|
-
private printTree;
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["commands/info.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAMnF,qBAAa,WAAY,SAAQ,gBAAgB;IAE/C,QAAQ,CAAC,IAAI,UAAU;IACvB,QAAQ,CAAC,WAAW,0BAA0B;cAG9B,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;YAY7D,aAAa;YAWb,SAAS;CAiCxB","file":"info.command.d.ts","sourcesContent":["import { Arguments, WorkspaceArgs, WorkspaceCommand } from '@jujulego/jill-common';\nimport { Workspace } from '@jujulego/jill-core';\nimport chalk from 'chalk';\nimport path from 'path';\n\n// Command\nexport class InfoCommand extends WorkspaceCommand {\n // Attributes\n readonly name = 'info';\n readonly description = 'Print workspace data';\n\n // Methods\n protected async run(args: Arguments<WorkspaceArgs>): Promise<number | void> {\n await super.run(args);\n this.spinner.stop();\n\n // Print data\n this.log(chalk`Workspace {bold ${this.workspace.name}}:`);\n this.log(chalk`{bold Version:} ${this.workspace.manifest.version || chalk.grey('unset')}`);\n this.log(chalk`{bold Directory:} ${path.relative(process.cwd(), this.workspace.cwd) || '.'}`);\n this.log('');\n await this.printDepsTree();\n }\n\n private async printDepsTree(): Promise<void> {\n this.log(chalk`{bold Dependencies:}`);\n const printed = new Set([this.workspace.name]);\n\n await this.printTree(this.workspace, '', false, printed);\n\n if (printed.size === 1) {\n this.log(chalk.grey(` No dependencies for ${this.workspace.name}`));\n }\n }\n\n private async printTree(wks: Workspace, level: string, dev: boolean, printed: Set<string>) {\n const workspaces: [Workspace, boolean][] = [];\n\n for await (const dep of wks.dependencies()) {\n workspaces.push([dep, dev]);\n }\n\n for await (const dep of wks.devDependencies()) {\n workspaces.push([dep, true]);\n }\n\n for (let i = 0; i < workspaces.length; ++i) {\n const [dep, isDev] = workspaces[i];\n const isPrinted = printed.has(dep.cwd);\n const isLast = i === workspaces.length - 1;\n\n // Format\n let name = dep.name;\n if (dep.version) name = chalk`${name}{grey @${dep.version}}`;\n if (isDev) name = chalk.blue(`${name} (dev)`);\n if (isPrinted) name = chalk.italic(name);\n\n const branchFmt = dev ? chalk.blue : (s: string) => s;\n\n this.log(`${level}${branchFmt(`${isLast ? '└' : '├' }─ `)}${name}`);\n\n // Print deps of dep\n if (!isPrinted) {\n printed.add(dep.cwd);\n await this.printTree(dep, level + (isLast ? ' ' : branchFmt('│ ')), isDev, printed);\n }\n }\n }\n}\n"]}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.InfoCommand = void 0;
|
|
7
|
-
|
|
8
|
-
var _jillCommon = require("@jujulego/jill-common");
|
|
9
|
-
|
|
10
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
11
|
-
|
|
12
|
-
var _path = _interopRequireDefault(require("path"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
17
|
-
function adopt(value) {
|
|
18
|
-
return value instanceof P ? value : new P(function (resolve) {
|
|
19
|
-
resolve(value);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
-
function fulfilled(value) {
|
|
25
|
-
try {
|
|
26
|
-
step(generator.next(value));
|
|
27
|
-
} catch (e) {
|
|
28
|
-
reject(e);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function rejected(value) {
|
|
33
|
-
try {
|
|
34
|
-
step(generator["throw"](value));
|
|
35
|
-
} catch (e) {
|
|
36
|
-
reject(e);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function step(result) {
|
|
41
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
var __asyncValues = void 0 && (void 0).__asyncValues || function (o) {
|
|
49
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
50
|
-
var m = o[Symbol.asyncIterator],
|
|
51
|
-
i;
|
|
52
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () {
|
|
53
|
-
return this;
|
|
54
|
-
}, i);
|
|
55
|
-
|
|
56
|
-
function verb(n) {
|
|
57
|
-
i[n] = o[n] && function (v) {
|
|
58
|
-
return new Promise(function (resolve, reject) {
|
|
59
|
-
v = o[n](v), settle(resolve, reject, v.done, v.value);
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function settle(resolve, reject, d, v) {
|
|
65
|
-
Promise.resolve(v).then(function (v) {
|
|
66
|
-
resolve({
|
|
67
|
-
value: v,
|
|
68
|
-
done: d
|
|
69
|
-
});
|
|
70
|
-
}, reject);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// Command
|
|
75
|
-
class InfoCommand extends _jillCommon.WorkspaceCommand {
|
|
76
|
-
constructor() {
|
|
77
|
-
super(...arguments); // Attributes
|
|
78
|
-
|
|
79
|
-
this.name = 'info';
|
|
80
|
-
this.description = 'Print workspace data';
|
|
81
|
-
} // Methods
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
run(args) {
|
|
85
|
-
const _super = Object.create(null, {
|
|
86
|
-
run: {
|
|
87
|
-
get: () => super.run
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
yield _super.run.call(this, args);
|
|
93
|
-
this.spinner.stop(); // Print data
|
|
94
|
-
|
|
95
|
-
this.log((0, _chalk.default)`Workspace {bold ${this.workspace.name}}:`);
|
|
96
|
-
this.log((0, _chalk.default)`{bold Version:} ${this.workspace.manifest.version || _chalk.default.grey('unset')}`);
|
|
97
|
-
this.log((0, _chalk.default)`{bold Directory:} ${_path.default.relative(process.cwd(), this.workspace.cwd) || '.'}`);
|
|
98
|
-
this.log('');
|
|
99
|
-
yield this.printDepsTree();
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
printDepsTree() {
|
|
104
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
this.log((0, _chalk.default)`{bold Dependencies:}`);
|
|
106
|
-
const printed = new Set([this.workspace.name]);
|
|
107
|
-
yield this.printTree(this.workspace, '', false, printed);
|
|
108
|
-
|
|
109
|
-
if (printed.size === 1) {
|
|
110
|
-
this.log(_chalk.default.grey(` No dependencies for ${this.workspace.name}`));
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
printTree(wks, level, dev, printed) {
|
|
116
|
-
var e_1, _a, e_2, _b;
|
|
117
|
-
|
|
118
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
const workspaces = [];
|
|
120
|
-
|
|
121
|
-
try {
|
|
122
|
-
for (var _c = __asyncValues(wks.dependencies()), _d; _d = yield _c.next(), !_d.done;) {
|
|
123
|
-
const dep = _d.value;
|
|
124
|
-
workspaces.push([dep, dev]);
|
|
125
|
-
}
|
|
126
|
-
} catch (e_1_1) {
|
|
127
|
-
e_1 = {
|
|
128
|
-
error: e_1_1
|
|
129
|
-
};
|
|
130
|
-
} finally {
|
|
131
|
-
try {
|
|
132
|
-
if (_d && !_d.done && (_a = _c.return)) yield _a.call(_c);
|
|
133
|
-
} finally {
|
|
134
|
-
if (e_1) throw e_1.error;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
try {
|
|
139
|
-
for (var _e = __asyncValues(wks.devDependencies()), _f; _f = yield _e.next(), !_f.done;) {
|
|
140
|
-
const dep = _f.value;
|
|
141
|
-
workspaces.push([dep, true]);
|
|
142
|
-
}
|
|
143
|
-
} catch (e_2_1) {
|
|
144
|
-
e_2 = {
|
|
145
|
-
error: e_2_1
|
|
146
|
-
};
|
|
147
|
-
} finally {
|
|
148
|
-
try {
|
|
149
|
-
if (_f && !_f.done && (_b = _e.return)) yield _b.call(_e);
|
|
150
|
-
} finally {
|
|
151
|
-
if (e_2) throw e_2.error;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
for (let i = 0; i < workspaces.length; ++i) {
|
|
156
|
-
const [dep, isDev] = workspaces[i];
|
|
157
|
-
const isPrinted = printed.has(dep.cwd);
|
|
158
|
-
const isLast = i === workspaces.length - 1; // Format
|
|
159
|
-
|
|
160
|
-
let name = dep.name;
|
|
161
|
-
if (dep.version) name = (0, _chalk.default)`${name}{grey @${dep.version}}`;
|
|
162
|
-
if (isDev) name = _chalk.default.blue(`${name} (dev)`);
|
|
163
|
-
if (isPrinted) name = _chalk.default.italic(name);
|
|
164
|
-
const branchFmt = dev ? _chalk.default.blue : s => s;
|
|
165
|
-
this.log(`${level}${branchFmt(`${isLast ? '└' : '├'}─ `)}${name}`); // Print deps of dep
|
|
166
|
-
|
|
167
|
-
if (!isPrinted) {
|
|
168
|
-
printed.add(dep.cwd);
|
|
169
|
-
yield this.printTree(dep, level + (isLast ? ' ' : branchFmt('│ ')), isDev, printed);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
exports.InfoCommand = InfoCommand;
|
|
178
|
-
//# sourceMappingURL=info.command.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["commands/info.command.ts","commands/info.command.js"],"names":["__awaiter","thisArg","_arguments","P","generator","adopt","value","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","then","apply","__asyncValues","o","Symbol","asyncIterator","TypeError","m","i","call","__values","iterator","verb","n","v","settle","d","InfoCommand","WorkspaceCommand","constructor","arguments","name","description","run","args","_super","Object","create","get","spinner","stop","log","workspace","manifest","version","chalk","grey","path","relative","process","cwd","printDepsTree","printed","Set","printTree","size","wks","level","dev","e_1","_a","e_2","_b","workspaces","_c","dependencies","_d","dep","push","e_1_1","error","return","_e","devDependencies","_f","e_2_1","length","isDev","isPrinted","has","isLast","blue","italic","branchFmt","s","add"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;;;ACHA,IAAIA,SAAS,GAAI,UAAQ,SAAKA,SAAd,IAA4B,UAAUC,OAAV,EAAmBC,UAAnB,EAA+BC,CAA/B,EAAkCC,SAAlC,EAA6C;AACrF,WAASC,KAAT,CAAeC,KAAf,EAAsB;AAAE,WAAOA,KAAK,YAAYH,CAAjB,GAAqBG,KAArB,GAA6B,IAAIH,CAAJ,CAAM,UAAUI,OAAV,EAAmB;AAAEA,MAAAA,OAAO,CAACD,KAAD,CAAP;AAAiB,KAA5C,CAApC;AAAoF;;AAC5G,SAAO,KAAKH,CAAC,KAAKA,CAAC,GAAGK,OAAT,CAAN,EAAyB,UAAUD,OAAV,EAAmBE,MAAnB,EAA2B;AACvD,aAASC,SAAT,CAAmBJ,KAAnB,EAA0B;AAAE,UAAI;AAAEK,QAAAA,IAAI,CAACP,SAAS,CAACQ,IAAV,CAAeN,KAAf,CAAD,CAAJ;AAA8B,OAApC,CAAqC,OAAOO,CAAP,EAAU;AAAEJ,QAAAA,MAAM,CAACI,CAAD,CAAN;AAAY;AAAE;;AAC3F,aAASC,QAAT,CAAkBR,KAAlB,EAAyB;AAAE,UAAI;AAAEK,QAAAA,IAAI,CAACP,SAAS,CAAC,OAAD,CAAT,CAAmBE,KAAnB,CAAD,CAAJ;AAAkC,OAAxC,CAAyC,OAAOO,CAAP,EAAU;AAAEJ,QAAAA,MAAM,CAACI,CAAD,CAAN;AAAY;AAAE;;AAC9F,a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IAAIuB,MAAM,GAAG,KAAH,GAAWG,SAAS,CAAC,KAAD,CAA9B,CAAzB,EAAiEN,KAAjE,EAAwEzB,OAAxE,CAAN;AACD;AACF;ACqCI,KAhDe,CAAhB;ADYL;;AA7D8C","file":"info.command.js","sourcesContent":["import { Arguments, WorkspaceArgs, WorkspaceCommand } from '@jujulego/jill-common';\nimport { Workspace } from '@jujulego/jill-core';\nimport chalk from 'chalk';\nimport path from 'path';\n\n// Command\nexport class InfoCommand extends WorkspaceCommand {\n // Attributes\n readonly name = 'info';\n readonly description = 'Print workspace data';\n\n // Methods\n protected async run(args: Arguments<WorkspaceArgs>): Promise<number | void> {\n await super.run(args);\n this.spinner.stop();\n\n // Print data\n this.log(chalk`Workspace {bold ${this.workspace.name}}:`);\n this.log(chalk`{bold Version:} ${this.workspace.manifest.version || chalk.grey('unset')}`);\n this.log(chalk`{bold Directory:} ${path.relative(process.cwd(), this.workspace.cwd) || '.'}`);\n this.log('');\n await this.printDepsTree();\n }\n\n private async printDepsTree(): Promise<void> {\n this.log(chalk`{bold Dependencies:}`);\n const printed = new Set([this.workspace.name]);\n\n await this.printTree(this.workspace, '', false, printed);\n\n if (printed.size === 1) {\n this.log(chalk.grey(` No dependencies for ${this.workspace.name}`));\n }\n }\n\n private async printTree(wks: Workspace, level: string, dev: boolean, printed: Set<string>) {\n const workspaces: [Workspace, boolean][] = [];\n\n for await (const dep of wks.dependencies()) {\n workspaces.push([dep, dev]);\n }\n\n for await (const dep of wks.devDependencies()) {\n workspaces.push([dep, true]);\n }\n\n for (let i = 0; i < workspaces.length; ++i) {\n const [dep, isDev] = workspaces[i];\n const isPrinted = printed.has(dep.cwd);\n const isLast = i === workspaces.length - 1;\n\n // Format\n let name = dep.name;\n if (dep.version) name = chalk`${name}{grey @${dep.version}}`;\n if (isDev) name = chalk.blue(`${name} (dev)`);\n if (isPrinted) name = chalk.italic(name);\n\n const branchFmt = dev ? chalk.blue : (s: string) => s;\n\n this.log(`${level}${branchFmt(`${isLast ? '└' : '├' }─ `)}${name}`);\n\n // Print deps of dep\n if (!isPrinted) {\n printed.add(dep.cwd);\n await this.printTree(dep, level + (isLast ? ' ' : branchFmt('│ ')), isDev, printed);\n }\n }\n }\n}\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __asyncValues = (this && this.__asyncValues) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n};\nimport { WorkspaceCommand } from '@jujulego/jill-common';\nimport chalk from 'chalk';\nimport path from 'path';\n// Command\nexport class InfoCommand extends WorkspaceCommand {\n constructor() {\n super(...arguments);\n // Attributes\n this.name = 'info';\n this.description = 'Print workspace data';\n }\n // Methods\n run(args) {\n const _super = Object.create(null, {\n run: { get: () => super.run }\n });\n return __awaiter(this, void 0, void 0, function* () {\n yield _super.run.call(this, args);\n this.spinner.stop();\n // Print data\n this.log(chalk `Workspace {bold ${this.workspace.name}}:`);\n this.log(chalk `{bold Version:} ${this.workspace.manifest.version || chalk.grey('unset')}`);\n this.log(chalk `{bold Directory:} ${path.relative(process.cwd(), this.workspace.cwd) || '.'}`);\n this.log('');\n yield this.printDepsTree();\n });\n }\n printDepsTree() {\n return __awaiter(this, void 0, void 0, function* () {\n this.log(chalk `{bold Dependencies:}`);\n const printed = new Set([this.workspace.name]);\n yield this.printTree(this.workspace, '', false, printed);\n if (printed.size === 1) {\n this.log(chalk.grey(` No dependencies for ${this.workspace.name}`));\n }\n });\n }\n printTree(wks, level, dev, printed) {\n var e_1, _a, e_2, _b;\n return __awaiter(this, void 0, void 0, function* () {\n const workspaces = [];\n try {\n for (var _c = __asyncValues(wks.dependencies()), _d; _d = yield _c.next(), !_d.done;) {\n const dep = _d.value;\n workspaces.push([dep, dev]);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) yield _a.call(_c);\n }\n finally { if (e_1) throw e_1.error; }\n }\n try {\n for (var _e = __asyncValues(wks.devDependencies()), _f; _f = yield _e.next(), !_f.done;) {\n const dep = _f.value;\n workspaces.push([dep, true]);\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_f && !_f.done && (_b = _e.return)) yield _b.call(_e);\n }\n finally { if (e_2) throw e_2.error; }\n }\n for (let i = 0; i < workspaces.length; ++i) {\n const [dep, isDev] = workspaces[i];\n const isPrinted = printed.has(dep.cwd);\n const isLast = i === workspaces.length - 1;\n // Format\n let name = dep.name;\n if (dep.version)\n name = chalk `${name}{grey @${dep.version}}`;\n if (isDev)\n name = chalk.blue(`${name} (dev)`);\n if (isPrinted)\n name = chalk.italic(name);\n const branchFmt = dev ? chalk.blue : (s) => s;\n this.log(`${level}${branchFmt(`${isLast ? '└' : '├'}─ `)}${name}`);\n // Print deps of dep\n if (!isPrinted) {\n printed.add(dep.cwd);\n yield this.printTree(dep, level + (isLast ? ' ' : branchFmt('│ ')), isDev, printed);\n }\n }\n });\n }\n}"]}
|
package/dist/core.plugin.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["core.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAQ/C,eAAO,MAAM,UAAU,QAKrB,CAAC","file":"core.plugin.d.ts","sourcesContent":["import { Plugin } from '@jujulego/jill-common';\n\nimport { EachCommand } from './commands/each.command';\nimport { InfoCommand } from './commands/info.command';\nimport { ListCommand } from './commands/list.command';\nimport { RunCommand } from './commands/run.command';\n\n// Plugin\nexport const corePlugin = Plugin.createPlugin('core', [\n InfoCommand,\n ListCommand,\n RunCommand,\n EachCommand,\n]);\n"]}
|
package/dist/core.plugin.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.corePlugin = void 0;
|
|
7
|
-
|
|
8
|
-
var _jillCommon = require("@jujulego/jill-common");
|
|
9
|
-
|
|
10
|
-
var _each = require("./commands/each.command");
|
|
11
|
-
|
|
12
|
-
var _info = require("./commands/info.command");
|
|
13
|
-
|
|
14
|
-
var _list = require("./commands/list.command");
|
|
15
|
-
|
|
16
|
-
var _run = require("./commands/run.command");
|
|
17
|
-
|
|
18
|
-
// Plugin
|
|
19
|
-
const corePlugin = _jillCommon.Plugin.createPlugin('core', [_info.InfoCommand, _list.ListCommand, _run.RunCommand, _each.EachCommand]);
|
|
20
|
-
|
|
21
|
-
exports.corePlugin = corePlugin;
|
|
22
|
-
//# sourceMappingURL=core.plugin.js.map
|
package/dist/core.plugin.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["core.plugin.ts"],"names":["corePlugin","Plugin","createPlugin","InfoCommand","ListCommand","RunCommand","EachCommand"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AAEA;AACO,MAAMA,UAAU,GAAGC,mBAAOC,YAAP,CAAoB,MAApB,EAA4B,CACpDC,iBADoD,EAEpDC,iBAFoD,EAGpDC,eAHoD,EAIpDC,iBAJoD,CAA5B,CAAnB","file":"core.plugin.js","sourcesContent":["import { Plugin } from '@jujulego/jill-common';\n\nimport { EachCommand } from './commands/each.command';\nimport { InfoCommand } from './commands/info.command';\nimport { ListCommand } from './commands/list.command';\nimport { RunCommand } from './commands/run.command';\n\n// Plugin\nexport const corePlugin = Plugin.createPlugin('core', [\n InfoCommand,\n ListCommand,\n RunCommand,\n EachCommand,\n]);\n"]}
|
package/dist/task-logger.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Task, TaskSet } from '@jujulego/jill-core';
|
|
2
|
-
export declare type TaskLoggerState = 'spin-multiple' | 'spin-simple' | 'fail' | 'succeed';
|
|
3
|
-
export declare class TaskLogger {
|
|
4
|
-
private readonly _running;
|
|
5
|
-
private readonly _formats;
|
|
6
|
-
private _refreshSpinner;
|
|
7
|
-
private _handleStarted;
|
|
8
|
-
private _handleCompleted;
|
|
9
|
-
connect(set: TaskSet): void;
|
|
10
|
-
on(state: 'spin-multiple', format: (count: number) => string): void;
|
|
11
|
-
on(state: 'spin-simple', format: (tsk: Task) => string): void;
|
|
12
|
-
on(state: 'fail', format: (tsk: Task) => string): void;
|
|
13
|
-
on(state: 'succeed', format: (tsk: Task) => string): void;
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["task-logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAGpD,oBAAY,eAAe,GAAG,eAAe,GAAG,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;AAGnF,qBAAa,UAAU;IAErB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAC5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAKvB;IAGF,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAK3B,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI;IACnE,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,GAAG,IAAI;IAC7D,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,GAAG,IAAI;IACtD,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,GAAG,IAAI;CAI1D","file":"task-logger.d.ts","sourcesContent":["import { transport } from '@jujulego/jill-common';\nimport { Task, TaskSet } from '@jujulego/jill-core';\n\n// Types\nexport type TaskLoggerState = 'spin-multiple' | 'spin-simple' | 'fail' | 'succeed';\n\n// Class\nexport class TaskLogger {\n // Attributes\n private readonly _running = new Set<Task>();\n private readonly _formats = {\n 'spin-multiple': (count: number) => `Building ${count} workspaces ...`,\n 'spin-simple': (tsk: Task) => `Building ${tsk.context.workspace?.name} ...`,\n 'fail': (tsk: Task) => `Failed to build ${tsk.context.workspace?.name}`,\n 'succeed': (tsk: Task) => `${tsk.context.workspace?.name} built`,\n };\n\n // Methods\n private _refreshSpinner() {\n if (this._running.size > 1) {\n transport.spin(this._formats['spin-multiple'](this._running.size));\n } else if (this._running.size > 0) {\n const tsk = this._running.values().next().value;\n transport.spin(this._formats['spin-simple'](tsk));\n }\n }\n\n private _handleStarted(task: Task) {\n this._running.add(task);\n\n this._refreshSpinner();\n }\n\n private _handleCompleted(task: Task) {\n this._running.delete(task);\n\n if (task.status === 'failed') {\n transport.fail(this._formats['fail'](task));\n } else {\n transport.succeed(this._formats['succeed'](task));\n }\n\n this._refreshSpinner();\n }\n\n connect(set: TaskSet): void {\n set.on('started', (task) => this._handleStarted(task));\n set.on('completed', (task) => this._handleCompleted(task));\n }\n\n on(state: 'spin-multiple', format: (count: number) => string): void;\n on(state: 'spin-simple', format: (tsk: Task) => string): void;\n on(state: 'fail', format: (tsk: Task) => string): void;\n on(state: 'succeed', format: (tsk: Task) => string): void;\n on(state: TaskLoggerState, format: (arg: never) => string): void {\n this._formats[state] = format;\n }\n}\n"]}
|
package/dist/task-logger.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TaskLogger = void 0;
|
|
7
|
-
|
|
8
|
-
var _jillCommon = require("@jujulego/jill-common");
|
|
9
|
-
|
|
10
|
-
// Class
|
|
11
|
-
class TaskLogger {
|
|
12
|
-
constructor() {
|
|
13
|
-
// Attributes
|
|
14
|
-
this._running = new Set();
|
|
15
|
-
this._formats = {
|
|
16
|
-
'spin-multiple': count => `Building ${count} workspaces ...`,
|
|
17
|
-
'spin-simple': tsk => {
|
|
18
|
-
var _a;
|
|
19
|
-
|
|
20
|
-
return `Building ${(_a = tsk.context.workspace) === null || _a === void 0 ? void 0 : _a.name} ...`;
|
|
21
|
-
},
|
|
22
|
-
'fail': tsk => {
|
|
23
|
-
var _a;
|
|
24
|
-
|
|
25
|
-
return `Failed to build ${(_a = tsk.context.workspace) === null || _a === void 0 ? void 0 : _a.name}`;
|
|
26
|
-
},
|
|
27
|
-
'succeed': tsk => {
|
|
28
|
-
var _a;
|
|
29
|
-
|
|
30
|
-
return `${(_a = tsk.context.workspace) === null || _a === void 0 ? void 0 : _a.name} built`;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
} // Methods
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
_refreshSpinner() {
|
|
37
|
-
if (this._running.size > 1) {
|
|
38
|
-
_jillCommon.transport.spin(this._formats['spin-multiple'](this._running.size));
|
|
39
|
-
} else if (this._running.size > 0) {
|
|
40
|
-
const tsk = this._running.values().next().value;
|
|
41
|
-
|
|
42
|
-
_jillCommon.transport.spin(this._formats['spin-simple'](tsk));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
_handleStarted(task) {
|
|
47
|
-
this._running.add(task);
|
|
48
|
-
|
|
49
|
-
this._refreshSpinner();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
_handleCompleted(task) {
|
|
53
|
-
this._running.delete(task);
|
|
54
|
-
|
|
55
|
-
if (task.status === 'failed') {
|
|
56
|
-
_jillCommon.transport.fail(this._formats['fail'](task));
|
|
57
|
-
} else {
|
|
58
|
-
_jillCommon.transport.succeed(this._formats['succeed'](task));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
this._refreshSpinner();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
connect(set) {
|
|
65
|
-
set.on('started', task => this._handleStarted(task));
|
|
66
|
-
set.on('completed', task => this._handleCompleted(task));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
on(state, format) {
|
|
70
|
-
this._formats[state] = format;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
exports.TaskLogger = TaskLogger;
|
|
76
|
-
//# sourceMappingURL=task-logger.js.map
|
package/dist/task-logger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["task-logger.ts"],"names":["TaskLogger","constructor","_running","Set","_formats","count","tsk","_a","context","workspace","name","_refreshSpinner","size","transport","spin","values","next","value","_handleStarted","task","add","_handleCompleted","delete","status","fail","succeed","connect","set","on","state","format"],"mappings":";;;;;;;AAAA;;AAMA;AACM,MAAOA,UAAP,CAAiB;AAAvBC,EAAAA,WAAA,GAAA;AACE;AACiB,SAAAC,QAAA,GAAW,IAAIC,GAAJ,EAAX;AACA,SAAAC,QAAA,GAAW;AAC1B,uBAAkBC,KAAD,IAAmB,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KjB,QAAL,CAAckB,GAAd,CAAkBD,IAAlB;;AAEA,SAAKR,eAAL;AACD;;AAEOU,EAAAA,gBAAgB,CAACF,IAAD,EAAW;AACjC,SAAKjB,QAAL,CAAcoB,MAAd,CAAqBH,IAArB;;AAEA,QAAIA,IAAI,CAACI,MAAL,KAAgB,QAApB,EAA8B;AAC5BV,4BAAUW,IAAV,CAAe,KAAKpB,QAAL,CAAc,MAAd,EAAsBe,IAAtB,CAAf;AACD,KAFD,MAEO;AACLN,4BAAUY,OAAV,CAAkB,KAAKrB,QAAL,CAAc,SAAd,EAAyBe,IAAzB,CAAlB;AACD;;AAED,SAAKR,eAAL;AACD;;AAEDe,EAAAA,OAAO,CAACC,GAAD,EAAa;AAClBA,IAAAA,GAAG,CAACC,EAAJ,CAAO,SAAP,EAAmBT,IAAD,IAAU,KAAKD,cAAL,CAAoBC,IAApB,CAA5B;AACAQ,IAAAA,GAAG,CAACC,EAAJ,CAAO,WAAP,EAAqBT,IAAD,IAAU,KAAKE,gBAAL,CAAsBF,IAAtB,CAA9B;AACD;;AAMDS,EAAAA,EAAE,CAACC,KAAD,EAAyBC,MAAzB,EAAuD;AACvD,SAAK1B,QAAL,CAAcyB,KAAd,IAAuBC,MAAvB;AACD;;AAjDoB","file":"task-logger.js","sourcesContent":["import { transport } from '@jujulego/jill-common';\nimport { Task, TaskSet } from '@jujulego/jill-core';\n\n// Types\nexport type TaskLoggerState = 'spin-multiple' | 'spin-simple' | 'fail' | 'succeed';\n\n// Class\nexport class TaskLogger {\n // Attributes\n private readonly _running = new Set<Task>();\n private readonly _formats = {\n 'spin-multiple': (count: number) => `Building ${count} workspaces ...`,\n 'spin-simple': (tsk: Task) => `Building ${tsk.context.workspace?.name} ...`,\n 'fail': (tsk: Task) => `Failed to build ${tsk.context.workspace?.name}`,\n 'succeed': (tsk: Task) => `${tsk.context.workspace?.name} built`,\n };\n\n // Methods\n private _refreshSpinner() {\n if (this._running.size > 1) {\n transport.spin(this._formats['spin-multiple'](this._running.size));\n } else if (this._running.size > 0) {\n const tsk = this._running.values().next().value;\n transport.spin(this._formats['spin-simple'](tsk));\n }\n }\n\n private _handleStarted(task: Task) {\n this._running.add(task);\n\n this._refreshSpinner();\n }\n\n private _handleCompleted(task: Task) {\n this._running.delete(task);\n\n if (task.status === 'failed') {\n transport.fail(this._formats['fail'](task));\n } else {\n transport.succeed(this._formats['succeed'](task));\n }\n\n this._refreshSpinner();\n }\n\n connect(set: TaskSet): void {\n set.on('started', (task) => this._handleStarted(task));\n set.on('completed', (task) => this._handleCompleted(task));\n }\n\n on(state: 'spin-multiple', format: (count: number) => string): void;\n on(state: 'spin-simple', format: (tsk: Task) => string): void;\n on(state: 'fail', format: (tsk: Task) => string): void;\n on(state: 'succeed', format: (tsk: Task) => string): void;\n on(state: TaskLoggerState, format: (arg: never) => string): void {\n this._formats[state] = format;\n }\n}\n"]}
|