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

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,421 @@
1
1
  # @forge/cli-shared
2
2
 
3
- ## 0.0.0-experimental-7c72fec
3
+ ## 0.0.0-experimental-edeb51b
4
+
5
+ ### Minor Changes
6
+
7
+ - f33aada: Fix vulnerability dependencies
8
+ - 726ef79: Fix dependency vulnerabilities
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies [d094c69]
13
+ - Updated dependencies [ba67459]
14
+ - Updated dependencies [d196b41]
15
+ - Updated dependencies [e411a29]
16
+ - Updated dependencies [0accde8]
17
+ - Updated dependencies [a3bfe81]
18
+ - Updated dependencies [02839be]
19
+ - Updated dependencies [ffb508a]
20
+ - @forge/manifest@0.0.0-experimental-edeb51b
21
+
22
+ ## 2.4.0-next.6
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [d196b41]
27
+ - @forge/manifest@3.5.0-next.5
28
+
29
+ ## 2.4.0-next.5
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies [e411a29]
34
+ - @forge/manifest@3.5.0-next.4
35
+
36
+ ## 2.4.0-next.4
37
+
38
+ ### Patch Changes
39
+
40
+ - Updated dependencies [d094c69]
41
+ - @forge/manifest@3.5.0-next.3
42
+
43
+ ## 2.4.0-next.3
44
+
45
+ ### Minor Changes
46
+
47
+ - f33aada8: Fix vulnerability dependencies
48
+ - 726ef79d: Fix dependency vulnerabilities
49
+
50
+ ## 2.3.2-next.2
51
+
52
+ ### Patch Changes
53
+
54
+ - Updated dependencies [02839be]
55
+ - @forge/manifest@3.5.0-next.2
56
+
57
+ ## 2.3.2-next.1
58
+
59
+ ### Patch Changes
60
+
61
+ - Updated dependencies [a3bfe81]
62
+ - @forge/manifest@3.5.0-next.1
63
+
64
+ ## 2.3.2-next.0
65
+
66
+ ### Patch Changes
67
+
68
+ - Updated dependencies [ba674590]
69
+ - @forge/manifest@3.5.0-next.0
70
+
71
+ ## 2.3.1
72
+
73
+ ### Patch Changes
74
+
75
+ - Updated dependencies [64dd525]
76
+ - Updated dependencies [8e2c90f]
77
+ - Updated dependencies [1c6c578]
78
+ - Updated dependencies [8b4fede]
79
+ - Updated dependencies [54bf134]
80
+ - Updated dependencies [10f147f]
81
+ - Updated dependencies [2484683]
82
+ - Updated dependencies [1a8a4bb]
83
+ - Updated dependencies [e0a44d4]
84
+ - Updated dependencies [19820d3]
85
+ - Updated dependencies [1ca8bbc]
86
+ - @forge/manifest@3.4.0
87
+
88
+ ## 2.3.1-next.9
89
+
90
+ ### Patch Changes
91
+
92
+ - Updated dependencies [19820d3]
93
+ - @forge/manifest@3.4.0-next.9
94
+
95
+ ## 2.3.1-next.8
96
+
97
+ ### Patch Changes
98
+
99
+ - Updated dependencies [8e2c90f]
100
+ - @forge/manifest@3.4.0-next.8
101
+
102
+ ## 2.3.1-next.7
103
+
104
+ ### Patch Changes
105
+
106
+ - Updated dependencies [e0a44d40]
107
+ - @forge/manifest@3.4.0-next.7
108
+
109
+ ## 2.3.1-next.6
110
+
111
+ ### Patch Changes
112
+
113
+ - Updated dependencies [1ca8bbc9]
114
+ - @forge/manifest@3.4.0-next.6
115
+
116
+ ## 2.3.1-next.5
117
+
118
+ ### Patch Changes
119
+
120
+ - Updated dependencies [1c6c578]
121
+ - @forge/manifest@3.4.0-next.5
122
+
123
+ ## 2.3.1-next.4
124
+
125
+ ### Patch Changes
126
+
127
+ - Updated dependencies [64dd525]
128
+ - Updated dependencies [10f147f]
129
+ - @forge/manifest@3.4.0-next.4
130
+
131
+ ## 2.3.1-next.3
132
+
133
+ ### Patch Changes
134
+
135
+ - Updated dependencies [1a8a4bb]
136
+ - @forge/manifest@3.3.1-next.3
137
+
138
+ ## 2.3.1-next.2
139
+
140
+ ### Patch Changes
141
+
142
+ - Updated dependencies [8b4fede]
143
+ - @forge/manifest@3.3.1-next.2
144
+
145
+ ## 2.3.1-next.1
146
+
147
+ ### Patch Changes
148
+
149
+ - Updated dependencies [24846832]
150
+ - @forge/manifest@3.3.1-next.1
151
+
152
+ ## 2.3.1-next.0
153
+
154
+ ### Patch Changes
155
+
156
+ - Updated dependencies [54bf134]
157
+ - @forge/manifest@3.3.1-next.0
158
+
159
+ ## 2.3.0
160
+
161
+ ### Minor Changes
162
+
163
+ - 949bd40: The @forge/cli will now download templates from a new service (previously bitbucket), old versions of the CLI won't receive template updates
164
+ - cf2420d: Added root package.json and lock files to app bundle.
165
+
166
+ ### Patch Changes
167
+
168
+ - 47a71a6: Upgrade graphql-request for node 16 compatibility
169
+ - Updated dependencies [88e57a12]
170
+ - Updated dependencies [fcd9580]
171
+ - Updated dependencies [6c44d2b]
172
+ - Updated dependencies [e95919f]
173
+ - Updated dependencies [e822a8a]
174
+ - Updated dependencies [720953f]
175
+ - Updated dependencies [2420378]
176
+ - Updated dependencies [051ed1f]
177
+ - Updated dependencies [ad94136]
178
+ - Updated dependencies [e65d33e]
179
+ - Updated dependencies [ae111cd]
180
+ - Updated dependencies [8e35955]
181
+ - Updated dependencies [c255b24]
182
+ - Updated dependencies [f894871]
183
+ - @forge/util@1.2.0
184
+ - @forge/manifest@3.3.0
185
+
186
+ ## 2.3.0-next.11
187
+
188
+ ### Patch Changes
189
+
190
+ - Updated dependencies [720953f]
191
+ - @forge/manifest@3.3.0-next.9
192
+
193
+ ## 2.3.0-next.10
194
+
195
+ ### Patch Changes
196
+
197
+ - 47a71a62: Upgrade graphql-request for node 16 compatibility
198
+ - Updated dependencies [fcd95803]
199
+ - Updated dependencies [e65d33e6]
200
+ - @forge/manifest@3.3.0-next.8
201
+
202
+ ## 2.3.0-next.9
203
+
204
+ ### Minor Changes
205
+
206
+ - cf2420d2: Added root package.json and lock files to app bundle.
207
+
208
+ ## 2.3.0-next.8
209
+
210
+ ### Patch Changes
211
+
212
+ - Updated dependencies [8e35955]
213
+ - @forge/manifest@3.3.0-next.7
214
+
215
+ ## 2.3.0-next.7
216
+
217
+ ### Patch Changes
218
+
219
+ - Updated dependencies [ad94136]
220
+ - @forge/manifest@3.3.0-next.6
221
+
222
+ ## 2.3.0-next.6
223
+
224
+ ### Patch Changes
225
+
226
+ - Updated dependencies [e95919f]
227
+ - Updated dependencies [f894871]
228
+ - @forge/manifest@3.3.0-next.5
229
+
230
+ ## 2.3.0-next.5
231
+
232
+ ### Patch Changes
233
+
234
+ - Updated dependencies [ae111cd]
235
+ - @forge/manifest@3.3.0-next.4
236
+
237
+ ## 2.3.0-next.4
238
+
239
+ ### Patch Changes
240
+
241
+ - Updated dependencies [6c44d2b]
242
+ - Updated dependencies [051ed1f]
243
+ - @forge/manifest@3.3.0-next.3
244
+
245
+ ## 2.3.0-next.3
246
+
247
+ ### Patch Changes
248
+
249
+ - Updated dependencies [88e57a1]
250
+ - Updated dependencies [e822a8a]
251
+ - Updated dependencies [c255b24]
252
+ - @forge/util@1.2.0-next.0
253
+ - @forge/manifest@3.3.0-next.2
254
+
255
+ ## 2.3.0-next.2
256
+
257
+ ### Patch Changes
258
+
259
+ - Updated dependencies [24203783]
260
+ - @forge/manifest@3.3.0-next.1
261
+
262
+ ## 2.3.0-next.1
4
263
 
