@forge/cli-shared 0.0.0-experimental-64caa5a → 0.0.0-experimental-490cfcf

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,40 +1,383 @@
1
1
  # @forge/cli-shared
2
2
 
3
- ## 0.0.0-experimental-64caa5a
3
+ ## 0.0.0-experimental-490cfcf
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [54bf134]
8
+ - Updated dependencies [2484683]
9
+ - @forge/manifest@0.0.0-experimental-490cfcf
10
+
11
+ ## 2.3.1-next.1
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [24846832]
16
+ - @forge/manifest@3.3.1-next.1
17
+
18
+ ## 2.3.1-next.0
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [54bf134]
23
+ - @forge/manifest@3.3.1-next.0
24
+
25
+ ## 2.3.0
26
+
27
+ ### Minor Changes
28
+
29
+ - 949bd40: The @forge/cli will now download templates from a new service (previously bitbucket), old versions of the CLI won't receive template updates
30
+ - cf2420d: Added root package.json and lock files to app bundle.
31
+
32
+ ### Patch Changes
33
+
34
+ - 47a71a6: Upgrade graphql-request for node 16 compatibility
35
+ - Updated dependencies [88e57a12]
36
+ - Updated dependencies [fcd9580]
37
+ - Updated dependencies [6c44d2b]
38
+ - Updated dependencies [e95919f]
39
+ - Updated dependencies [e822a8a]
40
+ - Updated dependencies [720953f]
41
+ - Updated dependencies [2420378]
42
+ - Updated dependencies [051ed1f]
43
+ - Updated dependencies [ad94136]
44
+ - Updated dependencies [e65d33e]
45
+ - Updated dependencies [ae111cd]
46
+ - Updated dependencies [8e35955]
47
+ - Updated dependencies [c255b24]
48
+ - Updated dependencies [f894871]
49
+ - @forge/util@1.2.0
50
+ - @forge/manifest@3.3.0
51
+
52
+ ## 2.3.0-next.11
53
+
54
+ ### Patch Changes
55
+
56
+ - Updated dependencies [720953f]
57
+ - @forge/manifest@3.3.0-next.9
58
+
59
+ ## 2.3.0-next.10
60
+
61
+ ### Patch Changes
62
+
63
+ - 47a71a62: Upgrade graphql-request for node 16 compatibility
64
+ - Updated dependencies [fcd95803]
65
+ - Updated dependencies [e65d33e6]
66
+ - @forge/manifest@3.3.0-next.8
67
+
68
+ ## 2.3.0-next.9
69
+
70
+ ### Minor Changes
71
+
72
+ - cf2420d2: Added root package.json and lock files to app bundle.
73
+
74
+ ## 2.3.0-next.8
75
+
76
+ ### Patch Changes
77
+
78
+ - Updated dependencies [8e35955]
79
+ - @forge/manifest@3.3.0-next.7
80
+
81
+ ## 2.3.0-next.7
82
+
83
+ ### Patch Changes
84
+
85
+ - Updated dependencies [ad94136]
86
+ - @forge/manifest@3.3.0-next.6
87
+
88
+ ## 2.3.0-next.6
89
+
90
+ ### Patch Changes
91
+
92
+ - Updated dependencies [e95919f]
93
+ - Updated dependencies [f894871]
94
+ - @forge/manifest@3.3.0-next.5
95
+
96
+ ## 2.3.0-next.5
97
+
98
+ ### Patch Changes
99
+
100
+ - Updated dependencies [ae111cd]
101
+ - @forge/manifest@3.3.0-next.4
102
+
103
+ ## 2.3.0-next.4
104
+
105
+ ### Patch Changes
106
+
107
+ - Updated dependencies [6c44d2b]
108
+ - Updated dependencies [051ed1f]
109
+ - @forge/manifest@3.3.0-next.3
110
+
111
+ ## 2.3.0-next.3
112
+
113
+ ### Patch Changes
114
+
115
+ - Updated dependencies [88e57a1]
116
+ - Updated dependencies [e822a8a]
117
+ - Updated dependencies [c255b24]
118
+ - @forge/util@1.2.0-next.0
119
+ - @forge/manifest@3.3.0-next.2
120
+
121
+ ## 2.3.0-next.2
122
+
123
+ ### Patch Changes
124
+
125
+ - Updated dependencies [24203783]
126
+ - @forge/manifest@3.3.0-next.1
127
+
128
+ ## 2.3.0-next.1
129
+
130
+ ### Patch Changes
131
+
132
+ - Updated dependencies [c145946]
133
+ - @forge/manifest@3.3.0-next.0
134
+
135
+ ## 2.3.0-next.0
136
+
137
+ ### Minor Changes
138
+
139
+ - 949bd40: The @forge/cli will now download templates from a new service (previously bitbucket), old versions of the CLI won't receive template updates
140
+
141
+ ## 2.2.2
142
+
143
+ ### Patch Changes
144
+
145
+ - Updated dependencies [7f869f7]
146
+ - Updated dependencies [72e020c]
147
+ - Updated dependencies [b2cef71]
148
+ - Updated dependencies [254b239]
149
+ - Updated dependencies [47744fc]
150
+ - Updated dependencies [860c4fb]
151
+ - Updated dependencies [66e969f]
152
+ - Updated dependencies [2c635f9]
153
+ - @forge/manifest@3.2.0
154
+
155
+ ## 2.2.2-next.6
156
+
157
+ ### Patch Changes
158
+
159
+ - Updated dependencies [860c4fb0]
160
+ - @forge/manifest@3.2.0-next.6
161
+
162
+ ## 2.2.2-next.5
163
+
164
+ ### Patch Changes
165
+
166
+ - Updated dependencies [72e020c]
167
+ - @forge/manifest@3.2.0-next.5
168
+
169
+ ## 2.2.2-next.4
170
+
171
+ ### Patch Changes
172
+
173
+ - Updated dependencies [254b2397]
174
+ - @forge/manifest@3.2.0-next.4
175
+
176
+ ## 2.2.2-next.3
177
+
178
+ ### Patch Changes
179
+
180
+ - Updated dependencies [b2cef71d]
181
+ - @forge/manifest@3.2.0-next.3
182
+
183
+ ## 2.2.2-next.2
184
+
185
+ ### Patch Changes
186
+
187
+ - Updated dependencies [7f869f7]
188
+ - @forge/manifest@3.2.0-next.2
189
+
190
+ ## 2.2.2-next.1
191
+
192
+ ### Patch Changes
193
+
194
+ - Updated dependencies [47744fc]
195
+ - @forge/manifest@3.1.1-next.1
196
+
197
+ ## 2.2.2-next.0
198
+
199
+ ### Patch Changes
200
+
201
+ - Updated dependencies [2c635f9]
202
+ - @forge/manifest@3.1.1-next.0
203
+
204
+ ## 2.2.1
205
+
206
+ ### Patch Changes
207
+
208
+ - Updated dependencies [debe251]
209
+ - Updated dependencies [037c31a5]
210
+ - Updated dependencies [f6901fd]
211
+ - Updated dependencies [813f8f3]
212
+ - Updated dependencies [8ee1c58]
213
+ - Updated dependencies [67d2e17]
214
+ - Updated dependencies [14102be]
215
+ - Updated dependencies [7b2d17a]
216
+ - Updated dependencies [8aaa65c]
217
+ - Updated dependencies [d3ccc04]
218
+ - Updated dependencies [5152239]
219
+ - @forge/manifest@3.1.0
220
+ - @forge/util@1.1.0
221
+
222
+ ## 2.2.1-next.9
223
+
224
+ ### Patch Changes
225
+
226
+ - Updated dependencies [8aaa65c]
227
+ - @forge/manifest@3.1.0-next.9
228
+
229
+ ## 2.2.1-next.8
230
+
231
+ ### Patch Changes
232
+
233
+ - Updated dependencies [67d2e17c]
234
+ - @forge/manifest@3.1.0-next.8
235
+
236
+ ## 2.2.1-next.7
237
+
238
+ ### Patch Changes
239
+
240
+ - Updated dependencies [037c31a]
241
+ - @forge/manifest@3.1.0-next.7
242
+ - @forge/util@1.1.0-next.0
243
+
244
+ ## 2.2.1-next.6
245
+
246
+ ### Patch Changes
247
+
248
+ - Updated dependencies [7b2d17a]
249
+ - @forge/manifest@3.1.0-next.6
250
+
251
+ ## 2.2.1-next.5
252
+
253
+ ### Patch Changes
254
+
255
+ - Updated dependencies [f6901fd]
256
+ - @forge/manifest@3.1.0-next.5
257
+
258
+ ## 2.2.1-next.4
259
+
260
+ ### Patch Changes
261
+
262
+ - Updated dependencies [d3ccc04]
263
+ - @forge/manifest@3.1.0-next.4
264
+
265
+ ## 2.2.1-next.3
266
+
267
+ ### Patch Changes
268
+
269
+ - Updated dependencies [debe251]
270
+ - @forge/manifest@3.1.0-next.3
271
+
272
+ ## 2.2.1-next.2
273
+
274
+ ### Patch Changes
275
+
276
+ - Updated dependencies [14102be]
277
+ - @forge/manifest@3.1.0-next.2
278
+
279
+ ## 2.2.1-next.1
280
+
281
+ ### Patch Changes
282
+
283
+ - Updated dependencies [8ee1c58]
284
+ - @forge/manifest@3.1.0-next.1
285
+
286
+ ## 2.2.1-next.0
287
+
288
+ ### Patch Changes
289
+
290
+ - Updated dependencies [813f8f3]
291
+ - Updated dependencies [5152239]
292
+ - @forge/manifest@3.1.0-next.0
293
+
294
+ ## 2.2.0
4
295
 
