@forge/cli-shared 0.0.0-experimental-7c72fec → 0.0.0-experimental-c3d0263

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/CHANGELOG.md CHANGED
@@ -1,15 +1,238 @@
1
1
  # @forge/cli-shared
2
2
 
3
- ## 0.0.0-experimental-7c72fec
3
+ ## 0.0.0-experimental-c3d0263
4
+
5
+ ### Minor Changes
6
+
7
+ - 949bd40: The @forge/cli will now download templates from a new service (previously bitbucket), old versions of the CLI won't receive template updates
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [88e57a12]
12
+ - Updated dependencies [6c44d2b]
13
+ - Updated dependencies [e95919f]
14
+ - Updated dependencies [e822a8a]
15
+ - Updated dependencies [2420378]
16
+ - Updated dependencies [051ed1f]
17
+ - Updated dependencies [ad94136]
18
+ - Updated dependencies [ae111cd]
19
+ - Updated dependencies [8e35955]
20
+ - Updated dependencies [c255b24]
21
+ - Updated dependencies [f894871]
22
+ - @forge/util@0.0.0-experimental-c3d0263
23
+ - @forge/manifest@0.0.0-experimental-c3d0263
24
+
25
+ ## 2.3.0-next.8
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies [8e35955]
30
+ - @forge/manifest@3.3.0-next.7
31
+
32
+ ## 2.3.0-next.7
33
+
34
+ ### Patch Changes
35
+
36
+ - Updated dependencies [ad94136]
37
+ - @forge/manifest@3.3.0-next.6
38
+
39
+ ## 2.3.0-next.6
40
+
41
+ ### Patch Changes
42
+
43
+ - Updated dependencies [e95919f]
44
+ - Updated dependencies [f894871]
45
+ - @forge/manifest@3.3.0-next.5
46
+
47
+ ## 2.3.0-next.5
48
+
49
+ ### Patch Changes
50
+
51
+ - Updated dependencies [ae111cd]
52
+ - @forge/manifest@3.3.0-next.4
53
+
54
+ ## 2.3.0-next.4
55
+
56
+ ### Patch Changes
57
+
58
+ - Updated dependencies [6c44d2b]
59
+ - Updated dependencies [051ed1f]
60
+ - @forge/manifest@3.3.0-next.3
61
+
62
+ ## 2.3.0-next.3
63
+
64
+ ### Patch Changes
65
+
66
+ - Updated dependencies [88e57a1]
67
+ - Updated dependencies [e822a8a]
68
+ - Updated dependencies [c255b24]
69
+ - @forge/util@1.2.0-next.0
70
+ - @forge/manifest@3.3.0-next.2
71
+
72
+ ## 2.3.0-next.2
73
+
74
+ ### Patch Changes
75
+
76
+ - Updated dependencies [24203783]
77
+ - @forge/manifest@3.3.0-next.1
78
+
79
+ ## 2.3.0-next.1
4
80
 
5
81
  ### Patch Changes
6
82
 
7
- - Updated dependencies [7c72fec]
8
83
  - Updated dependencies [c145946]
84
+ - @forge/manifest@3.3.0-next.0
85
+
86
+ ## 2.3.0-next.0
87
+
88
+ ### Minor Changes
89
+
90
+ - 949bd40: The @forge/cli will now download templates from a new service (previously bitbucket), old versions of the CLI won't receive template updates
91
+
92
+ ## 2.2.2
93
+
94
+ ### Patch Changes
95
+
96
+ - Updated dependencies [7f869f7]
97
+ - Updated dependencies [72e020c]
98
+ - Updated dependencies [b2cef71]
99
+ - Updated dependencies [254b239]
100
+ - Updated dependencies [47744fc]
101
+ - Updated dependencies [860c4fb]
102
+ - Updated dependencies [66e969f]
103
+ - Updated dependencies [2c635f9]
104
+ - @forge/manifest@3.2.0
105
+
106
+ ## 2.2.2-next.6
107
+
108
+ ### Patch Changes
109
+
110
+ - Updated dependencies [860c4fb0]
111
+ - @forge/manifest@3.2.0-next.6
112
+
113
+ ## 2.2.2-next.5
114
+
115
+ ### Patch Changes
116
+
117
+ - Updated dependencies [72e020c]
118
+ - @forge/manifest@3.2.0-next.5
119
+
120
+ ## 2.2.2-next.4
121
+
122
+ ### Patch Changes
123
+
124
+ - Updated dependencies [254b2397]
125
+ - @forge/manifest@3.2.0-next.4
126
+
127
+ ## 2.2.2-next.3
128
+
129
+ ### Patch Changes
130
+
131
+ - Updated dependencies [b2cef71d]
132
+ - @forge/manifest@3.2.0-next.3
133
+
134
+ ## 2.2.2-next.2
135
+
136
+ ### Patch Changes
137
+
138
+ - Updated dependencies [7f869f7]
139
+ - @forge/manifest@3.2.0-next.2
140
+
141
+ ## 2.2.2-next.1
142
+
143
+ ### Patch Changes
144
+
145
+ - Updated dependencies [47744fc]
146
+ - @forge/manifest@3.1.1-next.1
147
+
148
+ ## 2.2.2-next.0
149
+
150
+ ### Patch Changes
151
+
152
+ - Updated dependencies [2c635f9]
153
+ - @forge/manifest@3.1.1-next.0
154
+
155
+ ## 2.2.1
156
+
157
+ ### Patch Changes
158
+
159
+ - Updated dependencies [debe251]
160
+ - Updated dependencies [037c31a5]
161
+ - Updated dependencies [f6901fd]
9
162
  - Updated dependencies [813f8f3]