5
264
  ### Patch Changes
6
265
 
7
- - Updated dependencies [7c72fec]
8
266
  - Updated dependencies [c145946]
267
+ - @forge/manifest@3.3.0-next.0
268
+
269
+ ## 2.3.0-next.0
270
+
271
+ ### Minor Changes
272
+
273
+ - 949bd40: The @forge/cli will now download templates from a new service (previously bitbucket), old versions of the CLI won't receive template updates
274
+
275
+ ## 2.2.2
276
+
277
+ ### Patch Changes
278
+
279
+ - Updated dependencies [7f869f7]
280
+ - Updated dependencies [72e020c]
281
+ - Updated dependencies [b2cef71]
282
+ - Updated dependencies [254b239]
283
+ - Updated dependencies [47744fc]
284
+ - Updated dependencies [860c4fb]
285
+ - Updated dependencies [66e969f]
286
+ - Updated dependencies [2c635f9]
287
+ - @forge/manifest@3.2.0
288
+
289
+ ## 2.2.2-next.6
290
+
291
+ ### Patch Changes
292
+
293
+ - Updated dependencies [860c4fb0]
294
+ - @forge/manifest@3.2.0-next.6
295
+
296
+ ## 2.2.2-next.5
297
+
298
+ ### Patch Changes
299
+
300
+ - Updated dependencies [72e020c]
301
+ - @forge/manifest@3.2.0-next.5
302
+
303
+ ## 2.2.2-next.4
304
+
305
+ ### Patch Changes
306
+
307
+ - Updated dependencies [254b2397]
308
+ - @forge/manifest@3.2.0-next.4
309
+
310
+ ## 2.2.2-next.3
311
+
312
+ ### Patch Changes
313
+
314
+ - Updated dependencies [b2cef71d]
315
+ - @forge/manifest@3.2.0-next.3
316
+
317
+ ## 2.2.2-next.2
318
+
319
+ ### Patch Changes
320
+
321
+ - Updated dependencies [7f869f7]
322
+ - @forge/manifest@3.2.0-next.2
323
+
324
+ ## 2.2.2-next.1
325
+
326
+ ### Patch Changes
327
+
328
+ - Updated dependencies [47744fc]
329
+ - @forge/manifest@3.1.1-next.1
330
+
331
+ ## 2.2.2-next.0
332
+
333
+ ### Patch Changes
334
+
335
+ - Updated dependencies [2c635f9]
336
+ - @forge/manifest@3.1.1-next.0
337
+
338
+ ## 2.2.1
339
+
340
+ ### Patch Changes
341
+
342
+ - Updated dependencies [debe251]
343
+ - Updated dependencies [037c31a5]
344
+ - Updated dependencies [f6901fd]
9
345
  - Updated dependencies [813f8f3]
