@yarn-tool/fix-all 2.0.15 → 2.0.18
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 +40 -0
- package/index.js +4 -0
- package/index.js.map +1 -1
- package/lib/root/index.js +17 -0
- package/lib/root/index.js.map +1 -1
- package/lib/ws/lerna.d.ts +5 -0
- package/lib/ws/lerna.js +27 -0
- package/lib/ws/lerna.js.map +1 -0
- package/package.json +21 -16
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,46 @@
|
|
|
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.18](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/fix-all@2.0.17...@yarn-tool/fix-all@2.0.18) (2022-09-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### 📚 Documentation
|
|
11
|
+
|
|
12
|
+
* add directory ([442a552](https://github.com/bluelovers/ws-yarn-workspaces/commit/442a55232619f7fe2b9bad6f8eccfffc4f8f47d2))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### 📌 Dependencies
|
|
16
|
+
|
|
17
|
+
* update deps ([aeb5e41](https://github.com/bluelovers/ws-yarn-workspaces/commit/aeb5e416e8ea6c7d37ed7d38fedd6ff5c8c371df))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### 🔖 Miscellaneous
|
|
21
|
+
|
|
22
|
+
* . ([3a7fdc9](https://github.com/bluelovers/ws-yarn-workspaces/commit/3a7fdc924ada93b1d0ac0160f8d77e46ff060588))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## [2.0.17](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/fix-all@2.0.16...@yarn-tool/fix-all@2.0.17) (2022-08-28)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### ✨ Features
|
|
31
|
+
|
|
32
|
+
* fixLernaJson ([5b5a5b1](https://github.com/bluelovers/ws-yarn-workspaces/commit/5b5a5b162fe68689fbef2f9fb46f884ea6814d7b))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## [2.0.16](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/fix-all@2.0.15...@yarn-tool/fix-all@2.0.16) (2022-08-26)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### ✨ Features
|
|
41
|
+
|
|
42
|
+
* add deps ([1bc30ca](https://github.com/bluelovers/ws-yarn-workspaces/commit/1bc30caa09e599ffb62b016b5867dfc1a0df4c08))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
6
46
|
## [2.0.15](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/fix-all@2.0.14...@yarn-tool/fix-all@2.0.15) (2022-08-26)
|
|
7
47
|
|
|
8
48
|
|
package/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const bluebird_1 = tslib_1.__importDefault(require("bluebird"));
|
|
|
11
11
|
const static_file_1 = require("@yarn-tool/static-file");
|
|
12
12
|
const wsCopyStaticFiles_1 = require("@yarn-tool/static-file/lib/ws/wsCopyStaticFiles");
|
|
13
13
|
const getRootCopyStaticFiles_1 = require("@yarn-tool/static-file/lib/root/getRootCopyStaticFiles");
|
|
14
|
+
const lerna_1 = require("./lib/ws/lerna");
|
|
14
15
|
function npmAutoFixAll(cwd, options) {
|
|
15
16
|
return bluebird_1.default.resolve().then(() => {
|
|
16
17
|
cwd !== null && cwd !== void 0 ? cwd : (cwd = process.cwd());
|
|
@@ -70,6 +71,9 @@ function npmAutoFixAll(cwd, options) {
|
|
|
70
71
|
targetDir: rootData.root,
|
|
71
72
|
});
|
|
72
73
|
}
|
|
74
|
+
(0, lerna_1._fixLernaJson)({
|
|
75
|
+
rootData,
|
|
76
|
+
});
|
|
73
77
|
const list = (0, index_2._initPkgListableByRootData)(rootData);
|
|
74
78
|
return (0, index_2._runEachPackagesAsync)(list, {
|
|
75
79
|
rootData,
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,oDAA8D;AAC9D,0DAA+D;AAC/D,4CAAwD;AACxD,2CAAoF;AACpF,gDAAoD;AACpD,gEAAgC;AAChC,wDAAyD;AACzD,uFAAuF;AACvF,mGAAoG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,oDAA8D;AAC9D,0DAA+D;AAC/D,4CAAwD;AACxD,2CAAoF;AACpF,gDAAoD;AACpD,gEAAgC;AAChC,wDAAyD;AACzD,uFAAuF;AACvF,mGAAoG;AACpG,0CAA+C;AAQ/C,SAAgB,aAAa,CAAC,GAAW,EAAE,OAAwB;IAElE,OAAO,kBAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;QAEnC,GAAG,aAAH,GAAG,cAAH,GAAG,IAAH,GAAG,GAAK,OAAO,CAAC,GAAG,EAAE,EAAC;QAEtB,sBAAa,CAAC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC;QAElC,IAAI,QAAQ,GAAG,IAAA,wBAAY,EAAC;YAC3B,GAAG;SACH,CAAC,CAAC;QAEH,IAAI,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,CAAA,EACnB;YACC,MAAM,IAAI,KAAK,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAA;SACvD;QAED,IAAI,QAAQ,CAAC,YAAY,IAAI,CAAC,QAAQ,CAAC,WAAW,EAClD;YACC,QAAQ,GAAG,IAAA,oBAAQ,EAAC;gBACnB,GAAG,EAAE,QAAQ,CAAC,IAAI;aAClB,CAAC,CAAC;SACH;QAED,OAAO,CAAC,GAAG,CAAC,OAAO,EAA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AC;gBACR,QAAQ;gBACR,aAAa;gBACb,MAAM;gBACN,sBAAsB;gBACtB,SAAS,EAAE,QAAQ,CAAC,IAAI;aACxB,CAAC,CAAA;SACF;QAED,IAAA,qBAAa,EAAC;YACb,QAAQ;SACR,CAAC,CAAC;QAEH,MAAM,IAAI,GAAG,IAAA,kCAA0B,EAAC,QAAQ,CAAC,CAAC;QAElD,OAAO,IAAA,6BAAqB,EAAC,IAAI,EAAE;YAClC,QAAQ;YACR,sBAAsB;YACtB,MAAM;YACN,aAAa;SACb,CAAC,CAAA;IACH,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAS,CAAC,CAAA;AAC9B,CAAC;AAjGD,sCAiGC;AAED,kBAAe,aAAa,CAAA","sourcesContent":["import { findRoot, findRootLazy } from '@yarn-tool/find-root';\nimport { npmHostedGitInfoLazy } from '@yarn-tool/pkg-git-info';\nimport { _fixRoot, _fixWsRoot } from './lib/root/index';\nimport { _initPkgListableByRootData, _runEachPackagesAsync } from './lib/pkg/index';\nimport { consoleLogger } from 'debug-color2/logger';\nimport Bluebird from 'bluebird';\nimport { copyStaticFiles } from '@yarn-tool/static-file';\nimport { getWsCopyStaticFiles } from '@yarn-tool/static-file/lib/ws/wsCopyStaticFiles';\nimport { getRootCopyStaticFilesAuto } from '@yarn-tool/static-file/lib/root/getRootCopyStaticFiles';\nimport { _fixLernaJson } from './lib/ws/lerna';\n\nexport interface INpmAutoFixAll\n{\n\toverwriteHostedGitInfo?: boolean;\n\tbranch?: string;\n}\n\nexport function npmAutoFixAll(cwd: string, options?: INpmAutoFixAll)\n{\n\treturn Bluebird.resolve().then(() =>\n\t{\n\t\tcwd ??= process.cwd();\n\n\t\tconsoleLogger.info(`cwd: ${cwd}`);\n\n\t\tlet rootData = findRootLazy({\n\t\t\tcwd,\n\t\t});\n\n\t\tif (!rootData?.root)\n\t\t{\n\t\t\tthrow new Error(`Invalid workspaces / package: ${cwd}`)\n\t\t}\n\n\t\tif (rootData.hasWorkspace && !rootData.isWorkspace)\n\t\t{\n\t\t\trootData = findRoot({\n\t\t\t\tcwd: rootData.root,\n\t\t\t});\n\t\t}\n\n\t\tconsole.log(`root:`, rootData.root);\n\t\tconsole.log(`hasWorkspace:`, rootData.hasWorkspace);\n\n\t\tlet { branch, overwriteHostedGitInfo } = options ?? {};\n\n\t\tcwd = rootData.cwd;\n\n\t\tif (rootData.hasWorkspace)\n\t\t{\n\t\t\tconst file_map = getWsCopyStaticFiles();\n\n\t\t\tcopyStaticFiles({\n\t\t\t\tcwd: rootData.ws,\n\t\t\t\tfile_map,\n\t\t\t});\n\t\t}\n\t\telse if (rootData.root)\n\t\t{\n\t\t\tconst file_map = getRootCopyStaticFilesAuto({\n\t\t\t\t...rootData,\n\t\t\t\tisRoot: true,\n\t\t\t});\n\n\t\t\tcopyStaticFiles({\n\t\t\t\tcwd: rootData.root,\n\t\t\t\tfile_map,\n\t\t\t});\n\t\t}\n\n\t\tconsoleLogger.info(`check git info`);\n\n\t\tconst hostedGitInfo = npmHostedGitInfoLazy(cwd);\n\n\t\tconsole.log(`homepage:`, hostedGitInfo.homepage);\n\t\tconsole.log(`repository:`, hostedGitInfo.repository);\n\n\t\tconsoleLogger.info(`auto fix root of workspaces / package`);\n\n\t\tconsole.log(`root:`, rootData.root);\n\n\t\tif (rootData.hasWorkspace)\n\t\t{\n\t\t\t_fixWsRoot({\n\t\t\t\trootData,\n\t\t\t\thostedGitInfo,\n\t\t\t\tbranch,\n\t\t\t\toverwriteHostedGitInfo,\n\t\t\t})\n\t\t}\n\t\telse\n\t\t{\n\t\t\t_fixRoot({\n\t\t\t\trootData,\n\t\t\t\thostedGitInfo,\n\t\t\t\tbranch,\n\t\t\t\toverwriteHostedGitInfo,\n\t\t\t\ttargetDir: rootData.root,\n\t\t\t})\n\t\t}\n\n\t\t_fixLernaJson({\n\t\t\trootData,\n\t\t});\n\n\t\tconst list = _initPkgListableByRootData(rootData);\n\n\t\treturn _runEachPackagesAsync(list, {\n\t\t\trootData,\n\t\t\toverwriteHostedGitInfo,\n\t\t\tbranch,\n\t\t\thostedGitInfo,\n\t\t})\n\t}).then(() => void 0 as void)\n}\n\nexport default npmAutoFixAll\n"]}
|
package/lib/root/index.js
CHANGED
|
@@ -9,6 +9,7 @@ const ws_scope_1 = require("@yarn-tool/ws-scope");
|
|
|
9
9
|
const sort_package_json3_1 = require("sort-package-json3");
|
|
10
10
|
const ws_root_scripts_1 = require("@yarn-tool/pkg-entry-util/lib/preset/ws-root-scripts");
|
|
11
11
|
const dummy_1 = require("@yarn-tool/pkg-entry-util/lib/preset/dummy");
|
|
12
|
+
const pkg_deps_add_1 = require("@yarn-tool/pkg-deps-add");
|
|
12
13
|
function _fixRoot(options) {
|
|
13
14
|
let { rootData, branch, overwriteHostedGitInfo, hostedGitInfo, targetDir } = options;
|
|
14
15
|
const root_file_package_json = (0, upath2_1.join)(targetDir, 'package.json');
|
|
@@ -50,6 +51,22 @@ function _fixWsRoot(options) {
|
|
|
50
51
|
var _b;
|
|
51
52
|
(_a = (_b = runtime.root_pkg_json.data.scripts)[key]) !== null && _a !== void 0 ? _a : (_b[key] = value);
|
|
52
53
|
});
|
|
54
|
+
[
|
|
55
|
+
'@yarn-tool/ws-find-up-paths',
|
|
56
|
+
'@types/node',
|
|
57
|
+
'@bluelovers/tsconfig',
|
|
58
|
+
].forEach(name => {
|
|
59
|
+
var _a;
|
|
60
|
+
var _b;
|
|
61
|
+
const _check = (0, pkg_deps_add_1._checkDependenciesExistsAll)(runtime.root_pkg_json.data, [
|
|
62
|
+
'devDependencies',
|
|
63
|
+
'dependencies',
|
|
64
|
+
], name);
|
|
65
|
+
if (!_check._exists) {
|
|
66
|
+
(_a = (_b = runtime.root_pkg_json.data).devDependencies) !== null && _a !== void 0 ? _a : (_b.devDependencies = {});
|
|
67
|
+
runtime.root_pkg_json.data.devDependencies[name] = '*';
|
|
68
|
+
}
|
|
69
|
+
});
|
|
53
70
|
runtime.root_pkg_json.data = (0, sort_package_json3_1.sortPackageJson)(runtime.root_pkg_json.data);
|
|
54
71
|
runtime.root_pkg_json.write();
|
|
55
72
|
let wss = new ws_scope_1.WorkspacesScope(runtime.rootData.ws);
|
package/lib/root/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AACA,gEAA0F;AAC1F,mCAA8B;AAC9B,0DAA+D;AAC/D,qEAA4D;AAC5D,kDAAsD;AACtD,2DAAqD;AACrD,0FAAmG;AACnG,sEAA8E;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AACA,gEAA0F;AAC1F,mCAA8B;AAC9B,0DAA+D;AAC/D,qEAA4D;AAC5D,kDAAsD;AACtD,2DAAqD;AACrD,0FAAmG;AACnG,sEAA8E;AAC9E,0DAAsE;AAEtE,SAAgB,QAAQ,CAAC,OAA4C;IAEpE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,sBAAsB,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAErF,MAAM,sBAAsB,GAAG,IAAA,aAAI,EAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IAE/D,IAAI,aAAa,GAAG,IAAI,2CAAiB,CAAC,sBAAsB,CAAC,CAAC;IAElE,aAAa,aAAb,aAAa,cAAb,aAAa,IAAb,aAAa,GAAK,IAAA,mCAAoB,GAAE,EAAC;IAEzC,IAAI,aAAa,EACjB;QACC,IAAA,mCAAiB,EAAC,aAAa,CAAC,IAAI,EAAE;YACrC,SAAS;YACT,QAAQ;YACR,aAAa;YACb,MAAM;YACN,sBAAsB;SACtB,CAAC,CAAC;QAEH,aAAa,CAAC,IAAI,GAAG,IAAA,oCAAe,EAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAEzD,aAAa,CAAC,KAAK,EAAE,CAAC;KACtB;IAED,OAAO;QACN,sBAAsB;QACtB,aAAa;QACb,SAAS;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OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IAE9B,IAAI,GAAG,GAAG,IAAI,0BAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnD,GAAG,CAAC,SAAS,EAAE,CAAC;IAChB,GAAG,CAAC,IAAI,EAAE,CAAC;IAEX,OAAO,OAAO,CAAA;AACf,CAAC;AA3CD,gCA2CC","sourcesContent":["import { ITSRequiredPick } from 'ts-type/lib/type/record';\nimport { fillPkgHostedInfo, IFillPkgHostedInfoOptions } from '@yarn-tool/pkg-hosted-info';\nimport { join } from 'upath2';\nimport { npmHostedGitInfoLazy } from '@yarn-tool/pkg-git-info';\nimport { PackageJsonLoader } from 'npm-package-json-loader';\nimport { WorkspacesScope } from '@yarn-tool/ws-scope';\nimport { sortPackageJson } from 'sort-package-json3';\nimport { defaultWorkspaceRootScripts } from '@yarn-tool/pkg-entry-util/lib/preset/ws-root-scripts';\nimport { fillDummyScripts } from '@yarn-tool/pkg-entry-util/lib/preset/dummy';\nimport { _checkDependenciesExistsAll } from '@yarn-tool/pkg-deps-add';\n\nexport function _fixRoot(options: Required<IFillPkgHostedInfoOptions>)\n{\n\tlet { rootData, branch, overwriteHostedGitInfo, hostedGitInfo, targetDir } = options;\n\n\tconst root_file_package_json = join(targetDir, 'package.json');\n\n\tlet root_pkg_json = new PackageJsonLoader(root_file_package_json);\n\n\thostedGitInfo ??= npmHostedGitInfoLazy();\n\n\tif (hostedGitInfo)\n\t{\n\t\tfillPkgHostedInfo(root_pkg_json.data, {\n\t\t\ttargetDir,\n\t\t\trootData,\n\t\t\thostedGitInfo,\n\t\t\tbranch,\n\t\t\toverwriteHostedGitInfo,\n\t\t});\n\n\t\troot_pkg_json.data = sortPackageJson(root_pkg_json.data);\n\n\t\troot_pkg_json.write();\n\t}\n\n\treturn {\n\t\troot_file_package_json,\n\t\troot_pkg_json,\n\t\ttargetDir,\n\t\trootData,\n\t\thostedGitInfo,\n\t\tbranch,\n\t\toverwriteHostedGitInfo,\n\t}\n}\n\nexport function _fixWsRoot(options: ITSRequiredPick<IFillPkgHostedInfoOptions, 'hostedGitInfo' | 'rootData' | 'overwriteHostedGitInfo' | 'branch'>)\n{\n\tif (!options.rootData.ws?.length)\n\t{\n\t\tthrow new Error(`Invalid workspaces`)\n\t}\n\n\tlet runtime = _fixRoot({\n\t\t...options,\n\t\ttargetDir: options.rootData.ws,\n\t});\n\n\tObject.entries(fillDummyScripts(defaultWorkspaceRootScripts())).forEach(([key, value]) =>\n\t{\n\t\truntime.root_pkg_json.data.scripts[key] ??= value;\n\t});\n\n\t[\n\t\t'@yarn-tool/ws-find-up-paths',\n\t\t'@types/node',\n\t\t'@bluelovers/tsconfig',\n\t].forEach(name => {\n\t\tconst _check = _checkDependenciesExistsAll(runtime.root_pkg_json.data, [\n\t\t\t'devDependencies',\n\t\t\t'dependencies',\n\t\t], name);\n\n\t\tif (!_check._exists)\n\t\t{\n\t\t\truntime.root_pkg_json.data.devDependencies ??= {};\n\t\t\truntime.root_pkg_json.data.devDependencies[name] = '*';\n\t\t}\n\t});\n\n\truntime.root_pkg_json.data = sortPackageJson(runtime.root_pkg_json.data);\n\n\truntime.root_pkg_json.write();\n\n\tlet wss = new WorkspacesScope(runtime.rootData.ws);\n\twss.syncValue();\n\twss.save();\n\n\treturn runtime\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ITSRequiredPick } from 'ts-type/lib/type/record';
|
|
2
|
+
import { IFillPkgHostedInfoOptions } from '@yarn-tool/pkg-hosted-info';
|
|
3
|
+
import { ILernaJson } from '@ts-type/package-dts/lerna-json';
|
|
4
|
+
export declare function _fixLernaJsonCore(current: ILernaJson, tpl: ILernaJson): ILernaJson;
|
|
5
|
+
export declare function _fixLernaJson(options: ITSRequiredPick<IFillPkgHostedInfoOptions, 'rootData'>): void;
|
package/lib/ws/lerna.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._fixLernaJson = exports._fixLernaJsonCore = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const fs_extra_1 = require("fs-extra");
|
|
6
|
+
const lodash_1 = require("lodash");
|
|
7
|
+
const __root_1 = require("@yarn-tool/static-file/__root");
|
|
8
|
+
const write_package_json_1 = require("@yarn-tool/write-package-json");
|
|
9
|
+
const array_hyper_unique_1 = require("array-hyper-unique");
|
|
10
|
+
function _fixLernaJsonCore(current, tpl) {
|
|
11
|
+
current.command = (0, lodash_1.defaultsDeep)(current.command, tpl.command);
|
|
12
|
+
current.command.publish.ignoreChanges = current.command.publish.ignoreChanges.concat(tpl.command.publish.ignoreChanges);
|
|
13
|
+
(0, array_hyper_unique_1.array_unique_overwrite)(current.command.publish.ignoreChanges);
|
|
14
|
+
return current;
|
|
15
|
+
}
|
|
16
|
+
exports._fixLernaJsonCore = _fixLernaJsonCore;
|
|
17
|
+
function _fixLernaJson(options) {
|
|
18
|
+
const file = (0, path_1.resolve)(options.rootData.root, 'lerna.json');
|
|
19
|
+
if ((0, fs_extra_1.existsSync)(file)) {
|
|
20
|
+
let json = (0, fs_extra_1.readJSONSync)(file);
|
|
21
|
+
let json2 = (0, fs_extra_1.readJSONSync)((0, path_1.resolve)(__root_1.__STATIC_ROOT, 'file/lerna.json.tpl'));
|
|
22
|
+
json = _fixLernaJsonCore(json, json2);
|
|
23
|
+
(0, write_package_json_1.writePackageJSONSync)(file, json);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports._fixLernaJson = _fixLernaJson;
|
|
27
|
+
//# sourceMappingURL=lerna.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lerna.js","sourceRoot":"","sources":["lerna.ts"],"names":[],"mappings":";;;AAEA,+BAA+B;AAC/B,uCAAoD;AACpD,mCAA6C;AAC7C,0DAA8D;AAC9D,sEAAqE;AAErE,2DAA4D;AAE5D,SAAgB,iBAAiB,CAAC,OAAmB,EAAE,GAAe;IAErE,OAAO,CAAC,OAAO,GAAG,IAAA,qBAAY,EAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAE7D,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,GAAI,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,aAA0B,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,aAAyB,CAAC,CAAC;IAElJ,IAAA,2CAAsB,EAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAE9D,OAAO,OAAO,CAAA;AACf,CAAC;AATD,8CASC;AAED,SAAgB,aAAa,CAAC,OAA+D;IAE5F,MAAM,IAAI,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAE1D,IAAI,IAAA,qBAAU,EAAC,IAAI,CAAC,EACpB;QACC,IAAI,IAAI,GAAG,IAAA,uBAAY,EAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,KAAK,GAAG,IAAA,uBAAY,EAAC,IAAA,cAAO,EAAC,sBAAa,EAAE,qBAAqB,CAAC,CAAC,CAAC;QAExE,IAAI,GAAG,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAEtC,IAAA,yCAAoB,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;KACjC;AACF,CAAC;AAbD,sCAaC","sourcesContent":["import { ITSRequiredPick } from 'ts-type/lib/type/record';\nimport { IFillPkgHostedInfoOptions } from '@yarn-tool/pkg-hosted-info';\nimport { resolve } from 'path';\nimport { existsSync, readJSONSync } from 'fs-extra';\nimport { defaultsDeep, merge } from 'lodash';\nimport { __STATIC_ROOT } from '@yarn-tool/static-file/__root';\nimport { writePackageJSONSync } from '@yarn-tool/write-package-json';\nimport { ILernaJson } from '@ts-type/package-dts/lerna-json';\nimport { array_unique_overwrite } from 'array-hyper-unique';\n\nexport function _fixLernaJsonCore(current: ILernaJson, tpl: ILernaJson)\n{\n\tcurrent.command = defaultsDeep(current.command, tpl.command);\n\n\tcurrent.command.publish.ignoreChanges = (current.command.publish.ignoreChanges as string[]).concat(tpl.command.publish.ignoreChanges as string[]);\n\n\tarray_unique_overwrite(current.command.publish.ignoreChanges);\n\n\treturn current\n}\n\nexport function _fixLernaJson(options: ITSRequiredPick<IFillPkgHostedInfoOptions, 'rootData'>)\n{\n\tconst file = resolve(options.rootData.root, 'lerna.json');\n\n\tif (existsSync(file))\n\t{\n\t\tlet json = readJSONSync(file);\n\t\tlet json2 = readJSONSync(resolve(__STATIC_ROOT, 'file/lerna.json.tpl'));\n\n\t\tjson = _fixLernaJsonCore(json, json2);\n\n\t\twritePackageJSONSync(file, json);\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarn-tool/fix-all",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.18",
|
|
4
4
|
"description": "auto check/fix workspaces/package",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"yarn",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
26
|
-
"url": "git+https://github.com/bluelovers/ws-yarn-workspaces.git"
|
|
26
|
+
"url": "git+https://github.com/bluelovers/ws-yarn-workspaces.git",
|
|
27
|
+
"directory": "packages/@yarn-tool/fix-all"
|
|
27
28
|
},
|
|
28
29
|
"license": "ISC",
|
|
29
30
|
"author": "bluelovers",
|
|
@@ -56,29 +57,33 @@
|
|
|
56
57
|
"tsc:showConfig": "ynpx get-current-tsconfig -p"
|
|
57
58
|
},
|
|
58
59
|
"dependencies": {
|
|
59
|
-
"@
|
|
60
|
-
"@yarn-tool/
|
|
61
|
-
"@yarn-tool/
|
|
62
|
-
"@yarn-tool/
|
|
63
|
-
"@yarn-tool/pkg-
|
|
64
|
-
"@yarn-tool/
|
|
65
|
-
"@yarn-tool/
|
|
60
|
+
"@ts-type/package-dts": "^2.0.5",
|
|
61
|
+
"@yarn-tool/find-root": "^2.0.6",
|
|
62
|
+
"@yarn-tool/fix-ws-versions": "^2.0.6",
|
|
63
|
+
"@yarn-tool/normalize-deps-value": "^1.0.4",
|
|
64
|
+
"@yarn-tool/pkg-git-info": "^1.0.36",
|
|
65
|
+
"@yarn-tool/pkg-hosted-info": "^2.0.8",
|
|
66
|
+
"@yarn-tool/static-file": "^2.0.8",
|
|
67
|
+
"@yarn-tool/write-package-json": "^1.0.5",
|
|
68
|
+
"@yarn-tool/ws-scope": "^2.0.6",
|
|
69
|
+
"array-hyper-unique": "^2.0.8",
|
|
66
70
|
"bluebird": "^3.7.2",
|
|
67
|
-
"cache-path": "^3.0.
|
|
71
|
+
"cache-path": "^3.0.6",
|
|
68
72
|
"debug-color2": "^1.3.2",
|
|
69
73
|
"fs-extra": "^10.1.0",
|
|
70
|
-
"lazy-aggregate-error": "^1.0.
|
|
71
|
-
"
|
|
74
|
+
"lazy-aggregate-error": "^1.0.16",
|
|
75
|
+
"lodash": "^4.17.21",
|
|
76
|
+
"npm-package-json-loader": "^2.0.13",
|
|
72
77
|
"progress-estimator": "^0.3.0",
|
|
73
|
-
"sort-package-json3": "^2.0.
|
|
78
|
+
"sort-package-json3": "^2.0.6",
|
|
74
79
|
"ts-type": "^2.1.10",
|
|
75
|
-
"tslib": "
|
|
80
|
+
"tslib": ">=2",
|
|
76
81
|
"upath2": "^3.1.15",
|
|
77
|
-
"ws-pkg-list": "^2.0.
|
|
82
|
+
"ws-pkg-list": "^2.0.6"
|
|
78
83
|
},
|
|
79
84
|
"packageManager": "yarn@1.22.19",
|
|
80
85
|
"publishConfig": {
|
|
81
86
|
"access": "public"
|
|
82
87
|
},
|
|
83
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "fccc2913440df31b04f2971e479fbe1d4c3a7a0c"
|
|
84
89
|
}
|