@xylabs/ts-scripts-yarn3 6.4.5 → 6.5.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/dist/index.mjs CHANGED
@@ -783,13 +783,14 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
783
783
  );
784
784
  const imports = [];
785
785
  const typeImports = [];
786
+ const isDeclarationFile = filePath.endsWith(".d.ts");
786
787
  function visit(node) {
787
788
  if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {
788
789
  const moduleSpecifier = node.moduleSpecifier?.getFullText();
789
790
  const isTypeImport = ts.isImportDeclaration(node) ? node.importClause?.isTypeOnly ?? false : false;
790
791
  if (moduleSpecifier) {
791
792
  const trimmed = moduleSpecifier.split("'").at(1) ?? moduleSpecifier;
792
- if (isTypeImport) {
793
+ if (isTypeImport && !isDeclarationFile) {
793
794
  typeImports.push(trimmed);
794
795
  } else {
795
796
  imports.push(trimmed);
@@ -966,46 +967,102 @@ var deplint = ({ pkg }) => {
966
967
  };
967
968
 
968
969
  // src/actions/deploy.ts
970
+ import { readFileSync as readFileSync5 } from "node:fs";
971
+ var privatePackageExcludeList = () => {
972
+ const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
973
+ workspace,
974
+ JSON.parse(readFileSync5(`${workspace.location}/package.json`, { encoding: "utf8" }))
975
+ ]);
976
+ const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
977
+ const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
978
+ return excludeList;
979
+ };
969
980
  var deploy = () => {
981
+ const excludeList = privatePackageExcludeList();
982
+ if (excludeList.length > 0) {
983
+ console.log("Excluding private packages from deployment:", excludeList);
984
+ }
970
985
  return runSteps("Deploy [Patch]", [
971
986
  ["yarn", "workspaces foreach --all version patch --deferred"],
972
987
  ["yarn", "xy clean"],
973
988
  ["yarn", "xy build"],
974
989
  ["yarn", "version apply --all"],
975
- ["yarn", "workspaces foreach --all --parallel npm publish"]
990
+ ["yarn", `workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish`]
976
991
  ]);
977
992
  };
978
993
 
979
994
  // src/actions/deploy-major.ts
995
+ import { readFileSync as readFileSync6 } from "node:fs";
996
+ var privatePackageExcludeList2 = () => {
997
+ const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
998
+ workspace,
999
+ JSON.parse(readFileSync6(`${workspace.location}/package.json`, { encoding: "utf8" }))
1000
+ ]);
1001
+ const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
1002
+ const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
1003
+ return excludeList;
1004
+ };
980
1005
  var deployMajor = () => {
1006
+ const excludeList = privatePackageExcludeList2();
1007
+ if (excludeList.length > 0) {
1008
+ console.log("Excluding private packages from deployment:", excludeList);
1009
+ }
981
1010
  return runSteps("Deploy [Major]", [
982
1011
  ["yarn", "workspaces foreach --all version major --deferred"],
983
1012
  ["yarn", "xy clean"],
984
1013
  ["yarn", "xy build"],
985
1014
  ["yarn", "version apply --all"],
986
- ["yarn", "workspaces foreach --all --parallel npm publish"]
1015
+ ["yarn", `workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish`]
987
1016
  ]);
988
1017
  };
989
1018
 
990
1019
  // src/actions/deploy-minor.ts
1020
+ import { readFileSync as readFileSync7 } from "node:fs";
1021
+ var privatePackageExcludeList3 = () => {
1022
+ const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
1023
+ workspace,
1024
+ JSON.parse(readFileSync7(`${workspace.location}/package.json`, { encoding: "utf8" }))
1025
+ ]);
1026
+ const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
1027
+ const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
1028
+ return excludeList;
1029
+ };
991
1030
  var deployMinor = () => {
1031
+ const excludeList = privatePackageExcludeList3();
1032
+ if (excludeList.length > 0) {
1033
+ console.log("Excluding private packages from deployment:", excludeList);
1034
+ }
992
1035
  return runSteps("Deploy [Minor]", [
993
1036
  ["yarn", "workspaces foreach --all version minor --deferred"],
994
1037
  ["yarn", "xy clean"],
995
1038
  ["yarn", "xy build"],
996
1039
  ["yarn", "version apply --all"],
997
- ["yarn", "workspaces foreach --all --parallel npm publish"]
1040
+ ["yarn", `workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish`]
998
1041
  ]);
999
1042
  };
1000
1043
 
1001
1044
  // src/actions/deploy-next.ts
1045
+ import { readFileSync as readFileSync8 } from "node:fs";
1046
+ var privatePackageExcludeList4 = () => {
1047
+ const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
1048
+ workspace,
1049
+ JSON.parse(readFileSync8(`${workspace.location}/package.json`, { encoding: "utf8" }))
1050
+ ]);
1051
+ const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
1052
+ const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
1053
+ return excludeList;
1054
+ };
1002
1055
  var deployNext = () => {
1056
+ const excludeList = privatePackageExcludeList4();
1057
+ if (excludeList.length > 0) {
1058
+ console.log("Excluding private packages from deployment:", excludeList);
1059
+ }
1003
1060
  return runSteps("Deploy [Next]", [
1004
1061
  ["yarn", "workspaces foreach --all version minor --deferred"],
1005
1062
  ["yarn", "xy clean"],
1006
1063
  ["yarn", "xy build"],
1007
1064
  ["yarn", "version apply --all --prerelease"],
1008
- ["yarn", "workspaces foreach --all --parallel npm publish --tag next"]
1065
+ ["yarn", `workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish --tag next`]
1009
1066
  ]);
1010
1067
  };
1011
1068