@mnci/cli 4.0.1 → 4.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/dist/cli.js CHANGED
@@ -207,6 +207,23 @@ function markPublic(manifestPath) {
207
207
  const manifest = readJson(manifestPath);
208
208
  writeFileEnsured(manifestPath, toJson({ ...manifest, publishConfig: { access: "public" } }));
209
209
  }
210
+ var WRONG_TYPES_PATH = "./dist/index.esm.d.ts";
211
+ var ACTUAL_TYPES_PATH = "./dist/index.d.ts";
212
+ var DECLARATION_MAP_EXCLUSION = "!**/*.d.ts.map";
213
+ function repairPublishableManifest(manifestPath) {
214
+ const manifest = readJson(manifestPath);
215
+ if (manifest.types === WRONG_TYPES_PATH) {
216
+ manifest.types = ACTUAL_TYPES_PATH;
217
+ }
218
+ const dot = manifest.exports?.["."];
219
+ if (typeof dot === "object" && dot.types === WRONG_TYPES_PATH) {
220
+ dot.types = ACTUAL_TYPES_PATH;
221
+ }
222
+ if (manifest.files && !manifest.files.includes(DECLARATION_MAP_EXCLUSION)) {
223
+ manifest.files.push(DECLARATION_MAP_EXCLUSION);
224
+ }
225
+ writeFileEnsured(manifestPath, toJson(manifest));
226
+ }
210
227
  function ensureAdmZip(workspaceRoot) {
211
228
  if (hasPlugin(workspaceRoot, "adm-zip")) {
212
229
  return;
@@ -714,7 +731,9 @@ async function addNpmLib(workspaceRoot, name, options, kindProvided, stack) {
714
731
  ],
715
732
  workspaceRoot
716
733
  );
717
- markPublic((0, import_node_path6.join)(workspaceRoot, "packages", name, "package.json"));
734
+ const manifestPath = (0, import_node_path6.join)(workspaceRoot, "packages", name, "package.json");
735
+ markPublic(manifestPath);
736
+ repairPublishableManifest(manifestPath);
718
737
  removeGeneratedEslintConfig(workspaceRoot, `packages/${name}`);
719
738
  registerProjectCommands(workspaceRoot, name, { build: true });
720
739
  }
@@ -1021,19 +1040,6 @@ function addReactApp(workspaceRoot, name, stack) {
1021
1040
 
1022
1041
  // src/commands/add/reactLib.ts
1023
1042
  var import_node_path9 = require("path");
1024
- var WRONG_TYPES_PATH = "./dist/index.esm.d.ts";
1025
- var ACTUAL_TYPES_PATH = "./dist/index.d.ts";
1026
- function repairTypesPath(manifestPath) {
1027
- const manifest = readJson(manifestPath);
1028
- if (manifest.types === WRONG_TYPES_PATH) {
1029
- manifest.types = ACTUAL_TYPES_PATH;
1030
- }
1031
- const dot = manifest.exports?.["."];
1032
- if (typeof dot === "object" && dot.types === WRONG_TYPES_PATH) {
1033
- dot.types = ACTUAL_TYPES_PATH;
1034
- }
1035
- writeFileEnsured(manifestPath, toJson(manifest));
1036
- }
1037
1043
  var REACT_LIB_BUNDLER = "rollup";
1038
1044
  async function addReactLib(workspaceRoot, name, options, kindProvided, stack) {
1039
1045
  ensurePlugin(workspaceRoot, "@nx/react");
@@ -1055,7 +1061,7 @@ async function addReactLib(workspaceRoot, name, options, kindProvided, stack) {
1055
1061
  );
1056
1062
  const publishableManifest = (0, import_node_path9.join)(workspaceRoot, "packages", name, "package.json");
1057
1063
  markPublic(publishableManifest);
1058
- repairTypesPath(publishableManifest);
1064
+ repairPublishableManifest(publishableManifest);
1059
1065
  removeGeneratedEslintConfig(workspaceRoot, `packages/${name}`);
1060
1066
  registerProjectCommands(workspaceRoot, name, { build: true });
1061
1067
  }
@@ -1076,7 +1082,7 @@ function addReactInternalLib(workspaceRoot, name, stack) {
1076
1082
  );
1077
1083
  const privateManifest = (0, import_node_path9.join)(workspaceRoot, "libs", name, "package.json");
1078
1084
  markPrivate(privateManifest);
1079
- repairTypesPath(privateManifest);
1085
+ repairPublishableManifest(privateManifest);
1080
1086
  removeGeneratedEslintConfig(workspaceRoot, `libs/${name}`);
1081
1087
  registerProjectCommands(workspaceRoot, name, { build: true });
1082
1088
  }