salt-codemod
Advanced tools
Comparing version 0.1.0-alpha.1 to 0.1.0-alpha.2
18
index.js
@@ -50,4 +50,11 @@ #!/usr/bin/env node | ||
} from "./utils/args.js"; | ||
import { verboseOnlyDimLog } from "./utils/log.js"; | ||
import { | ||
verboseOnlyDimLog, | ||
verboseOnlyTableLog, | ||
verboseOnlyLog, | ||
} from "./utils/log.js"; | ||
verboseOnlyLog("Args used:"); | ||
verboseOnlyTableLog(parsedArgs); | ||
const { | ||
@@ -152,2 +159,5 @@ tsconfig, | ||
// Ignore tsconfig if `tsSourceGlob` option is provided | ||
const initialiseFromTsConfig = !tsSourceGlob && tsConfigExisted; | ||
const project = new Project({ | ||
@@ -158,3 +168,3 @@ // Optionally specify compiler options, tsconfig.json, in-memory file system, and more here. | ||
// Read more: https://ts-morph.com/setup/ | ||
tsConfigFilePath: tsConfigExisted ? tsconfig : undefined, | ||
tsConfigFilePath: initialiseFromTsConfig ? tsconfig : undefined, | ||
}); | ||
@@ -164,3 +174,3 @@ | ||
if (tsConfigExisted) { | ||
if (initialiseFromTsConfig) { | ||
console.log(chalk.dim("Initialising TypeScript project from", tsconfig)); | ||
@@ -176,3 +186,3 @@ // project.addSourceFilesFromTsConfig(); | ||
); | ||
// Very bad way of handling monorepo, adding all ts files from `tsSourceGlob` args, by default is all ts* in packages folder | ||
// One example way of handling monorepo, adding all ts files from `tsSourceGlob` args, by default is all ts* in packages folder | ||
project.addSourceFilesAtPaths(tsSourceGlob); | ||
@@ -179,0 +189,0 @@ } |
{ | ||
"name": "salt-codemod", | ||
"version": "0.1.0-alpha.1", | ||
"version": "0.1.0-alpha.2", | ||
"description": "Codemod to help upgrade Salt design system packages", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,8 +16,8 @@ import _yargs from "yargs"; | ||
description: | ||
"React code is modified using ts-morph, which needs a path to your tsconfig.json file.", | ||
"React code is modified using ts-morph, which needs a path to your tsconfig.json file. Ignored when `tsSourceGlob` is provided.", | ||
}) | ||
.option("tsSourceGlob", { | ||
default: "packages/**/*.ts*", | ||
type: "string", | ||
description: | ||
"React source glob to be used by ts-morph, which is useful for monorepo where tsconfig is not available at the root.", | ||
'React source glob to be used by ts-morph, which is useful for monorepo where tsconfig is not available at the root. When provided, `tsconfig` is ignored. e.g., "packages/**/*.ts*"', | ||
}) | ||
@@ -38,3 +38,2 @@ .option("themeCss", { | ||
default: false, | ||
alias: "v", | ||
description: "verbose logging", | ||
@@ -79,4 +78,5 @@ }) | ||
}) | ||
.wrap(yargs.terminalWidth()) | ||
.help() | ||
.example(`$0 --from 1.30.0 --to 1.36.0 --tsSourceGlob "packages/**/*.ts*"`) | ||
.alias("help", "h").argv; |
@@ -17,1 +17,5 @@ import { parsedArgs } from "./args.js"; | ||
} | ||
export function verboseOnlyTableLog(...data) { | ||
(verbose || dryRun) && console.table(...data); | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73552
2183