10
163
  - Updated dependencies [8ee1c58]
164
+ - Updated dependencies [67d2e17]
165
+ - Updated dependencies [14102be]
166
+ - Updated dependencies [7b2d17a]
167
+ - Updated dependencies [8aaa65c]
168
+ - Updated dependencies [d3ccc04]
11
169
  - Updated dependencies [5152239]
12
- - @forge/manifest@0.0.0-experimental-7c72fec
170
+ - @forge/manifest@3.1.0
171
+ - @forge/util@1.1.0
172
+
173
+ ## 2.2.1-next.9
174
+
175
+ ### Patch Changes
176
+
177
+ - Updated dependencies [8aaa65c]
178
+ - @forge/manifest@3.1.0-next.9
179
+
180
+ ## 2.2.1-next.8
181
+
182
+ ### Patch Changes
183
+
184
+ - Updated dependencies [67d2e17c]
185
+ - @forge/manifest@3.1.0-next.8
186
+
187
+ ## 2.2.1-next.7
188
+
189
+ ### Patch Changes
190
+
191
+ - Updated dependencies [037c31a]
192
+ - @forge/manifest@3.1.0-next.7
193
+ - @forge/util@1.1.0-next.0
194
+
195
+ ## 2.2.1-next.6
196
+
197
+ ### Patch Changes
198
+
199
+ - Updated dependencies [7b2d17a]
200
+ - @forge/manifest@3.1.0-next.6
201
+
202
+ ## 2.2.1-next.5
203
+
204
+ ### Patch Changes
205
+
206
+ - Updated dependencies [f6901fd]
207
+ - @forge/manifest@3.1.0-next.5
208
+
209
+ ## 2.2.1-next.4
210
+
211
+ ### Patch Changes
212
+
213
+ - Updated dependencies [d3ccc04]
214
+ - @forge/manifest@3.1.0-next.4
215
+
216
+ ## 2.2.1-next.3
217
+
218
+ ### Patch Changes
219
+
220
+ - Updated dependencies [debe251]
221
+ - @forge/manifest@3.1.0-next.3
222
+
223
+ ## 2.2.1-next.2
224
+
225
+ ### Patch Changes
226
+
227
+ - Updated dependencies [14102be]
228
+ - @forge/manifest@3.1.0-next.2
229
+
230
+ ## 2.2.1-next.1
231
+
232
+ ### Patch Changes
233
+
234
+ - Updated dependencies [8ee1c58]
235
+ - @forge/manifest@3.1.0-next.1
13
236
 
14
237
  ## 2.2.1-next.0
15
238
 
