tsds-lib-test 1.0.2
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/LICENSE +22 -0
- package/README.md +30 -0
- package/assets/c8rc.json +4 -0
- package/assets/karma.conf.js +37 -0
- package/dist/cjs/index.js +17 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/lib/data.js +83 -0
- package/dist/cjs/lib/data.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/lib/data.mjs +81 -0
- package/dist/esm/lib/data.mjs.map +1 -0
- package/dist/esm/package.json +1 -0
- package/package.json +63 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Kevin Malakoff
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
wof this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
## ts-dev-stack
|
|
2
|
+
|
|
3
|
+
Development stack for TypeScript libraries
|
|
4
|
+
|
|
5
|
+
For an example, check out [parser-multipart](https://github.com/kmalakoff/parser-multipart)
|
|
6
|
+
|
|
7
|
+
# Example 1: CLI
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
# build
|
|
11
|
+
$ tsds build
|
|
12
|
+
|
|
13
|
+
# run coverage tests (default on "test/**/*.test.*" only) using c8
|
|
14
|
+
$ tsds coverage
|
|
15
|
+
|
|
16
|
+
# deploy library using np
|
|
17
|
+
$ tsds deploy
|
|
18
|
+
|
|
19
|
+
# format library using prettier
|
|
20
|
+
$ tsds format
|
|
21
|
+
|
|
22
|
+
# run tests on current version of node and browser
|
|
23
|
+
$ tsds test
|
|
24
|
+
|
|
25
|
+
# run tests on current version of node
|
|
26
|
+
$ tsds test:node
|
|
27
|
+
|
|
28
|
+
# run tests on browser only
|
|
29
|
+
$ tsds test:browser
|
|
30
|
+
```
|
package/assets/c8rc.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var extensions = require('../dist/cjs/lib/extensions');
|
|
2
|
+
|
|
3
|
+
var preprocessors = extensions.reduce(function (memo, ext) {
|
|
4
|
+
memo['test/**/*' + ext] = ['webpack', 'sourcemap'];
|
|
5
|
+
return memo;
|
|
6
|
+
}, {});
|
|
7
|
+
|
|
8
|
+
var webpack = {
|
|
9
|
+
devtool: 'inline-source-map',
|
|
10
|
+
module: {
|
|
11
|
+
rules: [{ test: /\.(ts|tsx)$/, use: 'ts-loader', exclude: /node_modules/ }],
|
|
12
|
+
},
|
|
13
|
+
resolve: {
|
|
14
|
+
extensions: extensions,
|
|
15
|
+
alias: {
|
|
16
|
+
jsdom: false,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
module.exports = function (config) {
|
|
22
|
+
var pattern = process.argv[process.argv.length - 1];
|
|
23
|
+
config.set({
|
|
24
|
+
basePath: process.cwd(),
|
|
25
|
+
frameworks: ['mocha', 'webpack'],
|
|
26
|
+
reporters: ['mocha'],
|
|
27
|
+
preprocessors,
|
|
28
|
+
files: [{ pattern: pattern, watched: false }],
|
|
29
|
+
webpack,
|
|
30
|
+
client: { mocha: { timeout: 5000 } },
|
|
31
|
+
colors: true,
|
|
32
|
+
browsers: ['ChromeHeadless'],
|
|
33
|
+
autoWatch: false,
|
|
34
|
+
singleRun: true,
|
|
35
|
+
concurrency: Infinity,
|
|
36
|
+
});
|
|
37
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "data", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _data.default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _data = /*#__PURE__*/ _interop_require_default(require("./lib/data"));
|
|
12
|
+
function _interop_require_default(obj) {
|
|
13
|
+
return obj && obj.__esModule ? obj : {
|
|
14
|
+
default: obj
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.mjs"],"sourcesContent":["export { default as data } from './lib/data';\n"],"names":["data"],"mappings":";;;;+BAAoBA;;;eAAAA,aAAI;;;2DAAQ"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var fs = require('fs');
|
|
3
|
+
var path = require('path');
|
|
4
|
+
var Queue = require('queue-cb');
|
|
5
|
+
var spawn = require('cross-spawn-cb');
|
|
6
|
+
var access = require('fs-access-compat');
|
|
7
|
+
var tmpdir = require('os').tmpdir || require('os-shim').tmpdir;
|
|
8
|
+
var mkdirp = require('mkdirp');
|
|
9
|
+
var rimraf2 = require('rimraf2');
|
|
10
|
+
var shortHash = require('short-hash');
|
|
11
|
+
var dest = path.join(tmpdir(), 'tsds', shortHash(__dirname));
|
|
12
|
+
mkdirp.sync(dest);
|
|
13
|
+
module.exports = function data(git, options, callback) {
|
|
14
|
+
var packageName = path.basename(git, path.extname(git));
|
|
15
|
+
var packagePath = path.join(dest, packageName);
|
|
16
|
+
var tsdsPackagePath = path.resolve(packagePath, 'node_modules', 'ts-dev-stack');
|
|
17
|
+
var tsdsBinPath = path.resolve(packagePath, 'node_modules', '.bin', 'tsds');
|
|
18
|
+
// return callback(null, packagePath);
|
|
19
|
+
console.log('------------------');
|
|
20
|
+
console.log("Preparing: ".concat(packagePath));
|
|
21
|
+
access(packagePath, function(err) {
|
|
22
|
+
var queue = new Queue(1);
|
|
23
|
+
if (!err && options.clean) {
|
|
24
|
+
rimraf2.sync(packagePath, {
|
|
25
|
+
disableGlob: true
|
|
26
|
+
});
|
|
27
|
+
err = true;
|
|
28
|
+
}
|
|
29
|
+
// does not exist - clone
|
|
30
|
+
if (err) {
|
|
31
|
+
queue.defer(spawn.bind(null, 'git', [
|
|
32
|
+
'clone',
|
|
33
|
+
git
|
|
34
|
+
], {
|
|
35
|
+
stdio: 'inherit',
|
|
36
|
+
cwd: dest
|
|
37
|
+
}));
|
|
38
|
+
} else {
|
|
39
|
+
queue.defer(spawn.bind(null, 'git', [
|
|
40
|
+
'clean',
|
|
41
|
+
'-fd'
|
|
42
|
+
], {
|
|
43
|
+
stdio: 'inherit',
|
|
44
|
+
cwd: packagePath
|
|
45
|
+
}));
|
|
46
|
+
queue.defer(spawn.bind(null, 'git', [
|
|
47
|
+
'reset',
|
|
48
|
+
'--hard',
|
|
49
|
+
'HEAD'
|
|
50
|
+
], {
|
|
51
|
+
stdio: 'inherit',
|
|
52
|
+
cwd: packagePath
|
|
53
|
+
}));
|
|
54
|
+
queue.defer(spawn.bind(null, 'git', [
|
|
55
|
+
'pull',
|
|
56
|
+
'--rebase'
|
|
57
|
+
], {
|
|
58
|
+
stdio: 'inherit',
|
|
59
|
+
cwd: packagePath
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
queue.defer(spawn.bind(null, 'nvu', [
|
|
63
|
+
'lts',
|
|
64
|
+
'--silent',
|
|
65
|
+
'npm',
|
|
66
|
+
'install'
|
|
67
|
+
], {
|
|
68
|
+
stdio: 'inherit',
|
|
69
|
+
cwd: packagePath
|
|
70
|
+
}));
|
|
71
|
+
// link package
|
|
72
|
+
queue.defer(fs.rename.bind(null, tsdsPackagePath, "".concat(tsdsPackagePath, ".tsds")));
|
|
73
|
+
queue.defer(fs.symlink.bind(null, path.resolve(__dirname, '..', '..'), tsdsPackagePath, 'dir'));
|
|
74
|
+
// link bin
|
|
75
|
+
queue.defer(fs.rename.bind(null, tsdsBinPath, "".concat(tsdsBinPath, ".tsds")));
|
|
76
|
+
queue.defer(fs.symlink.bind(null, path.resolve(__dirname, '..', '..', 'bin', 'cli.js'), tsdsBinPath, 'file'));
|
|
77
|
+
queue.await(function(err) {
|
|
78
|
+
console.log('------------------');
|
|
79
|
+
err ? callback(err) : callback(null, packagePath);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["data.js"],"sourcesContent":["const fs = require('fs');\nconst path = require('path');\nconst Queue = require('queue-cb');\nconst spawn = require('cross-spawn-cb');\nconst access = require('fs-access-compat');\n\nconst tmpdir = require('os').tmpdir || require('os-shim').tmpdir;\nconst mkdirp = require('mkdirp');\nconst rimraf2 = require('rimraf2');\nconst shortHash = require('short-hash');\n\nconst dest = path.join(tmpdir(), 'tsds', shortHash(__dirname));\nmkdirp.sync(dest);\n\nmodule.exports = function data(git, options, callback) {\n const packageName = path.basename(git, path.extname(git));\n const packagePath = path.join(dest, packageName);\n const tsdsPackagePath = path.resolve(packagePath, 'node_modules', 'ts-dev-stack');\n const tsdsBinPath = path.resolve(packagePath, 'node_modules', '.bin', 'tsds');\n\n // return callback(null, packagePath);\n\n console.log('------------------');\n console.log(`Preparing: ${packagePath}`);\n\n access(packagePath, (err) => {\n const queue = new Queue(1);\n\n if (!err && options.clean) {\n rimraf2.sync(packagePath, { disableGlob: true });\n err = true;\n }\n\n // does not exist - clone\n if (err) {\n queue.defer(spawn.bind(null, 'git', ['clone', git], { stdio: 'inherit', cwd: dest }));\n }\n // exists - reset git\n else {\n queue.defer(spawn.bind(null, 'git', ['clean', '-fd'], { stdio: 'inherit', cwd: packagePath }));\n queue.defer(spawn.bind(null, 'git', ['reset', '--hard', 'HEAD'], { stdio: 'inherit', cwd: packagePath }));\n queue.defer(spawn.bind(null, 'git', ['pull', '--rebase'], { stdio: 'inherit', cwd: packagePath }));\n }\n queue.defer(spawn.bind(null, 'nvu', ['lts', '--silent', 'npm', 'install'], { stdio: 'inherit', cwd: packagePath }));\n\n // link package\n queue.defer(fs.rename.bind(null, tsdsPackagePath, `${tsdsPackagePath}.tsds`));\n queue.defer(fs.symlink.bind(null, path.resolve(__dirname, '..', '..'), tsdsPackagePath, 'dir'));\n\n // link bin\n queue.defer(fs.rename.bind(null, tsdsBinPath, `${tsdsBinPath}.tsds`));\n queue.defer(fs.symlink.bind(null, path.resolve(__dirname, '..', '..', 'bin', 'cli.js'), tsdsBinPath, 'file'));\n\n queue.await((err) => {\n console.log('------------------');\n err ? callback(err) : callback(null, packagePath);\n });\n });\n};\n"],"names":["fs","require","path","Queue","spawn","access","tmpdir","mkdirp","rimraf2","shortHash","dest","join","__dirname","sync","module","exports","data","git","options","callback","packageName","basename","extname","packagePath","tsdsPackagePath","resolve","tsdsBinPath","console","log","err","queue","clean","disableGlob","defer","bind","stdio","cwd","rename","symlink","await"],"mappings":";AAAA,IAAMA,KAAKC,QAAQ;AACnB,IAAMC,OAAOD,QAAQ;AACrB,IAAME,QAAQF,QAAQ;AACtB,IAAMG,QAAQH,QAAQ;AACtB,IAAMI,SAASJ,QAAQ;AAEvB,IAAMK,SAASL,QAAQ,MAAMK,MAAM,IAAIL,QAAQ,WAAWK,MAAM;AAChE,IAAMC,SAASN,QAAQ;AACvB,IAAMO,UAAUP,QAAQ;AACxB,IAAMQ,YAAYR,QAAQ;AAE1B,IAAMS,OAAOR,KAAKS,IAAI,CAACL,UAAU,QAAQG,UAAUG;AACnDL,OAAOM,IAAI,CAACH;AAEZI,OAAOC,OAAO,GAAG,SAASC,KAAKC,GAAG,EAAEC,OAAO,EAAEC,QAAQ;IACnD,IAAMC,cAAclB,KAAKmB,QAAQ,CAACJ,KAAKf,KAAKoB,OAAO,CAACL;IACpD,IAAMM,cAAcrB,KAAKS,IAAI,CAACD,MAAMU;IACpC,IAAMI,kBAAkBtB,KAAKuB,OAAO,CAACF,aAAa,gBAAgB;IAClE,IAAMG,cAAcxB,KAAKuB,OAAO,CAACF,aAAa,gBAAgB,QAAQ;IAEtE,sCAAsC;IAEtCI,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC,AAAC,cAAyB,OAAZL;IAE1BlB,OAAOkB,aAAa,SAACM;QACnB,IAAMC,QAAQ,IAAI3B,MAAM;QAExB,IAAI,CAAC0B,OAAOX,QAAQa,KAAK,EAAE;YACzBvB,QAAQK,IAAI,CAACU,aAAa;gBAAES,aAAa;YAAK;YAC9CH,MAAM;QACR;QAEA,yBAAyB;QACzB,IAAIA,KAAK;YACPC,MAAMG,KAAK,CAAC7B,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+1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as data } from './lib/data';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.mjs"],"sourcesContent":["export { default as data } from './lib/data';\n"],"names":["default","data"],"mappings":"AAAA,SAASA,WAAWC,IAAI,QAAQ,aAAa"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const Queue = require('queue-cb');
|
|
4
|
+
const spawn = require('cross-spawn-cb');
|
|
5
|
+
const access = require('fs-access-compat');
|
|
6
|
+
const tmpdir = require('os').tmpdir || require('os-shim').tmpdir;
|
|
7
|
+
const mkdirp = require('mkdirp');
|
|
8
|
+
const rimraf2 = require('rimraf2');
|
|
9
|
+
const shortHash = require('short-hash');
|
|
10
|
+
const dest = path.join(tmpdir(), 'tsds', shortHash(__dirname));
|
|
11
|
+
mkdirp.sync(dest);
|
|
12
|
+
module.exports = function data(git, options, callback) {
|
|
13
|
+
const packageName = path.basename(git, path.extname(git));
|
|
14
|
+
const packagePath = path.join(dest, packageName);
|
|
15
|
+
const tsdsPackagePath = path.resolve(packagePath, 'node_modules', 'ts-dev-stack');
|
|
16
|
+
const tsdsBinPath = path.resolve(packagePath, 'node_modules', '.bin', 'tsds');
|
|
17
|
+
// return callback(null, packagePath);
|
|
18
|
+
console.log('------------------');
|
|
19
|
+
console.log(`Preparing: ${packagePath}`);
|
|
20
|
+
access(packagePath, (err)=>{
|
|
21
|
+
const queue = new Queue(1);
|
|
22
|
+
if (!err && options.clean) {
|
|
23
|
+
rimraf2.sync(packagePath, {
|
|
24
|
+
disableGlob: true
|
|
25
|
+
});
|
|
26
|
+
err = true;
|
|
27
|
+
}
|
|
28
|
+
// does not exist - clone
|
|
29
|
+
if (err) {
|
|
30
|
+
queue.defer(spawn.bind(null, 'git', [
|
|
31
|
+
'clone',
|
|
32
|
+
git
|
|
33
|
+
], {
|
|
34
|
+
stdio: 'inherit',
|
|
35
|
+
cwd: dest
|
|
36
|
+
}));
|
|
37
|
+
} else {
|
|
38
|
+
queue.defer(spawn.bind(null, 'git', [
|
|
39
|
+
'clean',
|
|
40
|
+
'-fd'
|
|
41
|
+
], {
|
|
42
|
+
stdio: 'inherit',
|
|
43
|
+
cwd: packagePath
|
|
44
|
+
}));
|
|
45
|
+
queue.defer(spawn.bind(null, 'git', [
|
|
46
|
+
'reset',
|
|
47
|
+
'--hard',
|
|
48
|
+
'HEAD'
|
|
49
|
+
], {
|
|
50
|
+
stdio: 'inherit',
|
|
51
|
+
cwd: packagePath
|
|
52
|
+
}));
|
|
53
|
+
queue.defer(spawn.bind(null, 'git', [
|
|
54
|
+
'pull',
|
|
55
|
+
'--rebase'
|
|
56
|
+
], {
|
|
57
|
+
stdio: 'inherit',
|
|
58
|
+
cwd: packagePath
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
queue.defer(spawn.bind(null, 'nvu', [
|
|
62
|
+
'lts',
|
|
63
|
+
'--silent',
|
|
64
|
+
'npm',
|
|
65
|
+
'install'
|
|
66
|
+
], {
|
|
67
|
+
stdio: 'inherit',
|
|
68
|
+
cwd: packagePath
|
|
69
|
+
}));
|
|
70
|
+
// link package
|
|
71
|
+
queue.defer(fs.rename.bind(null, tsdsPackagePath, `${tsdsPackagePath}.tsds`));
|
|
72
|
+
queue.defer(fs.symlink.bind(null, path.resolve(__dirname, '..', '..'), tsdsPackagePath, 'dir'));
|
|
73
|
+
// link bin
|
|
74
|
+
queue.defer(fs.rename.bind(null, tsdsBinPath, `${tsdsBinPath}.tsds`));
|
|
75
|
+
queue.defer(fs.symlink.bind(null, path.resolve(__dirname, '..', '..', 'bin', 'cli.js'), tsdsBinPath, 'file'));
|
|
76
|
+
queue.await((err)=>{
|
|
77
|
+
console.log('------------------');
|
|
78
|
+
err ? callback(err) : callback(null, packagePath);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["data.js"],"sourcesContent":["const fs = require('fs');\nconst path = require('path');\nconst Queue = require('queue-cb');\nconst spawn = require('cross-spawn-cb');\nconst access = require('fs-access-compat');\n\nconst tmpdir = require('os').tmpdir || require('os-shim').tmpdir;\nconst mkdirp = require('mkdirp');\nconst rimraf2 = require('rimraf2');\nconst shortHash = require('short-hash');\n\nconst dest = path.join(tmpdir(), 'tsds', shortHash(__dirname));\nmkdirp.sync(dest);\n\nmodule.exports = function data(git, options, callback) {\n const packageName = path.basename(git, path.extname(git));\n const packagePath = path.join(dest, packageName);\n const tsdsPackagePath = path.resolve(packagePath, 'node_modules', 'ts-dev-stack');\n const tsdsBinPath = path.resolve(packagePath, 'node_modules', '.bin', 'tsds');\n\n // return callback(null, packagePath);\n\n console.log('------------------');\n console.log(`Preparing: ${packagePath}`);\n\n access(packagePath, (err) => {\n const queue = new Queue(1);\n\n if (!err && options.clean) {\n rimraf2.sync(packagePath, { disableGlob: true });\n err = true;\n }\n\n // does not exist - clone\n if (err) {\n queue.defer(spawn.bind(null, 'git', ['clone', git], { stdio: 'inherit', cwd: dest }));\n }\n // exists - reset git\n else {\n queue.defer(spawn.bind(null, 'git', ['clean', '-fd'], { stdio: 'inherit', cwd: packagePath }));\n queue.defer(spawn.bind(null, 'git', ['reset', '--hard', 'HEAD'], { stdio: 'inherit', cwd: packagePath }));\n queue.defer(spawn.bind(null, 'git', ['pull', '--rebase'], { stdio: 'inherit', cwd: packagePath }));\n }\n queue.defer(spawn.bind(null, 'nvu', ['lts', '--silent', 'npm', 'install'], { stdio: 'inherit', cwd: packagePath }));\n\n // link package\n queue.defer(fs.rename.bind(null, tsdsPackagePath, `${tsdsPackagePath}.tsds`));\n queue.defer(fs.symlink.bind(null, path.resolve(__dirname, '..', '..'), tsdsPackagePath, 'dir'));\n\n // link bin\n queue.defer(fs.rename.bind(null, tsdsBinPath, `${tsdsBinPath}.tsds`));\n queue.defer(fs.symlink.bind(null, path.resolve(__dirname, '..', '..', 'bin', 'cli.js'), tsdsBinPath, 'file'));\n\n queue.await((err) => {\n console.log('------------------');\n err ? callback(err) : callback(null, packagePath);\n });\n });\n};\n"],"names":["fs","require","path","Queue","spawn","access","tmpdir","mkdirp","rimraf2","shortHash","dest","join","__dirname","sync","module","exports","data","git","options","callback","packageName","basename","extname","packagePath","tsdsPackagePath","resolve","tsdsBinPath","console","log","err","queue","clean","disableGlob","defer","bind","stdio","cwd","rename","symlink","await"],"mappings":"AAAA,MAAMA,KAAKC,QAAQ;AACnB,MAAMC,OAAOD,QAAQ;AACrB,MAAME,QAAQF,QAAQ;AACtB,MAAMG,QAAQH,QAAQ;AACtB,MAAMI,SAASJ,QAAQ;AAEvB,MAAMK,SAASL,QAAQ,MAAMK,MAAM,IAAIL,QAAQ,WAAWK,MAAM;AAChE,MAAMC,SAASN,QAAQ;AACvB,MAAMO,UAAUP,QAAQ;AACxB,MAAMQ,YAAYR,QAAQ;AAE1B,MAAMS,OAAOR,KAAKS,IAAI,CAACL,UAAU,QAAQG,UAAUG;AACnDL,OAAOM,IAAI,CAACH;AAEZI,OAAOC,OAAO,GAAG,SAASC,KAAKC,GAAG,EAAEC,OAAO,EAAEC,QAAQ;IACnD,MAAMC,cAAclB,KAAKmB,QAAQ,CAACJ,KAAKf,KAAKoB,OAAO,CAACL;IACpD,MAAMM,cAAcrB,KAAKS,IAAI,CAACD,MAAMU;IACpC,MAAMI,kBAAkBtB,KAAKuB,OAAO,CAACF,aAAa,gBAAgB;IAClE,MAAMG,cAAcxB,KAAKuB,OAAO,CAACF,aAAa,gBAAgB,QAAQ;IAEtE,sCAAsC;IAEtCI,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC,CAAC,WAAW,EAAEL,aAAa;IAEvClB,OAAOkB,aAAa,CAACM;QACnB,MAAMC,QAAQ,IAAI3B,MAAM;QAExB,IAAI,CAAC0B,OAAOX,QAAQa,KAAK,EAAE;YACzBvB,QAA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MS,KAAK,CAAC,CAACV;YACXF,QAAQC,GAAG,CAAC;YACZC,MAAMV,SAASU,OAAOV,SAAS,MAAMI;QACvC;IACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tsds-lib-test",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Development stack for TypeScript libraries",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"c8",
|
|
7
|
+
"dev",
|
|
8
|
+
"development",
|
|
9
|
+
"mocha",
|
|
10
|
+
"rollup",
|
|
11
|
+
"stack",
|
|
12
|
+
"test",
|
|
13
|
+
"typescript"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+ssh://git@github.com/kmalakoff/ts-dev-stack.git"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"type": "commonjs",
|
|
21
|
+
"main": "dist/cjs/index.js",
|
|
22
|
+
"types": "dist/types/index.d.ts",
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"assets",
|
|
26
|
+
"scripts"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "node ../ts-dev-stack/scripts/build.js",
|
|
30
|
+
"depcheck": "depcheck",
|
|
31
|
+
"format": "biome check --write --unsafe src/ test/",
|
|
32
|
+
"test": "",
|
|
33
|
+
"test2": "tsds test:node --no-timeouts",
|
|
34
|
+
"test:engines": "npm test",
|
|
35
|
+
"version": "tsds version"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"cross-spawn-cb": "^1.1.2",
|
|
39
|
+
"fs-access-compat": "^1.0.3",
|
|
40
|
+
"mkdirp": "0.5.6",
|
|
41
|
+
"os-shim": "^0.1.3",
|
|
42
|
+
"queue-cb": "^1.2.1",
|
|
43
|
+
"rimraf2": "^2.8.2",
|
|
44
|
+
"short-hash": "^1.0.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@biomejs/biome": "^1.9.4",
|
|
48
|
+
"@types/mocha": "^10.0.10",
|
|
49
|
+
"@types/node": "^22.10.1",
|
|
50
|
+
"depcheck": "^1.4.7"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=0.8"
|
|
54
|
+
},
|
|
55
|
+
"tsds": {
|
|
56
|
+
"source": "src/index.mjs",
|
|
57
|
+
"targets": [
|
|
58
|
+
"cjs",
|
|
59
|
+
"esm"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"gitHead": "4c68727e736d211adfcd8d2e9f0bc6ecd90a5df1"
|
|
63
|
+
}
|