@yarn-tool/static-file 2.0.1 → 2.0.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.
- package/CHANGELOG.md +48 -0
- package/README.md +12 -0
- package/file/gitignore +5 -0
- package/file/jest.config.auto.js +116 -0
- package/file/jest.config.js +78 -4
- package/file/npmignore +10 -0
- package/file/test/__root.d.ts +1 -1
- package/file/test/__root.js +2 -2
- package/file/test/__root.js.map +1 -1
- package/file/test/__root.ts +1 -1
- package/file/ws-root/__root_ws.d.ts +1 -1
- package/file/ws-root/__root_ws.js +2 -2
- package/file/ws-root/__root_ws.js.map +1 -1
- package/file/ws-root/__root_ws.ts +1 -1
- package/file/ws-root/jest-preset.js +5 -0
- package/lib/const.js +7 -1
- package/lib/const.js.map +1 -1
- package/lib/root/getRootCopyStaticFiles.d.ts +3 -0
- package/lib/root/getRootCopyStaticFiles.js +20 -0
- package/lib/root/getRootCopyStaticFiles.js.map +1 -0
- package/lib/types.d.ts +7 -7
- package/lib/ws/wsCopyStaticFiles.d.ts +9 -0
- package/lib/ws/wsCopyStaticFiles.js +20 -0
- package/lib/ws/wsCopyStaticFiles.js.map +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,54 @@
|
|
|
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.4](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/static-file@2.0.3...@yarn-tool/static-file@2.0.4) (2022-08-19)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### ✨ Features
|
|
10
|
+
|
|
11
|
+
* getRootCopyStaticFilesAuto ([2b857c0](https://github.com/bluelovers/ws-yarn-workspaces/commit/2b857c07566a6cdcb7018d9f1b9efbe4f0a5202b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### 📦 Code Refactoring
|
|
15
|
+
|
|
16
|
+
* move `getWsCopyStaticFiles` ([f3f6349](https://github.com/bluelovers/ws-yarn-workspaces/commit/f3f634995b504794d189cbba564da2d46488fb18))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### 🔖 Miscellaneous
|
|
20
|
+
|
|
21
|
+
* . ([b76c5a8](https://github.com/bluelovers/ws-yarn-workspaces/commit/b76c5a8902781abb3bee14492e652b89307ffacd))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## [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)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### 🐛 Bug Fixes
|
|
31
|
+
|
|
32
|
+
* update jest preset ([0aafe23](https://github.com/bluelovers/ws-yarn-workspaces/commit/0aafe239e0da4d8cb6f9580fc50c9a42432390a6))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### ✨ Features
|
|
36
|
+
|
|
37
|
+
* update static-file ([6d3f126](https://github.com/bluelovers/ws-yarn-workspaces/commit/6d3f1261ac1d82d4045293ac2c561ea866156dd4))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## [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)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### ✨ Features
|
|
47
|
+
|
|
48
|
+
* update static files ([2da4c65](https://github.com/bluelovers/ws-yarn-workspaces/commit/2da4c65772856fa729bee66893dd4e347f7ede05))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
6
54
|
## [2.0.1](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/static-file@2.0.0...@yarn-tool/static-file@2.0.1) (2022-07-11)
|
|
7
55
|
|
|
8
56
|
|
package/README.md
ADDED
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,5 +1,9 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
+
const { join, dirname } = require('path');
|
|
4
|
+
const { tryRealpath } = require('jest-util');
|
|
5
|
+
const { tmpdir } = require('os');
|
|
6
|
+
|
|
3
7
|
/**
|
|
4
8
|
* @param {string} name
|
|
5
9
|
* @returns {string}
|
|
@@ -37,6 +41,27 @@ function _requireResolve(name)
|
|
|
37
41
|
return result
|
|
38
42
|
}
|
|
39
43
|
|
|
44
|
+
/**
|
|
45
|
+
* @returns {string}
|
|
46
|
+
* @see https://github.com/facebook/jest/blob/main/packages/jest-config/src/getCacheDirectory.ts
|
|
47
|
+
*/
|
|
48
|
+
function getCacheDirectory()
|
|
49
|
+
{
|
|
50
|
+
const { getuid } = process;
|
|
51
|
+
const tmpdirPath = process.env['JEST_CACHE_DIRECTORY'] || join(tryRealpath(tmpdir()), 'jest');
|
|
52
|
+
if (getuid == null)
|
|
53
|
+
{
|
|
54
|
+
return tmpdirPath;
|
|
55
|
+
}
|
|
56
|
+
else
|
|
57
|
+
{
|
|
58
|
+
// On some platforms tmpdir() is `/tmp`, causing conflicts between different
|
|
59
|
+
// users and permission issues. Adding an additional subdivision by UID can
|
|
60
|
+
// help.
|
|
61
|
+
return `${tmpdirPath}_${getuid.call(process).toString(36)}`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
40
65
|
const testExt = [
|
|
41
66
|
'ts',
|
|
42
67
|
'tsx',
|
|
@@ -48,20 +73,19 @@ const testExt = [
|
|
|
48
73
|
// 'cjs',
|
|
49
74
|
].join('|');
|
|
50
75
|
|
|
51
|
-
|
|
52
|
-
console.info(`- file: ${__filename}`);
|
|
53
|
-
console.info(`- cwd: ${process.cwd()}`);
|
|
76
|
+
const cacheDirectory = getCacheDirectory();
|
|
54
77
|
|
|
55
78
|
/**
|
|
56
79
|
* // @type { import('@jest/types').Config.InitialOptions }
|
|
57
80
|
* @type { import('ts-jest').InitialOptionsTsJest }
|
|
58
81
|
*/
|
|
59
|
-
|
|
82
|
+
const jestConfig = {
|
|
60
83
|
globals: {
|
|
61
84
|
'ts-jest': {
|
|
62
85
|
//tsconfig: 'tsconfig.spec.json',
|
|
63
86
|
},
|
|
64
87
|
},
|
|
88
|
+
cacheDirectory,
|
|
65
89
|
maxWorkers: 1,
|
|
66
90
|
clearMocks: true,
|
|
67
91
|
passWithNoTests: true,
|
|
@@ -91,6 +115,7 @@ module.exports = {
|
|
|
91
115
|
'/__tests__/helpers/',
|
|
92
116
|
'/__tests__/utils/',
|
|
93
117
|
'__mocks__',
|
|
118
|
+
'/dist/',
|
|
94
119
|
],
|
|
95
120
|
//testRunner: 'jest-circus/runner',
|
|
96
121
|
setupFilesAfterEnv: [
|
|
@@ -118,12 +143,61 @@ module.exports = {
|
|
|
118
143
|
'/node_modules/',
|
|
119
144
|
'/__snapshots__/',
|
|
120
145
|
'/__tests__/',
|
|
146
|
+
'/__test__/',
|
|
121
147
|
//'**/node_modules/',
|
|
122
148
|
//'**/__snapshots__/',
|
|
123
149
|
//'**/__tests__/',
|
|
150
|
+
'/dist/',
|
|
151
|
+
'/test/',
|
|
152
|
+
'/fixture/',
|
|
124
153
|
],
|
|
125
154
|
/**
|
|
126
155
|
* https://github.com/facebook/jest/issues/9771#issuecomment-872764344
|
|
127
156
|
*/
|
|
128
157
|
//resolver: 'jest-node-exports-resolver',
|
|
129
158
|
}
|
|
159
|
+
|
|
160
|
+
/*
|
|
161
|
+
try
|
|
162
|
+
{
|
|
163
|
+
if (!jestConfig.preset)
|
|
164
|
+
{
|
|
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
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
catch (e)
|
|
176
|
+
{
|
|
177
|
+
|
|
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}`);
|
|
202
|
+
|
|
203
|
+
module.exports = jestConfig
|
package/file/npmignore
CHANGED
|
@@ -35,12 +35,18 @@ node_modules
|
|
|
35
35
|
/bin/**/*.d.cts
|
|
36
36
|
/bin/*.d.cts
|
|
37
37
|
|
|
38
|
+
!./src/**/*.ts
|
|
39
|
+
!./src/**/*.cts
|
|
40
|
+
!./src/**/*.mts
|
|
41
|
+
!./src/**/*.tsx
|
|
42
|
+
|
|
38
43
|
/src/**/*.d.ts
|
|
39
44
|
/src/**/*.js
|
|
40
45
|
/src/**/*.d.cts
|
|
41
46
|
/src/**/*.d.mts
|
|
42
47
|
/src/**/*.cjs
|
|
43
48
|
/src/**/*.mjs
|
|
49
|
+
/src/**/*.jsx
|
|
44
50
|
|
|
45
51
|
*.tgz
|
|
46
52
|
/tsconfig.json.tpl
|
|
@@ -99,7 +105,9 @@ now.json
|
|
|
99
105
|
*.spec.mjs
|
|
100
106
|
*.spec.mts
|
|
101
107
|
|
|
108
|
+
*.spec.d.tsx
|
|
102
109
|
*.spec.tsx
|
|
110
|
+
|
|
103
111
|
__mocks__
|
|
104
112
|
__tests__
|
|
105
113
|
__snapshots__
|
|
@@ -125,3 +133,5 @@ changelog-option.js
|
|
|
125
133
|
|
|
126
134
|
bin/tsconfig.json
|
|
127
135
|
bin/tsconfig.*.json
|
|
136
|
+
|
|
137
|
+
.yarnrc.yml
|
package/file/test/__root.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const __ROOT: string;
|
|
2
2
|
export declare const isWin: boolean;
|
package/file/test/__root.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isWin = exports.
|
|
3
|
+
exports.isWin = exports.__ROOT = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
|
-
exports.
|
|
5
|
+
exports.__ROOT = (0, path_1.join)(__dirname, '..');
|
|
6
6
|
exports.isWin = process.platform === "win32";
|
|
7
7
|
//# sourceMappingURL=__root.js.map
|
package/file/test/__root.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"__root.js","sourceRoot":"","sources":["__root.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAEf,QAAA,MAAM,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAE/B,QAAA,KAAK,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC","sourcesContent":["import { join } from \"path\";\n\nexport const
|
|
1
|
+
{"version":3,"file":"__root.js","sourceRoot":"","sources":["__root.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAEf,QAAA,MAAM,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAE/B,QAAA,KAAK,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC","sourcesContent":["import { join } from \"path\";\n\nexport const __ROOT = join(__dirname, '..');\n\nexport const isWin = process.platform === \"win32\";\n"]}
|
package/file/test/__root.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const __ROOT_WS: string;
|
|
2
2
|
export declare const isWin: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isWin = exports.
|
|
3
|
+
exports.isWin = exports.__ROOT_WS = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
|
-
exports.
|
|
5
|
+
exports.__ROOT_WS = (0, path_1.join)(__dirname);
|
|
6
6
|
exports.isWin = process.platform === "win32";
|
|
7
7
|
//# sourceMappingURL=__root_ws.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"__root_ws.js","sourceRoot":"","sources":["__root_ws.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAEf,QAAA,SAAS,GAAG,IAAA,WAAI,EAAC,SAAS,CAAC,CAAC;AAE5B,QAAA,KAAK,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC","sourcesContent":["import { join } from \"path\";\n\nexport const
|
|
1
|
+
{"version":3,"file":"__root_ws.js","sourceRoot":"","sources":["__root_ws.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAEf,QAAA,SAAS,GAAG,IAAA,WAAI,EAAC,SAAS,CAAC,CAAC;AAE5B,QAAA,KAAK,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC","sourcesContent":["import { join } from \"path\";\n\nexport const __ROOT_WS = join(__dirname);\n\nexport const isWin = process.platform === \"win32\";\n"]}
|
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,mB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E,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"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRootCopyStaticFilesAuto = void 0;
|
|
4
|
+
const const_1 = require("../const");
|
|
5
|
+
function getRootCopyStaticFilesAuto(rootData) {
|
|
6
|
+
let file_map = [
|
|
7
|
+
...const_1.defaultCopyStaticFiles,
|
|
8
|
+
];
|
|
9
|
+
if (rootData.isRoot) {
|
|
10
|
+
if (!rootData.hasWorkspace) {
|
|
11
|
+
file_map = [
|
|
12
|
+
...const_1.defaultCopyStaticFilesRootOnly,
|
|
13
|
+
...file_map,
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return file_map;
|
|
18
|
+
}
|
|
19
|
+
exports.getRootCopyStaticFilesAuto = getRootCopyStaticFilesAuto;
|
|
20
|
+
//# sourceMappingURL=getRootCopyStaticFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRootCopyStaticFiles.js","sourceRoot":"","sources":["getRootCopyStaticFiles.ts"],"names":[],"mappings":";;;AAEA,oCAAkF;AAElF,SAAgB,0BAA0B,CAAC,QAA6D;IAEvG,IAAI,QAAQ,GAAiC;QAC5C,GAAG,8BAAsB;KACzB,CAAC;IAEF,IAAI,QAAQ,CAAC,MAAM,EACnB;QACC,IAAI,CAAC,QAAQ,CAAC,YAAY,EAC1B;YACC,QAAQ,GAAG;gBACV,GAAG,sCAA8B;gBACjC,GAAG,QAAQ;aACX,CAAC;SACF;KACD;IAED,OAAO,QAAQ,CAAA;AAChB,CAAC;AAlBD,gEAkBC","sourcesContent":["import { IFindRootReturnType } from '@yarn-tool/find-root';\nimport { IStaticFilesMapArray } from '../types';\nimport { defaultCopyStaticFiles, defaultCopyStaticFilesRootOnly } from '../const';\n\nexport function getRootCopyStaticFilesAuto(rootData: Pick<IFindRootReturnType, 'isRoot'| 'hasWorkspace'>)\n{\n\tlet file_map: IStaticFilesMapArray<string> = [\n\t\t...defaultCopyStaticFiles,\n\t];\n\n\tif (rootData.isRoot)\n\t{\n\t\tif (!rootData.hasWorkspace)\n\t\t{\n\t\t\tfile_map = [\n\t\t\t\t...defaultCopyStaticFilesRootOnly,\n\t\t\t\t...file_map,\n\t\t\t];\n\t\t}\n\t}\n\n\treturn file_map\n}\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;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defaultCopyStaticFiles, defaultCopyStaticFilesRootOnly } from '../const';
|
|
2
|
+
import { IStaticFiles, IStaticFilesKey } from '../types';
|
|
3
|
+
declare const remap: {
|
|
4
|
+
readonly 'tsconfig.json': "tsconfig.json.tpl";
|
|
5
|
+
readonly 'lerna.json': "lerna.json.tpl";
|
|
6
|
+
readonly 'pnpm-workspace.yaml': "pnpm-workspace.yaml.tpl";
|
|
7
|
+
};
|
|
8
|
+
export declare function getWsCopyStaticFiles(): IStaticFiles<IStaticFilesKey<typeof defaultCopyStaticFiles | typeof defaultCopyStaticFilesRootOnly> | keyof typeof remap>;
|
|
9
|
+
export default getWsCopyStaticFiles;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWsCopyStaticFiles = void 0;
|
|
4
|
+
const const_1 = require("../const");
|
|
5
|
+
const reMapStaticFilesMapArray_1 = require("../reMapStaticFilesMapArray");
|
|
6
|
+
const remap = {
|
|
7
|
+
'tsconfig.json': 'tsconfig.json.tpl',
|
|
8
|
+
'lerna.json': 'lerna.json.tpl',
|
|
9
|
+
'pnpm-workspace.yaml': 'pnpm-workspace.yaml.tpl',
|
|
10
|
+
};
|
|
11
|
+
function getWsCopyStaticFiles() {
|
|
12
|
+
return (0, reMapStaticFilesMapArray_1.reMapStaticFilesMapArray)([
|
|
13
|
+
...const_1.defaultCopyStaticFiles,
|
|
14
|
+
...const_1.defaultCopyStaticFilesRootOnly,
|
|
15
|
+
...const_1.defaultCopyStaticFilesWsRootOnly,
|
|
16
|
+
], remap);
|
|
17
|
+
}
|
|
18
|
+
exports.getWsCopyStaticFiles = getWsCopyStaticFiles;
|
|
19
|
+
exports.default = getWsCopyStaticFiles;
|
|
20
|
+
//# sourceMappingURL=wsCopyStaticFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wsCopyStaticFiles.js","sourceRoot":"","sources":["wsCopyStaticFiles.ts"],"names":[],"mappings":";;;AAAA,oCAIkB;AAElB,0EAAuE;AAEvE,MAAM,KAAK,GAAG;IACb,eAAe,EAAE,mBAAmB;IACpC,YAAY,EAAE,gBAAgB;IAC9B,qBAAqB,EAAE,yBAAyB;CACvC,CAAA;AAEV,SAAgB,oBAAoB;IAEnC,OAAO,IAAA,mDAAwB,EAAC;QAC/B,GAAG,8BAAsB;QACzB,GAAG,sCAA8B;QACjC,GAAG,wCAAgC;KACnC,EAAE,KAAK,CAAC,CAAC;AACX,CAAC;AAPD,oDAOC;AAED,kBAAe,oBAAoB,CAAC","sourcesContent":["import {\n\tdefaultCopyStaticFiles,\n\tdefaultCopyStaticFilesRootOnly,\n\tdefaultCopyStaticFilesWsRootOnly,\n} from '../const';\nimport { IStaticFiles, IStaticFilesKey, IStaticFilesMapArray } from '../types';\nimport { reMapStaticFilesMapArray } from '../reMapStaticFilesMapArray';\n\nconst remap = {\n\t'tsconfig.json': 'tsconfig.json.tpl',\n\t'lerna.json': 'lerna.json.tpl',\n\t'pnpm-workspace.yaml': 'pnpm-workspace.yaml.tpl',\n} as const\n\nexport function getWsCopyStaticFiles(): IStaticFiles<IStaticFilesKey<typeof defaultCopyStaticFiles | typeof defaultCopyStaticFilesRootOnly> | keyof typeof remap>\n{\n\treturn reMapStaticFilesMapArray([\n\t\t...defaultCopyStaticFiles,\n\t\t...defaultCopyStaticFilesRootOnly,\n\t\t...defaultCopyStaticFilesWsRootOnly,\n\t], remap);\n}\n\nexport default getWsCopyStaticFiles;\n"]}
|
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.4",
|
|
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": "04b0e35bd37a6cbe152fd6564f0ec2439625270a"
|
|
35
35
|
}
|