ts-purify
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -27,4 +27,7 @@ "use strict"; | ||
} | ||
else if (arg === '-i' || arg === '--ignore-pattern') { | ||
options.ignorePattern = args[++i]; | ||
} | ||
else if (arg === '-h' || arg === '--help') { | ||
console.log(args[1] + ' [-h] [-v] [-s <dir>] [-d <dir]'); | ||
console.log(args[1] + ' [-h] [-v] [-s <dir>] [-d <dir>] [-i <pattern>]'); | ||
process.exit(0); | ||
@@ -31,0 +34,0 @@ } |
export interface Options { | ||
ignorePattern?: string; | ||
verbose?: boolean; | ||
@@ -3,0 +4,0 @@ watchProject?: boolean; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const minimatch_1 = __importDefault(require("minimatch")); | ||
const util_1 = require("util"); | ||
@@ -34,2 +38,5 @@ const fb_watchman_1 = require("fb-watchman"); | ||
} | ||
if (options.ignorePattern && minimatch_1.default(file, options.ignorePattern)) { | ||
return false; | ||
} | ||
const correspondingSource = file.slice(destDir.length + 1).replace(/\.js(\.map)?/, '.ts'); | ||
@@ -90,3 +97,4 @@ return !srcSet.has(correspondingSource); | ||
toDelete.forEach(async (file) => { | ||
if (await goodExists(file)) { | ||
if ((await goodExists(file)) && | ||
!(options.ignorePattern && minimatch_1.default(file, options.ignorePattern))) { | ||
fs_1.unlink(file, (err) => { | ||
@@ -93,0 +101,0 @@ if (err) { |
{ | ||
"name": "ts-purify", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "ensure compiled typescript files are removed when the corresponding source files are", | ||
@@ -13,3 +13,3 @@ "author": "insidewhy <github@chilon.net>", | ||
"type": "git", | ||
"url": "git://github.com/insidewhy/mirror-directories.git" | ||
"url": "git://github.com/insidewhy/ts-purify.git" | ||
}, | ||
@@ -36,17 +36,18 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"fb-watchman": "^2.0.1" | ||
"fb-watchman": "^2.0.1", | ||
"minimatch": "^3.0.4" | ||
}, | ||
"devDependencies": { | ||
"@types/fb-watchman": "2.0.0", | ||
"@types/node": "12.12.34", | ||
"@typescript-eslint/eslint-plugin": "2.27.0", | ||
"@typescript-eslint/parser": "2.27.0", | ||
"eslint": "6.8.0", | ||
"eslint-config-prettier": "6.10.1", | ||
"husky": "4.2.3", | ||
"prettier": "2.0.4", | ||
"@types/node": "12.12.37", | ||
"@typescript-eslint/eslint-plugin": "2.34.0", | ||
"@typescript-eslint/parser": "2.34.0", | ||
"eslint": "7.1.0", | ||
"eslint-config-prettier": "6.11.0", | ||
"husky": "4.2.5", | ||
"prettier": "2.0.5", | ||
"pretty-quick": "2.0.1", | ||
"rimraf": "3.0.2", | ||
"typescript": "3.8.3" | ||
"typescript": "3.9.3" | ||
} | ||
} |
@@ -22,4 +22,6 @@ import { cleanAllFiles, watchSourceAndCleanDest, Options } from '.' | ||
options.watchProject = true | ||
} else if (arg === '-i' || arg === '--ignore-pattern') { | ||
options.ignorePattern = args[++i] | ||
} else if (arg === '-h' || arg === '--help') { | ||
console.log(args[1] + ' [-h] [-v] [-s <dir>] [-d <dir]') | ||
console.log(args[1] + ' [-h] [-v] [-s <dir>] [-d <dir>] [-i <pattern>]') | ||
process.exit(0) | ||
@@ -26,0 +28,0 @@ } else { |
@@ -0,1 +1,2 @@ | ||
import minimatch from 'minimatch' | ||
import { promisify } from 'util' | ||
@@ -29,2 +30,3 @@ import { Client } from 'fb-watchman' | ||
export interface Options { | ||
ignorePattern?: string | ||
verbose?: boolean | ||
@@ -56,2 +58,6 @@ watchProject?: boolean | ||
if (options.ignorePattern && minimatch(file, options.ignorePattern)) { | ||
return false | ||
} | ||
const correspondingSource = file.slice(destDir.length + 1).replace(/\.js(\.map)?/, '.ts') | ||
@@ -128,3 +134,6 @@ return !srcSet.has(correspondingSource) | ||
toDelete.forEach(async (file) => { | ||
if (await goodExists(file)) { | ||
if ( | ||
(await goodExists(file)) && | ||
!(options.ignorePattern && minimatch(file, options.ignorePattern)) | ||
) { | ||
unlink(file, (err) => { | ||
@@ -131,0 +140,0 @@ if (err) { |
@@ -11,5 +11,6 @@ { | ||
"target": "es2017", | ||
"preserveWatchOutput": true | ||
"preserveWatchOutput": true, | ||
"esModuleInterop": true | ||
}, | ||
"include": ["."] | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
24409
375
0
2
+ Addedminimatch@^3.0.4
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedminimatch@3.1.2(transitive)