@firestartr/cli 1.36.1 → 1.36.2

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
@@ -131357,6 +131357,16 @@ async function listReleases(repo, owner = 'prefapp') {
131357
131357
  });
131358
131358
  return response.data;
131359
131359
  }
131360
+ async function getReleaseByTag(releaseTag, repo, owner = 'prefapp') {
131361
+ repository_messageLog(`Getting release ${releaseTag} for ${owner}/${repo}`);
131362
+ const octokit = await getOctokitForOrg(owner);
131363
+ const response = await octokit.rest.repos.getReleaseByTag({
131364
+ owner,
131365
+ repo,
131366
+ tag: releaseTag,
131367
+ });
131368
+ return response.data;
131369
+ }
131360
131370
  // Not exported, internal user for getContent and deleteFile
131361
131371
  async function getFileFromGithub(path, repo, owner = 'prefapp') {
131362
131372
  const octokit = await getOctokitForOrg(owner);
@@ -131511,6 +131521,7 @@ async function addCommitStatus(state, sha, repo, owner = 'prefapp', target_url =
131511
131521
  }
131512
131522
  /* harmony default export */ const repository = ({
131513
131523
  listReleases,
131524
+ getReleaseByTag,
131514
131525
  getContent,
131515
131526
  setContent,
131516
131527
  uploadFile,
@@ -136767,17 +136778,16 @@ async function prepareFeature(featureName, version, repo = 'features', owner = '
136767
136778
  await downloadFeatureTarball(repo, featureName, version, owner);
136768
136779
  }
136769
136780
  async function downloadFeatureTarball(repo, featureName, version, owner = 'prefapp') {
136770
- const releases = await github_0.repo.listReleases(repo, owner);
136771
- // There should be one release with the name.
136772
- // However it is an array so just get the first one
136773
- const release = releases.filter((r) => r.name === `${featureName}: v${version}`)[0];
136774
- const ref = release['tag_name'];
136775
- const octokit = await github_0.getOctokitForOrg(owner);
136776
- const response = await octokit.request(`GET /repos/${owner}/${repo}/tarball/${ref}`, { owner, repo, ref });
136777
- const tarballExtractPath = catalog_common.features.tarballs.getFeaturesExtractPath(featureName, version, { createIfNotExists: true });
136778
- const tarballPath = catalog_common.features.tarballs.getFeatureTarballDownloadPath(featureName, version);
136779
- external_fs_.writeFileSync(tarballPath, Buffer.from(response.data));
136781
+ const release = await github_0.repo.getReleaseByTag(`${featureName}-v${version}`, repo, owner);
136780
136782
  try {
136783
+ if (!release)
136784
+ throw new Error(`Release ${featureName}-v${version} not found`);
136785
+ const ref = release['tag_name'];
136786
+ const octokit = await github_0.getOctokitForOrg(owner);
136787
+ const response = await octokit.request(`GET /repos/${owner}/${repo}/tarball/${ref}`, { owner, repo, ref });
136788
+ const tarballExtractPath = catalog_common.features.tarballs.getFeaturesExtractPath(featureName, version, { createIfNotExists: true });
136789
+ const tarballPath = catalog_common.features.tarballs.getFeatureTarballDownloadPath(featureName, version);
136790
+ external_fs_.writeFileSync(tarballPath, Buffer.from(response.data));
136781
136791
  node_modules_tar.x({
136782
136792
  file: tarballPath,
136783
136793
  cwd: tarballExtractPath,
@@ -136787,7 +136797,7 @@ async function downloadFeatureTarball(repo, featureName, version, owner = 'prefa
136787
136797
  return tarballExtractPath;
136788
136798
  }
136789
136799
  catch (error) {
136790
- throw `downloadFeatureTarball: ${error}`;
136800
+ throw `Error for feature with tag ${featureName}-v${version}: ${error}. GitHub response: ${release}`;
136791
136801
  }
136792
136802
  }
136793
136803
 
@@ -139178,7 +139188,7 @@ class FeatureRepoChart extends BaseGithubChart {
139178
139188
  return repositoryTarget;
139179
139189
  }
139180
139190
  instanceApiObject(template) {
139181
- return new FirestartrGithubRepositoryFeature(this, `${template.metadata.name}-${template.spec.firestartr.tfStateKey}`, template);
139191
+ return new FirestartrGithubRepositoryFeature(this, `${template.metadata.name}-${template.spec.firestartr.tfStateKey}-feature`, template);
139182
139192
  }
139183
139193
  }
139184
139194
 
@@ -11,6 +11,7 @@ declare const _default: {
11
11
  };
12
12
  repo: {
13
13
  listReleases: typeof import("./src/repository").listReleases;
14
+ getReleaseByTag: typeof import("./src/repository").getReleaseByTag;
14
15
  getContent: typeof import("./src/repository").getContent;
15
16
  setContent: typeof import("./src/repository").setContent;
16
17
  uploadFile: typeof import("./src/repository").uploadFile;
@@ -428,7 +428,7 @@ export declare function getBranch(repo: string, branch: string, owner?: string):
428
428
  verified_at: string;
429
429
  };
430
430
  };
431
- author: {
431
+ author: Record<string, never> | {
432
432
  name?: string;
433
433
  email?: string;
434
434
  login: string;
@@ -451,8 +451,8 @@ export declare function getBranch(repo: string, branch: string, owner?: string):
451
451
  site_admin: boolean;
452
452
  starred_at?: string;
453
453
  user_view_type?: string;
454
- } | Record<string, never>;
455
- committer: {
454
+ };
455
+ committer: Record<string, never> | {
456
456
  name?: string;
457
457
  email?: string;
458
458
  login: string;
@@ -475,7 +475,7 @@ export declare function getBranch(repo: string, branch: string, owner?: string):
475
475
  site_admin: boolean;
476
476
  starred_at?: string;
477
477
  user_view_type?: string;
478
- } | Record<string, never>;
478
+ };
479
479
  parents: {
480
480
  sha: string;
481
481
  url: string;
@@ -96,6 +96,102 @@ export declare function listReleases(repo: string, owner?: string): Promise<{
96
96
  rocket: number;
97
97
  };
98
98
  }[]>;
99
+ export declare function getReleaseByTag(releaseTag: string, repo: string, owner?: string): Promise<{
100
+ url: string;
101
+ html_url: string;
102
+ assets_url: string;
103
+ upload_url: string;
104
+ tarball_url: string;
105
+ zipball_url: string;
106
+ id: number;
107
+ node_id: string;
108
+ tag_name: string;
109
+ target_commitish: string;
110
+ name: string;
111
+ body?: string;
112
+ draft: boolean;
113
+ prerelease: boolean;
114
+ created_at: string;
115
+ published_at: string;
116
+ author: {
117
+ name?: string;
118
+ email?: string;
119
+ login: string;
120
+ id: number;
121
+ node_id: string;
122
+ avatar_url: string;
123
+ gravatar_id: string;
124
+ url: string;
125
+ html_url: string;
126
+ followers_url: string;
127
+ following_url: string;
128
+ gists_url: string;
129
+ starred_url: string;
130
+ subscriptions_url: string;
131
+ organizations_url: string;
132
+ repos_url: string;
133
+ events_url: string;
134
+ received_events_url: string;
135
+ type: string;
136
+ site_admin: boolean;
137
+ starred_at?: string;
138
+ user_view_type?: string;
139
+ };
140
+ assets: {
141
+ url: string;
142
+ browser_download_url: string;
143
+ id: number;
144
+ node_id: string;
145
+ name: string;
146
+ label: string;
147
+ state: "open" | "uploaded";
148
+ content_type: string;
149
+ size: number;
150
+ download_count: number;
151
+ created_at: string;
152
+ updated_at: string;
153
+ uploader: {
154
+ name?: string;
155
+ email?: string;
156
+ login: string;
157
+ id: number;
158
+ node_id: string;
159
+ avatar_url: string;
160
+ gravatar_id: string;
161
+ url: string;
162
+ html_url: string;
163
+ followers_url: string;
164
+ following_url: string;
165
+ gists_url: string;
166
+ starred_url: string;
167
+ subscriptions_url: string;
168
+ organizations_url: string;
169
+ repos_url: string;
170
+ events_url: string;
171
+ received_events_url: string;
172
+ type: string;
173
+ site_admin: boolean;
174
+ starred_at?: string;
175
+ user_view_type?: string;
176
+ };
177
+ }[];
178
+ body_html?: string;
179
+ body_text?: string;
180
+ mentions_count?: number;
181
+ discussion_url?: string;
182
+ reactions?: {
183
+ url: string;
184
+ total_count: number;
185
+ "+1": number;
186
+ "-1": number;
187
+ laugh: number;
188
+ confused: number;
189
+ heart: number;
190
+ hooray: number;
191
+ eyes: number;
192
+ rocket: number;
193
+ };
194
+ }>;
99
195
  export declare function getContent(path: string, repo: string, owner?: string, ref?: string): Promise<string>;
100
196
  export declare function getRepoInfo(owner: string, name: string): Promise<{
101
197
  id: number;
@@ -1167,6 +1263,7 @@ export declare function addStatusCheck(output: any, is_failure: boolean, head_sh
1167
1263
  export declare function addCommitStatus(state: commitStatusState, sha: string, repo: string, owner?: string, target_url?: string, description?: string, context?: string): Promise<void>;
1168
1264
  declare const _default: {
1169
1265
  listReleases: typeof listReleases;
1266
+ getReleaseByTag: typeof getReleaseByTag;
1170
1267
  getContent: typeof getContent;
1171
1268
  setContent: typeof setContent;
1172
1269
  uploadFile: typeof uploadFile;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "1.36.1",
3
+ "version": "1.36.2",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",