@cobol-ts/cli-config 0.0.0-stage → 0.0.59
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/README.md +11 -3
- package/dist/index.d.ts +7 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/src/config.command.spec.d.ts +1 -0
- package/dist/src/config.command.spec.js +36 -0
- package/dist/src/config.command.spec.js.map +1 -0
- package/dist/src/config.compositions.d.ts +6 -0
- package/dist/src/config.compositions.js +15 -0
- package/dist/src/config.compositions.js.map +1 -0
- package/dist/src/config.files.d.ts +5 -0
- package/dist/src/config.files.js +10 -0
- package/dist/src/config.files.js.map +1 -0
- package/dist/src/config.list.d.ts +5 -0
- package/dist/src/config.list.js +11 -0
- package/dist/src/config.list.js.map +1 -0
- package/dist/src/config.names.d.ts +5 -0
- package/dist/src/config.names.js +11 -0
- package/dist/src/config.names.js.map +1 -0
- package/dist/src/config.validate.d.ts +5 -0
- package/dist/src/config.validate.js +12 -0
- package/dist/src/config.validate.js.map +1 -0
- package/dist/src/config.view.d.ts +5 -0
- package/dist/src/config.view.js +11 -0
- package/dist/src/config.view.js.map +1 -0
- package/dist/src/validate.all.d.ts +4 -0
- package/dist/src/validate.all.js +36 -0
- package/dist/src/validate.all.js.map +1 -0
- package/index.ts +7 -0
- package/package.json +63 -3
package/README.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# @cobol-ts/cli-config
|
|
2
|
+
|
|
3
|
+
Configuration inspection and validation command adapters. Commander registration and output belong here; project capabilities remain in the corresponding project library.
|
|
4
|
+
|
|
5
|
+
The `config` family lists referenced configuration, logical file names and compositions, prints the catalogue and validates configured files. `validate all` is the multi-project configuration check. Configuration inspection does not execute a business graph.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
yarn cobolts -d modules/examples/init config compositions
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
See the [CLI reference](../cobolts/README.md) for the complete command options.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './src/config.compositions';
|
|
2
|
+
export * from './src/config.files';
|
|
3
|
+
export * from './src/config.list';
|
|
4
|
+
export * from './src/config.names';
|
|
5
|
+
export * from './src/config.view';
|
|
6
|
+
export * from './src/config.validate';
|
|
7
|
+
export * from './src/validate.all';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./src/config.compositions"), exports);
|
|
18
|
+
__exportStar(require("./src/config.files"), exports);
|
|
19
|
+
__exportStar(require("./src/config.list"), exports);
|
|
20
|
+
__exportStar(require("./src/config.names"), exports);
|
|
21
|
+
__exportStar(require("./src/config.view"), exports);
|
|
22
|
+
__exportStar(require("./src/config.validate"), exports);
|
|
23
|
+
__exportStar(require("./src/validate.all"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAAyC;AACzC,qDAAkC;AAClC,oDAAiC;AACjC,qDAAkC;AAClC,oDAAiC;AACjC,wDAAqC;AACrC,qDAAkC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const commander_1 = require("commander");
|
|
4
|
+
const config_validate_1 = require("./config.validate");
|
|
5
|
+
const paths = { projectRoot: 'project', directory: 'project/.cobolts', catalogue: 'files.yaml',
|
|
6
|
+
policy: 'generation.yaml', data: 'data.yaml', accumulator: 'accumulator.yaml' };
|
|
7
|
+
function setup(filenames) {
|
|
8
|
+
const calls = [], output = [];
|
|
9
|
+
const services = {
|
|
10
|
+
paths: async () => paths, output: line => { output.push(line); },
|
|
11
|
+
list: async () => { calls.push('list'); return filenames; },
|
|
12
|
+
logicalNames: async () => { calls.push('names'); return ['customers']; },
|
|
13
|
+
compositions: async () => { calls.push('compositions'); return []; },
|
|
14
|
+
manifest: async () => { calls.push('manifest'); return { sources: [], artefacts: [] }; },
|
|
15
|
+
validateData: async () => { calls.push('data'); },
|
|
16
|
+
validateAccumulator: async () => { calls.push('accumulator'); return { value: {} }; },
|
|
17
|
+
read: async (name) => { calls.push(`read:${name}`); return ''; }
|
|
18
|
+
};
|
|
19
|
+
const root = new commander_1.Command().option('--policy <filename>');
|
|
20
|
+
(0, config_validate_1.addConfigValidate)(root.command('config'), services, () => root.opts());
|
|
21
|
+
return { root, calls, output };
|
|
22
|
+
}
|
|
23
|
+
test('config validate preserves validation order and allows an absent implicit generation policy', async () => {
|
|
24
|
+
const { root, calls, output } = setup([paths.catalogue]);
|
|
25
|
+
await root.parseAsync(['config', 'validate'], { from: 'user' });
|
|
26
|
+
expect(calls).toEqual(['names', 'compositions', 'list', 'data', 'accumulator', 'read:files.yaml']);
|
|
27
|
+
expect(output).toEqual(['Valid: 1 logical files, 0 artefacts']);
|
|
28
|
+
});
|
|
29
|
+
test('config validate rejects an absent explicitly selected policy before data validation', async () => {
|
|
30
|
+
const { root, calls, output } = setup([paths.catalogue]);
|
|
31
|
+
await expect(root.parseAsync(['--policy', paths.policy, 'config', 'validate'], { from: 'user' }))
|
|
32
|
+
.rejects.toThrow('Explicit generation policy does not exist: generation.yaml');
|
|
33
|
+
expect(calls).toEqual(['names', 'compositions', 'list']);
|
|
34
|
+
expect(output).toEqual([]);
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=config.command.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.command.spec.js","sourceRoot":"","sources":["../../src/config.command.spec.ts"],"names":[],"mappings":";;AAAA,yCAAiC;AAGjC,uDAAmD;AAEnD,MAAM,KAAK,GAAa,EAAC,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY;IACnG,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAC,CAAA;AAElF,SAAS,KAAK,CAAC,SAA4B;IACvC,MAAM,KAAK,GAAa,EAAE,EAAE,MAAM,GAAa,EAAE,CAAA;IACjD,MAAM,QAAQ,GAAmB;QAC7B,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAA,CAAC;QAC7D,IAAI,EAAE,KAAK,IAAI,EAAE,GAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,SAAS,CAAA,CAAA,CAAC;QACxD,YAAY,EAAE,KAAK,IAAI,EAAE,GAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA,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,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC,CAAA;IAC7D,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAAC,CAAA;IAClG,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,qCAAqC,CAAC,CAAC,CAAA;AACnE,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,qFAAqF,EAAE,KAAK,IAAI,EAAE;IACnG,MAAM,EAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAC,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAA;IACtD,MAAM,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC,CAAC;SAC1F,OAAO,CAAC,OAAO,CAAC,4DAA4D,CAAC,CAAA;IAClF,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC,CAAA;IACxD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;AAC9B,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { CliOptions } from '@cobol-ts/cli-common';
|
|
3
|
+
import type { ConfigServices } from '@cobol-ts/project-config';
|
|
4
|
+
/** A catalogue lists named execution compositions, never selects one implicitly. */
|
|
5
|
+
export declare function addConfigCompositions(command: Command, services: ConfigCompositionsServices, options: () => CliOptions): void;
|
|
6
|
+
export type ConfigCompositionsServices = Pick<ConfigServices, 'compositions' | 'output' | 'paths'>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addConfigCompositions = addConfigCompositions;
|
|
4
|
+
/** A catalogue lists named execution compositions, never selects one implicitly. */
|
|
5
|
+
function addConfigCompositions(command, services, options) {
|
|
6
|
+
command.command('compositions').description('List named compositions and their periodicities')
|
|
7
|
+
.action(async () => {
|
|
8
|
+
const paths = await services.paths(options());
|
|
9
|
+
for (const composition of await services.compositions(paths))
|
|
10
|
+
services.output(composition.type === 'relational'
|
|
11
|
+
? `${composition.name} (${composition.periodicity})`
|
|
12
|
+
: `${composition.name} (validationDataSet: ${composition.location})`);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=config.compositions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.compositions.js","sourceRoot":"","sources":["../../src/config.compositions.ts"],"names":[],"mappings":";;AAKA,sDASC;AAVD,oFAAoF;AACpF,SAAgB,qBAAqB,CAAC,OAAe,EAAC,QAAmC,EAAC,OAAsB;IAC5G,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,WAAW,CAAC,iDAAiD,CAAC;SACzF,MAAM,CAAC,KAAK,IAAE,EAAE;QACb,MAAM,KAAK,GAAC,MAAM,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QAC3C,KAAI,MAAM,WAAW,IAAI,MAAM,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC;YACvD,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,KAAG,YAAY;gBAC3C,CAAC,CAAC,GAAG,WAAW,CAAC,IAAI,KAAK,WAAW,CAAC,WAAW,GAAG;gBACpD,CAAC,CAAC,GAAG,WAAW,CAAC,IAAI,wBAAwB,WAAW,CAAC,QAAQ,GAAG,CAAC,CAAA;IACjF,CAAC,CAAC,CAAA;AACV,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { CliOptions } from '@cobol-ts/cli-common';
|
|
3
|
+
import type { ConfigServices } from '@cobol-ts/project-config';
|
|
4
|
+
export declare function addConfigFiles(command: Command, services: ConfigFilesServices, options: () => CliOptions): void;
|
|
5
|
+
export type ConfigFilesServices = Pick<ConfigServices, 'output' | 'paths' | 'read'>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addConfigFiles = addConfigFiles;
|
|
4
|
+
function addConfigFiles(command, services, options) {
|
|
5
|
+
command.command('files').description('Print the file catalogue with its filename').action(async () => {
|
|
6
|
+
const paths = await services.paths(options());
|
|
7
|
+
services.output(`${paths.catalogue}\n${await services.read(paths.catalogue)}`);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=config.files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.files.js","sourceRoot":"","sources":["../../src/config.files.ts"],"names":[],"mappings":";;AAIA,wCAKC;AALD,SAAgB,cAAc,CAAC,OAAgB,EAAE,QAA6B,EAAE,OAAyB;IACrG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,4CAA4C,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;QACjG,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QAC7C,QAAQ,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,SAAS,KAAK,MAAM,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;IAClF,CAAC,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { CliOptions } from '@cobol-ts/cli-common';
|
|
3
|
+
import type { ConfigServices } from '@cobol-ts/project-config';
|
|
4
|
+
export declare function addConfigList(command: Command, services: ConfigListServices, options: () => CliOptions): void;
|
|
5
|
+
export type ConfigListServices = Pick<ConfigServices, 'list' | 'output' | 'paths'>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addConfigList = addConfigList;
|
|
4
|
+
function addConfigList(command, services, options) {
|
|
5
|
+
command.command('list').description('List configuration files and referenced copybooks').action(async () => {
|
|
6
|
+
const paths = await services.paths(options());
|
|
7
|
+
for (const filename of await services.list(paths))
|
|
8
|
+
services.output(filename);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=config.list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.list.js","sourceRoot":"","sources":["../../src/config.list.ts"],"names":[],"mappings":";;AAIA,sCAKC;AALD,SAAgB,aAAa,CAAC,OAAgB,EAAE,QAA4B,EAAE,OAAyB;IACnG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,mDAAmD,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;QACvG,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QAC7C,KAAK,MAAM,QAAQ,IAAI,MAAM,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IAChF,CAAC,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { CliOptions } from '@cobol-ts/cli-common';
|
|
3
|
+
import type { ConfigServices } from '@cobol-ts/project-config';
|
|
4
|
+
export declare function addConfigNames(command: Command, services: ConfigNamesServices, options: () => CliOptions): void;
|
|
5
|
+
export type ConfigNamesServices = Pick<ConfigServices, 'logicalNames' | 'output' | 'paths'>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addConfigNames = addConfigNames;
|
|
4
|
+
function addConfigNames(command, services, options) {
|
|
5
|
+
command.command('names').description('List logical file names from the catalogue').action(async () => {
|
|
6
|
+
const paths = await services.paths(options());
|
|
7
|
+
for (const name of await services.logicalNames(paths))
|
|
8
|
+
services.output(name);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=config.names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.names.js","sourceRoot":"","sources":["../../src/config.names.ts"],"names":[],"mappings":";;AAIA,wCAKC;AALD,SAAgB,cAAc,CAAC,OAAgB,EAAE,QAA6B,EAAE,OAAyB;IACrG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,4CAA4C,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;QACjG,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QAC7C,KAAK,MAAM,IAAI,IAAI,MAAM,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC;YAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAChF,CAAC,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { CliOptions } from '@cobol-ts/cli-common';
|
|
3
|
+
import { type ConfigurationValidationServices, type ConfigServices } from '@cobol-ts/project-config';
|
|
4
|
+
export declare function addConfigValidate(command: Command, services: ConfigValidateServices, options: () => CliOptions): void;
|
|
5
|
+
export type ConfigValidateServices = ConfigurationValidationServices & Pick<ConfigServices, 'output' | 'paths'>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addConfigValidate = addConfigValidate;
|
|
4
|
+
const project_config_1 = require("@cobol-ts/project-config");
|
|
5
|
+
function addConfigValidate(command, services, options) {
|
|
6
|
+
command.command('validate').description('Validate configured files and optional generation policy').action(async () => {
|
|
7
|
+
const selected = options();
|
|
8
|
+
const paths = await services.paths(selected);
|
|
9
|
+
services.output(await (0, project_config_1.validateConfiguration)(paths, services, selected.policy !== undefined));
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=config.validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.validate.js","sourceRoot":"","sources":["../../src/config.validate.ts"],"names":[],"mappings":";;AAIA,8CAMC;AARD,6DAAyH;AAEzH,SAAgB,iBAAiB,CAAC,OAAgB,EAAE,QAAgC,EAAE,OAAyB;IAC3G,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,0DAA0D,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;QAClH,MAAM,QAAQ,GAAG,OAAO,EAAE,CAAA;QAC1B,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAC5C,QAAQ,CAAC,MAAM,CAAC,MAAM,IAAA,sCAAqB,EAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAA;IAChG,CAAC,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { CliOptions } from '@cobol-ts/cli-common';
|
|
3
|
+
import type { ConfigServices } from '@cobol-ts/project-config';
|
|
4
|
+
export declare function addConfigView(command: Command, services: ConfigViewServices, options: () => CliOptions): void;
|
|
5
|
+
export type ConfigViewServices = Pick<ConfigServices, 'list' | 'output' | 'paths' | 'read'>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addConfigView = addConfigView;
|
|
4
|
+
function addConfigView(command, services, options) {
|
|
5
|
+
command.command('view').description('Print configuration files and referenced copybooks, in list order').action(async () => {
|
|
6
|
+
const paths = await services.paths(options());
|
|
7
|
+
for (const filename of await services.list(paths))
|
|
8
|
+
services.output(`${filename}\n${await services.read(filename)}`);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=config.view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.view.js","sourceRoot":"","sources":["../../src/config.view.ts"],"names":[],"mappings":";;AAIA,sCAKC;AALD,SAAgB,aAAa,CAAC,OAAgB,EAAE,QAA4B,EAAE,OAAyB;IACnG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,mEAAmE,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;QACvH,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QAC7C,KAAK,MAAM,QAAQ,IAAI,MAAM,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,KAAK,MAAM,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IACvH,CAAC,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { CliOptions } from '@cobol-ts/cli-common';
|
|
3
|
+
import { type ValidateAllServices, type ProjectDiscovery } from '@cobol-ts/project-config';
|
|
4
|
+
export declare function addValidateAll(root: Command, services: ValidateAllServices, options: () => CliOptions, discover?: ProjectDiscovery): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addValidateAll = addValidateAll;
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
const project_config_local_1 = require("@cobol-ts/project-config-local");
|
|
6
|
+
const project_config_1 = require("@cobol-ts/project-config");
|
|
7
|
+
function addValidateAll(root, services, options, discover = project_config_local_1.findCoboltsProjects) {
|
|
8
|
+
root.command('validate')
|
|
9
|
+
.description('Validate one or all COBOL-TS projects')
|
|
10
|
+
.command('all')
|
|
11
|
+
.description('Validate every .cobolts project beneath -d (or the current directory)')
|
|
12
|
+
.action(async () => {
|
|
13
|
+
const directory = (0, node_path_1.resolve)(options().directory ?? options().root ?? process.cwd());
|
|
14
|
+
const projects = await discover(directory);
|
|
15
|
+
if (projects.length === 0)
|
|
16
|
+
throw new Error(`No .cobolts projects found below ${directory}`);
|
|
17
|
+
let failed = 0;
|
|
18
|
+
for (const project of projects) {
|
|
19
|
+
const label = (0, node_path_1.relative)(directory, project) || '.';
|
|
20
|
+
try {
|
|
21
|
+
const paths = await services.paths({ ...options(), directory: project });
|
|
22
|
+
await (0, project_config_1.validateProject)(paths, services, options().policy !== undefined);
|
|
23
|
+
services.output(`PASS ${label}`);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
failed++;
|
|
27
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
28
|
+
services.output(`FAIL ${label}: ${message}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
services.output(`Validated ${projects.length} projects: ${projects.length - failed} passed, ${failed} failed`);
|
|
32
|
+
if (failed > 0)
|
|
33
|
+
throw new Error(`${failed} project(s) failed validation`);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=validate.all.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.all.js","sourceRoot":"","sources":["../../src/validate.all.ts"],"names":[],"mappings":";;AAMA,wCAyBC;AA/BD,yCAA2C;AAG3C,yEAAkE;AAClE,6DAAyG;AAEzG,S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tE,QAAQ,CAAC,MAAM,CAAC,QAAQ,KAAK,KAAK,OAAO,EAAE,CAAC,CAAA;YAChD,CAAC;QACL,CAAC;QACD,QAAQ,CAAC,MAAM,CAAC,aAAa,QAAQ,CAAC,MAAM,cAAc,QAAQ,CAAC,MAAM,GAAG,MAAM,YAAY,MAAM,SAAS,CAAC,CAAA;QAC9G,IAAI,MAAM,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,+BAA+B,CAAC,CAAA;IAC7E,CAAC,CAAC,CAAA;AACV,CAAC"}
|
package/index.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cobol-ts/cli-config",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Configuration inspection and validation command adapters",
|
|
4
|
+
"version": "0.0.59",
|
|
5
|
+
"main": "dist/index",
|
|
6
|
+
"types": "dist/index",
|
|
7
|
+
"browserslist": {
|
|
8
|
+
"development": [
|
|
9
|
+
"last 1 chrome version",
|
|
10
|
+
"last 1 firefox version",
|
|
11
|
+
"last 1 safari version"
|
|
12
|
+
],
|
|
13
|
+
"production": [
|
|
14
|
+
">0.2%",
|
|
15
|
+
"not dead",
|
|
16
|
+
"not op_mini all"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@cobol-ts/cli-common": "0.0.59",
|
|
21
|
+
"@cobol-ts/project-config": "0.0.59",
|
|
22
|
+
"@cobol-ts/project-config-local": "0.0.59",
|
|
23
|
+
"commander": "^12.1.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@testing-library/jest-dom": "^6.1.4",
|
|
27
|
+
"@types/jest": "^29.0.0",
|
|
28
|
+
"@types/node": "^20.0.0",
|
|
29
|
+
"jest": "^29.0.0",
|
|
30
|
+
"ts-jest": "^29.0.0",
|
|
31
|
+
"typescript": "^5.2.2"
|
|
32
|
+
},
|
|
33
|
+
"eslintConfig": {
|
|
34
|
+
"extends": [
|
|
35
|
+
"react-app",
|
|
36
|
+
"react-app/jest"
|
|
37
|
+
],
|
|
38
|
+
"overrides": [
|
|
39
|
+
{
|
|
40
|
+
"files": [
|
|
41
|
+
"**/*.stories.*"
|
|
42
|
+
],
|
|
43
|
+
"rules": {
|
|
44
|
+
"import/no-anonymous-default-export": "off"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"files": [
|
|
50
|
+
"dist/index.js",
|
|
51
|
+
"dist/index.d.ts",
|
|
52
|
+
"dist/src/",
|
|
53
|
+
"dist/",
|
|
54
|
+
"dist/**/*"
|
|
55
|
+
],
|
|
56
|
+
"keywords": [
|
|
57
|
+
"indexing"
|
|
58
|
+
],
|
|
59
|
+
"license": "MIT",
|
|
60
|
+
"module": "./index.ts",
|
|
61
|
+
"repository": "git@github.com:intellimaintain/intellimaintain.git",
|
|
62
|
+
"scripts": {
|
|
63
|
+
"test": "jest --config jest.config.json --env node",
|
|
64
|
+
"test:watch": "npm run test -- --watch"
|
|
65
|
+
}
|
|
6
66
|
}
|