@yarn-tool/fix-all 2.0.16 → 2.0.17
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 +10 -0
- package/index.js +4 -0
- package/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 +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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.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)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### ✨ Features
|
|
11
|
+
|
|
12
|
+
* fixLernaJson ([5b5a5b1](https://github.com/bluelovers/ws-yarn-workspaces/commit/5b5a5b162fe68689fbef2f9fb46f884ea6814d7b))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
6
16
|
## [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)
|
|
7
17
|
|
|
8
18
|
|
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,iCA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C;QAE5D,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEpC,IAAI,QAAQ,CAAC,YAAY,EACzB;YACC,IAAA,kBAAU,EAAC;gBACV,QAAQ;gBACR,aAAa;gBACb,MAAM;gBACN,sBAAsB;aACtB,CAAC,CAAA;SACF;aAED;YACC,IAAA,gBAAQ,EAAC;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"]}
|
|
@@ -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.17",
|
|
4
4
|
"description": "auto check/fix workspaces/package",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"yarn",
|
|
@@ -56,18 +56,22 @@
|
|
|
56
56
|
"tsc:showConfig": "ynpx get-current-tsconfig -p"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
+
"@ts-type/package-dts": "^2.0.5",
|
|
59
60
|
"@yarn-tool/find-root": "^2.0.5",
|
|
60
61
|
"@yarn-tool/fix-ws-versions": "^2.0.5",
|
|
61
62
|
"@yarn-tool/normalize-deps-value": "^1.0.3",
|
|
62
|
-
"@yarn-tool/pkg-git-info": "^1.0.
|
|
63
|
-
"@yarn-tool/pkg-hosted-info": "^2.0.
|
|
64
|
-
"@yarn-tool/static-file": "^2.0.
|
|
63
|
+
"@yarn-tool/pkg-git-info": "^1.0.35",
|
|
64
|
+
"@yarn-tool/pkg-hosted-info": "^2.0.7",
|
|
65
|
+
"@yarn-tool/static-file": "^2.0.7",
|
|
66
|
+
"@yarn-tool/write-package-json": "^1.0.4",
|
|
65
67
|
"@yarn-tool/ws-scope": "^2.0.5",
|
|
68
|
+
"array-hyper-unique": "^2.0.8",
|
|
66
69
|
"bluebird": "^3.7.2",
|
|
67
70
|
"cache-path": "^3.0.5",
|
|
68
71
|
"debug-color2": "^1.3.2",
|
|
69
72
|
"fs-extra": "^10.1.0",
|
|
70
73
|
"lazy-aggregate-error": "^1.0.12",
|
|
74
|
+
"lodash": "^4.17.21",
|
|
71
75
|
"npm-package-json-loader": "^2.0.12",
|
|
72
76
|
"progress-estimator": "^0.3.0",
|
|
73
77
|
"sort-package-json3": "^2.0.5",
|
|
@@ -80,5 +84,5 @@
|
|
|
80
84
|
"publishConfig": {
|
|
81
85
|
"access": "public"
|
|
82
86
|
},
|
|
83
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "e7aec5c1c202bac1026b9117bcb8ee18b9188916"
|
|
84
88
|
}
|