@firestartr/cli 1.59.0-snapshot-6 → 1.59.0-snapshot-8

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.
Files changed (2) hide show
  1. package/build/index.js +35 -4
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -367329,12 +367329,36 @@ function compileReg(value) {
367329
367329
 
367330
367330
 
367331
367331
 
367332
+ const KIND_TO_COLLECTION_FILTERS = {
367333
+ FirestartrGithubRepository: 'gh-repo',
367334
+ FirestartrGithubGroup: 'gh-group',
367335
+ FirestartrGithubMembership: 'gh-members',
367336
+ };
367332
367337
  // we create a special Collection that will use
367333
367338
  class ReimportCollection {
367339
+ helperNameExtractor(cr) {
367340
+ return cr.metadata.annotations['firestartr.dev/external-name'];
367341
+ }
367342
+ isSkipped(cr, generatedFilters) {
367343
+ if (cr.kind in KIND_TO_COLLECTION_FILTERS) {
367344
+ return this.IS_SKIP_SET(generatedFilters, KIND_TO_COLLECTION_FILTERS[cr.kind]);
367345
+ }
367346
+ else {
367347
+ return false;
367348
+ }
367349
+ }
367334
367350
  isCrIncluded(cr, generatedFilters) {
367335
- return this.filter('cr', generatedFilters, [cr]).then((result) => {
367336
- return result.length > 0;
367337
- });
367351
+ if (this.isSkipped(cr, generatedFilters)) {
367352
+ return Promise.resolve(false);
367353
+ }
367354
+ if (cr.kind in KIND_TO_COLLECTION_FILTERS) {
367355
+ return this.filter(KIND_TO_COLLECTION_FILTERS[cr.kind], generatedFilters, [this.helperNameExtractor(cr)]).then((result) => {
367356
+ return result.length > 0;
367357
+ });
367358
+ }
367359
+ else {
367360
+ return Promise.resolve(false);
367361
+ }
367338
367362
  }
367339
367363
  }
367340
367364
  applyCollectionMixins(ReimportCollection);
@@ -367344,6 +367368,7 @@ async function reimportGithubGitopsRepository(org, crsPath, configPath, generate
367344
367368
  const reImportAnnotation = catalog_common.generic.getFirestartrAnnotation('needs-re-import');
367345
367369
  // we need to perform a search in all the crsPath
367346
367370
  await searchCRs(crsPath, async (cr, filePath) => {
367371
+ importer_src_logger.debug(`${JSON.stringify(cr)}`);
367347
367372
  // lets filter the cr with the generated filters, if it passes we annotate it with needs-re-import
367348
367373
  if (await collection.isCrIncluded(cr, generatedFilters)) {
367349
367374
  importer_src_logger.info(`Annotating ${cr.kind}/${cr.metadata.name} with ${reImportAnnotation} and ${importAnnotation}`);
@@ -367363,10 +367388,16 @@ async function searchCRs(dirname, functionToApply) {
367363
367388
  const files = await promises_default().readdir(dirname);
367364
367389
  for (const file of files) {
367365
367390
  if (file.endsWith('.yaml') || file.endsWith('.yml')) {
367391
+ importer_src_logger.debug(`Processing file: ${file}`);
367366
367392
  const filePath = external_path_default().join(dirname, file);
367367
367393
  const content = await promises_default().readFile(filePath, 'utf-8');
367368
367394
  // let's use the catalog_common yaml loader
367369
367395
  const cr = catalog_common.io.fromYaml(content);
367396
+ // let's check if the file is a valid file (i.e a CR)
367397
+ if (!('kind' in cr) || !('metadata' in cr) || !('name' in cr.metadata)) {
367398
+ importer_src_logger.debug(`File ${filePath} is not a valid CR, skipping...`);
367399
+ continue;
367400
+ }
367370
367401
  await functionToApply(cr, filePath);
367371
367402
  }
367372
367403
  else if (await reimporter_isDirectory(external_path_default().join(dirname, file))) {
@@ -378464,7 +378495,7 @@ const crs_analyzerSubcommand = {
378464
378495
  };
378465
378496
 
378466
378497
  ;// CONCATENATED MODULE: ./package.json
378467
- const package_namespaceObject = JSON.parse('{"i8":"1.59.0-snapshot-6"}');
378498
+ const package_namespaceObject = JSON.parse('{"i8":"1.59.0-snapshot-8"}');
378468
378499
  ;// CONCATENATED MODULE: ../../package.json
378469
378500
  const package_namespaceObject_1 = {"i8":"1.58.0"};
378470
378501
  ;// CONCATENATED MODULE: ./src/subcommands/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "1.59.0-snapshot-6",
3
+ "version": "1.59.0-snapshot-8",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",