@@ -17,7 +17,7 @@ export interface TemplateLister {
17
17
  export interface Templater extends TemplateLister {
18
18
  downloadAndExtract(template: string, directory: string): Promise<void>;
19
19
  }
20
- export declare class BitbucketTemplateDownloader implements TemplateDownloader {
20
+ export declare class TemplateServiceDownloader implements TemplateDownloader {
21
21
  download(template: string, zipFile: string): Promise<void>;
22
22
  private buildZipUrl;
23
23
  }
@@ -30,7 +30,9 @@ export declare class ZipTemplateExtractor implements TemplateExtractor {
30
30
  export declare class TemplateFetchError extends Error {
31
31
  constructor();
32
32
  }
33
- export declare class BitbucketTemplateLister implements TemplateLister {
33
+ export declare class TemplateServiceLister implements TemplateLister {
34
+ private isValidTemplateMapEntry;
35
+ private isValidTemplatesResponse;
34
36
  getAvailableTemplates(): Promise<string[]>;
35
37
  }
36
38
  export declare class ComposableTemplater implements Templater {
@@ -1 +1 @@
1
- {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/apps/template.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAK/B,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,QAAQ,EAAE,MAAM;CAG7B;AAED,qBAAa,2BAA4B,SAAQ,KAAK;CAAG;AAEzD,MAAM,WA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,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAc7D,2BAA2B;CAqB1C;AAED,qBAAa,kBAAmB,SAAQ,KAAK;;CAI5C;AAKD,qBAAa,qBAAsB,YAAW,cAAc;IAC1D,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,wBAAwB;IAOnB,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAkBxD;AAED,qBAAa,mBAAoB,YAAW,SAAS;IAEjD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAHN,UAAU,EAAE,kBAAkB,EAC9B,SAAS,EAAE,iBAAiB,EAC5B,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM;IAEpB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBnF,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAG3C"}
@@ -1,16 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ComposableTemplater = exports.BitbucketTemplateLister = exports.TemplateFetchError = exports.ZipTemplateExtractor = exports.BitbucketTemplateDownloader = exports.InvalidTemplateArchiveError = exports.NoTemplateError = void 0;
3
+ exports.ComposableTemplater = exports.TemplateServiceLister = exports.TemplateFetchError = exports.ZipTemplateExtractor = exports.TemplateServiceDownloader = exports.InvalidTemplateArchiveError = exports.NoTemplateError = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const fs_1 = tslib_1.__importDefault(require("fs"));
6
6
  const fs_extra_1 = require("fs-extra");
7
- const https_1 = require("https");
8
7
  const ignore_walk_1 = tslib_1.__importDefault(require("ignore-walk"));
9
8
  const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
10
9
  const path_1 = require("path");
11
10
  const tmp_1 = tslib_1.__importDefault(require("tmp"));
11
+ const url_1 = require("url");
12
12
  const ui_1 = require("../ui");
13
- const BITBUCKET_PROJECT = 'XTEM';
13
+ const TEMPLATE_SERVICE_URL = 'https://forge-templates.us-west-2.prod.public.atl-paas.net/';
14
+ const TEMPLATE_MAP = 'templates.json';
14
15
  class NoTemplateError extends Error {
15
16
  constructor(template) {
16
17
  super(ui_1.Text.create.error.template.notFound(template));
@@ -20,27 +21,24 @@ exports.NoTemplateError = NoTemplateError;
20
21
  class InvalidTemplateArchiveError extends Error {
21
22
  }
22
23
  exports.InvalidTemplateArchiveError = InvalidTemplateArchiveError;
23
- class BitbucketTemplateDownloader {
24
+ class TemplateServiceDownloader {
24
25
  async download(template, zipFile) {
25
- return new Promise((resolve, reject) => {
26
- const zipUrl = this.buildZipUrl(template);
27
- const fileStream = fs_1.default.createWriteStream(zipFile);
28
- const downloadRequest = https_1.request(zipUrl, (res) => {
29
- if (res.statusCode !== 200) {
30
- reject(new NoTemplateError(template));
31
- return;
32
- }
33
- res.pipe(fileStream);
34
- });
35
- downloadRequest.end();
26
+ const zipUrl = this.buildZipUrl(template);
27
+ const fileStream = fs_1.default.createWriteStream(zipFile);
28
+ const response = await node_fetch_1.default(zipUrl);
29
+ if (!response.ok) {
30
+ throw new NoTemplateError(template);
31
+ }
32
+ await new Promise((resolve) => {
36
33
  fileStream.on('finish', resolve);
34
+ response.body.pipe(fileStream);
37
35
  });
38
36
  }
39
37
  buildZipUrl(template) {
40
- return `https://bitbucket.org/atlassian/${template}/get/master.zip`;
38
+ return new url_1.URL(`${template}.zip`, TEMPLATE_SERVICE_URL);
41
39
  }
42
40
  }
43
- exports.BitbucketTemplateDownloader = BitbucketTemplateDownloader;
41
+ exports.TemplateServiceDownloader = TemplateServiceDownloader;
44
42
  class ZipTemplateExtractor {
45
43
  constructor(zipAccessor) {
46
44
  this.zipAccessor = zipAccessor;
@@ -80,22 +78,36 @@ class TemplateFetchError extends Error {
80
78
  }
81
79
  }
82
80
  exports.TemplateFetchError = TemplateFetchError;
83
- class BitbucketTemplateLister {
81
+ class TemplateServiceLister {
82
+ isValidTemplateMapEntry(entry) {
83
+ return typeof entry === 'object' && entry !== null && typeof entry.name === 'string';
84
+ }
85
+ isValidTemplatesResponse(response) {
86
+ if (Array.isArray(response)) {
87
+ return response.every((curr) => this.isValidTemplateMapEntry(curr));
88
+ }
89
+ return false;
90
+ }
84
91
  async getAvailableTemplates() {
85
92
  try {
86
- const res = await node_fetch_1.default(`https://api.bitbucket.org/2.0/repositories/atlassian?q=project.key=%22${BITBUCKET_PROJECT}%22&sort=name&pagelen=50`);
93
+ const res = await node_fetch_1.default(new url_1.URL(TEMPLATE_MAP, TEMPLATE_SERVICE_URL));
87
94
  if (!res.ok) {
88
95
  throw new TemplateFetchError();
89
96
  }
90
97
  const json = await res.json();
91
- return json.values.map((repo) => repo.name);
98
+ if (this.isValidTemplatesResponse(json)) {
99
+ return json.map(({ name }) => name);
100
+ }
101
+ else {
102
+ throw new TemplateFetchError();
103
+ }
92
104
  }
93
105
  catch (e) {
94
106
  throw new TemplateFetchError();
95
107
  }
96
108
  }
97
109
  }
98
- exports.BitbucketTemplateLister = BitbucketTemplateLister;
110
+ exports.TemplateServiceLister = TemplateServiceLister;
99
111
  class ComposableTemplater {
100
112
  constructor(downloader, extractor, lister, logger) {
101
113
  this.downloader = downloader;