5
296
  ### Minor Changes
6
297
 
7
- - f4c23d3: Support workspace installation for Forge App
8
- - 5bf2ff0: Add support for workspace app installation and upgrade
9
298
  - b63af27: Refactor templates code to be more generic in order to ease implementing other templating methods
10
299
 
11
300
  ### Patch Changes
12
301
 
13
- - 2338be5: Handle the manifest case of remotes found in the egress permissions section when installing an app
302
+ - 1dba082: Handle the manifest case of remotes found in the egress permissions section when installing an app
14
303
  - Updated dependencies [bd6e025]
15
- - Updated dependencies [a0a2c5b]
304
+ - Updated dependencies [1c196ff]
305
+ - Updated dependencies [271b98a]
306
+ - Updated dependencies [4cfa56d]
16
307
  - Updated dependencies [22a488e]
17
- - Updated dependencies [62089be]
308
+ - Updated dependencies [218fe20]
309
+ - Updated dependencies [2bca1c0]
18
310
  - Updated dependencies [689c09b]
19
311
  - Updated dependencies [b97660c]
20
312
  - Updated dependencies [7c0d2ee]
21
- - Updated dependencies [06209fc]
313
+ - Updated dependencies [1dba082]
22
314
  - Updated dependencies [d3afe01]
23
315
  - Updated dependencies [dfe9dd8]