10
346
  - Updated dependencies [8ee1c58]
347
+ - Updated dependencies [67d2e17]
348
+ - Updated dependencies [14102be]
349
+ - Updated dependencies [7b2d17a]
350
+ - Updated dependencies [8aaa65c]
351
+ - Updated dependencies [d3ccc04]
11
352
  - Updated dependencies [5152239]
12
- - @forge/manifest@0.0.0-experimental-7c72fec
353
+ - @forge/manifest@3.1.0
354
+ - @forge/util@1.1.0
355
+
356
+ ## 2.2.1-next.9
357
+
358
+ ### Patch Changes
359
+
360
+ - Updated dependencies [8aaa65c]
361
+ - @forge/manifest@3.1.0-next.9
362
+
363
+ ## 2.2.1-next.8
364
+
365
+ ### Patch Changes
366
+
367
+ - Updated dependencies [67d2e17c]
368
+ - @forge/manifest@3.1.0-next.8
369
+
370
+ ## 2.2.1-next.7
371
+
372
+ ### Patch Changes
373
+
374
+ - Updated dependencies [037c31a]
375
+ - @forge/manifest@3.1.0-next.7
376
+ - @forge/util@1.1.0-next.0
377
+
378
+ ## 2.2.1-next.6
379
+
380
+ ### Patch Changes
381
+
382
+ - Updated dependencies [7b2d17a]
383
+ - @forge/manifest@3.1.0-next.6
384
+
385
+ ## 2.2.1-next.5
386
+
387
+ ### Patch Changes
388
+
389
+ - Updated dependencies [f6901fd]
390
+ - @forge/manifest@3.1.0-next.5
391
+
392
+ ## 2.2.1-next.4
393
+
394
+ ### Patch Changes
395
+
396
+ - Updated dependencies [d3ccc04]
397
+ - @forge/manifest@3.1.0-next.4
398
+
399
+ ## 2.2.1-next.3
400
+
401
+ ### Patch Changes
402
+
403
+ - Updated dependencies [debe251]
404
+ - @forge/manifest@3.1.0-next.3
405
+
406
+ ## 2.2.1-next.2
407
+
408
+ ### Patch Changes
409
+
410
+ - Updated dependencies [14102be]
411
+ - @forge/manifest@3.1.0-next.2
412
+
413
+ ## 2.2.1-next.1
414
+
415
+ ### Patch Changes
416
+
417
+ - Updated dependencies [8ee1c58]
418
+ - @forge/manifest@3.1.0-next.1
13
419
 
