tsds-lib-test 1.19.2 → 1.19.4

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.
@@ -10,10 +10,10 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  var _crossspawncb = /*#__PURE__*/ _interop_require_default(require("cross-spawn-cb"));
12
12
  var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
13
+ var _fsremovecompat = require("fs-remove-compat");
13
14
  var _mkdirpclassic = /*#__PURE__*/ _interop_require_default(require("mkdirp-classic"));
14
15
  var _path = /*#__PURE__*/ _interop_require_default(require("path"));
15
16
  var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
16
- var _rimraf2 = /*#__PURE__*/ _interop_require_default(require("rimraf2"));
17
17
  var _tsdslib = require("tsds-lib");
18
18
  var _url = /*#__PURE__*/ _interop_require_default(require("url"));
19
19
  function _interop_require_default(obj) {
@@ -30,9 +30,9 @@ function worker(repo, dest, options, callback) {
30
30
  var installOptions = options;
31
31
  // options.clean = true;
32
32
  function checkOrClean(dest, callback) {
33
- installOptions.clean ? (0, _rimraf2.default)(dest, {
34
- disableGlob: true
35
- }, callback.bind(null, new Error('clone'))) : _fs.default.stat(dest, callback);
33
+ installOptions.clean ? (0, _fsremovecompat.safeRm)(dest, function() {
34
+ return callback(new Error('clone'));
35
+ }) : _fs.default.stat(dest, callback);
36
36
  }
37
37
  checkOrClean(dest, function(err) {
38
38
  var queue = new _queuecb.default(1);
@@ -48,6 +48,46 @@ function worker(repo, dest, options, callback) {
48
48
  stdio: 'inherit'
49
49
  }));
50
50
  } else {
51
+ // Remove stale lock files first
52
+ queue.defer(function(cb) {
53
+ var gitDir = _path.default.join(dest, '.git');
54
+ try {
55
+ var files = _fs.default.readdirSync(gitDir);
56
+ for(var i = 0; i < files.length; i++){
57
+ if (files[i].indexOf('.lock') >= 0) {
58
+ try {
59
+ _fs.default.unlinkSync(_path.default.join(gitDir, files[i]));
60
+ } catch (_e) {
61
+ /* ignore */ }
62
+ }
63
+ }
64
+ } catch (_e) {
65
+ /* ignore */ }
66
+ cb();
67
+ });
68
+ // Abort any in-progress merge/rebase (ignore errors if none in progress)
69
+ queue.defer(function(cb) {
70
+ return (0, _crossspawncb.default)('git', [
71
+ 'merge',
72
+ '--abort'
73
+ ], {
74
+ cwd: dest,
75
+ stdio: 'inherit'
76
+ }, function() {
77
+ return cb();
78
+ });
79
+ });
80
+ queue.defer(function(cb) {
81
+ return (0, _crossspawncb.default)('git', [
82
+ 'rebase',
83
+ '--abort'
84
+ ], {
85
+ cwd: dest,
86
+ stdio: 'inherit'
87
+ }, function() {
88
+ return cb();
89
+ });
90
+ });
51
91
  queue.defer(_crossspawncb.default.bind(null, 'git', [
52
92
  'clean',
53
93
  '-fd'
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ts-dev-stack/tsds-lib-test/src/lib/installGitRepo.ts"],"sourcesContent":["import spawn from 'cross-spawn-cb';\nimport fs from 'fs';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport rimraf2 from 'rimraf2';\nimport type { CommandCallback, CommandOptions } from 'tsds-lib';\nimport { wrapWorker } from 'tsds-lib';\nimport url from 'url';\nimport type { InstallOptions } from '../types.ts';\n\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst major = +process.versions.node.split('.')[0];\nconst dist = path.join(__dirname, '..', '..');\nconst version = major > 14 ? 'local' : 'stable';\nconst workerWrapper = wrapWorker(path.join(dist, 'cjs', 'lib', 'installGitRepo.js'));\n\nfunction worker(repo, dest, options: CommandOptions | InstallOptions, callback: CommandCallback) {\n const installOptions = options as InstallOptions;\n // options.clean = true;\n function checkOrClean(dest, callback) {\n installOptions.clean ? rimraf2(dest, { disableGlob: true }, callback.bind(null, new Error('clone'))) : fs.stat(dest, callback);\n }\n\n checkOrClean(dest, (err) => {\n const queue = new Queue(1);\n queue.defer(mkdirp.bind(null, dest));\n\n // does not exist - clone\n if (err) {\n queue.defer(spawn.bind(null, 'git', ['clone', repo, path.basename(dest)], { cwd: path.dirname(dest), stdio: 'inherit' }));\n }\n // exists - reset git\n else {\n queue.defer(spawn.bind(null, 'git', ['clean', '-fd'], { cwd: dest, stdio: 'inherit' }));\n queue.defer(spawn.bind(null, 'git', ['reset', '--hard', 'HEAD'], { cwd: dest, stdio: 'inherit' }));\n queue.defer(spawn.bind(null, 'git', ['pull', '--rebase'], { cwd: dest, stdio: 'inherit' }));\n }\n\n queue.defer(spawn.bind(null, 'npm', ['install', '--silent'], { cwd: dest }));\n queue.await(callback);\n });\n}\n\nexport default function installGitRepo(repo: string, dest: string, options: CommandOptions | CommandCallback, callback?: CommandCallback): undefined {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n version !== 'local' ? workerWrapper(version, repo, dest, options, callback) : worker(repo, dest, options, callback);\n}\n"],"names":["installGitRepo","__dirname","path","dirname","__filename","url","fileURLToPath","major","process","versions","node","split","dist","join","version","workerWrapper","wrapWorker","worker","repo","dest","options","callback","installOptions","checkOrClean","clean","rimraf2","disableGlob","bind","Error","fs","stat","err","queue","Queue","defer","mkdirp","spawn","basename","cwd","stdio","await"],"mappings":";;;;+BA4CA;;;eAAwBA;;;mEA5CN;yDACH;oEACI;2DACF;8DACC;8DACE;uBAEO;0DACX;;;;;;AAGhB,IAAMC,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,OAAOV,aAAI,CAACW,IAAI,CAACZ,WAAW,MAAM;AACxC,IAAMa,UAAUP,QAAQ,KAAK,UAAU;AACvC,IAAMQ,gBAAgBC,IAAAA,mBAAU,EAACd,aAAI,CAACW,IAAI,CAACD,MAAM,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Ee,SAASrB,eAAekB,IAAY,EAAEC,IAAY,EAAEC,OAAyC,EAAEC,QAA0B;IACtI,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IACtBN,YAAY,UAAUC,cAAcD,SAASI,MAAMC,MAAMC,SAASC,YAAYJ,OAAOC,MAAMC,MAAMC,SAASC;AAC5G"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ts-dev-stack/tsds-lib-test/src/lib/installGitRepo.ts"],"sourcesContent":["import spawn from 'cross-spawn-cb';\nimport fs from 'fs';\nimport { safeRm } from 'fs-remove-compat';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport type { CommandCallback, CommandOptions } from 'tsds-lib';\nimport { wrapWorker } from 'tsds-lib';\nimport url from 'url';\nimport type { InstallOptions } from '../types.ts';\n\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst major = +process.versions.node.split('.')[0];\nconst dist = path.join(__dirname, '..', '..');\nconst version = major > 14 ? 'local' : 'stable';\nconst workerWrapper = wrapWorker(path.join(dist, 'cjs', 'lib', 'installGitRepo.js'));\n\nfunction worker(repo, dest, options: CommandOptions | InstallOptions, callback: CommandCallback) {\n const installOptions = options as InstallOptions;\n // options.clean = true;\n function checkOrClean(dest, callback) {\n installOptions.clean ? safeRm(dest, () => callback(new Error('clone'))) : fs.stat(dest, callback);\n }\n\n checkOrClean(dest, (err) => {\n const queue = new Queue(1);\n queue.defer(mkdirp.bind(null, dest));\n\n // does not exist - clone\n if (err) {\n queue.defer(spawn.bind(null, 'git', ['clone', repo, path.basename(dest)], { cwd: path.dirname(dest), stdio: 'inherit' }));\n }\n // exists - reset git\n else {\n // Remove stale lock files first\n queue.defer((cb) => {\n const gitDir = path.join(dest, '.git');\n try {\n const files = fs.readdirSync(gitDir);\n for (let i = 0; i < files.length; i++) {\n if (files[i].indexOf('.lock') >= 0) {\n try {\n fs.unlinkSync(path.join(gitDir, files[i]));\n } catch (_e) {\n /* ignore */\n }\n }\n }\n } catch (_e) {\n /* ignore */\n }\n cb();\n });\n // Abort any in-progress merge/rebase (ignore errors if none in progress)\n queue.defer((cb) => spawn('git', ['merge', '--abort'], { cwd: dest, stdio: 'inherit' }, () => cb()));\n queue.defer((cb) => spawn('git', ['rebase', '--abort'], { cwd: dest, stdio: 'inherit' }, () => cb()));\n queue.defer(spawn.bind(null, 'git', ['clean', '-fd'], { cwd: dest, stdio: 'inherit' }));\n queue.defer(spawn.bind(null, 'git', ['reset', '--hard', 'HEAD'], { cwd: dest, stdio: 'inherit' }));\n queue.defer(spawn.bind(null, 'git', ['pull', '--rebase'], { cwd: dest, stdio: 'inherit' }));\n }\n\n queue.defer(spawn.bind(null, 'npm', ['install', '--silent'], { cwd: dest }));\n queue.await(callback);\n });\n}\n\nexport default function installGitRepo(repo: string, dest: string, options: CommandOptions | CommandCallback, callback?: CommandCallback): undefined {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n version !== 'local' ? workerWrapper(version, repo, dest, options, callback) : worker(repo, dest, options, callback);\n}\n"],"names":["installGitRepo","__dirname","path","dirname","__filename","url","fileURLToPath","major","process","versions","node","split","dist","join","version","workerWrapper","wrapWorker","worker","repo","dest","options","callback","installOptions","checkOrClean","clean","safeRm","Error","fs","stat","err","queue","Queue","defer","mkdirp","bind","spawn","basename","cwd","stdio","cb","gitDir","files","readdirSync","i","length","indexOf","unlinkSync","_e","await"],"mappings":";;;;+BAkEA;;;eAAwBA;;;mEAlEN;yDACH;8BACQ;oEACJ;2DACF;8DACC;uBAES;0DACX;;;;;;AAGhB,IAAMC,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,C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1,9 +1,9 @@
1
1
  import spawn from 'cross-spawn-cb';
2
2
  import fs from 'fs';
3
+ import { safeRm } from 'fs-remove-compat';
3
4
  import mkdirp from 'mkdirp-classic';
4
5
  import path from 'path';
5
6
  import Queue from 'queue-cb';
6
- import rimraf2 from 'rimraf2';
7
7
  import { wrapWorker } from 'tsds-lib';
8
8
  import url from 'url';
9
9
  const __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);
@@ -15,9 +15,7 @@ function worker(repo, dest, options, callback) {
15
15
  const installOptions = options;
16
16
  // options.clean = true;
17
17
  function checkOrClean(dest, callback) {
18
- installOptions.clean ? rimraf2(dest, {
19
- disableGlob: true
20
- }, callback.bind(null, new Error('clone'))) : fs.stat(dest, callback);
18
+ installOptions.clean ? safeRm(dest, ()=>callback(new Error('clone'))) : fs.stat(dest, callback);
21
19
  }
22
20
  checkOrClean(dest, (err)=>{
23
21
  const queue = new Queue(1);
@@ -33,6 +31,38 @@ function worker(repo, dest, options, callback) {
33
31
  stdio: 'inherit'
34
32
  }));
35
33
  } else {
34
+ // Remove stale lock files first
35
+ queue.defer((cb)=>{
36
+ const gitDir = path.join(dest, '.git');
37
+ try {
38
+ const files = fs.readdirSync(gitDir);
39
+ for(let i = 0; i < files.length; i++){
40
+ if (files[i].indexOf('.lock') >= 0) {
41
+ try {
42
+ fs.unlinkSync(path.join(gitDir, files[i]));
43
+ } catch (_e) {
44
+ /* ignore */ }
45
+ }
46
+ }
47
+ } catch (_e) {
48
+ /* ignore */ }
49
+ cb();
50
+ });
51
+ // Abort any in-progress merge/rebase (ignore errors if none in progress)
52
+ queue.defer((cb)=>spawn('git', [
53
+ 'merge',
54
+ '--abort'
55
+ ], {
56
+ cwd: dest,
57
+ stdio: 'inherit'
58
+ }, ()=>cb()));
59
+ queue.defer((cb)=>spawn('git', [
60
+ 'rebase',
61
+ '--abort'
62
+ ], {
63
+ cwd: dest,
64
+ stdio: 'inherit'
65
+ }, ()=>cb()));
36
66
  queue.defer(spawn.bind(null, 'git', [
37
67
  'clean',
38
68
  '-fd'
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ts-dev-stack/tsds-lib-test/src/lib/installGitRepo.ts"],"sourcesContent":["import spawn from 'cross-spawn-cb';\nimport fs from 'fs';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport rimraf2 from 'rimraf2';\nimport type { CommandCallback, CommandOptions } from 'tsds-lib';\nimport { wrapWorker } from 'tsds-lib';\nimport url from 'url';\nimport type { InstallOptions } from '../types.ts';\n\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst major = +process.versions.node.split('.')[0];\nconst dist = path.join(__dirname, '..', '..');\nconst version = major > 14 ? 'local' : 'stable';\nconst workerWrapper = wrapWorker(path.join(dist, 'cjs', 'lib', 'installGitRepo.js'));\n\nfunction worker(repo, dest, options: CommandOptions | InstallOptions, callback: CommandCallback) {\n const installOptions = options as InstallOptions;\n // options.clean = true;\n function checkOrClean(dest, callback) {\n installOptions.clean ? rimraf2(dest, { disableGlob: true }, callback.bind(null, new Error('clone'))) : fs.stat(dest, callback);\n }\n\n checkOrClean(dest, (err) => {\n const queue = new Queue(1);\n queue.defer(mkdirp.bind(null, dest));\n\n // does not exist - clone\n if (err) {\n queue.defer(spawn.bind(null, 'git', ['clone', repo, path.basename(dest)], { cwd: path.dirname(dest), stdio: 'inherit' }));\n }\n // exists - reset git\n else {\n queue.defer(spawn.bind(null, 'git', ['clean', '-fd'], { cwd: dest, stdio: 'inherit' }));\n queue.defer(spawn.bind(null, 'git', ['reset', '--hard', 'HEAD'], { cwd: dest, stdio: 'inherit' }));\n queue.defer(spawn.bind(null, 'git', ['pull', '--rebase'], { cwd: dest, stdio: 'inherit' }));\n }\n\n queue.defer(spawn.bind(null, 'npm', ['install', '--silent'], { cwd: dest }));\n queue.await(callback);\n });\n}\n\nexport default function installGitRepo(repo: string, dest: string, options: CommandOptions | CommandCallback, callback?: CommandCallback): undefined {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n version !== 'local' ? workerWrapper(version, repo, dest, options, callback) : worker(repo, dest, options, callback);\n}\n"],"names":["spawn","fs","mkdirp","path","Queue","rimraf2","wrapWorker","url","__dirname","dirname","__filename","fileURLToPath","major","process","versions","node","split","dist","join","version","workerWrapper","worker","repo","dest","options","callback","installOptions","checkOrClean","clean","disableGlob","bind","Error","stat","err","queue","defer","basename","cwd","stdio","await","installGitRepo"],"mappings":"AAAA,OAAOA,WAAW,iBAAiB;AACnC,OAAOC,QAAQ,KAAK;AACpB,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAC7B,OAAOC,aAAa,UAAU;AAE9B,SAASC,UAAU,QAAQ,WAAW;AACtC,OAAOC,SAAS,MAAM;AAGtB,MAAMC,YAAYL,KAAKM,OAAO,CAAC,OAAOC,eAAe,cAAcH,IAAII,aAAa,CAAC,YAAYJ,GAAG,IAAIG;AACxG,MAAME,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,OAAOd,KAAKe,IAAI,CAACV,WAAW,MAAM;AACxC,MAAMW,UAAUP,QAAQ,KAAK,UAAU;AACvC,MAAMQ,gBAAgBd,WAAWH,KAAKe,IAAI,CAACD,MAAM,OAAO,OAAO;AAE/D,SAASI,OAAOC,IAAI,EAAEC,IAAI,EAAEC,OAAwC,EAAEC,QAAyB;IAC7F,MAAMC,iBAAiBF;IACvB,wBAAwB;IACxB,SAASG,aAAaJ,IAAI,EAAEE,QAAQ;QAClCC,eAAeE,KAAK,GAAGvB,QAAQkB,MAAM;YAAEM,aAAa;QAAK,GAAGJ,SAASK,IAAI,CAAC,MAAM,IAAIC,MAAM,aAAa9B,GAAG+B,IAAI,CAACT,MAAME;IACvH;IAEAE,aAAaJ,M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nimport fs from 'fs';\nimport { safeRm } from 'fs-remove-compat';\nimport mkdirp from 'mkdirp-classic';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport type { CommandCallback, CommandOptions } from 'tsds-lib';\nimport { wrapWorker } from 'tsds-lib';\nimport url from 'url';\nimport type { InstallOptions } from '../types.ts';\n\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst major = +process.versions.node.split('.')[0];\nconst dist = path.join(__dirname, '..', '..');\nconst version = major > 14 ? 'local' : 'stable';\nconst workerWrapper = wrapWorker(path.join(dist, 'cjs', 'lib', 'installGitRepo.js'));\n\nfunction worker(repo, dest, options: CommandOptions | InstallOptions, callback: CommandCallback) {\n const installOptions = options as InstallOptions;\n // options.clean = true;\n function checkOrClean(dest, callback) {\n installOptions.clean ? safeRm(dest, () => callback(new Error('clone'))) : fs.stat(dest, callback);\n }\n\n checkOrClean(dest, (err) => {\n const queue = new Queue(1);\n queue.defer(mkdirp.bind(null, dest));\n\n // does not exist - clone\n if (err) {\n queue.defer(spawn.bind(null, 'git', ['clone', repo, path.basename(dest)], { cwd: path.dirname(dest), stdio: 'inherit' }));\n }\n // exists - reset git\n else {\n // Remove stale lock files first\n queue.defer((cb) => {\n const gitDir = path.join(dest, '.git');\n try {\n const files = fs.readdirSync(gitDir);\n for (let i = 0; i < files.length; i++) {\n if (files[i].indexOf('.lock') >= 0) {\n try {\n fs.unlinkSync(path.join(gitDir, files[i]));\n } catch (_e) {\n /* ignore */\n }\n }\n }\n } catch (_e) {\n /* ignore */\n }\n cb();\n });\n // Abort any in-progress merge/rebase (ignore errors if none in progress)\n queue.defer((cb) => spawn('git', ['merge', '--abort'], { cwd: dest, stdio: 'inherit' }, () => cb()));\n queue.defer((cb) => spawn('git', ['rebase', '--abort'], { cwd: dest, stdio: 'inherit' }, () => cb()));\n queue.defer(spawn.bind(null, 'git', ['clean', '-fd'], { cwd: dest, stdio: 'inherit' }));\n queue.defer(spawn.bind(null, 'git', ['reset', '--hard', 'HEAD'], { cwd: dest, stdio: 'inherit' }));\n queue.defer(spawn.bind(null, 'git', ['pull', '--rebase'], { cwd: dest, stdio: 'inherit' }));\n }\n\n queue.defer(spawn.bind(null, 'npm', ['install', '--silent'], { cwd: dest }));\n queue.await(callback);\n });\n}\n\nexport default function installGitRepo(repo: string, dest: string, options: CommandOptions | CommandCallback, callback?: CommandCallback): undefined {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n version !== 'local' ? workerWrapper(version, repo, dest, options, callback) : worker(repo, dest, options, callback);\n}\n"],"names":["spawn","fs","safeRm","mkdirp","path","Queue","wrapWorker","url","__dirname","dirname","__filename","fileURLToPath","major","process","versions","node","split","dist","join","version","workerWrapper","worker","repo","dest","options","callback","installOptions","checkOrClean","clean","Error","stat","err","queue","defer","bind","basename","cwd","stdio","cb","gitDir","files","readdirSync","i","length","indexOf","unlinkSync","_e","await","installGitRepo"],"mappings":"AAAA,OAAOA,WAAW,iBAAiB;AACnC,OAAOC,QAAQ,KAAK;AACpB,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAE7B,SAASC,UAAU,QAAQ,WAAW;AACtC,OAAOC,SAAS,MAAM;AAGtB,MAAMC,YAAYJ,KAAKK,OAAO,CAAC,OAAOC,eAAe,cAAcH,IAAII,aAAa,CAAC,YAAYJ,GAAG,IAAIG;AACxG,MAAME,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,OAAOb,KAAKc,IAAI,CAACV,WAAW,MAAM;AACxC,MAAMW,UAAUP,QAAQ,KAAK,UAAU;AACvC,MAAMQ,gBAAgBd,WAAWF,KAAKc,IAAI,CAACD,MAAM,OAAO,OAAO;AAE/D,SAASI,OAAOC,IAAI,EAAEC,IAAI,EAAEC,OAAwC,EAAEC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BAAU;iBAAU,EAAE;oBAAEoC,KAAKb;oBAAMc,OAAO;gBAAU,GAAG,IAAMC;YAC/FN,MAAMC,KAAK,CAACjC,MAAMkC,IAAI,CAAC,MAAM,OAAO;gBAAC;gBAAS;aAAM,EAAE;gBAAEE,KAAKb;gBAAMc,OAAO;YAAU;YACpFL,MAAMC,KAAK,CAACjC,MAAMkC,IAAI,CAAC,MAAM,OAAO;gBAAC;gBAAS;gBAAU;aAAO,EAAE;gBAAEE,KAAKb;gBAAMc,OAAO;YAAU;YAC/FL,MAAMC,KAAK,CAACjC,MAAMkC,IAAI,CAAC,MAAM,OAAO;gBAAC;gBAAQ;aAAW,EAAE;gBAAEE,KAAKb;gBAAMc,OAAO;YAAU;QAC1F;QAEAL,MAAMC,KAAK,CAACjC,MAAMkC,IAAI,CAAC,MAAM,OAAO;YAAC;YAAW;SAAW,EAAE;YAAEE,KAAKb;QAAK;QACzES,MAAMe,KAAK,CAACtB;IACd;AACF;AAEA,eAAe,SAASuB,eAAe1B,IAAY,EAAEC,IAAY,EAAEC,OAAyC,EAAEC,QAA0B;IACtI,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IACtBL,YAAY,UAAUC,cAAcD,SAASG,MAAMC,MAAMC,SAASC,YAAYJ,OAAOC,MAAMC,MAAMC,SAASC;AAC5G"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsds-lib-test",
3
- "version": "1.19.2",
3
+ "version": "1.19.4",
4
4
  "description": "Development stack for TypeScript libraries",
5
5
  "keywords": [
6
6
  "dev",
@@ -40,9 +40,9 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "cross-spawn-cb": "*",
43
+ "fs-remove-compat": "*",
43
44
  "mkdirp-classic": "*",
44
45
  "queue-cb": "*",
45
- "rimraf2": "*",
46
46
  "tsds-lib": "*"
47
47
  },
48
48
  "devDependencies": {