24
316
  - Updated dependencies [91ea057]
25
317
  - Updated dependencies [3010f0e]
26
318
  - Updated dependencies [2b7c32b]
319
+ - Updated dependencies [e7ee3a7]
27
320
  - Updated dependencies [92d081d]
28
321
  - Updated dependencies [d3c8c8d]
322
+ - Updated dependencies [fca240d]
29
323
  - Updated dependencies [36c7c8f]
30
324
  - Updated dependencies [d2f6992]
31
- - Updated dependencies [a017696]
325
+ - Updated dependencies [d18c9f1]
326
+ - Updated dependencies [1dba082]
327
+ - Updated dependencies [fa963b1]
32
328
  - Updated dependencies [0a7725f]
33
- - Updated dependencies [af1473c]
329
+ - Updated dependencies [1dba082]
34
330
  - Updated dependencies [e4a14c7]
35
331
  - Updated dependencies [2bb89c5]
332
+ - Updated dependencies [5875eb3]
36
333
  - Updated dependencies [0a39c43]
37
- - @forge/manifest@0.0.0-experimental-64caa5a
334
+ - @forge/manifest@3.0.0
335
+
336
+ ## 2.2.0-next.22
337
+
338
+ ### Patch Changes
339
+
340
+ - Updated dependencies [4cfa56d]
341
+ - Updated dependencies [fca240d]
342
+ - @forge/manifest@3.0.0-next.21
343
+
344
+ ## 2.2.0-next.21
345
+
346
+ ### Patch Changes
347
+
348
+ - Updated dependencies [271b98a]
349
+ - Updated dependencies [2bca1c0]
350
+ - @forge/manifest@2.6.0-next.20
351
+
352
+ ## 2.2.0-next.20
353
+
354
+ ### Patch Changes
355
+
356
+ - Updated dependencies [d18c9f1]
357
+ - Updated dependencies [5875eb3]
358
+ - @forge/manifest@2.6.0-next.19
359
+
360
+ ## 2.2.0-next.19
361
+
362
+ ### Patch Changes
363
+
364
+ - Updated dependencies [1c196ff]
365
+ - Updated dependencies [e7ee3a7]
366
+ - @forge/manifest@2.6.0-next.18
367
+
368
+ ## 2.2.0-next.18
369
+
370
+ ### Patch Changes
371
+
372
+ - Updated dependencies [fa963b1]
373
+ - @forge/manifest@2.6.0-next.17
374
+
375
+ ## 2.2.0-next.17
376
+
377
+ ### Patch Changes
378
+
379
+ - Updated dependencies [218fe20]
380
+ - @forge/manifest@2.6.0-next.16
38
381
 
39
382
  ## 2.2.0-next.16
40
383
 
@@ -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 ComposableT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AAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE;AAED,qBAAa,yBAA0B,YAAW,kBAAkB;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAevE,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,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;
@@ -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';