14
420
  ## 2.2.1-next.0
15
421
 
@@ -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,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChE;AAED,MAAM,WAAW,cAAc;IAC7B,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,SAAU,SAAQ,cAAc;IAC/C,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE;AAED,qBAAa,2BAA4B,YAAW,kBAAkB;IACvD,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBvE,OAAO,CAAC,WAAW;CAGpB;AAED,qBAAa,oBAAqB,YAAW,iBAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAExC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,a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";
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;
@@ -30,23 +30,23 @@ class ConfigFile {
30
30
  return functions.map((funcs) => funcs.handler.split('.')[0]);
31
31
  }
32
32
  async readConfig() {
33
- const manifestFileContents = this.fileReader.readFile(_1.manifestFilename);
33
+ const manifestFileContents = this.fileReader.readFile(_1.manifestFileName);
34
34
  try {
35
35
  yaml_1.default.scalarOptions.null.nullStr = '';
36
36
  return yaml_1.parse(manifestFileContents);
37
37
  }
38
38
  catch (_a) {
39
- throw new ui_1.ValidationError(ui_1.Text.artifact.error.invalidYaml(_1.manifestFilename));
39
+ throw new ui_1.ValidationError(ui_1.Text.artifact.error.invalidYaml(_1.manifestFileName));
40
40
  }
41
41
  }
42
42
  async readConfigToDocument() {
43
- const manifestFileContents = this.fileReader.readFile(_1.manifestFilename);
43
+ const manifestFileContents = this.fileReader.readFile(_1.manifestFileName);
44
44
  if (manifestFileContents) {
45
45
  try {
46
46
  return yaml_1.parseDocument(manifestFileContents);
47
47
  }
48
48
  catch (_a) {
49
- throw new ui_1.ValidationError(ui_1.Text.artifact.error.invalidYaml(_1.manifestFilename));
49
+ throw new ui_1.ValidationError(ui_1.Text.artifact.error.invalidYaml(_1.manifestFileName));
50
50
  }
51
51
  }
52
52
  }
