@nordicsemiconductor/pc-nrfconnect-shared 246.0.0 → 247.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.
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env tsx
2
+ export declare const sameRepoURLs: (url1: string, url2: string) => boolean;
2
3
  declare const runChecks: ({ checkChangelogHasCurrentEntry, }: {
3
4
  checkChangelogHasCurrentEntry: boolean;
4
5
  }) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"check-app-properties.d.ts","sourceRoot":"","sources":["../../../scripts/check-app-properties.ts"],"names":[],"mappings":";AAkLA,QAAA,MAAM,SAAS,GAAI,oCAEhB;IACC,6BAA6B,EAAE,OAAO,CAAC;CAC1C,SAKA,CAAC;AAOF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"check-app-properties.d.ts","sourceRoot":"","sources":["../../../scripts/check-app-properties.ts"],"names":[],"mappings":";AAmEA,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,YAUtD,CAAC;AAuGF,QAAA,MAAM,SAAS,GAAI,oCAEhB;IACC,6BAA6B,EAAE,OAAO,CAAC;CAC1C,SAKA,CAAC;AAOF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=check-app-properties.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-app-properties.test.d.ts","sourceRoot":"","sources":["../../../scripts/check-app-properties.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nordicsemiconductor/pc-nrfconnect-shared",
3
- "version": "246.0.0",
3
+ "version": "247.0.0",
4
4
  "description": "Shared commodities for developing pc-nrfconnect-* packages",
5
5
  "repository": {
6
6
  "type": "git",
package/release_notes.md CHANGED
@@ -1,3 +1,3 @@
1
1
  ### Changed
2
2
 
3
- - Aligned Card component styles with old implementation.
3
+ - In the repo URL check, ignore the hostname for ssh git URLs.
@@ -0,0 +1,60 @@
1
+ /*
2
+ * Copyright (c) 2026 Nordic Semiconductor ASA
3
+ *
4
+ * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
+ */
6
+
7
+ import { sameRepoURLs } from './check-app-properties';
8
+
9
+ describe('sameRepoURLs', () => {
10
+ it('accepts equal URLs', () => {
11
+ expect(
12
+ sameRepoURLs(
13
+ 'https://github.com/nordicsemi/pc-nrfconnect-ppk',
14
+ 'https://github.com/nordicsemi/pc-nrfconnect-ppk',
15
+ ),
16
+ ).toBe(true);
17
+ });
18
+
19
+ it('rejects different URLs', () => {
20
+ expect(
21
+ sameRepoURLs(
22
+ 'https://github.com/nordicsemi/pc-nrfconnect-ppk',
23
+ 'https://github.com/nordicsemi/pc-nrfconnect-shared',
24
+ ),
25
+ ).toBe(false);
26
+ });
27
+
28
+ it('ignores a .git postfix on either URL', () => {
29
+ expect(
30
+ sameRepoURLs(
31
+ 'https://github.com/nordicsemi/pc-nrfconnect-ppk.git',
32
+ 'https://github.com/nordicsemi/pc-nrfconnect-ppk',
33
+ ),
34
+ ).toBe(true);
35
+ expect(
36
+ sameRepoURLs(
37
+ 'https://github.com/nordicsemi/pc-nrfconnect-ppk',
38
+ 'https://github.com/nordicsemi/pc-nrfconnect-ppk.git',
39
+ ),
40
+ ).toBe(true);
41
+ });
42
+
43
+ it('treats the protocol https and git as the same', () => {
44
+ expect(
45
+ sameRepoURLs(
46
+ 'https://github.com/nordicsemi/pc-nrfconnect-ppk',
47
+ 'git@github.com:nordicsemi/pc-nrfconnect-ppk.git',
48
+ ),
49
+ ).toBe(true);
50
+ });
51
+
52
+ it('ignores the host name for the git protocol', () => {
53
+ expect(
54
+ sameRepoURLs(
55
+ 'https://github.com/nordicsemi/pc-nrfconnect-ppk',
56
+ 'git@nordic-git:nordicsemi/pc-nrfconnect-ppk.git',
57
+ ),
58
+ ).toBe(true);
59
+ });
60
+ });
@@ -65,6 +65,18 @@ const mustContainOneOf = (
65
65
  }
66
66
  };
67
67
 
68
+ export const sameRepoURLs = (url1: string, url2: string) => {
69
+ const withoutPostfix = (gitUrl: string) => gitUrl.replace(/\.git$/, '');
70
+
71
+ const withoutProtocol = (gitUrl: string) =>
72
+ gitUrl.replace(/^git@[^:]+:/, 'github.com/').replace(/^https:\/\//, '');
73
+
74
+ const stripped = (gitUrl: string) =>
75
+ withoutProtocol(withoutPostfix(gitUrl));
76
+
77
+ return stripped(url1) === stripped(url2);
78
+ };
79
+
68
80
  const checkRepoUrl = (packageJson: PackageJsonApp) => {
69
81
  if (!existsSync('./.git')) {
70
82
  return;
@@ -75,17 +87,7 @@ const checkRepoUrl = (packageJson: PackageJsonApp) => {
75
87
  }).trimEnd();
76
88
  const declaredGitUrl = packageJson.repository?.url;
77
89
 
78
- const withoutPostfix = (gitUrl?: string) => gitUrl?.replace(/\.git$/, '');
79
-
80
- const withoutProtocol = (gitUrl?: string) =>
81
- gitUrl
82
- ?.replace(/^git@github\.com:/, 'github.com/')
83
- .replace(/^https:\/\//, '');
84
-
85
- const stripped = (gitUrl?: string) =>
86
- withoutProtocol(withoutPostfix(gitUrl));
87
-
88
- if (stripped(realGitUrl) !== stripped(declaredGitUrl)) {
90
+ if (declaredGitUrl == null || !sameRepoURLs(realGitUrl, declaredGitUrl)) {
89
91
  fail(
90
92
  `package.json says the repository is located at \`${declaredGitUrl}\` but \`git remote get-url origin\` says it is at \`${realGitUrl}\`.`,
91
93
  );