Comparing version 1.0.8 to 1.1.0
@@ -23,2 +23,6 @@ export declare const cliArgsOptions: { | ||
}; | ||
readonly force: { | ||
readonly type: "boolean"; | ||
readonly short: "f"; | ||
}; | ||
readonly version: { | ||
@@ -25,0 +29,0 @@ readonly type: "boolean"; |
@@ -23,2 +23,6 @@ export const cliArgsOptions = { | ||
}, | ||
force: { | ||
type: "boolean", | ||
short: "f", | ||
}, | ||
version: { | ||
@@ -43,2 +47,3 @@ type: "boolean", | ||
-w, --watch Watch mode | ||
-f, --force Force copy | ||
-v, --version Print copypack version | ||
@@ -45,0 +50,0 @@ -h, --help Print this message |
@@ -8,3 +8,3 @@ #!/usr/bin/env node | ||
import { cliArgsOptions, printHelp } from "./cli-options.js"; | ||
const { values: { help, source, target, matchers, watch: watchMode, version: versionMode, }, } = parseArgs(cliArgsOptions); | ||
const { values: { help, source, target, matchers, force: forceCopy, watch: watchMode, version: versionMode, }, } = parseArgs(cliArgsOptions); | ||
const version = loadPackageJson().version; | ||
@@ -11,0 +11,0 @@ if (versionMode) { |
export declare function watch(sourceProjectPath: string, targetProjectPath: string, sourcePackagesMatchers: string[]): void; | ||
export declare function run(sourceProjectPath: string, targetProjectPath: string, sourcePackagesMatchers: string[]): void; | ||
export declare function run(sourceProjectPath: string, targetProjectPath: string, sourcePackagesMatchers: string[], forceCopy?: boolean): void; | ||
//# sourceMappingURL=copypack.d.ts.map |
@@ -28,3 +28,3 @@ import ts from "typescript"; | ||
} | ||
export function run(sourceProjectPath, targetProjectPath, sourcePackagesMatchers) { | ||
export function run(sourceProjectPath, targetProjectPath, sourcePackagesMatchers, forceCopy = false) { | ||
const targetNodeModulesPath = getExistingNodeModulesPath(targetProjectPath); | ||
@@ -46,4 +46,5 @@ const packageJsonPaths = ts.sys.readDirectory(sourceProjectPath, undefined, undefined, sourcePackagesMatchers); | ||
const targetPackageJsonPath = path.join(targetPackagePath, "package.json"); | ||
if (fs.existsSync(targetPackagePath) && | ||
fs.statSync(targetPackagePath).isDirectory()) { | ||
if (forceCopy || | ||
(fs.existsSync(targetPackagePath) && | ||
fs.statSync(targetPackagePath).isDirectory())) { | ||
reportPackageDependencyChanges(targetPackageJsonPath, pkg); | ||
@@ -50,0 +51,0 @@ fs.rmSync(targetPackagePath, { recursive: true }); |
@@ -5,3 +5,3 @@ export function debounce(fn, ms) { | ||
clearTimeout(timeoutId); | ||
timeoutId = setTimeout(fn, ms, args); | ||
timeoutId = setTimeout(() => fn(...args), ms); | ||
}; | ||
@@ -8,0 +8,0 @@ } |
{ | ||
"name": "copypack", | ||
"version": "1.0.8", | ||
"version": "1.1.0", | ||
"description": "like links but copies", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -25,2 +25,6 @@ import { ParseArgsConfig } from "node:util"; | ||
}, | ||
force: { | ||
type: "boolean" as const, | ||
short: "f", | ||
}, | ||
version: { | ||
@@ -45,2 +49,3 @@ type: "boolean" as const, | ||
-w, --watch Watch mode | ||
-f, --force Force copy | ||
-v, --version Print copypack version | ||
@@ -47,0 +52,0 @@ -h, --help Print this message |
@@ -15,2 +15,3 @@ #!/usr/bin/env node | ||
matchers, | ||
force: forceCopy, | ||
watch: watchMode, | ||
@@ -17,0 +18,0 @@ version: versionMode, |
@@ -40,3 +40,4 @@ import ts from "typescript"; | ||
targetProjectPath: string, | ||
sourcePackagesMatchers: string[] | ||
sourcePackagesMatchers: string[], | ||
forceCopy = false | ||
) { | ||
@@ -72,4 +73,5 @@ const targetNodeModulesPath = getExistingNodeModulesPath(targetProjectPath); | ||
if ( | ||
fs.existsSync(targetPackagePath) && | ||
fs.statSync(targetPackagePath).isDirectory() | ||
forceCopy || | ||
(fs.existsSync(targetPackagePath) && | ||
fs.statSync(targetPackagePath).isDirectory()) | ||
) { | ||
@@ -76,0 +78,0 @@ reportPackageDependencyChanges(targetPackageJsonPath, pkg); |
@@ -8,3 +8,3 @@ export function debounce<T extends (...args: any[]) => void>( | ||
clearTimeout(timeoutId); | ||
timeoutId = setTimeout(fn, ms, args); | ||
timeoutId = setTimeout(() => fn(...args), ms); | ||
}; | ||
@@ -11,0 +11,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
48964
804