@nordicsemiconductor/pc-nrfconnect-shared 198.0.0 → 199.0.0

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.
@@ -107,18 +107,6 @@ class FtpClient extends Client {
107
107
  });
108
108
  });
109
109
 
110
- createSourceDirectory = () =>
111
- new Promise<void>((resolve, reject) => {
112
- console.log(`Creating source directory ${this.sourceDir}`);
113
- this.ftpClient.mkdir(this.sourceDir, true, err => {
114
- if (err) {
115
- reject(new Error(`Failed to create source directory.`));
116
- } else {
117
- resolve();
118
- }
119
- });
120
- });
121
-
122
110
  changeWorkingDirectory = () =>
123
111
  new Promise<void>((resolve, reject) => {
124
112
  console.log(`Changing to directory ${this.sourceDir}`);
@@ -127,9 +115,7 @@ class FtpClient extends Client {
127
115
  reject(
128
116
  new Error(
129
117
  '\nError: Failed to change to directory. ' +
130
- 'Check whether it exists on the FTP server.\n' +
131
- 'If you want to create a new source, use the ' +
132
- '--create-source option.'
118
+ 'Check whether it exists on the FTP server.'
133
119
  )
134
120
  );
135
121
  } else {
@@ -140,9 +126,6 @@ class FtpClient extends Client {
140
126
 
141
127
  initialise = async () => {
142
128
  await this.connect();
143
- if (this.options.doCreateSource) {
144
- await this.createSourceDirectory();
145
- }
146
129
  await this.changeWorkingDirectory();
147
130
  };
148
131
 
@@ -287,7 +270,6 @@ const splitSourceAndAccessLevel = (sourceAndMaybeAccessLevel: string) => {
287
270
 
288
271
  interface Options {
289
272
  doPack: boolean;
290
- doCreateSource: boolean;
291
273
  deployOfficial: boolean;
292
274
  source: string;
293
275
  sourceName?: string;
@@ -316,12 +298,6 @@ const parseOptions = (): Options => {
316
298
  '-n, --no-pack',
317
299
  'Publish existing .tgz file at the root directory without npm pack.'
318
300
  )
319
- .option(
320
- '--create-source <source name>',
321
- 'Do not fail if the source specifiec with --source does not yet ' +
322
- 'exist but instead create a new source with this name ' +
323
- '(e.g. "Release Test").'
324
- )
325
301
  .parse();
326
302
 
327
303
  const options = program.opts();
@@ -332,9 +308,7 @@ const parseOptions = (): Options => {
332
308
 
333
309
  return {
334
310
  doPack: options.pack,
335
- doCreateSource: options.createSource != null,
336
311
  source,
337
- sourceName: options.createSource,
338
312
  deployOfficial,
339
313
  destination: options.destination,
340
314
  accessLevel,
@@ -410,23 +384,6 @@ const assertAppVersionIsValid = (
410
384
  }
411
385
  };
412
386
 
413
- const createBlankSourceJson = async (name: string) => {
414
- try {
415
- await client.download('source.json');
416
- } catch {
417
- // Expected that the download throws an exception,
418
- // because the file is supposed to not exist yet
419
- return {
420
- name,
421
- apps: [],
422
- };
423
- }
424
-
425
- throw new Error(
426
- '`--create-source` given, but a `source.json` already exists on the server.'
427
- );
428
- };
429
-
430
387
  const downloadSourceJson = async () => {
431
388
  let sourceJsonContent;
432
389
  try {
@@ -445,8 +402,7 @@ const downloadSourceJson = async () => {
445
402
 
446
403
  return sourceJson;
447
404
  } catch (error) {
448
- const message =
449
- 'Unable to read `source.json` on the server. If you want to create a new source, use the option --create-source.\nError: ';
405
+ const message = 'Unable to read `source.json` on the server.\nError: ';
450
406
  const caughtError = errorAsString(error);
451
407
  const maybeSourceJsonContent =
452
408
  sourceJsonContent == null
@@ -457,15 +413,10 @@ const downloadSourceJson = async () => {
457
413
  }
458
414
  };
459
415
 
460
- const getUpdatedSourceJson = async (
461
- app: App,
462
- options: Options
463
- ): Promise<SourceJson> => {
464
- const sourceJson = await (options.doCreateSource
465
- ? createBlankSourceJson(options.sourceName!) // eslint-disable-line @typescript-eslint/no-non-null-assertion -- Can never be null because of the control flow
466
- : downloadSourceJson());
416
+ const getUpdatedSourceJson = async (app: App): Promise<SourceJson> => {
417
+ const sourceJson = await downloadSourceJson();
467
418
  return {
468
- name: sourceJson.name,
419
+ ...sourceJson,
469
420
  apps: [
470
421
  ...new Set(sourceJson.apps).add(
471
422
  `${app.sourceUrl}/${app.appInfoName}`
@@ -495,13 +446,8 @@ const failBecauseOfMissingProperty = () => {
495
446
  );
496
447
  };
497
448
 
498
- const getUpdatedAppInfo = async (
499
- app: App,
500
- options: Options
501
- ): Promise<AppInfo> => {
502
- const oldAppInfo = options.doCreateSource
503
- ? {}
504
- : await downloadExistingAppInfo(app);
449
+ const getUpdatedAppInfo = async (app: App): Promise<AppInfo> => {
450
+ const oldAppInfo = await downloadExistingAppInfo(app);
505
451
 
506
452
  assertAppVersionIsValid(oldAppInfo.latestVersion, app);
507
453
 
@@ -588,8 +534,8 @@ const main = async () => {
588
534
 
589
535
  await client.initialise(options);
590
536
 
591
- const sourceJson = await getUpdatedSourceJson(app, options);
592
- const appInfo = await getUpdatedAppInfo(app, options);
537
+ const sourceJson = await getUpdatedSourceJson(app);
538
+ const appInfo = await getUpdatedAppInfo(app);
593
539
 
594
540
  await uploadChangelog(app);
595
541
  await uploadIcon(app);
@@ -2,13 +2,16 @@ import { z } from 'zod';
2
2
  export type UrlString = string;
3
3
  export declare const sourceJsonSchema: z.ZodObject<{
4
4
  name: z.ZodString;
5
+ description: z.ZodOptional<z.ZodString>;
5
6
  apps: z.ZodArray<z.ZodString, "many">;
6
7
  }, "strip", z.ZodTypeAny, {
7
8
  name: string;
8
9
  apps: string[];
10
+ description?: string | undefined;
9
11
  }, {
10
12
  name: string;
11
13
  apps: string[];
14
+ description?: string | undefined;
12
15
  }>;
13
16
  export type SourceJson = z.infer<typeof sourceJsonSchema>;
14
17
  export declare const withdrawnJsonSchema: z.ZodArray<z.ZodString, "many">;
@@ -1 +1 @@
1
- {"version":3,"file":"MetaFiles.d.ts","sourceRoot":"","sources":["../../../ipc/MetaFiles.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B,eAAO,MAAM,gBAAgB;;;;;;;;;EAG3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,mBAAmB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C,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE,eAAO,MAAM,UAAU,2DAAiD,CAAC;AAEzE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
@@ -66,9 +66,9 @@ declare const packageJsonApp: z.ZodObject<z.objectUtil.extendShape<{
66
66
  }>>;
67
67
  }>, "strip", z.ZodTypeAny, {
68
68
  name: string;
69
+ description: string;
69
70
  version: string;
70
71
  displayName: string;
71
- description: string;
72
72
  engines: Record<string, string | undefined> & {
73
73
  nrfconnect: string;
74
74
  };
@@ -88,9 +88,9 @@ declare const packageJsonApp: z.ZodObject<z.objectUtil.extendShape<{
88
88
  } | undefined;
89
89
  }, {
90
90
  name: string;
91
+ description: string;
91
92
  version: string;
92
93
  displayName: string;
93
- description: string;
94
94
  engines: Record<string, string | undefined> & {
95
95
  nrfconnect: string;
96
96
  };
@@ -112,9 +112,9 @@ declare const packageJsonApp: z.ZodObject<z.objectUtil.extendShape<{
112
112
  export type PackageJsonApp = z.infer<typeof packageJsonApp>;
113
113
  export declare const parsePackageJsonApp: (content: string) => z.SafeParseSuccess<{
114
114
  name: string;
115
+ description: string;
115
116
  version: string;
116
117
  displayName: string;
117
- description: string;
118
118
  engines: Record<string, string | undefined> & {
119
119
  nrfconnect: string;
120
120
  };
@@ -195,9 +195,9 @@ declare const packageJsonLegacyApp: z.ZodObject<z.objectUtil.extendShape<z.objec
195
195
  }>>;
196
196
  }>, "strip", z.ZodTypeAny, {
197
197
  name: string;
198
+ description: string;
198
199
  version: string;
199
200
  displayName: string;
200
- description: string;
201
201
  engines: Record<string, string | undefined> & {
202
202
  nrfconnect: string;
203
203
  };
@@ -217,9 +217,9 @@ declare const packageJsonLegacyApp: z.ZodObject<z.objectUtil.extendShape<z.objec
217
217
  } | undefined;
218
218
  }, {
219
219
  name: string;
220
+ description: string;
220
221
  version: string;
221
222
  displayName: string;
222
- description: string;
223
223
  engines: Record<string, string | undefined> & {
224
224
  nrfconnect: string;
225
225
  };
@@ -241,9 +241,9 @@ declare const packageJsonLegacyApp: z.ZodObject<z.objectUtil.extendShape<z.objec
241
241
  export type PackageJsonLegacyApp = z.infer<typeof packageJsonLegacyApp>;
242
242
  export declare const parsePackageJsonLegacyApp: (content: string) => z.SafeParseSuccess<{
243
243
  name: string;
244
+ description: string;
244
245
  version: string;
245
246
  displayName: string;
246
- description: string;
247
247
  engines: Record<string, string | undefined> & {
248
248
  nrfconnect: string;
249
249
  };
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ts-node
2
+ export {};
3
+ //# sourceMappingURL=create-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-source.d.ts","sourceRoot":"","sources":["../../../scripts/create-source.ts"],"names":[],"mappings":""}
@@ -5,9 +5,9 @@ export declare const isLauncher: (packageJson?: {
5
5
  displayName?: string | undefined;
6
6
  } | {
7
7
  name: string;
8
+ description: string;
8
9
  version: string;
9
10
  displayName: string;
10
- description: string;
11
11
  engines: Record<string, string | undefined> & {
12
12
  nrfconnect: string;
13
13
  };
@@ -29,9 +29,9 @@ export declare const isLauncher: (packageJson?: {
29
29
  export declare const packageJson: () => PackageJson | PackageJsonApp;
30
30
  export declare const packageJsonApp: () => {
31
31
  name: string;
32
+ description: string;
32
33
  version: string;
33
34
  displayName: string;
34
- description: string;
35
35
  engines: Record<string, string | undefined> & {
36
36
  nrfconnect: string;
37
37
  };