@jujulego/jill 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/798.js +3 -0
- package/dist/798.js.LICENSE.txt +73 -0
- package/dist/798.js.map +1 -0
- package/dist/main.js +1 -28
- package/dist/main.js.map +1 -1
- package/dist/runtime.js +2 -0
- package/dist/runtime.js.map +1 -0
- package/package.json +41 -41
- package/dist/commands/each.js +0 -118
- package/dist/commands/each.js.map +0 -1
- package/dist/commands/list.js +0 -170
- package/dist/commands/list.js.map +0 -1
- package/dist/commands/run.js +0 -71
- package/dist/commands/run.js.map +0 -1
- package/dist/commands/tree.js +0 -35
- package/dist/commands/tree.js.map +0 -1
- package/dist/filters/affected.filter.js +0 -82
- package/dist/filters/affected.filter.js.map +0 -1
- package/dist/filters/index.js +0 -21
- package/dist/filters/index.js.map +0 -1
- package/dist/filters/pipeline.js +0 -34
- package/dist/filters/pipeline.js.map +0 -1
- package/dist/filters/private.filter.js +0 -20
- package/dist/filters/private.filter.js.map +0 -1
- package/dist/filters/scripts.filter.js +0 -21
- package/dist/filters/scripts.filter.js.map +0 -1
- package/dist/git.js +0 -94
- package/dist/git.js.map +0 -1
- package/dist/middlewares/global-config.js +0 -36
- package/dist/middlewares/global-config.js.map +0 -1
- package/dist/middlewares/index.js +0 -21
- package/dist/middlewares/index.js.map +0 -1
- package/dist/middlewares/load-project.js +0 -41
- package/dist/middlewares/load-project.js.map +0 -1
- package/dist/middlewares/load-workspace.js +0 -42
- package/dist/middlewares/load-workspace.js.map +0 -1
- package/dist/middlewares/setup-ink.js +0 -22
- package/dist/middlewares/setup-ink.js.map +0 -1
- package/dist/project/index.js +0 -19
- package/dist/project/index.js.map +0 -1
- package/dist/project/project.js +0 -190
- package/dist/project/project.js.map +0 -1
- package/dist/project/workspace.js +0 -173
- package/dist/project/workspace.js.map +0 -1
- package/dist/services/index.js +0 -21
- package/dist/services/index.js.map +0 -1
- package/dist/services/inversify.config.js +0 -34
- package/dist/services/inversify.config.js.map +0 -1
- package/dist/services/logger.service.js +0 -75
- package/dist/services/logger.service.js.map +0 -1
- package/dist/services/spinner.service.js +0 -57
- package/dist/services/spinner.service.js.map +0 -1
- package/dist/services/task-manager.service.js +0 -18
- package/dist/services/task-manager.service.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types.js +0 -7
- package/dist/types.js.map +0 -1
- package/dist/ui/global-spinner.js +0 -65
- package/dist/ui/global-spinner.js.map +0 -1
- package/dist/ui/index.js +0 -25
- package/dist/ui/index.js.map +0 -1
- package/dist/ui/layout.js +0 -20
- package/dist/ui/layout.js.map +0 -1
- package/dist/ui/list.js +0 -30
- package/dist/ui/list.js.map +0 -1
- package/dist/ui/static-logs.js +0 -63
- package/dist/ui/static-logs.js.map +0 -1
- package/dist/ui/task-name.js +0 -35
- package/dist/ui/task-name.js.map +0 -1
- package/dist/ui/task-spinner.js +0 -117
- package/dist/ui/task-spinner.js.map +0 -1
- package/dist/ui/tasks-spinner.js +0 -39
- package/dist/ui/tasks-spinner.js.map +0 -1
- package/dist/ui/workspace-tree.js +0 -88
- package/dist/ui/workspace-tree.js.map +0 -1
- package/dist/utils/index.js +0 -20
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/streams.js +0 -49
- package/dist/utils/streams.js.map +0 -1
- package/dist/utils/string.js +0 -14
- package/dist/utils/string.js.map +0 -1
- package/dist/utils/yargs.js +0 -33
- package/dist/utils/yargs.js.map +0 -1
package/dist/commands/list.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, // Command
|
|
6
|
-
"default", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: ()=>_default
|
|
9
|
-
});
|
|
10
|
-
const _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
const _chalk = /*#__PURE__*/ _interopRequireDefault(require("chalk"));
|
|
12
|
-
const _nodePath = /*#__PURE__*/ _interopRequireDefault(require("node:path"));
|
|
13
|
-
const _slugify = /*#__PURE__*/ _interopRequireDefault(require("slugify"));
|
|
14
|
-
const _filters = require("../filters");
|
|
15
|
-
const _middlewares = require("../middlewares");
|
|
16
|
-
const _project = require("../project");
|
|
17
|
-
const _services = require("../services");
|
|
18
|
-
const _ui = require("../ui");
|
|
19
|
-
const _utils = require("../utils");
|
|
20
|
-
function _interopRequireDefault(obj) {
|
|
21
|
-
return obj && obj.__esModule ? obj : {
|
|
22
|
-
default: obj
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
// Constants
|
|
26
|
-
const LONG_ATTRIBUTES = [
|
|
27
|
-
'name',
|
|
28
|
-
'version',
|
|
29
|
-
'root'
|
|
30
|
-
];
|
|
31
|
-
const JSON_ATTRIBUTES = [
|
|
32
|
-
'name',
|
|
33
|
-
'version',
|
|
34
|
-
'slug',
|
|
35
|
-
'root'
|
|
36
|
-
];
|
|
37
|
-
const DEFAULT_ATTRIBUTES = [
|
|
38
|
-
'name'
|
|
39
|
-
];
|
|
40
|
-
const EXTRACTORS = {
|
|
41
|
-
name: (wks)=>wks.name,
|
|
42
|
-
version: (wks, json)=>wks.manifest.version || (json ? undefined : _chalk.default.grey('unset')),
|
|
43
|
-
root: (wks)=>wks.cwd,
|
|
44
|
-
slug: (wks)=>(0, _slugify.default)(wks.name)
|
|
45
|
-
};
|
|
46
|
-
// Utils
|
|
47
|
-
function buildExtractor(attrs) {
|
|
48
|
-
return (wks, json)=>{
|
|
49
|
-
const data = {};
|
|
50
|
-
for (const attr of attrs){
|
|
51
|
-
data[attr] = EXTRACTORS[attr](wks, json);
|
|
52
|
-
}
|
|
53
|
-
return data;
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
const _default = (0, _utils.defineCommand)({
|
|
57
|
-
command: [
|
|
58
|
-
'list',
|
|
59
|
-
'ls'
|
|
60
|
-
],
|
|
61
|
-
describe: 'List workspaces',
|
|
62
|
-
builder: (yargs)=>(0, _utils.applyMiddlewares)(yargs, [
|
|
63
|
-
_middlewares.setupInk,
|
|
64
|
-
_middlewares.loadProject
|
|
65
|
-
])// Filters
|
|
66
|
-
.option('private', {
|
|
67
|
-
type: 'boolean',
|
|
68
|
-
group: 'Filters:',
|
|
69
|
-
desc: 'Print only private workspaces'
|
|
70
|
-
}).option('with-script', {
|
|
71
|
-
type: 'array',
|
|
72
|
-
string: true,
|
|
73
|
-
group: 'Filters:',
|
|
74
|
-
desc: 'Print only workspaces having the given script'
|
|
75
|
-
})// Affected filter
|
|
76
|
-
.option('affected', {
|
|
77
|
-
alias: 'a',
|
|
78
|
-
type: 'string',
|
|
79
|
-
coerce: (rev)=>rev === '' ? 'master' : rev,
|
|
80
|
-
group: 'Affected:',
|
|
81
|
-
desc: 'Print only affected workspaces towards given git revision. If no revision is given, it will check towards master.\n' + 'Replaces %name by workspace name.'
|
|
82
|
-
}).option('affected-rev-sort', {
|
|
83
|
-
type: 'string',
|
|
84
|
-
group: 'Affected:',
|
|
85
|
-
desc: 'Sort applied to git tag / git branch command'
|
|
86
|
-
}).option('affected-rev-fallback', {
|
|
87
|
-
type: 'string',
|
|
88
|
-
default: 'master',
|
|
89
|
-
group: 'Affected:',
|
|
90
|
-
desc: 'Fallback revision, used if no revision matching the given format is found'
|
|
91
|
-
}).option('attrs', {
|
|
92
|
-
type: 'array',
|
|
93
|
-
choices: [
|
|
94
|
-
'name',
|
|
95
|
-
'version',
|
|
96
|
-
'root',
|
|
97
|
-
'slug'
|
|
98
|
-
],
|
|
99
|
-
default: [],
|
|
100
|
-
group: 'Format:',
|
|
101
|
-
desc: 'Select printed attributes'
|
|
102
|
-
}).option('headers', {
|
|
103
|
-
type: 'boolean',
|
|
104
|
-
group: 'Format:',
|
|
105
|
-
desc: 'Prints columns headers'
|
|
106
|
-
}).option('long', {
|
|
107
|
-
alias: 'l',
|
|
108
|
-
type: 'boolean',
|
|
109
|
-
group: 'Format:',
|
|
110
|
-
desc: 'Prints name, version and root of all workspaces'
|
|
111
|
-
}).option('json', {
|
|
112
|
-
type: 'boolean',
|
|
113
|
-
group: 'Format:',
|
|
114
|
-
desc: 'Prints data as a JSON array'
|
|
115
|
-
}),
|
|
116
|
-
async handler (args) {
|
|
117
|
-
// Setup pipeline
|
|
118
|
-
const pipeline = new _filters.Pipeline();
|
|
119
|
-
if (args.private !== undefined) {
|
|
120
|
-
pipeline.add(new _filters.PrivateFilter(args.private));
|
|
121
|
-
}
|
|
122
|
-
if (args.withScript) {
|
|
123
|
-
pipeline.add(new _filters.ScriptsFilter(args.withScript));
|
|
124
|
-
}
|
|
125
|
-
if (args.affected !== undefined) {
|
|
126
|
-
pipeline.add(new _filters.AffectedFilter(args.affected, args.affectedRevFallback, args.affectedRevSort));
|
|
127
|
-
}
|
|
128
|
-
// Load workspaces
|
|
129
|
-
const project = _services.container.getNamed(_project.Project, _services.CURRENT);
|
|
130
|
-
const workspaces = [];
|
|
131
|
-
for await (const wks of pipeline.filter(project.workspaces())){
|
|
132
|
-
workspaces.push(wks);
|
|
133
|
-
}
|
|
134
|
-
// Build data
|
|
135
|
-
let attrs = args.attrs;
|
|
136
|
-
if (args.attrs.length === 0) {
|
|
137
|
-
if (args.long) {
|
|
138
|
-
attrs = LONG_ATTRIBUTES;
|
|
139
|
-
} else if (args.json) {
|
|
140
|
-
attrs = JSON_ATTRIBUTES;
|
|
141
|
-
} else {
|
|
142
|
-
attrs = DEFAULT_ATTRIBUTES;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
const data = workspaces.map((wks)=>buildExtractor(attrs)(wks, args.json || false));
|
|
146
|
-
// Print list
|
|
147
|
-
if (args.json) {
|
|
148
|
-
if (process.stdout.isTTY) {
|
|
149
|
-
console.log(JSON.stringify(data, null, 2));
|
|
150
|
-
} else {
|
|
151
|
-
process.stdout.write(JSON.stringify(data));
|
|
152
|
-
}
|
|
153
|
-
} else {
|
|
154
|
-
const app = _services.container.get(_services.INK_APP);
|
|
155
|
-
for (const d of data){
|
|
156
|
-
if (d.root) {
|
|
157
|
-
d.root = _nodePath.default.relative(process.cwd(), d.root) || '.';
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
app.rerender(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_ui.Layout, {
|
|
161
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_ui.List, {
|
|
162
|
-
items: data,
|
|
163
|
-
headers: args.headers ?? attrs.length > 1
|
|
164
|
-
})
|
|
165
|
-
}));
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
//# sourceMappingURL=list.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/list.tsx"],"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, 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) =>\n 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.getNamed(Project, CURRENT);\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 process.stdout.write(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","getNamed","Project","CURRENT","workspaces","filter","push","length","long","map","process","stdout","isTTY","console","log","JSON","stringify","write","app","get","INK_APP","d","path","relative","rerender","Layout","List","items","headers"],"mappings":"AAAA;;;;+BA2CA,UAAU;AACV;;aAAA;;;4DA5CkB;+DACD;8DAEG;yBAEmD;6BACjC;yBACH;0BACS;oBACf;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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WK,GAAG,CAACxD,CAAAA,MAAOW,eAAeC,OAAOZ,KAAKkC,KAAKhC,IAAI,IAAI,KAAK;QAEhF,aAAa;QACb,IAAIgC,KAAKhC,IAAI,EAAE;YACb,IAAIuD,QAAQC,MAAM,CAACC,KAAK,EAAE;gBACxBC,QAAQC,GAAG,CAACC,KAAKC,SAAS,CAAClD,MAAM,IAAI,EAAE;YACzC,OAAO;gBACL4C,QAAQC,MAAM,CAACM,KAAK,CAACF,KAAKC,SAAS,CAAClD;YACtC,CAAC;QACH,OAAO;YACL,MAAMoD,MAAMlB,mBAAS,CAACmB,GAAG,CAAeC,iBAAO;YAE/C,KAAK,MAAMC,KAAKvD,KAAM;gBACpB,IAAIuD,EAAE7D,IAAI,EAAE;oBACV6D,EAAE7D,IAAI,GAAG8D,iBAAI,CAACC,QAAQ,CAACb,QAAQjD,GAAG,IAAI4D,EAAE7D,IAAI,KAAK;gBACnD,CAAC;YACH;YAEA0D,IAAIM,QAAQ,eACV,qBAACC,UAAM;0BACL,cAAA,qBAACC,QAAI;oBAACC,OAAO7D;oBAAM8D,SAASzC,KAAKyC,OAAO,IAAK/D,MAAM0C,MAAM,GAAG;;;QAGlE,CAAC;IACH;AACF"}
|
package/dist/commands/run.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, // Command
|
|
6
|
-
"default", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: ()=>_default
|
|
9
|
-
});
|
|
10
|
-
const _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
const _eventTree = require("@jujulego/event-tree");
|
|
12
|
-
const _tasks = require("@jujulego/tasks");
|
|
13
|
-
const _yargs = /*#__PURE__*/ _interopRequireDefault(require("yargs"));
|
|
14
|
-
const _middlewares = require("../middlewares");
|
|
15
|
-
const _project = require("../project");
|
|
16
|
-
const _services = require("../services");
|
|
17
|
-
const _ui = require("../ui");
|
|
18
|
-
const _utils = require("../utils");
|
|
19
|
-
function _interopRequireDefault(obj) {
|
|
20
|
-
return obj && obj.__esModule ? obj : {
|
|
21
|
-
default: obj
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
const _default = (0, _utils.defineCommand)({
|
|
25
|
-
command: 'run <script>',
|
|
26
|
-
describe: 'Run script inside workspace',
|
|
27
|
-
builder: (yargs)=>(0, _utils.applyMiddlewares)(yargs, [
|
|
28
|
-
_middlewares.setupInk,
|
|
29
|
-
_middlewares.loadProject,
|
|
30
|
-
_middlewares.loadWorkspace
|
|
31
|
-
]).positional('script', {
|
|
32
|
-
type: 'string',
|
|
33
|
-
demandOption: true
|
|
34
|
-
}).option('deps-mode', {
|
|
35
|
-
choice: [
|
|
36
|
-
'all',
|
|
37
|
-
'prod',
|
|
38
|
-
'none'
|
|
39
|
-
],
|
|
40
|
-
default: 'all',
|
|
41
|
-
desc: 'Dependency selection mode:\n' + ' - all = dependencies AND devDependencies\n' + ' - prod = dependencies\n' + ' - none = nothing'
|
|
42
|
-
}),
|
|
43
|
-
async handler (args) {
|
|
44
|
-
const app = _services.container.get(_services.INK_APP);
|
|
45
|
-
const workspace = _services.container.getNamed(_project.Workspace, _services.CURRENT);
|
|
46
|
-
const manager = _services.container.get(_tasks.TaskManager);
|
|
47
|
-
// Extract arguments
|
|
48
|
-
const rest = args._.map((arg)=>arg.toString());
|
|
49
|
-
if (rest[0] === 'run') {
|
|
50
|
-
rest.splice(0, 1);
|
|
51
|
-
}
|
|
52
|
-
// Run script in workspace
|
|
53
|
-
const task = await workspace.run(args.script, rest, {
|
|
54
|
-
buildDeps: args.depsMode
|
|
55
|
-
});
|
|
56
|
-
manager.add(task);
|
|
57
|
-
// Render
|
|
58
|
-
app.rerender(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_ui.Layout, {
|
|
59
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_ui.TasksSpinner, {
|
|
60
|
-
manager: manager
|
|
61
|
-
})
|
|
62
|
-
}));
|
|
63
|
-
// Wait for result
|
|
64
|
-
const result = await (0, _eventTree.waitForEvent)(task, 'completed');
|
|
65
|
-
if (result.status === 'failed') {
|
|
66
|
-
return _yargs.default.exit(1, new Error('Task failed !'));
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
//# sourceMappingURL=run.js.map
|
package/dist/commands/run.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/run.tsx"],"sourcesContent":["import { waitForEvent } from '@jujulego/event-tree';\nimport { TaskManager } from '@jujulego/tasks';\nimport ink from 'ink';\nimport yargs from 'yargs';\n\nimport { loadProject, loadWorkspace, setupInk } from '../middlewares';\nimport { Workspace, WorkspaceDepsMode } from '../project';\nimport { container, CURRENT, INK_APP } from '../services';\nimport { Layout, TasksSpinner } from '../ui';\nimport { applyMiddlewares, defineCommand } from '../utils';\n\n// Command\nexport default defineCommand({\n command: 'run <script>',\n describe: 'Run script inside workspace',\n builder: (yargs) =>\n applyMiddlewares(yargs, [\n setupInk,\n loadProject,\n loadWorkspace\n ])\n .positional('script', { type: 'string', demandOption: true })\n .option('deps-mode', {\n choice: ['all', 'prod', 'none'],\n default: 'all' as WorkspaceDepsMode,\n desc: 'Dependency selection mode:\\n' +\n ' - all = dependencies AND devDependencies\\n' +\n ' - prod = dependencies\\n' +\n ' - none = nothing'\n }),\n async handler(args) {\n const app = container.get<ink.Instance>(INK_APP);\n const workspace = container.getNamed(Workspace, CURRENT);\n const manager = container.get(TaskManager);\n\n // Extract arguments\n const rest = args._.map(arg => arg.toString());\n\n if (rest[0] === 'run') {\n rest.splice(0, 1);\n }\n\n // Run script in workspace\n const task = await workspace.run(args.script, rest, {\n buildDeps: args.depsMode,\n });\n manager.add(task);\n\n // Render\n app.rerender(\n <Layout>\n <TasksSpinner manager={manager} />\n </Layout>\n );\n\n // Wait for result\n const result = await waitForEvent(task, 'completed');\n\n if (result.status === 'failed') {\n return yargs.exit(1, new Error('Task failed !'));\n }\n }\n});\n"],"names":["defineCommand","command","describe","builder","yargs","applyMiddlewares","setupInk","loadProject","loadWorkspace","positional","type","demandOption","option","choice","default","desc","handler","args","app","container","get","INK_APP","workspace","getNamed","Workspace","CURRENT","manager","TaskManager","rest","_","map","arg","toString","splice","task","run","script","buildDeps","depsMode","add","rerender","Layout","TasksSpinner","result","waitForEvent","status","exit","Error"],"mappings":"AAAA;;;;+BAWA,UAAU;AACV;;aAAA;;;2BAZ6B;uBACD;4DAEV;6BAEmC;yBACR;0BACD;oBACP;uBACW;;;;;;MAGhD,WAAeA,IAAAA,oBAAa,EAAC;IAC3BC,SAAS;IACTC,UAAU;IACVC,SAAS,CAACC,QACRC,IAAAA,uBAAgB,EAACD,OAAO;YACtBE,qBAAQ;YACRC,wBAAW;YACXC,0BAAa;SACd,EACEC,UAAU,CAAC,UAAU;YAAEC,MAAM;YAAUC,cAAc,IAAI;QAAC,GAC1DC,MAAM,CAAC,aAAa;YACnBC,QAAQ;gBAAC;gBAAO;gBAAQ;aAAO;YAC/BC,SAAS;YACTC,MAAM,iCACJ,gDACA,6BACA;QACJ;IACJ,MAAMC,SAAQC,IAAI,EAAE;QAClB,MAAMC,MAAMC,mBAAS,CAACC,GAAG,CAAeC,iBAAO;QAC/C,MAAMC,YAAYH,mBAAS,CAACI,QAAQ,CAACC,kBAAS,EAAEC,iBAAO;QACvD,MAAMC,UAAUP,mBAAS,CAACC,GAAG,CAACO,kBAAW;QAEzC,oBAAoB;QACpB,MAAMC,OAAOX,KAAKY,CAAC,CAACC,GAAG,CAACC,CAAAA,MAAOA,IAAIC,QAAQ;QAE3C,IAAIJ,IAAI,CAAC,EAAE,KAAK,OAAO;YACrBA,KAAKK,MAAM,CAAC,GAAG;QACjB,CAAC;QAED,0BAA0B;QAC1B,MAAMC,OAAO,MAAMZ,UAAUa,GAAG,CAAClB,KAAKmB,MAAM,EAAER,MAAM;YAClDS,WAAWpB,KAAKqB,QAAQ;QAC1B;QACAZ,QAAQa,GAAG,CAACL;QAEZ,SAAS;QACThB,IAAIsB,QAAQ,eACV,qBAACC,UAAM;sBACL,cAAA,qBAACC,gBAAY;gBAAChB,SAASA;;;QAI3B,kBAAkB;QAClB,MAAMiB,SAAS,MAAMC,IAAAA,uBAAY,EAACV,MAAM;QAExC,IAAIS,OAAOE,MAAM,KAAK,UAAU;YAC9B,OAAOzC,cAAK,CAAC0C,IAAI,CAAC,GAAG,IAAIC,MAAM;QACjC,CAAC;IACH;AACF"}
|
package/dist/commands/tree.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, // Command
|
|
6
|
-
"default", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: ()=>_default
|
|
9
|
-
});
|
|
10
|
-
const _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
const _middlewares = require("../middlewares");
|
|
12
|
-
const _project = require("../project");
|
|
13
|
-
const _services = require("../services");
|
|
14
|
-
const _ui = require("../ui");
|
|
15
|
-
const _utils = require("../utils");
|
|
16
|
-
const _default = (0, _utils.defineCommand)({
|
|
17
|
-
command: 'tree',
|
|
18
|
-
describe: 'Print workspace dependency tree',
|
|
19
|
-
builder: (yargs)=>(0, _utils.applyMiddlewares)(yargs, [
|
|
20
|
-
_middlewares.setupInk,
|
|
21
|
-
_middlewares.loadProject,
|
|
22
|
-
_middlewares.loadWorkspace
|
|
23
|
-
]),
|
|
24
|
-
handler: ()=>{
|
|
25
|
-
const app = _services.container.get(_services.INK_APP);
|
|
26
|
-
const workspace = _services.container.getNamed(_project.Workspace, _services.CURRENT);
|
|
27
|
-
app.rerender(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_ui.Layout, {
|
|
28
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_ui.WorkspaceTree, {
|
|
29
|
-
workspace: workspace
|
|
30
|
-
})
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
//# sourceMappingURL=tree.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/tree.tsx"],"sourcesContent":["import ink from 'ink';\n\nimport { loadProject, loadWorkspace, setupInk } from '../middlewares';\nimport { Workspace } from '../project';\nimport { container, CURRENT, INK_APP } from '../services';\nimport { Layout, WorkspaceTree } from '../ui';\nimport { applyMiddlewares, defineCommand } from '../utils';\n\n// Command\nexport default defineCommand({\n command: 'tree',\n describe: 'Print workspace dependency tree',\n builder: (yargs) =>\n applyMiddlewares(yargs, [\n setupInk,\n loadProject,\n loadWorkspace\n ]),\n handler: () => {\n const app = container.get<ink.Instance>(INK_APP);\n const workspace = container.getNamed(Workspace, CURRENT);\n\n app.rerender(\n <Layout>\n <WorkspaceTree workspace={workspace} />\n </Layout>\n );\n }\n});\n"],"names":["defineCommand","command","describe","builder","yargs","applyMiddlewares","setupInk","loadProject","loadWorkspace","handler","app","container","get","INK_APP","workspace","getNamed","Workspace","CURRENT","rerender","Layout","WorkspaceTree"],"mappings":"AAAA;;;;+BAQA,UAAU;AACV;;aAAA;;;6BAPqD;yBAC3B;0BACkB;oBACN;uBACU;MAGhD,WAAeA,IAAAA,oBAAa,EAAC;IAC3BC,SAAS;IACTC,UAAU;IACVC,SAAS,CAACC,QACRC,IAAAA,uBAAgB,EAACD,OAAO;YACtBE,qBAAQ;YACRC,wBAAW;YACXC,0BAAa;SACd;IACHC,SAAS,IAAM;QACb,MAAMC,MAAMC,mBAAS,CAACC,GAAG,CAAeC,iBAAO;QAC/C,MAAMC,YAAYH,mBAAS,CAACI,QAAQ,CAACC,kBAAS,EAAEC,iBAAO;QAEvDP,IAAIQ,QAAQ,eACV,qBAACC,UAAM;sBACL,cAAA,qBAACC,iBAAa;gBAACN,WAAWA;;;IAGhC;AACF"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "AffectedFilter", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: ()=>AffectedFilter
|
|
8
|
-
});
|
|
9
|
-
const _git = require("../git");
|
|
10
|
-
const _services = require("../services");
|
|
11
|
-
var __decorate = (void 0) && (void 0).__decorate || function(decorators, target, key, desc) {
|
|
12
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
14
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
15
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16
|
-
};
|
|
17
|
-
class AffectedFilter {
|
|
18
|
-
// Constructor
|
|
19
|
-
constructor(format, fallback, sort){
|
|
20
|
-
this.format = format;
|
|
21
|
-
this.fallback = fallback;
|
|
22
|
-
this.sort = sort;
|
|
23
|
-
}
|
|
24
|
-
// Methods
|
|
25
|
-
async _formatRevision(wks) {
|
|
26
|
-
const logger = this._logger.child({
|
|
27
|
-
label: wks.name
|
|
28
|
-
});
|
|
29
|
-
// Format revision
|
|
30
|
-
let result = this.format;
|
|
31
|
-
result = result.replace(/(?<!\\)((?:\\\\)*)%name/g, `$1${wks.name}`);
|
|
32
|
-
result = result.replace(/\\(.)/g, '$1');
|
|
33
|
-
// Ask git to complete it
|
|
34
|
-
const sortArgs = this.sort ? [
|
|
35
|
-
'--sort',
|
|
36
|
-
this.sort
|
|
37
|
-
] : [];
|
|
38
|
-
// - search in branches
|
|
39
|
-
if (result.includes('*')) {
|
|
40
|
-
const branches = await _git.Git.listBranches([
|
|
41
|
-
...sortArgs,
|
|
42
|
-
result
|
|
43
|
-
], {
|
|
44
|
-
cwd: wks.cwd,
|
|
45
|
-
logger: logger
|
|
46
|
-
});
|
|
47
|
-
if (branches.length > 0) {
|
|
48
|
-
result = branches[branches.length - 1];
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
// - search in tags
|
|
52
|
-
if (result.includes('*')) {
|
|
53
|
-
const tags = await _git.Git.listTags([
|
|
54
|
-
...sortArgs,
|
|
55
|
-
result
|
|
56
|
-
], {
|
|
57
|
-
cwd: wks.cwd,
|
|
58
|
-
logger: logger
|
|
59
|
-
});
|
|
60
|
-
if (tags.length > 0) {
|
|
61
|
-
result = tags[tags.length - 1];
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (result !== this.format) {
|
|
65
|
-
logger.verbose(`Resolved ${this.format} into ${result}`);
|
|
66
|
-
}
|
|
67
|
-
if (result.includes('*')) {
|
|
68
|
-
logger.warn(`No revision found matching ${result}, using fallback ${this.fallback}`);
|
|
69
|
-
return this.fallback;
|
|
70
|
-
}
|
|
71
|
-
return result;
|
|
72
|
-
}
|
|
73
|
-
async test(workspace) {
|
|
74
|
-
const rev = await this._formatRevision(workspace);
|
|
75
|
-
return await workspace.isAffected(rev);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
__decorate([
|
|
79
|
-
(0, _services.lazyInject)(_services.Logger)
|
|
80
|
-
], AffectedFilter.prototype, "_logger", void 0);
|
|
81
|
-
|
|
82
|
-
//# sourceMappingURL=affected.filter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/filters/affected.filter.ts"],"sourcesContent":["import { Git } from '../git';\nimport { lazyInject, Logger } from '../services';\nimport { Workspace } from '../project';\n\nimport { PipelineFilter } from './pipeline';\n\n// Class\nexport class AffectedFilter implements PipelineFilter {\n // Properties\n @lazyInject(Logger)\n private readonly _logger: Logger;\n\n // Constructor\n constructor(\n readonly format: string,\n readonly fallback: string,\n readonly sort?: string,\n ) {}\n\n // Methods\n private async _formatRevision(wks: Workspace): Promise<string> {\n const logger = this._logger.child({ label: wks.name });\n\n // Format revision\n let result = this.format;\n result = result.replace(/(?<!\\\\)((?:\\\\\\\\)*)%name/g, `$1${wks.name}`);\n result = result.replace(/\\\\(.)/g, '$1');\n\n // Ask git to complete it\n const sortArgs = this.sort ? ['--sort', this.sort] : [];\n\n // - search in branches\n if (result.includes('*')) {\n const branches = await Git.listBranches([...sortArgs, result], { cwd: wks.cwd, logger: logger });\n\n if (branches.length > 0) {\n result = branches[branches.length - 1];\n }\n }\n\n // - search in tags\n if (result.includes('*')) {\n const tags = await Git.listTags([...sortArgs, result], { cwd: wks.cwd, logger: logger });\n\n if (tags.length > 0) {\n result = tags[tags.length - 1];\n }\n }\n\n if (result !== this.format) {\n logger.verbose(`Resolved ${this.format} into ${result}`);\n }\n\n if (result.includes('*')) {\n logger.warn(`No revision found matching ${result}, using fallback ${this.fallback}`);\n\n return this.fallback;\n }\n\n return result;\n }\n\n async test(workspace: Workspace): Promise<boolean> {\n const rev = await this._formatRevision(workspace);\n return await workspace.isAffected(rev);\n }\n}\n"],"names":["AffectedFilter","constructor","format","fallback","sort","_formatRevision","wks","logger","_logger","child","label","name","result","replace","sortArgs","includes","branches","Git","listBranches","cwd","length","tags","listTags","verbose","warn","test","workspace","rev","isAffected","lazyInject","Logger"],"mappings":"AAAA;;;;+BAOaA;;aAAAA;;qBAPO;0BACe;;;;;;;AAM5B,MAAMA;IAKX,cAAc;IACdC,YACWC,QACAC,UACAC,KACT;sBAHSF;wBACAC;oBACAC;IACR;IAEH,UAAU;IACV,MAAcC,gBAAgBC,GAAc,EAAmB;QAC7D,MAAMC,SAAS,IAAI,CAACC,OAAO,CAACC,KAAK,CAAC;YAAEC,OAAOJ,IAAIK,IAAI;QAAC;QAEpD,kBAAkB;QAClB,IAAIC,SAAS,IAAI,CAACV,MAAM;QACxBU,SAASA,OAAOC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,CAACtB,eAAe,CAACqB;QACvC,OAAO,MAAMA,UAAUE,UAAU,CAACD;IACpC;AACF;;IAzDGE,IAAAA,oBAAU,EAACC,gBAAM;GAFP9B"}
|
package/dist/filters/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
_exportStar(require("./affected.filter"), exports);
|
|
6
|
-
_exportStar(require("./pipeline"), exports);
|
|
7
|
-
_exportStar(require("./private.filter"), exports);
|
|
8
|
-
_exportStar(require("./scripts.filter"), exports);
|
|
9
|
-
function _exportStar(from, to) {
|
|
10
|
-
Object.keys(from).forEach(function(k) {
|
|
11
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function() {
|
|
14
|
-
return from[k];
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
return from;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/filters/index.ts"],"sourcesContent":["export * from './affected.filter';\nexport * from './pipeline';\nexport * from './private.filter';\nexport * from './scripts.filter';\n"],"names":[],"mappings":"AAAA;;;;oBAAc;oBACA;oBACA;oBACA"}
|
package/dist/filters/pipeline.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "Pipeline", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: ()=>Pipeline
|
|
8
|
-
});
|
|
9
|
-
class Pipeline {
|
|
10
|
-
// Attributes
|
|
11
|
-
_filters = [];
|
|
12
|
-
// Methods
|
|
13
|
-
add(filter) {
|
|
14
|
-
this._filters.push(filter);
|
|
15
|
-
}
|
|
16
|
-
async _test(workspace) {
|
|
17
|
-
for (const filter of this._filters){
|
|
18
|
-
const res = await filter.test(workspace);
|
|
19
|
-
if (!res) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
async *filter(workspaces) {
|
|
26
|
-
for await (const wks of workspaces){
|
|
27
|
-
if (await this._test(wks)) {
|
|
28
|
-
yield wks;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
//# sourceMappingURL=pipeline.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/filters/pipeline.ts"],"sourcesContent":["import { Workspace } from '../project';\nimport { Awaitable } from '../types';\n\n// Interface\nexport interface PipelineFilter {\n // Methods\n test(workspace: Workspace): Awaitable<boolean>;\n}\n\n// Class\nexport class Pipeline {\n // Attributes\n private _filters: PipelineFilter[] = [];\n\n // Methods\n add(filter: PipelineFilter): void {\n this._filters.push(filter);\n }\n\n private async _test(workspace: Workspace): Promise<boolean> {\n for (const filter of this._filters) {\n const res = await filter.test(workspace);\n\n if (!res) {\n return false;\n }\n }\n\n return true;\n }\n\n async *filter(workspaces: Iterable<Workspace> | AsyncIterable<Workspace>): AsyncGenerator<Workspace> {\n for await (const wks of workspaces) {\n if (await this._test(wks)) {\n yield wks;\n }\n }\n }\n}\n"],"names":["Pipeline","_filters","add","filter","push","_test","workspace","res","test","workspaces","wks"],"mappings":"AAAA;;;;+BAUaA;;aAAAA;;AAAN,MAAMA;IACX,aAAa;IACLC,WAA6B,EAAE,CAAC;IAExC,UAAU;IACVC,IAAIC,MAAsB,EAAQ;QAChC,IAAI,CAACF,QAAQ,CAACG,IAAI,CAACD;IACrB;IAEA,MAAcE,MAAMC,SAAoB,EAAoB;QAC1D,KAAK,MAAMH,UAAU,IAAI,CAACF,QAAQ,CAAE;YAClC,MAAMM,MAAM,MAAMJ,OAAOK,IAAI,CAACF;YAE9B,IAAI,CAACC,KAAK;gBACR,OAAO,KAAK;YACd,CAAC;QACH;QAEA,OAAO,IAAI;IACb;IAEA,OAAOJ,OAAOM,UAA0D,EAA6B;QACnG,WAAW,MAAMC,OAAOD,WAAY;YAClC,IAAI,MAAM,IAAI,CAACJ,KAAK,CAACK,MAAM;gBACzB,MAAMA;YACR,CAAC;QACH;IACF;AACF"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "PrivateFilter", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: ()=>PrivateFilter
|
|
8
|
-
});
|
|
9
|
-
class PrivateFilter {
|
|
10
|
-
// Constructor
|
|
11
|
-
constructor(value){
|
|
12
|
-
this.value = value;
|
|
13
|
-
}
|
|
14
|
-
// Methods
|
|
15
|
-
test(workspace) {
|
|
16
|
-
return (workspace.manifest.private ?? false) === this.value;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=private.filter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/filters/private.filter.ts"],"sourcesContent":["import { Workspace } from '../project';\n\nimport { PipelineFilter } from './pipeline';\n\n// Filter\nexport class PrivateFilter implements PipelineFilter {\n // Constructor\n constructor(readonly value: boolean) {}\n\n // Methods\n test(workspace: Workspace): boolean {\n return (workspace.manifest.private ?? false) === this.value;\n }\n}\n"],"names":["PrivateFilter","constructor","value","test","workspace","manifest","private"],"mappings":"AAAA;;;;+BAKaA;;aAAAA;;AAAN,MAAMA;IACX,cAAc;IACdC,YAAqBC,MAAgB;qBAAhBA;IAAiB;IAEtC,UAAU;IACVC,KAAKC,SAAoB,EAAW;QAClC,OAAO,AAACA,CAAAA,UAAUC,QAAQ,CAACC,OAAO,IAAI,KAAK,AAAD,MAAO,IAAI,CAACJ,KAAK;IAC7D;AACF"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "ScriptsFilter", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: ()=>ScriptsFilter
|
|
8
|
-
});
|
|
9
|
-
class ScriptsFilter {
|
|
10
|
-
// Constructor
|
|
11
|
-
constructor(scripts){
|
|
12
|
-
this.scripts = scripts;
|
|
13
|
-
}
|
|
14
|
-
// Methods
|
|
15
|
-
test(workspace) {
|
|
16
|
-
const scripts = Object.keys(workspace.manifest.scripts || {});
|
|
17
|
-
return this.scripts.some((scr)=>scripts.includes(scr));
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
//# sourceMappingURL=scripts.filter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/filters/scripts.filter.ts"],"sourcesContent":["import { Workspace } from '../project';\n\nimport { PipelineFilter } from './pipeline';\n\n// Filter\nexport class ScriptsFilter implements PipelineFilter {\n // Constructor\n constructor(readonly scripts: string[]) {}\n\n // Methods\n test(workspace: Workspace): boolean {\n const scripts = Object.keys(workspace.manifest.scripts || {});\n return this.scripts.some((scr) => scripts.includes(scr));\n }\n}\n"],"names":["ScriptsFilter","constructor","scripts","test","workspace","Object","keys","manifest","some","scr","includes"],"mappings":"AAAA;;;;+BAKaA;;aAAAA;;AAAN,MAAMA;IACX,cAAc;IACdC,YAAqBC,QAAmB;uBAAnBA;IAAoB;IAEzC,UAAU;IACVC,KAAKC,SAAoB,EAAW;QAClC,MAAMF,UAAUG,OAAOC,IAAI,CAACF,UAAUG,QAAQ,CAACL,OAAO,IAAI,CAAC;QAC3D,OAAO,IAAI,CAACA,OAAO,CAACM,IAAI,CAAC,CAACC,MAAQP,QAAQQ,QAAQ,CAACD;IACrD;AACF"}
|
package/dist/git.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "Git", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: ()=>Git
|
|
8
|
-
});
|
|
9
|
-
const _tasks = require("@jujulego/tasks");
|
|
10
|
-
const _services = require("./services");
|
|
11
|
-
const _utils = require("./utils");
|
|
12
|
-
var __decorate = (void 0) && (void 0).__decorate || function(decorators, target, key, desc) {
|
|
13
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
15
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
16
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17
|
-
};
|
|
18
|
-
class Git {
|
|
19
|
-
// commons
|
|
20
|
-
static command(cmd, args, options = {}) {
|
|
21
|
-
const opts = {
|
|
22
|
-
logger: this.logger,
|
|
23
|
-
...options
|
|
24
|
-
};
|
|
25
|
-
// Create task
|
|
26
|
-
const task = new _tasks.SpawnTask('git', [
|
|
27
|
-
cmd,
|
|
28
|
-
...args
|
|
29
|
-
], {
|
|
30
|
-
command: cmd
|
|
31
|
-
}, opts);
|
|
32
|
-
task.subscribe('stream', ({ data })=>opts.logger.debug(data.toString('utf-8')));
|
|
33
|
-
this.manager.add(task);
|
|
34
|
-
return task;
|
|
35
|
-
}
|
|
36
|
-
// commands
|
|
37
|
-
static branch(args, options) {
|
|
38
|
-
return this.command('branch', args, options);
|
|
39
|
-
}
|
|
40
|
-
static diff(args, options) {
|
|
41
|
-
return this.command('diff', args, options);
|
|
42
|
-
}
|
|
43
|
-
static tag(args, options) {
|
|
44
|
-
return this.command('tag', args, options);
|
|
45
|
-
}
|
|
46
|
-
// high level
|
|
47
|
-
static isAffected(reference, args = [], opts) {
|
|
48
|
-
return new Promise((resolve, reject)=>{
|
|
49
|
-
const task = this.diff([
|
|
50
|
-
'--quiet',
|
|
51
|
-
reference,
|
|
52
|
-
...args
|
|
53
|
-
], opts);
|
|
54
|
-
task.subscribe('status.done', ()=>resolve(false));
|
|
55
|
-
task.subscribe('status.failed', ()=>{
|
|
56
|
-
if (task.exitCode) {
|
|
57
|
-
resolve(true);
|
|
58
|
-
} else {
|
|
59
|
-
reject(new Error(`Task ${task.name} failed`));
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
static async listBranches(args = [], opts) {
|
|
65
|
-
const task = this.branch([
|
|
66
|
-
'-l',
|
|
67
|
-
...args
|
|
68
|
-
], opts);
|
|
69
|
-
const result = [];
|
|
70
|
-
for await (const line of (0, _utils.streamLines)(task, 'stdout')){
|
|
71
|
-
result.push(line.replace(/^[ *] /, ''));
|
|
72
|
-
}
|
|
73
|
-
return result;
|
|
74
|
-
}
|
|
75
|
-
static async listTags(args = [], opts) {
|
|
76
|
-
const task = this.tag([
|
|
77
|
-
'-l',
|
|
78
|
-
...args
|
|
79
|
-
], opts);
|
|
80
|
-
const result = [];
|
|
81
|
-
for await (const line of (0, _utils.streamLines)(task, 'stdout')){
|
|
82
|
-
result.push(line);
|
|
83
|
-
}
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
__decorate([
|
|
88
|
-
(0, _services.lazyInject)(_tasks.TaskManager)
|
|
89
|
-
], Git, "manager", void 0);
|
|
90
|
-
__decorate([
|
|
91
|
-
(0, _services.lazyInject)(_services.Logger)
|
|
92
|
-
], Git, "logger", void 0);
|
|
93
|
-
|
|
94
|
-
//# sourceMappingURL=git.js.map
|
package/dist/git.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/git.ts"],"sourcesContent":["import { SpawnTask, SpawnTaskOptions, TaskContext, TaskManager } from '@jujulego/tasks';\n\nimport { lazyInject, Logger } from './services';\nimport { streamLines } from './utils';\n\n// Types\nexport interface GitContext extends TaskContext {\n command: string;\n}\n\n// Git commands\nexport class Git {\n // Services\n @lazyInject(TaskManager)\n static readonly manager: TaskManager;\n\n @lazyInject(Logger)\n static readonly logger: Logger;\n\n // commons\n static command(cmd: string, args: string[], options: SpawnTaskOptions = {}): SpawnTask<GitContext> {\n const opts = { logger: this.logger, ...options };\n\n // Create task\n const task = new SpawnTask('git', [cmd, ...args], { command: cmd }, opts);\n task.subscribe('stream', ({ data }) => opts.logger.debug(data.toString('utf-8')));\n\n this.manager.add(task);\n\n return task;\n }\n\n // commands\n static branch(args: string[], options?: SpawnTaskOptions): SpawnTask<GitContext> {\n return this.command('branch', args, options);\n }\n\n static diff(args: string[], options?: SpawnTaskOptions): SpawnTask<GitContext> {\n return this.command('diff', args, options);\n }\n\n static tag(args: string[], options?: SpawnTaskOptions): SpawnTask<GitContext> {\n return this.command('tag', args, options);\n }\n\n // high level\n static isAffected(reference: string, args: string[] = [], opts?: SpawnTaskOptions): Promise<boolean> {\n return new Promise((resolve, reject) => {\n const task = this.diff(['--quiet', reference, ...args], opts);\n\n task.subscribe('status.done', () => resolve(false));\n task.subscribe('status.failed', () => {\n if (task.exitCode) {\n resolve(true);\n } else {\n reject(new Error(`Task ${task.name} failed`));\n }\n });\n });\n }\n\n static async listBranches(args: string[] = [], opts?: SpawnTaskOptions): Promise<string[]> {\n const task = this.branch(['-l', ...args], opts);\n const result: string[] = [];\n\n for await (const line of streamLines(task, 'stdout')) {\n result.push(line.replace(/^[ *] /, ''));\n }\n\n return result;\n }\n\n static async listTags(args: string[] = [], opts?: SpawnTaskOptions): Promise<string[]> {\n const task = this.tag(['-l', ...args], opts);\n const result: string[] = [];\n\n for await (const line of streamLines(task, 'stdout')) {\n result.push(line);\n }\n\n return result;\n }\n}\n"],"names":["Git","command","cmd","args","options","opts","logger","task","SpawnTask","subscribe","data","debug","toString","manager","add","branch","diff","tag","isAffected","reference","Promise","resolve","reject","exitCode","Error","name","listBranches","result","line","streamLines","push","replace","listTags","lazyInject","TaskManager","Logger"],"mappings":"AAAA;;;;+BAWaA;;aAAAA;;uBAXyD;0BAEnC;uBACP;;;;;;;AAQrB,MAAMA;IAQX,UAAU;IACV,OAAOC,QAAQC,GAAW,EAAEC,IAAc,EAAEC,UAA4B,CAAC,CAAC,EAAyB;QACjG,MAAMC,OAAO;YAAEC,QAAQ,IAAI,CAACA,MAAM;YAAE,GAAGF,OAAO;QAAC;QAE/C,cAAc;QACd,MAAMG,OAAO,IAAIC,gBAAS,CAAC,OAAO;YAACN;eAAQC;SAAK,EAAE;YAAEF,SAASC;QAAI,GAAGG;QACpEE,KAAKE,SAAS,CAAC,UAAU,CAAC,EAAEC,KAAI,EAAE,GAAKL,KAAKC,MAAM,CAACK,KAAK,CAACD,KAAKE,QAAQ,CAAC;QAEvE,IAAI,CAACC,OAAO,CAACC,GAAG,CAACP;QAEjB,OAAOA;IACT;IAEA,WAAW;IACX,OAAOQ,OAAOZ,IAAc,EAAEC,OAA0B,EAAyB;QAC/E,OAAO,IAAI,CAACH,OAAO,CAAC,UAAUE,MAAMC;IACtC;IAEA,OAAOY,KAAKb,IAAc,EAAEC,OAA0B,EAAyB;QAC7E,OAAO,IAAI,CAACH,OAAO,CAAC,QAAQE,MAAMC;IACpC;IAEA,OAAOa,IAAId,IAAc,EAAEC,OAA0B,EAAyB;QAC5E,OAAO,IAAI,CAACH,OAAO,CAAC,OAAOE,MAAMC;IACnC;IAEA,aAAa;IACb,OAAOc,WAAWC,SAAiB,EAAEhB,OAAiB,EAAE,EAAEE,IAAuB,EAAoB;QACnG,OAAO,IAAIe,QAAQ,CAACC,SAASC,SAAW;YACtC,MAAMf,OAAO,IAAI,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