@yarn-tool/static-file 2.0.2 → 2.0.3
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/CHANGELOG.md +16 -0
- package/file/gitignore +2 -0
- package/file/jest.config.auto.js +116 -0
- package/file/jest.config.js +34 -9
- package/file/npmignore +2 -0
- package/file/ws-root/jest-preset.js +5 -0
- package/lib/const.js +7 -1
- package/lib/const.js.map +1 -1
- package/lib/types.d.ts +7 -7
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.0.3](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/static-file@2.0.2...@yarn-tool/static-file@2.0.3) (2022-08-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update jest preset ([0aafe23](https://github.com/bluelovers/ws-yarn-workspaces/commit/0aafe239e0da4d8cb6f9580fc50c9a42432390a6))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### ✨ Features
|
|
15
|
+
|
|
16
|
+
* update static-file ([6d3f126](https://github.com/bluelovers/ws-yarn-workspaces/commit/6d3f1261ac1d82d4045293ac2c561ea866156dd4))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [2.0.2](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/static-file@2.0.1...@yarn-tool/static-file@2.0.2) (2022-07-31)
|
|
7
23
|
|
|
8
24
|
|
package/file/gitignore
CHANGED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
const { basename, extname, dirname } = require('path');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* // @type { import('@jest/types').Config.InitialOptions }
|
|
7
|
+
* @type { import('ts-jest').InitialOptionsTsJest }
|
|
8
|
+
*/
|
|
9
|
+
let jestConfig = {
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @param {string} name
|
|
15
|
+
* @returns {string}
|
|
16
|
+
* @private
|
|
17
|
+
*/
|
|
18
|
+
function _requireResolve(name)
|
|
19
|
+
{
|
|
20
|
+
let result;
|
|
21
|
+
|
|
22
|
+
try
|
|
23
|
+
{
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
const { requireResolveExtra, requireResolveCore } = require('@yarn-tool/require-resolve');
|
|
26
|
+
|
|
27
|
+
const paths = [
|
|
28
|
+
requireResolveExtra('@bluelovers/tsdx').result,
|
|
29
|
+
requireResolveExtra('tsdx').result,
|
|
30
|
+
].filter(Boolean);
|
|
31
|
+
|
|
32
|
+
result = requireResolveCore(name, {
|
|
33
|
+
includeGlobal: true,
|
|
34
|
+
includeCurrentDirectory: true,
|
|
35
|
+
paths,
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
catch (e)
|
|
39
|
+
{
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
result = result || require.resolve(name);
|
|
44
|
+
|
|
45
|
+
console.info('[require.resolve]', name, '=>', result)
|
|
46
|
+
|
|
47
|
+
return result
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let _ok = true;
|
|
51
|
+
|
|
52
|
+
try
|
|
53
|
+
{
|
|
54
|
+
if (!jestConfig.preset)
|
|
55
|
+
{
|
|
56
|
+
|
|
57
|
+
let result = require('@yarn-tool/ws-find-up-paths').findUpPathsWorkspaces([
|
|
58
|
+
'jest-preset.js',
|
|
59
|
+
'jest.config.js',
|
|
60
|
+
], {
|
|
61
|
+
ignoreCurrentPackage: true,
|
|
62
|
+
onlyFiles: true,
|
|
63
|
+
}).result;
|
|
64
|
+
|
|
65
|
+
if (result)
|
|
66
|
+
{
|
|
67
|
+
let name = basename(result, extname(result))
|
|
68
|
+
|
|
69
|
+
switch (name)
|
|
70
|
+
{
|
|
71
|
+
case 'jest-preset':
|
|
72
|
+
jestConfig.preset = dirname(result);
|
|
73
|
+
break;
|
|
74
|
+
default:
|
|
75
|
+
jestConfig = {
|
|
76
|
+
...require(result),
|
|
77
|
+
jestConfig,
|
|
78
|
+
};
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
_ok = false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (e)
|
|
87
|
+
{
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
try
|
|
92
|
+
{
|
|
93
|
+
if (_ok && !jestConfig.preset)
|
|
94
|
+
{
|
|
95
|
+
let result = _requireResolve('@bluelovers/jest-config/package.json');
|
|
96
|
+
if (result)
|
|
97
|
+
{
|
|
98
|
+
jestConfig.preset = dirname(result);
|
|
99
|
+
_ok = false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch (e)
|
|
104
|
+
{
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (_ok && !jestConfig.preset)
|
|
109
|
+
{
|
|
110
|
+
jestConfig.preset = '@bluelovers/jest-config';
|
|
111
|
+
_ok = false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
console.info(`jest.config.preset: ${jestConfig.preset}`);
|
|
115
|
+
|
|
116
|
+
module.exports = jestConfig
|
package/file/jest.config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
const { join } = require('path');
|
|
3
|
+
const { join, dirname } = require('path');
|
|
4
4
|
const { tryRealpath } = require('jest-util');
|
|
5
5
|
const { tmpdir } = require('os');
|
|
6
6
|
|
|
@@ -75,11 +75,6 @@ const testExt = [
|
|
|
75
75
|
|
|
76
76
|
const cacheDirectory = getCacheDirectory();
|
|
77
77
|
|
|
78
|
-
console.info(`jest.config`);
|
|
79
|
-
console.info(`- file: ${__filename}`);
|
|
80
|
-
console.info(`- cwd: ${process.cwd()}`);
|
|
81
|
-
console.info(`- cacheDirectory: ${cacheDirectory}`);
|
|
82
|
-
|
|
83
78
|
/**
|
|
84
79
|
* // @type { import('@jest/types').Config.InitialOptions }
|
|
85
80
|
* @type { import('ts-jest').InitialOptionsTsJest }
|
|
@@ -162,17 +157,47 @@ const jestConfig = {
|
|
|
162
157
|
//resolver: 'jest-node-exports-resolver',
|
|
163
158
|
}
|
|
164
159
|
|
|
160
|
+
/*
|
|
165
161
|
try
|
|
166
162
|
{
|
|
167
|
-
|
|
168
|
-
if (result && !jestConfig.preset)
|
|
163
|
+
if (!jestConfig.preset)
|
|
169
164
|
{
|
|
170
|
-
|
|
165
|
+
let result = require('@yarn-tool/ws-find-up-paths').findUpPathsWorkspaces('jest.config.js', {
|
|
166
|
+
ignoreCurrentPackage: true,
|
|
167
|
+
onlyFiles: true,
|
|
168
|
+
}).result;
|
|
169
|
+
if (result)
|
|
170
|
+
{
|
|
171
|
+
jestConfig.preset = result;
|
|
172
|
+
}
|
|
171
173
|
}
|
|
172
174
|
}
|
|
173
175
|
catch (e)
|
|
174
176
|
{
|
|
175
177
|
|
|
176
178
|
}
|
|
179
|
+
*/
|
|
180
|
+
|
|
181
|
+
try
|
|
182
|
+
{
|
|
183
|
+
if (!jestConfig.preset)
|
|
184
|
+
{
|
|
185
|
+
let result = _requireResolve('@bluelovers/jest-config/package.json');
|
|
186
|
+
if (result)
|
|
187
|
+
{
|
|
188
|
+
jestConfig.preset = dirname(result);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
catch (e)
|
|
193
|
+
{
|
|
194
|
+
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
console.info(`jest.config`);
|
|
198
|
+
console.info(`- file: ${__filename}`);
|
|
199
|
+
console.info(`- cwd: ${process.cwd()}`);
|
|
200
|
+
console.info(`- cacheDirectory: ${cacheDirectory}`);
|
|
201
|
+
console.info(`- preset: ${jestConfig.preset}`);
|
|
177
202
|
|
|
178
203
|
module.exports = jestConfig
|
package/file/npmignore
CHANGED
package/lib/const.js
CHANGED
|
@@ -15,7 +15,8 @@ const _defaultCopyStaticFiles = [
|
|
|
15
15
|
['README.md', 'file/README.md'],
|
|
16
16
|
['.nycrc', 'file/nycrc'],
|
|
17
17
|
['.mocharc.yml', 'file/mocharc.yml'],
|
|
18
|
-
['jest.config.js', 'file/jest.config.js'],
|
|
18
|
+
//['jest.config.js', 'file/jest.config.js'],
|
|
19
|
+
['jest.config.js', 'file/jest.config.auto.js'],
|
|
19
20
|
['.nowignore', 'file/nowignore'],
|
|
20
21
|
['now.json.tpl', 'file/now.json.tpl', 'now.json'],
|
|
21
22
|
['.npmrc.tpl', 'file/npmrc', '.npmrc'],
|
|
@@ -37,6 +38,9 @@ const _defaultCopyStaticFilesRootOnly = [
|
|
|
37
38
|
['.eslintrc.json', 'file/eslintrc.json.tpl', '.eslintrc.json'],
|
|
38
39
|
//['changelog-option.js', 'file/changelog-option.js', 'changelog-option.js.tpl'],
|
|
39
40
|
['.yarnrc.yml.tpl', 'file/root/yarnrc.yml', '.yarnrc.yml'],
|
|
41
|
+
['jest.config.js', 'file/jest.config.js'],
|
|
42
|
+
['jest.config.js.tpl', 'file/jest.config.js'],
|
|
43
|
+
['jest.config.auto.js.tpl', 'file/jest.config.auto.js'],
|
|
40
44
|
];
|
|
41
45
|
const _defaultCopyStaticFilesWsRootOnly = [
|
|
42
46
|
['lerna.json.tpl', 'file/lerna.json.tpl'],
|
|
@@ -44,6 +48,8 @@ const _defaultCopyStaticFilesWsRootOnly = [
|
|
|
44
48
|
['tsconfig.json', 'file/tsconfig.json.tpl'],
|
|
45
49
|
['tsc-multi.json.tpl', 'file/tsc-multi.json.tpl', 'tsc-multi.json'],
|
|
46
50
|
['__root_ws.ts', 'file/ws-root/__root_ws.ts'],
|
|
51
|
+
['jest.config.js', 'file/ws-root/jest.config.js'],
|
|
52
|
+
['jest-preset.js', 'file/ws-root/jest-preset.js'],
|
|
47
53
|
];
|
|
48
54
|
exports.defaultCopyStaticFiles = Object.freeze(_defaultCopyStaticFiles);
|
|
49
55
|
exports.defaultCopyStaticFilesRootOnly = Object.freeze(_defaultCopyStaticFilesRootOnly);
|
package/lib/const.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.js","sourceRoot":"","sources":["const.ts"],"names":[],"mappings":";;;AAEA,MAAM,uBAAuB,GAAG;IAE/B,CAAC,YAAY,EAAE,gBAAgB,CAAC;IAChC,CAAC,YAAY,EAAE,gBAAgB,CAAC;IAEhC,CAAC,eAAe,EAAE,mBAAmB,CAAC;IAEtC,CAAC,QAAQ,EAAE,YAAY,CAAC;IACxB,CAAC,iBAAiB,EAAE,qBAAqB,CAAC;IAE1C,CAAC,mBAAmB,EAAE,wBAAwB,EAAE,eAAe,CAAC;IAEhE,CAAC,wBAAwB,EAAE,6BAA6B,EAAE,oBAAoB,CAAC;IAE/E,CAAC,uBAAuB,EAAE,4BAA4B,EAAE,mBAAmB,CAAC;IAE5E,CAAC,wBAAwB,EAAE,6BAA6B,EAAE,oBAAoB,CAAC;IAE/E,CAAC,oBAAoB,EAAE,wBAAwB,EAAE,gBAAgB,CAAC;IAElE,CAAC,WAAW,EAAE,gBAAgB,CAAC;IAE/B,CAAC,QAAQ,EAAE,YAAY,CAAC;IAExB,CAAC,cAAc,EAAE,kBAAkB,CAAC;IACpC,CAAC,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["const.ts"],"names":[],"mappings":";;;AAEA,MAAM,uBAAuB,GAAG;IAE/B,CAAC,YAAY,EAAE,gBAAgB,CAAC;IAChC,CAAC,YAAY,EAAE,gBAAgB,CAAC;IAEhC,CAAC,eAAe,EAAE,mBAAmB,CAAC;IAEtC,CAAC,QAAQ,EAAE,YAAY,CAAC;IACxB,CAAC,iBAAiB,EAAE,qBAAqB,CAAC;IAE1C,CAAC,mBAAmB,EAAE,wBAAwB,EAAE,eAAe,CAAC;IAEhE,CAAC,wBAAwB,EAAE,6BAA6B,EAAE,oBAAoB,CAAC;IAE/E,CAAC,uBAAuB,EAAE,4BAA4B,EAAE,mBAAmB,CAAC;IAE5E,CAAC,wBAAwB,EAAE,6BAA6B,EAAE,oBAAoB,CAAC;IAE/E,CAAC,oBAAoB,EAAE,wBAAwB,EAAE,gBAAgB,CAAC;IAElE,CAAC,WAAW,EAAE,gBAAgB,CAAC;IAE/B,CAAC,QAAQ,EAAE,YAAY,CAAC;IAExB,CAAC,cAAc,EAAE,kBAAkB,CAAC;IACpC,4CAA4C;IAC5C,CAAC,gBAAgB,EAAE,0BAA0B,CAAC;IAE9C,CAAC,YAAY,EAAE,gBAAgB,CAAC;IAEhC,CAAC,cAAc,EAAE,mBAAmB,EAAE,UAAU,CAAC;IAEjD,CAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,CAAC;IAEtC,CAAC,oBAAoB,EAAE,qBAAqB,EAAE,gBAAgB,CAAC;IAE/D,CAAC,oBAAoB,EAAE,yBAAyB,EAAE,gBAAgB,CAAC;IAEnE,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;IAEzC,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;IAE9C,iFAAiF;CAExE,CAAC;AAEX,MAAM,+BAA+B,GAAG;IAEvC,CAAC,gBAAgB,EAAE,qBAAqB,EAAE,YAAY,CAAC;IAEvD,CAAC,yBAAyB,EAAE,0BAA0B,EAAE,qBAAqB,CAAC;IAE9E,CAAC,gCAAgC,EAAE,oCAAoC,CAAC;IAExE,CAAC,8CAA8C,EAAE,kDAAkD,CAAC;IAEpG,CAAC,6BAA6B,EAAE,iCAAiC,CAAC;IAElE,CAAC,yCAAyC,EAAE,6CAA6C,CAAC;IAE1F,CAAC,8BAA8B,EAAE,kCAAkC,CAAC;IAEpE,CAAC,eAAe,EAAE,wBAAwB,EAAE,eAAe,CAAC;IAE5D,CAAC,gBAAgB,EAAE,wBAAwB,EAAE,gBAAgB,CAAC;IAE9D,iFAAiF;IAEjF,CAAC,iBAAiB,EAAE,sBAAsB,EAAE,aAAa,CAAC;IAE1D,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;IAEzC,CAAC,oBAAoB,EAAE,qBAAqB,CAAC;IAC7C,CAAC,yBAAyB,EAAE,0BAA0B,CAAC;CAE9C,CAAC;AAEX,MAAM,iCAAiC,GAAG;IAEzC,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;IAEzC,CAAC,qBAAqB,EAAE,0BAA0B,CAAC;IAEnD,CAAC,eAAe,EAAE,wBAAwB,CAAC;IAE3C,CAAC,oBAAoB,EAAE,yBAAyB,EAAE,gBAAgB,CAAC;IAEnE,CAAC,cAAc,EAAE,2BAA2B,CAAC;IAE7C,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;IACjD,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;CAExC,CAAC;AAEE,QAAA,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAsE,CAAC;AAErI,QAAA,8BAA8B,GAAG,MAAM,CAAC,MAAM,CAAC,+BAA+B,CAA8E,CAAC;AAE7J,QAAA,gCAAgC,GAAG,MAAM,CAAC,MAAM,CAAC,iCAAiC,CAAgF,CAAC","sourcesContent":["import { _Key, IStaticFilesKey, IStaticFilesMapArray } from './types';\n\nconst _defaultCopyStaticFiles = [\n\n\t['.npmignore', 'file/npmignore'],\n\t['.gitignore', 'file/gitignore'],\n\n\t['.eslintignore', 'file/eslintignore'],\n\n\t['.nvmrc', 'file/nvmrc'],\n\t['.browserslistrc', 'file/browserslistrc'],\n\n\t['tsconfig.json.tpl', 'file/tsconfig.json.tpl', 'tsconfig.json'],\n\n\t['test/tsconfig.json.tpl', 'file/test/tsconfig.json.tpl', 'test/tsconfig.json'],\n\n\t['tsconfig.esm.json.tpl', 'file/tsconfig.esm.json.tpl', 'tsconfig.esm.json'],\n\n\t['tsconfig.tsdx.json.tpl', 'file/tsconfig.tsdx.json.tpl', 'tsconfig.tsdx.json'],\n\n\t['.eslintrc.json.tpl', 'file/eslintrc.json.tpl', '.eslintrc.json'],\n\n\t['README.md', 'file/README.md'],\n\n\t['.nycrc', 'file/nycrc'],\n\n\t['.mocharc.yml', 'file/mocharc.yml'],\n\t//['jest.config.js', 'file/jest.config.js'],\n\t['jest.config.js', 'file/jest.config.auto.js'],\n\n\t['.nowignore', 'file/nowignore'],\n\n\t['now.json.tpl', 'file/now.json.tpl', 'now.json'],\n\n\t['.npmrc.tpl', 'file/npmrc', '.npmrc'],\n\n\t['tsdx.config.js.tpl', 'file/tsdx.config.js', 'tsdx.config.js'],\n\n\t['tsc-multi.json.tpl', 'file/tsc-multi.json.tpl', 'tsc-multi.json'],\n\n\t['test/__root.ts', 'file/test/__root.ts'],\n\n\t['.editorconfig.tpl', 'file/tpl.editorconfig'],\n\n\t//['changelog-option.js.tpl', 'file/changelog-option.js', 'changelog-option.js'],\n\n] as const;\n\nconst _defaultCopyStaticFilesRootOnly = [\n\n\t['lerna.json.tpl', 'file/lerna.json.tpl', 'lerna.json'],\n\n\t['pnpm-workspace.yaml.tpl', 'file/pnpm-workspace.yaml', 'pnpm-workspace.yaml'],\n\n\t['.github/workflows/coverage.yml', 'file/github/workflows/coverage.yml'],\n\n\t['.github/workflows/action-yarnlock-dedupe.yml', 'file/github/workflows/action-yarnlock-dedupe.yml'],\n\n\t['.github/workflows/build.yml', 'file/github/workflows/build.yml'],\n\n\t['.github/workflows/yarn-lock-changes.yml', 'file/github/workflows/yarn-lock-changes.yml'],\n\n\t['.github/commit-convention.md', 'file/github/commit-convention.md'],\n\n\t['tsconfig.json', 'file/tsconfig.json.tpl', 'tsconfig.json'],\n\n\t['.eslintrc.json', 'file/eslintrc.json.tpl', '.eslintrc.json'],\n\n\t//['changelog-option.js', 'file/changelog-option.js', 'changelog-option.js.tpl'],\n\n\t['.yarnrc.yml.tpl', 'file/root/yarnrc.yml', '.yarnrc.yml'],\n\n\t['jest.config.js', 'file/jest.config.js'],\n\n\t['jest.config.js.tpl', 'file/jest.config.js'],\n\t['jest.config.auto.js.tpl', 'file/jest.config.auto.js'],\n\n] as const;\n\nconst _defaultCopyStaticFilesWsRootOnly = [\n\n\t['lerna.json.tpl', 'file/lerna.json.tpl'],\n\n\t['pnpm-workspace.yaml', 'file/pnpm-workspace.yaml'],\n\n\t['tsconfig.json', 'file/tsconfig.json.tpl'],\n\n\t['tsc-multi.json.tpl', 'file/tsc-multi.json.tpl', 'tsc-multi.json'],\n\n\t['__root_ws.ts', 'file/ws-root/__root_ws.ts'],\n\n\t['jest.config.js', 'file/ws-root/jest.config.js'],\n\t['jest-preset.js', 'file/ws-root/jest-preset.js'],\n\n] as const;\n\nexport const defaultCopyStaticFiles = Object.freeze(_defaultCopyStaticFiles) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFiles>>;\n\nexport const defaultCopyStaticFilesRootOnly = Object.freeze(_defaultCopyStaticFilesRootOnly) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFilesRootOnly>>;\n\nexport const defaultCopyStaticFilesWsRootOnly = Object.freeze(_defaultCopyStaticFilesWsRootOnly) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFilesWsRootOnly>>;\n"]}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { defaultCopyStaticFiles, defaultCopyStaticFilesRootOnly } from './const';
|
|
2
|
-
export
|
|
2
|
+
export type IStaticFilesID<T = typeof defaultCopyStaticFiles & typeof defaultCopyStaticFilesRootOnly> = T extends ({
|
|
3
3
|
[n: number]: IStaticFilesMapArrayEntry<infer U>;
|
|
4
4
|
} | {
|
|
5
5
|
readonly [n: number]: IStaticFilesMapArrayEntry<infer U>;
|
|
6
6
|
}) ? U : never;
|
|
7
|
-
export
|
|
7
|
+
export type IStaticFilesMapArrayEntry<K extends string> = [
|
|
8
8
|
targetFile: K,
|
|
9
9
|
staticFile: string,
|
|
10
10
|
detectFile?: string
|
|
11
11
|
];
|
|
12
|
-
export
|
|
12
|
+
export type IStaticFilesMapRecord<K extends string> = {
|
|
13
13
|
[P in K]: string;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
16
|
-
export
|
|
15
|
+
export type IStaticFilesMapArray<K extends string> = IStaticFilesMapArrayEntry<K>[];
|
|
16
|
+
export type IStaticFiles<K extends string> = IStaticFilesMapArray<K> | IStaticFilesMapRecord<K>;
|
|
17
17
|
export interface ICopyStaticFilesOptionsBase<K extends string = string> {
|
|
18
18
|
cwd: string;
|
|
19
19
|
staticRoot?: string;
|
|
@@ -22,5 +22,5 @@ export interface ICopyStaticFilesOptionsBase<K extends string = string> {
|
|
|
22
22
|
export interface ICopyStaticFilesOptions<K extends string = string> extends ICopyStaticFilesOptionsBase<K> {
|
|
23
23
|
file_map?: IStaticFiles<K>;
|
|
24
24
|
}
|
|
25
|
-
export
|
|
26
|
-
export
|
|
25
|
+
export type IStaticFilesKey<T extends IStaticFiles<string> | readonly any[]> = T extends IStaticFilesMapArray<infer K> ? K : T extends readonly IStaticFilesMapArrayEntry<infer K>[] ? K : T extends IStaticFilesMapRecord<infer K> ? K : _Key<T>;
|
|
26
|
+
export type _Key<T> = T extends readonly (infer U)[] | (infer U)[] ? (U extends [infer K, string, string] | readonly [infer K, string, string] ? K : never) : never;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarn-tool/static-file",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://github.com/bluelovers/ws-yarn-workspaces/tree/master/packages/@yarn-tool/static-file#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "e34c95f09bf1ad26e3a721028a28f6b8bfb44510"
|
|
35
35
|
}
|