@solid-stack/mason 1.0.18 → 1.0.21
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/README.md +713 -137
- package/dist/bin.cjs +29 -5
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +29 -5
- package/dist/bin.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/commands/import.d.ts +6 -0
- package/dist/commands/import.d.ts.map +1 -1
- package/dist/index.cjs +29 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -5
- package/dist/index.js.map +1 -1
- package/dist/utils/integrity.d.ts.map +1 -1
- package/package.json +3 -2
- package/schema.json +29 -0
package/dist/bin.js
CHANGED
|
@@ -3570,7 +3570,7 @@ function getAllFiles(dir, baseDir = dir) {
|
|
|
3570
3570
|
}
|
|
3571
3571
|
files.push(...getAllFiles(fullPath, baseDir));
|
|
3572
3572
|
} else if (entry.isFile()) {
|
|
3573
|
-
if (entry.name === "registry.json" || entry.name.endsWith(".test.ts") || entry.name.endsWith(".spec.ts") || entry.name.startsWith(".")) {
|
|
3573
|
+
if (entry.name === "registry.json" || entry.name.endsWith(".test.ts") || entry.name.endsWith(".spec.ts") || entry.name.endsWith(".test.js") || entry.name.endsWith(".spec.js") || entry.name.startsWith(".")) {
|
|
3574
3574
|
continue;
|
|
3575
3575
|
}
|
|
3576
3576
|
files.push(relPath);
|
|
@@ -3596,8 +3596,15 @@ function computeDirectoryHash(dirPath, files) {
|
|
|
3596
3596
|
// src/commands/import.ts
|
|
3597
3597
|
var importPrompts = {
|
|
3598
3598
|
select: p14.select,
|
|
3599
|
-
text: p14.text
|
|
3599
|
+
text: p14.text,
|
|
3600
|
+
confirm: p14.confirm
|
|
3600
3601
|
};
|
|
3602
|
+
function isTestFile(filePath) {
|
|
3603
|
+
const normalized = filePath.replace(/\\/g, "/");
|
|
3604
|
+
const parts = normalized.split("/");
|
|
3605
|
+
const fileName = parts[parts.length - 1] || "";
|
|
3606
|
+
return fileName.endsWith(".test.ts") || fileName.endsWith(".test.js") || fileName.endsWith(".spec.ts") || fileName.endsWith(".spec.js") || parts.includes("__tests__");
|
|
3607
|
+
}
|
|
3601
3608
|
function rewriteImports(content, aliasMap) {
|
|
3602
3609
|
if (aliasMap.size === 0) return content;
|
|
3603
3610
|
let rewritten = content;
|
|
@@ -4064,6 +4071,22 @@ async function handleImport(typeArg, nameArg, flags = {}) {
|
|
|
4064
4071
|
requiredNpmPackages.add(pkg);
|
|
4065
4072
|
}
|
|
4066
4073
|
}
|
|
4074
|
+
const hasTestFiles = Array.from(nodes.values()).some(
|
|
4075
|
+
(node) => node.manifest.files?.some((file) => isTestFile(file))
|
|
4076
|
+
);
|
|
4077
|
+
let includeTests = true;
|
|
4078
|
+
if (flags.tests !== void 0) {
|
|
4079
|
+
includeTests = Boolean(flags.tests);
|
|
4080
|
+
} else if (flags.yes) {
|
|
4081
|
+
includeTests = true;
|
|
4082
|
+
} else if (hasTestFiles) {
|
|
4083
|
+
includeTests = handleCancel(
|
|
4084
|
+
await importPrompts.confirm({
|
|
4085
|
+
message: "Include test files?",
|
|
4086
|
+
initialValue: true
|
|
4087
|
+
})
|
|
4088
|
+
);
|
|
4089
|
+
}
|
|
4067
4090
|
for (const key of orderedKeys) {
|
|
4068
4091
|
const res = resolutions.get(key);
|
|
4069
4092
|
if (res.action === "reuse") {
|
|
@@ -4088,6 +4111,7 @@ async function handleImport(typeArg, nameArg, flags = {}) {
|
|
|
4088
4111
|
}
|
|
4089
4112
|
for (const file of res.manifest.files || []) {
|
|
4090
4113
|
if (file === "registry.json") continue;
|
|
4114
|
+
if (!includeTests && isTestFile(file)) continue;
|
|
4091
4115
|
const remoteFilePath = `${folder}/${res.registryName}/${file}`;
|
|
4092
4116
|
const localFilePath = path2.join(targetDir, file);
|
|
4093
4117
|
if (fs9.existsSync(localFilePath) && !isOverwrite) {
|
|
@@ -4140,7 +4164,7 @@ async function handleImport(typeArg, nameArg, flags = {}) {
|
|
|
4140
4164
|
// src/cli.ts
|
|
4141
4165
|
function createCli() {
|
|
4142
4166
|
const cli = cac("mason");
|
|
4143
|
-
cli.command("[...args]", "Interactive scaffolding and import wizard").option("-d, --dry-run", "Preview changes without writing to disk").option("-o, --overwrite", "Overwrite existing files").option("-y, --yes", "Accept defaults and skip interactive prompts").option("--registry", "Run in registry mode").option("--point-to <mapping>", "Point a dependency to an existing local module (e.g. --point-to time:mytime)").option("--alias <mapping>", "Import a dependency fresh under an alias name (e.g. --alias time:time-mason)").action(async (args, flags) => {
|
|
4167
|
+
cli.command("[...args]", "Interactive scaffolding and import wizard").option("-d, --dry-run", "Preview changes without writing to disk").option("-o, --overwrite", "Overwrite existing files").option("-y, --yes", "Accept defaults and skip interactive prompts").option("--registry", "Run in registry mode").option("--point-to <mapping>", "Point a dependency to an existing local module (e.g. --point-to time:mytime)").option("--alias <mapping>", "Import a dependency fresh under an alias name (e.g. --alias time:time-mason)").option("--tests", "Include test files (use --no-tests to exclude)").action(async (args, flags) => {
|
|
4144
4168
|
if (args && args.length > 0) {
|
|
4145
4169
|
p14.log.error(
|
|
4146
4170
|
pc14.red(
|
|
@@ -4235,7 +4259,7 @@ function createCli() {
|
|
|
4235
4259
|
cli.command(
|
|
4236
4260
|
"import [type] [name]",
|
|
4237
4261
|
"Import pre-built shared modules or features from the Solid Stack Registry"
|
|
4238
|
-
).option("-o, --overwrite", "Overwrite existing files").option("-d, --dry-run", "Preview changes without writing to disk").option("-y, --yes", "Accept defaults and skip interactive prompts").option("--registry <url>", "Registry base URL or local directory").option("--skip-install", "Skip automatic package manager dependency installation").option("--point-to <mapping>", "Point a dependency to an existing local module (e.g. --point-to time:mytime)").option("--alias <mapping>", "Import a dependency fresh under an alias name (e.g. --alias time:time-mason)").example("mason import shared hasher").example("mason import feature authn").example("mason import shared").example("mason import feature").action(async (type, name, flags = {}) => {
|
|
4262
|
+
).option("-o, --overwrite", "Overwrite existing files").option("-d, --dry-run", "Preview changes without writing to disk").option("-y, --yes", "Accept defaults and skip interactive prompts").option("--registry <url>", "Registry base URL or local directory").option("--skip-install", "Skip automatic package manager dependency installation").option("--point-to <mapping>", "Point a dependency to an existing local module (e.g. --point-to time:mytime)").option("--alias <mapping>", "Import a dependency fresh under an alias name (e.g. --alias time:time-mason)").option("--tests", "Include test files (use --no-tests to exclude)").example("mason import shared hasher").example("mason import feature authn").example("mason import shared").example("mason import feature").action(async (type, name, flags = {}) => {
|
|
4239
4263
|
try {
|
|
4240
4264
|
await handleImport(type, name, flags);
|
|
4241
4265
|
} catch (err) {
|
|
@@ -4265,7 +4289,7 @@ function createCli() {
|
|
|
4265
4289
|
});
|
|
4266
4290
|
}
|
|
4267
4291
|
cli.help();
|
|
4268
|
-
cli.version("1.0.
|
|
4292
|
+
cli.version("1.0.19");
|
|
4269
4293
|
return cli;
|
|
4270
4294
|
}
|
|
4271
4295
|
function handleCliError(err) {
|