@sky.ui.pro/react 0.0.1 → 0.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sky.ui.pro/react",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Sky UI Pro React wrappers — installs full package via postinstall (online license).",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -21,13 +21,14 @@
21
21
  "tar": "^7.4.3"
22
22
  },
23
23
  "peerDependencies": {
24
- "@sky.ui/core": "^0.0.1",
25
- "@sky.ui/react": "^0.0.1",
26
- "@sky.ui.pro/core": "^0.0.1"
24
+ "@sky.ui/core": "^0.0.2",
25
+ "@sky.ui/react": "^0.0.2",
26
+ "@sky.ui.pro/core": "^0.0.2"
27
27
  },
28
28
  "skyUiPro": {
29
29
  "apiBase": "https://library.sky-ui.com",
30
- "artifactRegistry": "gitlab"
30
+ "artifactRegistry": "gitlab",
31
+ "artifactName": "@sky.ui.pro-artifact/react"
31
32
  },
32
33
  "publishConfig": {
33
34
  "access": "public",
@@ -5,7 +5,7 @@
5
5
  * does not remove artifacts already on disk.
6
6
  */
7
7
  import { createWriteStream } from "node:fs";
8
- import { access, cp, mkdir, mkdtemp, readdir, readFile, rm } from "node:fs/promises";
8
+ import { access, cp, mkdir, mkdtemp, readdir, readFile, rm, writeFile } from "node:fs/promises";
9
9
  import { homedir, tmpdir } from "node:os";
10
10
  import { dirname, join } from "node:path";
11
11
  import { fileURLToPath } from "node:url";
@@ -105,10 +105,15 @@ function resolveApiBase(pkg) {
105
105
  return "https://library.sky-ui.com";
106
106
  }
107
107
 
108
+ function tarballFileName(name, version) {
109
+ return `${name.replace(/^@/, "").replace("/", "-")}-${version}.tgz`;
110
+ }
111
+
108
112
  function tarballUrl(apiBase, name, version) {
109
113
  const base = apiBase.replace(/\/$/, "");
110
114
  const scopePath = name.replace("/", "%2f");
111
- return `${base}/npm/${scopePath}/-/${name}-${version}.tgz`;
115
+ const file = tarballFileName(name, version);
116
+ return `${base}/npm/${scopePath}/-/${file}`;
112
117
  }
113
118
 
114
119
  function printMissingToken(name) {
@@ -127,12 +132,14 @@ function printMissingToken(name) {
127
132
  `);
128
133
  }
129
134
 
130
- async function installFromTarball(tgzPath, slug, version) {
135
+ async function installFromTarball(tgzPath, slug, version, stubManifest) {
131
136
  const stagingDir = await mkdtemp(join(tmpdir(), `sky.ui.pro-${slug}-${version}-`));
132
137
  try {
133
138
  await extract({ file: tgzPath, cwd: stagingDir, strip: 1 });
134
139
  await copyDirectoryContents(stagingDir, pkgRoot);
135
- await saveToCache(slug, version, stagingDir);
140
+ // Keep npm stub identity (@sky.ui.pro/*) artifact tarballs use @sky.ui.pro-artifact/* on GitLab.
141
+ await writeFile(join(pkgRoot, "package.json"), `${JSON.stringify(stubManifest, null, 2)}\n`);
142
+ await saveToCache(slug, version, pkgRoot);
136
143
  } finally {
137
144
  await rm(stagingDir, { recursive: true, force: true });
138
145
  }
@@ -148,6 +155,8 @@ async function main() {
148
155
  return;
149
156
  }
150
157
 
158
+ const stubManifest = structuredClone(pkg);
159
+
151
160
  const slug = packageSlug(name);
152
161
  await enforceCachePolicy(slug, version);
153
162
 
@@ -180,7 +189,7 @@ async function main() {
180
189
  await mkdir(cacheRoot, { recursive: true });
181
190
  const tgzPath = join(cacheRoot, `${slug}-${version}.tgz`);
182
191
  await pipeline(res.body, createWriteStream(tgzPath));
183
- await installFromTarball(tgzPath, slug, version);
192
+ await installFromTarball(tgzPath, slug, version, stubManifest);
184
193
  console.log(`[@sky.ui.pro] Installed ${name}@${version}`);
185
194
  }
186
195