schemashift-cli 0.4.0 → 0.6.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/cli.js +37 -8
- package/dist/index.cjs +35685 -31
- package/dist/index.js +35711 -51
- package/package.json +4 -2
package/dist/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
// src/cli.ts
|
|
9
|
-
import { existsSync as existsSync4, readFileSync as readFileSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
9
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3, statSync, writeFileSync as writeFileSync4 } from "fs";
|
|
10
10
|
import { dirname as dirname2, join as join3, resolve } from "path";
|
|
11
11
|
import { fileURLToPath } from "url";
|
|
12
12
|
import {
|
|
@@ -36132,9 +36132,14 @@ program.command("init").description("Create .schemashiftrc.json config file").op
|
|
|
36132
36132
|
});
|
|
36133
36133
|
program.command("analyze <path>").description("Analyze schemas in your project").option("--json", "Output as JSON").option("-v, --verbose", "Show detailed analysis").action(async (targetPath, options) => {
|
|
36134
36134
|
const analyzer = new SchemaAnalyzer();
|
|
36135
|
-
|
|
36136
|
-
|
|
36137
|
-
|
|
36135
|
+
let files;
|
|
36136
|
+
if (existsSync4(targetPath) && statSync(targetPath).isFile()) {
|
|
36137
|
+
files = [resolve(targetPath)];
|
|
36138
|
+
} else {
|
|
36139
|
+
files = await glob2(join3(targetPath, "**/*.{ts,tsx}"), {
|
|
36140
|
+
ignore: ["**/node_modules/**", "**/dist/**"]
|
|
36141
|
+
});
|
|
36142
|
+
}
|
|
36138
36143
|
for (const file2 of files) {
|
|
36139
36144
|
analyzer.addSourceFiles([file2]);
|
|
36140
36145
|
}
|
|
@@ -36195,6 +36200,11 @@ program.command("migrate <path>").description("Migrate schemas from one library
|
|
|
36195
36200
|
console.log(`Upgrade at: ${pc2.cyan(POLAR_URL)}`);
|
|
36196
36201
|
process.exit(1);
|
|
36197
36202
|
}
|
|
36203
|
+
if (options.ci && !features.ciSupport) {
|
|
36204
|
+
console.error(pc2.red("CI mode requires Pro tier or higher."));
|
|
36205
|
+
console.log(`Upgrade at: ${pc2.cyan(POLAR_URL)}`);
|
|
36206
|
+
process.exit(1);
|
|
36207
|
+
}
|
|
36198
36208
|
if (!engine.hasHandler(options.from, options.to)) {
|
|
36199
36209
|
console.error(pc2.red(`No handler for ${migrationPath}`));
|
|
36200
36210
|
console.log(
|
|
@@ -36203,9 +36213,14 @@ program.command("migrate <path>").description("Migrate schemas from one library
|
|
|
36203
36213
|
);
|
|
36204
36214
|
process.exit(1);
|
|
36205
36215
|
}
|
|
36206
|
-
|
|
36207
|
-
|
|
36208
|
-
|
|
36216
|
+
let files;
|
|
36217
|
+
if (existsSync4(targetPath) && statSync(targetPath).isFile()) {
|
|
36218
|
+
files = [resolve(targetPath)];
|
|
36219
|
+
} else {
|
|
36220
|
+
files = await glob2(join3(targetPath, "**/*.{ts,tsx}"), {
|
|
36221
|
+
ignore: config2.exclude
|
|
36222
|
+
});
|
|
36223
|
+
}
|
|
36209
36224
|
if (files.length === 0) {
|
|
36210
36225
|
console.log(pc2.yellow("No files found matching patterns."));
|
|
36211
36226
|
process.exit(0);
|
|
@@ -36331,7 +36346,21 @@ program.command("watch <path>").description("Watch files and migrate on change")
|
|
|
36331
36346
|
console.log(`Upgrade at: ${pc2.cyan(POLAR_URL)}`);
|
|
36332
36347
|
process.exit(1);
|
|
36333
36348
|
}
|
|
36334
|
-
const
|
|
36349
|
+
const tier = validation.license?.tier || LicenseTier.FREE;
|
|
36350
|
+
if (!canUseMigration(tier, options.from, options.to)) {
|
|
36351
|
+
console.error(pc2.red(`Migration ${options.from}->${options.to} requires a higher tier.`));
|
|
36352
|
+
console.log(`Upgrade at: ${pc2.cyan(POLAR_URL)}`);
|
|
36353
|
+
process.exit(1);
|
|
36354
|
+
}
|
|
36355
|
+
let config2;
|
|
36356
|
+
try {
|
|
36357
|
+
config2 = await loadConfig(options.config);
|
|
36358
|
+
} catch {
|
|
36359
|
+
config2 = {
|
|
36360
|
+
include: ["**/*.ts", "**/*.tsx"],
|
|
36361
|
+
exclude: ["**/node_modules/**", "**/dist/**"]
|
|
36362
|
+
};
|
|
36363
|
+
}
|
|
36335
36364
|
const watchMode = new WatchMode();
|
|
36336
36365
|
const analyzer = new SchemaAnalyzer();
|
|
36337
36366
|
await watchMode.start({
|