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

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 +40 -1
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -367334,6 +367334,10 @@ const KIND_TO_COLLECTION_FILTERS = {
367334
367334
  FirestartrGithubGroup: 'gh-group',
367335
367335
  FirestartrGithubMembership: 'gh-members',
367336
367336
  };
367337
+ const DEPENDANT_KINDS = [
367338
+ 'FirestartrGithubRepositoryFeature',
367339
+ 'FirestartrGithubRepositorySecretsSection',
367340
+ ];
367337
367341
  // we create a special Collection that will use
367338
367342
  class ReimportCollection {
367339
367343
  helperNameExtractor(cr) {
@@ -367366,12 +367370,16 @@ async function reimportGithubGitopsRepository(org, crsPath, configPath, generate
367366
367370
  const collection = new ReimportCollection();
367367
367371
  const importAnnotation = catalog_common.generic.getFirestartrAnnotation('import');
367368
367372
  const reImportAnnotation = catalog_common.generic.getFirestartrAnnotation('needs-re-import');
367373
+ const crsWithDependenciesToAnnotate = [];
367369
367374
  // we need to perform a search in all the crsPath
367370
367375
  await searchCRs(crsPath, async (cr, filePath) => {
367371
367376
  importer_src_logger.debug(`${JSON.stringify(cr)}`);
367372
367377
  // lets filter the cr with the generated filters, if it passes we annotate it with needs-re-import
367373
367378
  if (await collection.isCrIncluded(cr, generatedFilters)) {
367374
367379
  importer_src_logger.info(`Annotating ${cr.kind}/${cr.metadata.name} with ${reImportAnnotation} and ${importAnnotation}`);
367380
+ if (cr.kind === 'FirestartrGithubRepository') {
367381
+ crsWithDependenciesToAnnotate.push(cr);
367382
+ }
367375
367383
  // we annotate the cr with needs-re-import
367376
367384
  if (!cr.metadata.annotations) {
367377
367385
  cr.metadata.annotations = {};
@@ -367383,6 +367391,37 @@ async function reimportGithubGitopsRepository(org, crsPath, configPath, generate
367383
367391
  await promises_default().writeFile(filePath, newContent, 'utf-8');
367384
367392
  }
367385
367393
  });
367394
+ // we need to search for dependencies if proceeds
367395
+ if (!collection.IS_SKIP_SET(generatedFilters, 'gh-repo')) {
367396
+ importer_src_logger.info(`Searching for dependencies to annotate with ${reImportAnnotation} and ${importAnnotation}`);
367397
+ await searchForDependencies(org, crsPath, configPath, generatedFilters, crsWithDependenciesToAnnotate, reImportAnnotation, importAnnotation);
367398
+ }
367399
+ }
367400
+ async function searchForDependencies(org, crsPath, configPath, generatedFilters, crsWithDependenciesToAnnotate, reImportAnnotation, importAnnotation) {
367401
+ // we need to perform a search in all the crsPath
367402
+ await searchCRs(crsPath, async (cr, filePath) => {
367403
+ importer_src_logger.debug(`${JSON.stringify(cr)}`);
367404
+ if (DEPENDANT_KINDS.includes(cr.kind)) {
367405
+ if ('spec' in cr && 'repositoryTarget' in cr.spec) {
367406
+ const repositoryTarget = cr.spec.repositoryTarget;
367407
+ const isDependent = crsWithDependenciesToAnnotate.some((repoCr) => {
367408
+ return repositoryTarget.ref.name === repoCr.metadata.name;
367409
+ });
367410
+ if (isDependent) {
367411
+ importer_src_logger.info(`Found dependency ${cr.kind}/${cr.metadata.name} for repository ${repositoryTarget.ref.name}`);
367412
+ // we annotate the cr with needs-re-import
367413
+ if (!cr.metadata.annotations) {
367414
+ cr.metadata.annotations = {};
367415
+ }
367416
+ cr.metadata.annotations[reImportAnnotation] = 'true';
367417
+ cr.metadata.annotations[importAnnotation] = 'true';
367418
+ // we write the cr back to the file system
367419
+ const newContent = catalog_common.io.toYaml(cr);
367420
+ await promises_default().writeFile(filePath, newContent, 'utf-8');
367421
+ }
367422
+ }
367423
+ }
367424
+ });
367386
367425
  }
367387
367426
  async function searchCRs(dirname, functionToApply) {
367388
367427
  const files = await promises_default().readdir(dirname);
@@ -378495,7 +378534,7 @@ const crs_analyzerSubcommand = {
378495
378534
  };
378496
378535
 
378497
378536
  ;// CONCATENATED MODULE: ./package.json
378498
- const package_namespaceObject = JSON.parse('{"i8":"1.59.0-snapshot-8"}');
378537
+ const package_namespaceObject = JSON.parse('{"i8":"1.59.0-snapshot-10"}');
378499
378538
  ;// CONCATENATED MODULE: ../../package.json
378500
378539
  const package_namespaceObject_1 = {"i8":"1.58.0"};
378501
378540
  ;// 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-8",
3
+ "version": "1.59.0-snapshot-10",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",