create-krispya 0.5.2 → 0.5.3
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.cjs +21 -29
- package/dist/cli.mjs +21 -29
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -821,29 +821,26 @@ async function getMonorepoScope(monorepoRoot) {
|
|
|
821
821
|
}
|
|
822
822
|
async function getWorkspacePackages(monorepoRoot) {
|
|
823
823
|
const packagesDir = path.join(monorepoRoot, "packages");
|
|
824
|
-
const packages = [];
|
|
825
824
|
try {
|
|
826
825
|
const { readdir } = await import('fs/promises');
|
|
827
826
|
const entries = await readdir(packagesDir, { withFileTypes: true });
|
|
827
|
+
const names = [];
|
|
828
828
|
for (const entry of entries) {
|
|
829
|
-
if (entry.isDirectory())
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
} catch {
|
|
841
|
-
}
|
|
829
|
+
if (!entry.isDirectory()) continue;
|
|
830
|
+
try {
|
|
831
|
+
const content = await promises.readFile(
|
|
832
|
+
path.join(packagesDir, entry.name, "package.json"),
|
|
833
|
+
"utf-8"
|
|
834
|
+
);
|
|
835
|
+
const pkg2 = JSON.parse(content);
|
|
836
|
+
if (pkg2.name) names.push(pkg2.name);
|
|
837
|
+
} catch {
|
|
842
838
|
}
|
|
843
839
|
}
|
|
840
|
+
return names;
|
|
844
841
|
} catch {
|
|
842
|
+
return [];
|
|
845
843
|
}
|
|
846
|
-
return packages;
|
|
847
844
|
}
|
|
848
845
|
async function ensureConfigInWorkspace(monorepoRoot) {
|
|
849
846
|
const workspacePath = path.join(monorepoRoot, "pnpm-workspace.yaml");
|
|
@@ -1147,20 +1144,15 @@ async function createPackageInWorkspace(monorepoRoot, packageManager, inheritedT
|
|
|
1147
1144
|
}
|
|
1148
1145
|
await Promise.all(versionPromises);
|
|
1149
1146
|
packageOptions.versions = versions;
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
required: false
|
|
1160
|
-
});
|
|
1161
|
-
if (!p__namespace.isCancel(selectedDeps) && selectedDeps.length > 0) {
|
|
1162
|
-
packageOptions.workspaceDependencies = selectedDeps;
|
|
1163
|
-
}
|
|
1147
|
+
const workspacePackages = packageType === "app" ? await getWorkspacePackages(monorepoRoot) : [];
|
|
1148
|
+
if (workspacePackages.length > 0) {
|
|
1149
|
+
const selectedDeps = await p__namespace.multiselect({
|
|
1150
|
+
message: "Add workspace dependencies?",
|
|
1151
|
+
options: workspacePackages.map((name) => ({ value: name, label: name })),
|
|
1152
|
+
required: false
|
|
1153
|
+
});
|
|
1154
|
+
if (!p__namespace.isCancel(selectedDeps) && selectedDeps.length > 0) {
|
|
1155
|
+
packageOptions.workspaceDependencies = selectedDeps;
|
|
1164
1156
|
}
|
|
1165
1157
|
}
|
|
1166
1158
|
const outputPath = path.join(monorepoRoot, relativePkgPath);
|
package/dist/cli.mjs
CHANGED
|
@@ -800,29 +800,26 @@ async function getMonorepoScope(monorepoRoot) {
|
|
|
800
800
|
}
|
|
801
801
|
async function getWorkspacePackages(monorepoRoot) {
|
|
802
802
|
const packagesDir = join(monorepoRoot, "packages");
|
|
803
|
-
const packages = [];
|
|
804
803
|
try {
|
|
805
804
|
const { readdir } = await import('fs/promises');
|
|
806
805
|
const entries = await readdir(packagesDir, { withFileTypes: true });
|
|
806
|
+
const names = [];
|
|
807
807
|
for (const entry of entries) {
|
|
808
|
-
if (entry.isDirectory())
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
});
|
|
818
|
-
}
|
|
819
|
-
} catch {
|
|
820
|
-
}
|
|
808
|
+
if (!entry.isDirectory()) continue;
|
|
809
|
+
try {
|
|
810
|
+
const content = await readFile(
|
|
811
|
+
join(packagesDir, entry.name, "package.json"),
|
|
812
|
+
"utf-8"
|
|
813
|
+
);
|
|
814
|
+
const pkg2 = JSON.parse(content);
|
|
815
|
+
if (pkg2.name) names.push(pkg2.name);
|
|
816
|
+
} catch {
|
|
821
817
|
}
|
|
822
818
|
}
|
|
819
|
+
return names;
|
|
823
820
|
} catch {
|
|
821
|
+
return [];
|
|
824
822
|
}
|
|
825
|
-
return packages;
|
|
826
823
|
}
|
|
827
824
|
async function ensureConfigInWorkspace(monorepoRoot) {
|
|
828
825
|
const workspacePath = join(monorepoRoot, "pnpm-workspace.yaml");
|
|
@@ -1126,20 +1123,15 @@ async function createPackageInWorkspace(monorepoRoot, packageManager, inheritedT
|
|
|
1126
1123
|
}
|
|
1127
1124
|
await Promise.all(versionPromises);
|
|
1128
1125
|
packageOptions.versions = versions;
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
required: false
|
|
1139
|
-
});
|
|
1140
|
-
if (!p.isCancel(selectedDeps) && selectedDeps.length > 0) {
|
|
1141
|
-
packageOptions.workspaceDependencies = selectedDeps;
|
|
1142
|
-
}
|
|
1126
|
+
const workspacePackages = packageType === "app" ? await getWorkspacePackages(monorepoRoot) : [];
|
|
1127
|
+
if (workspacePackages.length > 0) {
|
|
1128
|
+
const selectedDeps = await p.multiselect({
|
|
1129
|
+
message: "Add workspace dependencies?",
|
|
1130
|
+
options: workspacePackages.map((name) => ({ value: name, label: name })),
|
|
1131
|
+
required: false
|
|
1132
|
+
});
|
|
1133
|
+
if (!p.isCancel(selectedDeps) && selectedDeps.length > 0) {
|
|
1134
|
+
packageOptions.workspaceDependencies = selectedDeps;
|
|
1143
1135
|
}
|
|
1144
1136
|
}
|
|
1145
1137
|
const outputPath = join(monorepoRoot, relativePkgPath);
|