@firestartr/cli 2.7.0 → 2.8.0-snapshot-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js
CHANGED
|
@@ -323668,6 +323668,47 @@ function sanitizeApiEntityName(name) {
|
|
|
323668
323668
|
.replace(/[^a-z0-9-]/g, '-')
|
|
323669
323669
|
.replace(/^-+|-+$/g, '');
|
|
323670
323670
|
}
|
|
323671
|
+
async function generateClaimsMap(claimsPath, outputPath, sha) {
|
|
323672
|
+
const map = {
|
|
323673
|
+
headers: {
|
|
323674
|
+
sha: sha ?? '',
|
|
323675
|
+
},
|
|
323676
|
+
claims: {},
|
|
323677
|
+
};
|
|
323678
|
+
await crawlClaimsDir(claimsPath, claimsPath, map.claims);
|
|
323679
|
+
await external_fs_default().promises.writeFile(outputPath, JSON.stringify(map, null, 2), 'utf-8');
|
|
323680
|
+
}
|
|
323681
|
+
async function crawlClaimsDir(dir, basePath, claims) {
|
|
323682
|
+
let entries;
|
|
323683
|
+
try {
|
|
323684
|
+
entries = await (0,promises_.readdir)(dir, { withFileTypes: true });
|
|
323685
|
+
}
|
|
323686
|
+
catch (err) {
|
|
323687
|
+
throw new Error(`Reading directory ${dir}: ${err}`);
|
|
323688
|
+
}
|
|
323689
|
+
for (const entry of entries) {
|
|
323690
|
+
const fullPath = external_path_default().join(dir, entry.name);
|
|
323691
|
+
if (entry.isDirectory()) {
|
|
323692
|
+
await crawlClaimsDir(fullPath, basePath, claims);
|
|
323693
|
+
}
|
|
323694
|
+
else if (entry.isFile() && entry.name.match(/\.yaml$|\.yml$/)) {
|
|
323695
|
+
try {
|
|
323696
|
+
const data = await external_fs_default().promises.readFile(fullPath, 'utf-8');
|
|
323697
|
+
const claim = catalog_common/* default.io.fromYaml */.Z.io.fromYaml(data);
|
|
323698
|
+
if (!('kind' in claim && 'name' in claim)) {
|
|
323699
|
+
logger.warn(`Skipping file ${fullPath}: missing kind or name`);
|
|
323700
|
+
continue;
|
|
323701
|
+
}
|
|
323702
|
+
const ref = `${claim.kind}-${claim.name}`;
|
|
323703
|
+
const relativePath = external_path_default().relative(basePath, fullPath);
|
|
323704
|
+
claims[ref] = { filePath: relativePath };
|
|
323705
|
+
}
|
|
323706
|
+
catch (err) {
|
|
323707
|
+
throw new Error(`Error processing claim file ${fullPath}: ${err}`);
|
|
323708
|
+
}
|
|
323709
|
+
}
|
|
323710
|
+
}
|
|
323711
|
+
}
|
|
323671
323712
|
|
|
323672
323713
|
;// CONCATENATED MODULE: ../cdk8s_renderer/imports/firestartr.dev.ts
|
|
323673
323714
|
// generated by cdk8s
|
|
@@ -328837,6 +328878,7 @@ async function addLastStateAndLastClaimAnnotations(filePath, lastStatePRLink, la
|
|
|
328837
328878
|
|
|
328838
328879
|
|
|
328839
328880
|
|
|
328881
|
+
|
|
328840
328882
|
|
|
328841
328883
|
|
|
328842
328884
|
/* harmony default export */ const cdk8s_renderer = ({
|
|
@@ -342660,6 +342702,7 @@ const cdk8s_rendererSubcommands = {
|
|
|
342660
342702
|
{ name: 'render', alias: 'r', type: Boolean },
|
|
342661
342703
|
{ name: 'compare', type: Boolean },
|
|
342662
342704
|
{ name: 'render-plan', type: Boolean },
|
|
342705
|
+
{ name: 'generate-claims-map', type: Boolean },
|
|
342663
342706
|
/**
|
|
342664
342707
|
* Specific parameters for render functionality
|
|
342665
342708
|
*/
|
|
@@ -342716,6 +342759,10 @@ const cdk8s_rendererSubcommands = {
|
|
|
342716
342759
|
{ name: 'lastStatePrLink', type: String },
|
|
342717
342760
|
{ name: 'lastClaimPrLink', type: String },
|
|
342718
342761
|
{ name: 'crLocation', type: String },
|
|
342762
|
+
/**
|
|
342763
|
+
* Specific parameters for claims-map generation
|
|
342764
|
+
*/
|
|
342765
|
+
{ name: 'claims-map-output', alias: 'm', type: String },
|
|
342719
342766
|
],
|
|
342720
342767
|
run: async (options) => {
|
|
342721
342768
|
if (options['render']) {
|
|
@@ -342728,6 +342775,9 @@ const cdk8s_rendererSubcommands = {
|
|
|
342728
342775
|
else if (options['lastStatePrLink'] && options['lastClaimPrLink']) {
|
|
342729
342776
|
await cdk8s_renderer.addLastStateAndLastClaimAnnotations(options['crLocation'], options['lastStatePrLink'], options['lastClaimPrLink']);
|
|
342730
342777
|
}
|
|
342778
|
+
else if (options['generate-claims-map']) {
|
|
342779
|
+
await generateClaimsMap(options['claims'], options['claims-map-output'], options['sha']);
|
|
342780
|
+
}
|
|
342731
342781
|
},
|
|
342732
342782
|
};
|
|
342733
342783
|
|
|
@@ -521369,9 +521419,9 @@ const crsStatusSubcommand = {
|
|
|
521369
521419
|
};
|
|
521370
521420
|
|
|
521371
521421
|
;// CONCATENATED MODULE: ./package.json
|
|
521372
|
-
const package_namespaceObject = {"i8":"2.
|
|
521422
|
+
const package_namespaceObject = JSON.parse('{"i8":"2.8.0-snapshot-1"}');
|
|
521373
521423
|
;// CONCATENATED MODULE: ../../package.json
|
|
521374
|
-
const package_namespaceObject_1 = {"i8":"2.
|
|
521424
|
+
const package_namespaceObject_1 = {"i8":"2.6.4"};
|
|
521375
521425
|
;// CONCATENATED MODULE: ./src/subcommands/index.ts
|
|
521376
521426
|
|
|
521377
521427
|
|
|
@@ -13,6 +13,7 @@ import { runComparer } from './src/comparer';
|
|
|
13
13
|
import { AllowedProviders, setDefaultBranch, setPath, setRepositoryUrl } from './src/config';
|
|
14
14
|
import { render } from './src/renderer/renderer';
|
|
15
15
|
export { AllowedProviders, configureProvider, setDefaultBranch, setRepositoryUrl, } from './src/config';
|
|
16
|
+
export { generateClaimsMap } from './src/utils/claimUtils';
|
|
16
17
|
import { isCatalogEntity } from './src/validations/references';
|
|
17
18
|
import { normalizeModuleContent } from './src/normalizers';
|
|
18
19
|
import { loadCRs } from './src/loader/loader';
|
|
@@ -5,3 +5,13 @@ export declare function resolveClaimEntries(claimRefsList: string[]): AsyncGener
|
|
|
5
5
|
export declare function resolveClaimFileRef(claimFile: string): Promise<string>;
|
|
6
6
|
export declare function getClaimsEntryAbsolutePath(claimsDir: string, entryPath: string): string;
|
|
7
7
|
export declare function sanitizeApiEntityName(name: string): string;
|
|
8
|
+
export interface ClaimsMapEntry {
|
|
9
|
+
filePath: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ClaimsMap {
|
|
12
|
+
headers: {
|
|
13
|
+
sha: string;
|
|
14
|
+
};
|
|
15
|
+
claims: Record<string, ClaimsMapEntry>;
|
|
16
|
+
}
|
|
17
|
+
export declare function generateClaimsMap(claimsPath: string, outputPath: string, sha?: string): Promise<void>;
|