@reliverse/publish 2.3.1 → 2.3.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.
Files changed (2) hide show
  1. package/dist/mod.js +42 -0
  2. package/package.json +7 -7
package/dist/mod.js CHANGED
@@ -559,6 +559,48 @@ async function preparePackageForPublishing(packagePath, options, workspacePackag
559
559
  }
560
560
  pkg.exports = transformExportsForBuild(pkg.exports);
561
561
  }
562
+ if (pkg.bin) {
563
+ if (options.verbose) {
564
+ logger.debug("Transforming bin field for publishing");
565
+ }
566
+ if (typeof pkg.bin === "string") {
567
+ pkg.bin = pkg.bin.replace(/\.ts$/, ".js").replace(/^\.\/src\//, "./dist/");
568
+ } else if (typeof pkg.bin === "object" && pkg.bin !== null) {
569
+ for (const [key, value] of Object.entries(pkg.bin)) {
570
+ if (typeof value === "string") {
571
+ pkg.bin[key] = value.replace(/\.ts$/, ".js").replace(/^\.\/src\//, "./dist/");
572
+ }
573
+ }
574
+ }
575
+ }
576
+ if (pkg.module && typeof pkg.module === "string") {
577
+ if (options.verbose) {
578
+ logger.debug("Transforming module field for publishing");
579
+ }
580
+ pkg.module = pkg.module.replace(/\.ts$/, ".js").replace(/^\.\/src\//, "./dist/");
581
+ }
582
+ if (pkg.types && typeof pkg.types === "string") {
583
+ if (options.verbose) {
584
+ logger.debug("Transforming types field for publishing");
585
+ }
586
+ pkg.types = pkg.types.replace(/\.ts$/, ".d.ts").replace(/^\.\/src\//, "./dist/");
587
+ }
588
+ if (pkg.files && Array.isArray(pkg.files)) {
589
+ if (!pkg.files.includes("README.md")) {
590
+ try {
591
+ const readmePath = resolve(packagePath, "README.md");
592
+ await Bun.file(readmePath).stat();
593
+ pkg.files.push("README.md");
594
+ if (options.verbose) {
595
+ logger.debug("Added README.md to files field");
596
+ }
597
+ } catch (error) {
598
+ if (options.verbose) {
599
+ logger.debug("README.md not found, skipping addition to files field");
600
+ }
601
+ }
602
+ }
603
+ }
562
604
  await writePackageJSON(resolve(packagePath, "package.json"), pkg);
563
605
  if (options.verbose) {
564
606
  logger.debug("Successfully wrote modified package.json");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reliverse/publish",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "files": [
@@ -18,12 +18,12 @@
18
18
  "access": "public"
19
19
  },
20
20
  "dependencies": {
21
- "@reliverse/build": "2.3.1",
22
- "@reliverse/bump": "2.3.1",
23
- "@reliverse/config": "2.3.1",
24
- "@reliverse/relico": "2.3.1",
25
- "@reliverse/relinka": "2.3.1",
26
- "@reliverse/typerso": "2.3.1",
21
+ "@reliverse/build": "2.3.2",
22
+ "@reliverse/bump": "2.3.2",
23
+ "@reliverse/config": "2.3.2",
24
+ "@reliverse/relico": "2.3.2",
25
+ "@reliverse/relinka": "2.3.2",
26
+ "@reliverse/typerso": "2.3.2",
27
27
  "c12": "^3.3.3",
28
28
  "dotenv": "^17.2.3"
29
29
  }