@@ -76,18 +76,18 @@ class ConfigFile {
76
76
  return actualModules;
77
77
  }
78
78
  async prependAppNameToModules(name) {
79
- const manifestFileContents = this.fileReader.readFile(_1.manifestFilename);
79
+ const manifestFileContents = this.fileReader.readFile(_1.manifestFileName);
80
80
  const currentConfigDoc = yaml_1.parseDocument(manifestFileContents || '');
81
81
  const modules = currentConfigDoc.get('modules');
82
82
  if (modules && modules.type === util_1.Type.MAP) {
83
83
  const modulesObject = modules.toJSON();
84
84
  const modulesWithUniqueName = this.makeManifestUnique(modulesObject, name);
85
85
  currentConfigDoc.set('modules', modulesWithUniqueName);
86
- this.fileWriter.writeStringToFile(currentConfigDoc.toString(), _1.manifestFilename);
86
+ this.fileWriter.writeStringToFile(currentConfigDoc.toString(), _1.manifestFileName);
87
87
  }
88
88
  }
89
89
  async writeToConfigFile(configKey, config) {
90
- const manifestFileContents = this.fileReader.readFile(_1.manifestFilename);
90
+ const manifestFileContents = this.fileReader.readFile(_1.manifestFileName);
91
91
  const currentConfigDoc = yaml_1.parseDocument(manifestFileContents || '');
92
92
  Object.keys(config).forEach((key) => {
93
93
  if (config[key] === undefined) {
@@ -95,7 +95,7 @@ class ConfigFile {
95
95
  }
96
96
  });
97
97
  currentConfigDoc.set(configKey, config);
98
- this.fileWriter.writeStringToFile(currentConfigDoc.toString(), _1.manifestFilename);
98
+ this.fileWriter.writeStringToFile(currentConfigDoc.toString(), _1.manifestFileName);
99
99
  }
100
100
  getHostedResourceKeys(modules) {
101
101
  const resourceKeys = [];
@@ -1,5 +1,6 @@
1
1
  import { ManifestSchema, Resources } from '@forge/manifest';
2
- export declare const manifestFilename = "manifest.yml";
2
+ export declare const manifestFileName = "manifest.yml";
3
+ export declare const dependencyFileNames: string[];
3
4
  export interface BaseModule {
4
5
  key: string;
5
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5D,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAE/C,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,qBAAsB,SAAQ,UAAU;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,YAAY;IAC3B,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9F,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD;AAED,eAAO,MAAM,gBAAgB,aAAc,GAAG,0BAG7C,CAAC;AAEF,eAAO,MAAM,sBAAsB,WAAY,GAAG,oCAGjD,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5D,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAC/C,eAAO,MAAM,mBAAmB,UAAuE,CAAC;AAExG,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,qBAAsB,SAAQ,UAAU;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,YAAY;IAC3B,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9F,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD;AAED,eAAO,MAAM,gBAAgB,aAAc,GAAG,0BAG7C,CAAC;AAEF,eAAO,MAAM,sBAAsB,WAAY,GAAG,oCAGjD,CAAC"}
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isHostedResourceModule = exports.validateResource = exports.manifestFilename = void 0;
4
- exports.manifestFilename = 'manifest.yml';
3
+ exports.isHostedResourceModule = exports.validateResource = exports.dependencyFileNames = exports.manifestFileName = void 0;
4
+ exports.manifestFileName = 'manifest.yml';
5
+ exports.dependencyFileNames = [exports.manifestFileName, 'package.json', 'package-lock.json', 'yarn.lock'];
5
6
  exports.validateResource = (resource) => {
6
7
  const { key, path } = resource;
7
8
  return typeof key === 'string' && typeof path === 'string';