@nordicsemiconductor/pc-nrfconnect-shared 198.0.0 → 200.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.
- package/Changelog.md +12 -0
- package/ipc/MetaFiles.ts +1 -0
- package/package.json +4 -1
- package/scripts/create-source.ts +78 -0
- package/scripts/nordic-publish.js +7 -8
- package/scripts/nordic-publish.ts +16 -65
- package/typings/generated/ipc/MetaFiles.d.ts +3 -0
- package/typings/generated/ipc/MetaFiles.d.ts.map +1 -1
- package/typings/generated/ipc/schema/packageJson.d.ts +6 -6
- package/typings/generated/scripts/create-source.d.ts +3 -0
- package/typings/generated/scripts/create-source.d.ts.map +1 -0
- package/typings/generated/src/utils/packageJson.d.ts +2 -2
|
@@ -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
|
|
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
|
|
|
@@ -181,6 +164,7 @@ class ArtifactoryClient extends Client {
|
|
|
181
164
|
token = process.env.ARTIFACTORY_TOKEN;
|
|
182
165
|
|
|
183
166
|
sourceUrl: string;
|
|
167
|
+
uploadUrl: string;
|
|
184
168
|
|
|
185
169
|
constructor(private readonly options: Options) {
|
|
186
170
|
super();
|
|
@@ -191,7 +175,11 @@ class ArtifactoryClient extends Client {
|
|
|
191
175
|
);
|
|
192
176
|
}
|
|
193
177
|
|
|
194
|
-
this.
|
|
178
|
+
this.uploadUrl = `https://files.nordicsemi.com/artifactory/swtools/${this.getAccessLevel()}/ncd/apps/${
|
|
179
|
+
options.source
|
|
180
|
+
}`;
|
|
181
|
+
|
|
182
|
+
this.sourceUrl = `https://files.nordicsemi.com/ui/api/v1/download?isNativeBrowsing=false&repoKey=swtools&path=${this.getAccessLevel()}/ncd/apps/${
|
|
195
183
|
options.source
|
|
196
184
|
}`;
|
|
197
185
|
}
|
|
@@ -218,7 +206,7 @@ class ArtifactoryClient extends Client {
|
|
|
218
206
|
};
|
|
219
207
|
|
|
220
208
|
upload = async (content: Buffer, remoteFilename: string) => {
|
|
221
|
-
const url = `${this.
|
|
209
|
+
const url = `${this.uploadUrl}/${remoteFilename}`;
|
|
222
210
|
const res = await fetch(url, {
|
|
223
211
|
method: 'PUT',
|
|
224
212
|
body: content,
|
|
@@ -287,7 +275,6 @@ const splitSourceAndAccessLevel = (sourceAndMaybeAccessLevel: string) => {
|
|
|
287
275
|
|
|
288
276
|
interface Options {
|
|
289
277
|
doPack: boolean;
|
|
290
|
-
doCreateSource: boolean;
|
|
291
278
|
deployOfficial: boolean;
|
|
292
279
|
source: string;
|
|
293
280
|
sourceName?: string;
|
|
@@ -316,12 +303,6 @@ const parseOptions = (): Options => {
|
|
|
316
303
|
'-n, --no-pack',
|
|
317
304
|
'Publish existing .tgz file at the root directory without npm pack.'
|
|
318
305
|
)
|
|
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
306
|
.parse();
|
|
326
307
|
|
|
327
308
|
const options = program.opts();
|
|
@@ -332,9 +313,7 @@ const parseOptions = (): Options => {
|
|
|
332
313
|
|
|
333
314
|
return {
|
|
334
315
|
doPack: options.pack,
|
|
335
|
-
doCreateSource: options.createSource != null,
|
|
336
316
|
source,
|
|
337
|
-
sourceName: options.createSource,
|
|
338
317
|
deployOfficial,
|
|
339
318
|
destination: options.destination,
|
|
340
319
|
accessLevel,
|
|
@@ -410,23 +389,6 @@ const assertAppVersionIsValid = (
|
|
|
410
389
|
}
|
|
411
390
|
};
|
|
412
391
|
|
|
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
392
|
const downloadSourceJson = async () => {
|
|
431
393
|
let sourceJsonContent;
|
|
432
394
|
try {
|
|
@@ -445,8 +407,7 @@ const downloadSourceJson = async () => {
|
|
|
445
407
|
|
|
446
408
|
return sourceJson;
|
|
447
409
|
} 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: ';
|
|
410
|
+
const message = 'Unable to read `source.json` on the server.\nError: ';
|
|
450
411
|
const caughtError = errorAsString(error);
|
|
451
412
|
const maybeSourceJsonContent =
|
|
452
413
|
sourceJsonContent == null
|
|
@@ -457,15 +418,10 @@ const downloadSourceJson = async () => {
|
|
|
457
418
|
}
|
|
458
419
|
};
|
|
459
420
|
|
|
460
|
-
const getUpdatedSourceJson = async (
|
|
461
|
-
|
|
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());
|
|
421
|
+
const getUpdatedSourceJson = async (app: App): Promise<SourceJson> => {
|
|
422
|
+
const sourceJson = await downloadSourceJson();
|
|
467
423
|
return {
|
|
468
|
-
|
|
424
|
+
...sourceJson,
|
|
469
425
|
apps: [
|
|
470
426
|
...new Set(sourceJson.apps).add(
|
|
471
427
|
`${app.sourceUrl}/${app.appInfoName}`
|
|
@@ -495,13 +451,8 @@ const failBecauseOfMissingProperty = () => {
|
|
|
495
451
|
);
|
|
496
452
|
};
|
|
497
453
|
|
|
498
|
-
const getUpdatedAppInfo = async (
|
|
499
|
-
app
|
|
500
|
-
options: Options
|
|
501
|
-
): Promise<AppInfo> => {
|
|
502
|
-
const oldAppInfo = options.doCreateSource
|
|
503
|
-
? {}
|
|
504
|
-
: await downloadExistingAppInfo(app);
|
|
454
|
+
const getUpdatedAppInfo = async (app: App): Promise<AppInfo> => {
|
|
455
|
+
const oldAppInfo = await downloadExistingAppInfo(app);
|
|
505
456
|
|
|
506
457
|
assertAppVersionIsValid(oldAppInfo.latestVersion, app);
|
|
507
458
|
|
|
@@ -588,8 +539,8 @@ const main = async () => {
|
|
|
588
539
|
|
|
589
540
|
await client.initialise(options);
|
|
590
541
|
|
|
591
|
-
const sourceJson = await getUpdatedSourceJson(app
|
|
592
|
-
const appInfo = await getUpdatedAppInfo(app
|
|
542
|
+
const sourceJson = await getUpdatedSourceJson(app);
|
|
543
|
+
const appInfo = await getUpdatedAppInfo(app);
|
|
593
544
|
|
|
594
545
|
await uploadChangelog(app);
|
|
595
546
|
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
|
|
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;;;;;;;;;;;;EAI3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC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AAC,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 @@
|
|
|
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
|
};
|