@config-bound/cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +4 -0
- package/.turbo/turbo-format$colon$ci.log +6 -0
- package/.turbo/turbo-lint$colon$ci.log +4 -0
- package/.turbo/turbo-test.log +19 -0
- package/CHANGELOG.md +15 -0
- package/README.md +66 -0
- package/bin/configbound.js +3 -0
- package/dist/cli.module.d.ts +3 -0
- package/dist/cli.module.d.ts.map +1 -0
- package/dist/cli.module.js +29 -0
- package/dist/cli.module.js.map +1 -0
- package/dist/commands/export.command.d.ts +30 -0
- package/dist/commands/export.command.d.ts.map +1 -0
- package/dist/commands/export.command.js +226 -0
- package/dist/commands/export.command.js.map +1 -0
- package/dist/commands/list.command.d.ts +13 -0
- package/dist/commands/list.command.d.ts.map +1 -0
- package/dist/commands/list.command.js +93 -0
- package/dist/commands/list.command.js.map +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +17 -0
- package/dist/main.js.map +1 -0
- package/dist/services/config-discovery.service.d.ts +15 -0
- package/dist/services/config-discovery.service.d.ts.map +1 -0
- package/dist/services/config-discovery.service.js +191 -0
- package/dist/services/config-discovery.service.js.map +1 -0
- package/dist/services/config-discovery.service.spec.d.ts +2 -0
- package/dist/services/config-discovery.service.spec.d.ts.map +1 -0
- package/dist/services/config-discovery.service.spec.js +137 -0
- package/dist/services/config-discovery.service.spec.js.map +1 -0
- package/dist/services/config-loader.service.d.ts +13 -0
- package/dist/services/config-loader.service.d.ts.map +1 -0
- package/dist/services/config-loader.service.js +241 -0
- package/dist/services/config-loader.service.js.map +1 -0
- package/dist/services/file-writer.service.d.ts +6 -0
- package/dist/services/file-writer.service.d.ts.map +1 -0
- package/dist/services/file-writer.service.js +38 -0
- package/dist/services/file-writer.service.js.map +1 -0
- package/dist/services/file-writer.service.spec.d.ts +2 -0
- package/dist/services/file-writer.service.spec.d.ts.map +1 -0
- package/dist/services/file-writer.service.spec.js +98 -0
- package/dist/services/file-writer.service.spec.js.map +1 -0
- package/dist/services/schema-export.service.d.ts +14 -0
- package/dist/services/schema-export.service.d.ts.map +1 -0
- package/dist/services/schema-export.service.js +58 -0
- package/dist/services/schema-export.service.js.map +1 -0
- package/dist/services/schema-export.service.spec.d.ts +2 -0
- package/dist/services/schema-export.service.spec.d.ts.map +1 -0
- package/dist/services/schema-export.service.spec.js +69 -0
- package/dist/services/schema-export.service.spec.js.map +1 -0
- package/eslint.config.mjs +5 -0
- package/jest.config.js +39 -0
- package/package.json +62 -0
- package/src/cli.module.ts +21 -0
- package/src/commands/export.command.ts +253 -0
- package/src/commands/list.command.ts +108 -0
- package/src/main.ts +19 -0
- package/src/services/config-discovery.service.spec.ts +209 -0
- package/src/services/config-discovery.service.ts +237 -0
- package/src/services/config-loader.service.ts +379 -0
- package/src/services/file-writer.service.spec.ts +139 -0
- package/src/services/file-writer.service.ts +32 -0
- package/src/services/schema-export.service.spec.ts +124 -0
- package/src/services/schema-export.service.ts +85 -0
- package/tsconfig.json +10 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Injectable } from '@nestjs/common';
|
|
8
|
+
import * as fs from 'fs';
|
|
9
|
+
import * as path from 'path';
|
|
10
|
+
let FileWriterService = class FileWriterService {
|
|
11
|
+
writeToFile(filePath, content) {
|
|
12
|
+
const absolutePath = path.resolve(filePath);
|
|
13
|
+
const directory = path.dirname(absolutePath);
|
|
14
|
+
if (!fs.existsSync(directory)) {
|
|
15
|
+
fs.mkdirSync(directory, { recursive: true });
|
|
16
|
+
}
|
|
17
|
+
fs.writeFileSync(absolutePath, content, 'utf8');
|
|
18
|
+
}
|
|
19
|
+
writeToStdout(content) {
|
|
20
|
+
process.stdout.write(content);
|
|
21
|
+
if (!content.endsWith('\n')) {
|
|
22
|
+
process.stdout.write('\n');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
write(content, outputPath) {
|
|
26
|
+
if (outputPath) {
|
|
27
|
+
this.writeToFile(outputPath, content);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
this.writeToStdout(content);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
FileWriterService = __decorate([
|
|
35
|
+
Injectable()
|
|
36
|
+
], FileWriterService);
|
|
37
|
+
export { FileWriterService };
|
|
38
|
+
//# sourceMappingURL=file-writer.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-writer.service.js","sourceRoot":"","sources":["../../src/services/file-writer.service.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAGtB,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC5B,WAAW,CAAC,QAAgB,EAAE,OAAe;QAC3C,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAE7C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9B,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,CAAC;QAED,EAAE,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;IAED,aAAa,CAAC,OAAe;QAC3B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9B,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,UAAmB;QACxC,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACxC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;CACF,CAAA;AA1BY,iBAAiB;IAD7B,UAAU,EAAE;GACA,iBAAiB,CA0B7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-writer.service.spec.d.ts","sourceRoot":"","sources":["../../src/services/file-writer.service.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Test } from '@nestjs/testing';
|
|
2
|
+
import { FileWriterService } from './file-writer.service.js';
|
|
3
|
+
import { describe, beforeEach, afterEach, it, expect, jest } from '@jest/globals';
|
|
4
|
+
import * as fs from 'fs';
|
|
5
|
+
import * as path from 'path';
|
|
6
|
+
import * as os from 'os';
|
|
7
|
+
describe('FileWriterService', () => {
|
|
8
|
+
let service;
|
|
9
|
+
let tempDir;
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
const module = await Test.createTestingModule({
|
|
12
|
+
providers: [FileWriterService]
|
|
13
|
+
}).compile();
|
|
14
|
+
service = module.get(FileWriterService);
|
|
15
|
+
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'configbound-test-'));
|
|
16
|
+
});
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
if (fs.existsSync(tempDir)) {
|
|
19
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
it('should be defined', () => {
|
|
23
|
+
expect(service).toBeDefined();
|
|
24
|
+
});
|
|
25
|
+
describe('writeToFile', () => {
|
|
26
|
+
it('should write content to file', () => {
|
|
27
|
+
const filePath = path.join(tempDir, 'test.txt');
|
|
28
|
+
const content = 'Hello, World!';
|
|
29
|
+
service.writeToFile(filePath, content);
|
|
30
|
+
expect(fs.existsSync(filePath)).toBe(true);
|
|
31
|
+
const writtenContent = fs.readFileSync(filePath, 'utf8');
|
|
32
|
+
expect(writtenContent).toBe(content);
|
|
33
|
+
});
|
|
34
|
+
it('should create directories if they do not exist', () => {
|
|
35
|
+
const filePath = path.join(tempDir, 'nested', 'dir', 'test.txt');
|
|
36
|
+
const content = 'Test content';
|
|
37
|
+
service.writeToFile(filePath, content);
|
|
38
|
+
expect(fs.existsSync(filePath)).toBe(true);
|
|
39
|
+
const writtenContent = fs.readFileSync(filePath, 'utf8');
|
|
40
|
+
expect(writtenContent).toBe(content);
|
|
41
|
+
});
|
|
42
|
+
it('should overwrite existing file', () => {
|
|
43
|
+
const filePath = path.join(tempDir, 'test.txt');
|
|
44
|
+
service.writeToFile(filePath, 'First content');
|
|
45
|
+
service.writeToFile(filePath, 'Second content');
|
|
46
|
+
const writtenContent = fs.readFileSync(filePath, 'utf8');
|
|
47
|
+
expect(writtenContent).toBe('Second content');
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
describe('writeToStdout', () => {
|
|
51
|
+
let stdoutWriteSpy;
|
|
52
|
+
beforeEach(() => {
|
|
53
|
+
stdoutWriteSpy = jest
|
|
54
|
+
.spyOn(process.stdout, 'write')
|
|
55
|
+
.mockImplementation(() => true);
|
|
56
|
+
});
|
|
57
|
+
afterEach(() => {
|
|
58
|
+
stdoutWriteSpy.mockRestore();
|
|
59
|
+
});
|
|
60
|
+
it('should write content to stdout', () => {
|
|
61
|
+
const content = 'Test output';
|
|
62
|
+
service.writeToStdout(content);
|
|
63
|
+
expect(stdoutWriteSpy).toHaveBeenCalledWith(content);
|
|
64
|
+
});
|
|
65
|
+
it('should add newline if content does not end with one', () => {
|
|
66
|
+
const content = 'No newline';
|
|
67
|
+
service.writeToStdout(content);
|
|
68
|
+
expect(stdoutWriteSpy).toHaveBeenCalledWith(content);
|
|
69
|
+
expect(stdoutWriteSpy).toHaveBeenCalledWith('\n');
|
|
70
|
+
});
|
|
71
|
+
it('should not add extra newline if content already ends with one', () => {
|
|
72
|
+
const content = 'With newline\n';
|
|
73
|
+
service.writeToStdout(content);
|
|
74
|
+
expect(stdoutWriteSpy).toHaveBeenCalledWith(content);
|
|
75
|
+
expect(stdoutWriteSpy).toHaveBeenCalledTimes(1);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
describe('write', () => {
|
|
79
|
+
it('should write to file when output path is provided', () => {
|
|
80
|
+
const filePath = path.join(tempDir, 'output.txt');
|
|
81
|
+
const content = 'File output';
|
|
82
|
+
service.write(content, filePath);
|
|
83
|
+
expect(fs.existsSync(filePath)).toBe(true);
|
|
84
|
+
const writtenContent = fs.readFileSync(filePath, 'utf8');
|
|
85
|
+
expect(writtenContent).toBe(content);
|
|
86
|
+
});
|
|
87
|
+
it('should write to stdout when output path is not provided', () => {
|
|
88
|
+
const stdoutWriteSpy = jest
|
|
89
|
+
.spyOn(process.stdout, 'write')
|
|
90
|
+
.mockImplementation(() => true);
|
|
91
|
+
const content = 'Stdout output';
|
|
92
|
+
service.write(content);
|
|
93
|
+
expect(stdoutWriteSpy).toHaveBeenCalledWith(content);
|
|
94
|
+
stdoutWriteSpy.mockRestore();
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=file-writer.service.spec.js.map
|
|
@@ -0,0 +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L,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ConfigBound, TypedConfigBound, ConfigSchema } from '@config-bound/config-bound';
|
|
2
|
+
import { Section } from '@config-bound/config-bound/section';
|
|
3
|
+
export type ExportFormat = 'json' | 'yaml' | 'env';
|
|
4
|
+
export interface ExportSchemaOptions {
|
|
5
|
+
format: ExportFormat;
|
|
6
|
+
includeOmitted?: boolean;
|
|
7
|
+
pretty?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class SchemaExportService {
|
|
10
|
+
exportToString(configName: string, sections: Section[], configInstance: ConfigBound | TypedConfigBound<ConfigSchema>, options: ExportSchemaOptions): string;
|
|
11
|
+
private extractEnvVarPrefix;
|
|
12
|
+
getFileExtension(format: ExportFormat): string;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=schema-export.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-export.service.d.ts","sourceRoot":"","sources":["../../src/services/schema-export.service.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAG7D,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAEnD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,YAAY,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,qBACa,mBAAmB;IAC9B,cAAc,CACZ,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,OAAO,EAAE,EACnB,cAAc,EAAE,WAAW,GAAG,gBAAgB,CAAC,YAAY,CAAC,EAC5D,OAAO,EAAE,mBAAmB,GAC3B,MAAM;IAuBT,OAAO,CAAC,mBAAmB;IAmB3B,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM;CAY/C"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Injectable } from '@nestjs/common';
|
|
8
|
+
import { exportSchema, formatAsJSON, formatAsYAML, formatAsEnvExample } from '@config-bound/schema-export';
|
|
9
|
+
import { EnvVarBind } from '@config-bound/config-bound/bind/binds/envVar';
|
|
10
|
+
let SchemaExportService = class SchemaExportService {
|
|
11
|
+
exportToString(configName, sections, configInstance, options) {
|
|
12
|
+
const includeOmitted = options.includeOmitted || false;
|
|
13
|
+
const schema = exportSchema(configName, sections, includeOmitted);
|
|
14
|
+
switch (options.format) {
|
|
15
|
+
case 'json':
|
|
16
|
+
return formatAsJSON(schema, options.pretty !== false);
|
|
17
|
+
case 'yaml':
|
|
18
|
+
return formatAsYAML(schema);
|
|
19
|
+
case 'env': {
|
|
20
|
+
const prefix = this.extractEnvVarPrefix(configInstance);
|
|
21
|
+
return formatAsEnvExample(schema, prefix);
|
|
22
|
+
}
|
|
23
|
+
default:
|
|
24
|
+
throw new Error(`Unsupported format: ${options.format}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
extractEnvVarPrefix(configInstance) {
|
|
28
|
+
if (!configInstance || !configInstance.binds) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
for (const bind of configInstance.binds) {
|
|
32
|
+
if (bind instanceof EnvVarBind) {
|
|
33
|
+
const envVarBind = bind;
|
|
34
|
+
if (envVarBind.envVarPrefix) {
|
|
35
|
+
return envVarBind.envVarPrefix;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
getFileExtension(format) {
|
|
42
|
+
switch (format) {
|
|
43
|
+
case 'json':
|
|
44
|
+
return '.json';
|
|
45
|
+
case 'yaml':
|
|
46
|
+
return '.yaml';
|
|
47
|
+
case 'env':
|
|
48
|
+
return '.env.example';
|
|
49
|
+
default:
|
|
50
|
+
return '';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
SchemaExportService = __decorate([
|
|
55
|
+
Injectable()
|
|
56
|
+
], SchemaExportService);
|
|
57
|
+
export { SchemaExportService };
|
|
58
|
+
//# sourceMappingURL=schema-export.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-export.service.js","sourceRoot":"","sources":["../../src/services/schema-export.service.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,kBAAkB,EACnB,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAWnE,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC9B,cAAc,CACZ,UAAkB,EAClB,QAAmB,EACnB,cAA4D,EAC5D,OAA4B;QAE5B,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,KAAK,CAAC;QAEvD,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;QAElE,QAAQ,OAAO,CAAC,MAAM,EAAE,CAAC;YACvB,KAAK,MAAM;gBACT,OAAO,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC;YAExD,KAAK,MAAM;gBACT,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;YAE9B,KAAK,KAAK,CAAC,CAAC,CAAC;gBAEX,MAAM,MAAM,GAAG,IAAI,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;gBACxD,OAAO,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAC5C,CAAC;YAED;gBACE,MAAM,IAAI,KAAK,CAAC,uBAAuB,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IAEO,mBAAmB,CACzB,cAA4D;QAE5D,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;YAC7C,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,KAAK,MAAM,IAAI,IAAI,cAAc,CAAC,KAAK,EAAE,CAAC;YACxC,IAAI,IAAI,YAAY,UAAU,EAAE,CAAC;gBAC/B,MAAM,UAAU,GAAG,IAAkB,CAAC;gBACtC,IAAI,UAAU,CAAC,YAAY,EAAE,CAAC;oBAC5B,OAAO,UAAU,CAAC,YAAY,CAAC;gBACjC,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,gBAAgB,CAAC,MAAoB;QACnC,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,MAAM;gBACT,OAAO,OAAO,CAAC;YACjB,KAAK,MAAM;gBACT,OAAO,OAAO,CAAC;YACjB,KAAK,KAAK;gBACR,OAAO,cAAc,CAAC;YACxB;gBACE,OAAO,EAAE,CAAC;QACd,CAAC;IACH,CAAC;CACF,CAAA;AA5DY,mBAAmB;IAD/B,UAAU,EAAE;GACA,mBAAmB,CA4D/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-export.service.spec.d.ts","sourceRoot":"","sources":["../../src/services/schema-export.service.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Test } from '@nestjs/testing';
|
|
2
|
+
import { SchemaExportService } from './schema-export.service.js';
|
|
3
|
+
import { describe, beforeEach, it, expect } from '@jest/globals';
|
|
4
|
+
import { ConfigBound } from '@config-bound/config-bound';
|
|
5
|
+
import { Section } from '@config-bound/config-bound/section';
|
|
6
|
+
import { Element } from '@config-bound/config-bound/element';
|
|
7
|
+
import Joi from 'joi';
|
|
8
|
+
describe('SchemaExportService', () => {
|
|
9
|
+
let service;
|
|
10
|
+
let mockConfigInstance;
|
|
11
|
+
let mockSections;
|
|
12
|
+
beforeEach(async () => {
|
|
13
|
+
const module = await Test.createTestingModule({
|
|
14
|
+
providers: [SchemaExportService]
|
|
15
|
+
}).compile();
|
|
16
|
+
service = module.get(SchemaExportService);
|
|
17
|
+
const hostElement = new Element('host', 'Database host', 'localhost', undefined, false, false, Joi.string());
|
|
18
|
+
const portElement = new Element('port', 'Database port', 5432, undefined, false, false, Joi.number());
|
|
19
|
+
const databaseSection = new Section('database', [hostElement, portElement], 'Database configuration');
|
|
20
|
+
mockSections = [databaseSection];
|
|
21
|
+
mockConfigInstance = new ConfigBound('TestConfig', [], [], undefined);
|
|
22
|
+
});
|
|
23
|
+
it('should be defined', () => {
|
|
24
|
+
expect(service).toBeDefined();
|
|
25
|
+
});
|
|
26
|
+
describe('exportToString', () => {
|
|
27
|
+
it('should export to JSON format', () => {
|
|
28
|
+
const result = service.exportToString('TestConfig', mockSections, mockConfigInstance, {
|
|
29
|
+
format: 'json',
|
|
30
|
+
pretty: true
|
|
31
|
+
});
|
|
32
|
+
expect(result).toContain('"name": "TestConfig"');
|
|
33
|
+
expect(result).toContain('"database"');
|
|
34
|
+
const parsed = JSON.parse(result);
|
|
35
|
+
expect(parsed.name).toBe('TestConfig');
|
|
36
|
+
});
|
|
37
|
+
it('should export to YAML format', () => {
|
|
38
|
+
const result = service.exportToString('TestConfig', mockSections, mockConfigInstance, {
|
|
39
|
+
format: 'yaml'
|
|
40
|
+
});
|
|
41
|
+
expect(result).toContain('name: TestConfig');
|
|
42
|
+
expect(result).toContain('- name: database');
|
|
43
|
+
});
|
|
44
|
+
it('should export to env format', () => {
|
|
45
|
+
const result = service.exportToString('TestConfig', mockSections, mockConfigInstance, {
|
|
46
|
+
format: 'env'
|
|
47
|
+
});
|
|
48
|
+
expect(result).toContain('DATABASE_HOST=');
|
|
49
|
+
expect(result).toContain('DATABASE_PORT=');
|
|
50
|
+
});
|
|
51
|
+
it('should throw error for unsupported format', () => {
|
|
52
|
+
expect(() => service.exportToString('TestConfig', mockSections, mockConfigInstance, {
|
|
53
|
+
format: 'xml'
|
|
54
|
+
})).toThrow('Unsupported format: xml');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
describe('getFileExtension', () => {
|
|
58
|
+
it('should return correct extension for json', () => {
|
|
59
|
+
expect(service.getFileExtension('json')).toBe('.json');
|
|
60
|
+
});
|
|
61
|
+
it('should return correct extension for yaml', () => {
|
|
62
|
+
expect(service.getFileExtension('yaml')).toBe('.yaml');
|
|
63
|
+
});
|
|
64
|
+
it('should return correct extension for env', () => {
|
|
65
|
+
expect(service.getFileExtension('env')).toBe('.env.example');
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=schema-export.service.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-export.service.spec.js","sourceRoot":"","sources":["../../src/services/schema-export.service.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAiB,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,EAAE,OAAO,EA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E,MAAM,EAAE,KAAY;aACrB,CAAC,CACH,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;YAClD,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;YAClD,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;YACjD,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
|
|
3
|
+
/** @type {import('ts-jest').JestConfigWithTsJest} **/
|
|
4
|
+
export default {
|
|
5
|
+
preset: 'ts-jest',
|
|
6
|
+
testEnvironment: 'node',
|
|
7
|
+
roots: ['<rootDir>/src'],
|
|
8
|
+
testMatch: ['**/*.spec.ts'],
|
|
9
|
+
collectCoverageFrom: [
|
|
10
|
+
'src/**/*.ts',
|
|
11
|
+
'!src/**/*.spec.ts',
|
|
12
|
+
'!src/**/*.d.ts',
|
|
13
|
+
'!src/main.ts'
|
|
14
|
+
],
|
|
15
|
+
coverageDirectory: 'coverage',
|
|
16
|
+
coverageReporters: ['text', 'lcov', 'html'],
|
|
17
|
+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
|
18
|
+
extensionsToTreatAsEsm: ['.ts'],
|
|
19
|
+
transformIgnorePatterns: ['node_modules/(?!@config-bound)'],
|
|
20
|
+
moduleNameMapper: {
|
|
21
|
+
'^(\\.{1,2}/.*)\\.js$': '$1'
|
|
22
|
+
},
|
|
23
|
+
transform: {
|
|
24
|
+
'^.+\\.tsx?$': [
|
|
25
|
+
'ts-jest',
|
|
26
|
+
{
|
|
27
|
+
useESM: true,
|
|
28
|
+
tsconfig: {
|
|
29
|
+
emitDecoratorMetadata: true,
|
|
30
|
+
experimentalDecorators: true,
|
|
31
|
+
isolatedModules: true
|
|
32
|
+
},
|
|
33
|
+
diagnostics: {
|
|
34
|
+
ignoreCodes: [151002]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@config-bound/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CLI tool for ConfigBound schema export and management",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cli",
|
|
7
|
+
"config",
|
|
8
|
+
"schema",
|
|
9
|
+
"export",
|
|
10
|
+
"configbound"
|
|
11
|
+
],
|
|
12
|
+
"author": "Robert Keyser",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"bin": {
|
|
16
|
+
"configbound": "./bin/configbound.js"
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/main.js",
|
|
19
|
+
"types": "./dist/main.d.ts",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc",
|
|
22
|
+
"clean": "rimraf dist coverage .turbo",
|
|
23
|
+
"dev": "tsx src/main.ts",
|
|
24
|
+
"test": "NODE_OPTIONS='--experimental-vm-modules' jest",
|
|
25
|
+
"test:dev": "NODE_OPTIONS='--experimental-vm-modules' jest --watch",
|
|
26
|
+
"test:coverage": "NODE_OPTIONS='--experimental-vm-modules' jest --coverage",
|
|
27
|
+
"lint": "eslint src/**/*.ts --fix",
|
|
28
|
+
"lint:ci": "eslint src/**/*.ts",
|
|
29
|
+
"format": "prettier --write --config ../../.config/.prettierrc --ignore-path ../../.config/.prettierignore src/**/*.ts",
|
|
30
|
+
"format:ci": "prettier --check --config ../../.config/.prettierrc --ignore-path ../../.config/.prettierignore src/**/*.ts"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@config-bound/config-bound": "*",
|
|
34
|
+
"@config-bound/schema-export": "*",
|
|
35
|
+
"@nestjs/common": "^10.4.15",
|
|
36
|
+
"@nestjs/core": "^10.4.15",
|
|
37
|
+
"chalk": "^4.1.2",
|
|
38
|
+
"esbuild-register": "^3.6.0",
|
|
39
|
+
"nest-commander": "^3.15.0",
|
|
40
|
+
"reflect-metadata": "^0.2.2",
|
|
41
|
+
"ts-morph": "^24.0.0",
|
|
42
|
+
"tsx": "^4.20.6"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@config-bound/eslint-config": "*",
|
|
46
|
+
"@types/jest": "^30.0.0",
|
|
47
|
+
"@types/node": "^24.10.1",
|
|
48
|
+
"eslint": "^9.39.1",
|
|
49
|
+
"jest": "^30.2.0",
|
|
50
|
+
"rimraf": "^6.1.2",
|
|
51
|
+
"ts-jest": "^29.4.5",
|
|
52
|
+
"typescript": "^5.9.3"
|
|
53
|
+
},
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"access": "public",
|
|
56
|
+
"registry": "https://registry.npmjs.org"
|
|
57
|
+
},
|
|
58
|
+
"repository": {
|
|
59
|
+
"type": "git",
|
|
60
|
+
"url": "https://github.com/notr-ai/ConfigBound"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Module } from '@nestjs/common';
|
|
2
|
+
import { ListCommand } from './commands/list.command.js';
|
|
3
|
+
import { ExportCommand } from './commands/export.command.js';
|
|
4
|
+
import { ConfigDiscoveryService } from './services/config-discovery.service.js';
|
|
5
|
+
import { ConfigLoaderService } from './services/config-loader.service.js';
|
|
6
|
+
import { SchemaExportService } from './services/schema-export.service.js';
|
|
7
|
+
import { FileWriterService } from './services/file-writer.service.js';
|
|
8
|
+
|
|
9
|
+
@Module({
|
|
10
|
+
providers: [
|
|
11
|
+
ListCommand,
|
|
12
|
+
ExportCommand,
|
|
13
|
+
ConfigDiscoveryService,
|
|
14
|
+
ConfigLoaderService,
|
|
15
|
+
SchemaExportService,
|
|
16
|
+
FileWriterService
|
|
17
|
+
]
|
|
18
|
+
})
|
|
19
|
+
export class CliModule {}
|
|
20
|
+
|
|
21
|
+
|