@yarn-tool/fix-all 1.0.1 → 1.0.5
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 +42 -0
- package/index.js +12 -2
- package/index.js.map +1 -1
- package/lib/pkg/index.d.ts +3 -1
- package/lib/pkg/index.js +11 -1
- package/lib/pkg/index.js.map +1 -1
- package/lib/root/index.js +9 -5
- package/lib/root/index.js.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,48 @@
|
|
|
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
|
+
## [1.0.5](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/fix-all@1.0.4...@yarn-tool/fix-all@1.0.5) (2022-01-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### 📦 Code Refactoring
|
|
10
|
+
|
|
11
|
+
* code splitting ([fa83e8f](https://github.com/bluelovers/ws-yarn-workspaces/commit/fa83e8f47a10a5ad7ed1ac5337d8a2d20c556df9))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [1.0.4](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/fix-all@1.0.3...@yarn-tool/fix-all@1.0.4) (2021-12-31)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### 📦 Code Refactoring
|
|
21
|
+
|
|
22
|
+
* code splitting ([3236306](https://github.com/bluelovers/ws-yarn-workspaces/commit/323630687dcfaa851cd65176d446d55f74a1dd3b))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [1.0.3](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/fix-all@1.0.2...@yarn-tool/fix-all@1.0.3) (2021-12-30)
|
|
29
|
+
|
|
30
|
+
**Note:** Version bump only for package @yarn-tool/fix-all
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## [1.0.2](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/fix-all@1.0.1...@yarn-tool/fix-all@1.0.2) (2021-12-29)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### 🐛 Bug Fixes
|
|
40
|
+
|
|
41
|
+
* root ([998d010](https://github.com/bluelovers/ws-yarn-workspaces/commit/998d010dff5e6203f7fc8228f1591b9c9b9e0c09))
|
|
42
|
+
* homepage ([c606ec3](https://github.com/bluelovers/ws-yarn-workspaces/commit/c606ec33881919df58b5319cb4ef06974cf0d8bd))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
6
48
|
## 1.0.1 (2021-12-29)
|
|
7
49
|
|
|
8
50
|
|
package/index.js
CHANGED
|
@@ -12,12 +12,17 @@ function npmAutoFixAll(cwd, options) {
|
|
|
12
12
|
return bluebird_1.default.resolve().then(() => {
|
|
13
13
|
cwd !== null && cwd !== void 0 ? cwd : (cwd = process.cwd());
|
|
14
14
|
logger_1.consoleLogger.info(`cwd: ${cwd}`);
|
|
15
|
-
|
|
15
|
+
let rootData = (0, find_root_1.findRootLazy)({
|
|
16
16
|
cwd,
|
|
17
17
|
});
|
|
18
18
|
if (!(rootData === null || rootData === void 0 ? void 0 : rootData.root)) {
|
|
19
19
|
throw new Error(`Invalid workspaces / package: ${cwd}`);
|
|
20
20
|
}
|
|
21
|
+
if (rootData.hasWorkspace && !rootData.isWorkspace) {
|
|
22
|
+
rootData = (0, find_root_1.findRoot)({
|
|
23
|
+
cwd: rootData.root,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
21
26
|
console.log(`root:`, rootData.root);
|
|
22
27
|
console.log(`hasWorkspace:`, rootData.hasWorkspace);
|
|
23
28
|
let { branch, overwriteHostedGitInfo } = options !== null && options !== void 0 ? options : {};
|
|
@@ -46,7 +51,12 @@ function npmAutoFixAll(cwd, options) {
|
|
|
46
51
|
});
|
|
47
52
|
}
|
|
48
53
|
const list = (0, index_2._initPkgListableByRootData)(rootData);
|
|
49
|
-
return (0, index_2._runEachPackagesAsync)(list,
|
|
54
|
+
return (0, index_2._runEachPackagesAsync)(list, {
|
|
55
|
+
rootData,
|
|
56
|
+
overwriteHostedGitInfo,
|
|
57
|
+
branch,
|
|
58
|
+
hostedGitInfo,
|
|
59
|
+
});
|
|
50
60
|
}).then(() => void 0);
|
|
51
61
|
}
|
|
52
62
|
exports.npmAutoFixAll = npmAutoFixAll;
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,
|
|
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;AAQhC,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,GAA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,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAS,CAAC,CAAA;AAC9B,CAAC;AAvED,sCAuEC;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';\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\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\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/pkg/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { IOptionsPkgListable } from 'ws-pkg-list';
|
|
2
2
|
import { IFindRootReturnType } from '@yarn-tool/find-root';
|
|
3
3
|
import Bluebird from 'bluebird';
|
|
4
|
+
import { IFillPkgHostedInfoOptions } from '@yarn-tool/pkg-hosted-info';
|
|
5
|
+
import { ITSRequiredPick } from 'ts-type/lib/type/record';
|
|
4
6
|
export declare function _handler(cwd: string, ...argv: Parameters<IOptionsPkgListable["handler"]>): {
|
|
5
7
|
pkg: import("@ts-type/package-dts").IPackageJson<any>;
|
|
6
8
|
manifestLocation: string;
|
|
@@ -11,7 +13,7 @@ export declare function _handler(cwd: string, ...argv: Parameters<IOptionsPkgLis
|
|
|
11
13
|
prefix: string;
|
|
12
14
|
};
|
|
13
15
|
export declare type IEntry = ReturnType<typeof _handler>;
|
|
14
|
-
export declare function _runEachPackagesAsync(list: IEntry[],
|
|
16
|
+
export declare function _runEachPackagesAsync(list: IEntry[], options: ITSRequiredPick<IFillPkgHostedInfoOptions, 'overwriteHostedGitInfo' | 'branch' | 'rootData' | 'hostedGitInfo'>): Bluebird<void[]>;
|
|
15
17
|
export declare function _initPkgListableByRootData(rootData: Pick<IFindRootReturnType, 'root' | 'hasWorkspace'>): {
|
|
16
18
|
pkg: import("@ts-type/package-dts").IPackageJson<any>;
|
|
17
19
|
manifestLocation: string;
|
package/lib/pkg/index.js
CHANGED
|
@@ -10,6 +10,8 @@ const bluebird_1 = tslib_1.__importDefault(require("bluebird"));
|
|
|
10
10
|
const cli_progress_1 = require("../util/cli-progress");
|
|
11
11
|
const logger_1 = require("debug-color2/logger");
|
|
12
12
|
const debug_color2_1 = require("debug-color2");
|
|
13
|
+
const pkg_hosted_info_1 = require("@yarn-tool/pkg-hosted-info");
|
|
14
|
+
const sort_package_json3_1 = require("sort-package-json3");
|
|
13
15
|
function _handler(cwd, ...argv) {
|
|
14
16
|
return {
|
|
15
17
|
...(0, ws_pkg_list_1.normalizeListableRowExtra)(argv[0], cwd),
|
|
@@ -17,7 +19,8 @@ function _handler(cwd, ...argv) {
|
|
|
17
19
|
};
|
|
18
20
|
}
|
|
19
21
|
exports._handler = _handler;
|
|
20
|
-
function _runEachPackagesAsync(list,
|
|
22
|
+
function _runEachPackagesAsync(list, options) {
|
|
23
|
+
const { rootData, overwriteHostedGitInfo, hostedGitInfo, branch, } = options;
|
|
21
24
|
let logger;
|
|
22
25
|
return bluebird_1.default.resolve(list)
|
|
23
26
|
.tap(() => {
|
|
@@ -35,6 +38,13 @@ function _runEachPackagesAsync(list, rootData) {
|
|
|
35
38
|
catch (e) {
|
|
36
39
|
err.push(e);
|
|
37
40
|
}
|
|
41
|
+
(0, pkg_hosted_info_1.fillPkgHostedInfo)(pkg.data, {
|
|
42
|
+
targetDir: row.location,
|
|
43
|
+
overwriteHostedGitInfo,
|
|
44
|
+
hostedGitInfo,
|
|
45
|
+
branch,
|
|
46
|
+
});
|
|
47
|
+
pkg.data = (0, sort_package_json3_1.sortPackageJson)(pkg.data);
|
|
38
48
|
pkg.autofix();
|
|
39
49
|
pkg.write();
|
|
40
50
|
})().catch(e => err.push(e)), row.name);
|
package/lib/pkg/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.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QAC7B,GAAG;KACH,EAAE,GAAG,EAAE;QACP,OAAO,CAAC,GAAG,IAAI;YAEd,OAAO,QAAQ,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;QAC9B,CAAC;KACD,CAAC,CAAA;AACH,CAAC;AAtBD,gEAsBC","sourcesContent":["import { IOptionsPkgListable, normalizeListableRowExtra, wsPkgListable, wsPkgListableFromPaths } from 'ws-pkg-list';\nimport { IFindRootReturnType } from '@yarn-tool/find-root';\nimport { PackageJsonLoader } from 'npm-package-json-loader';\nimport { pkgExportsVerify } from '@yarn-tool/pkg-entry-util';\nimport { AggregateErrorExtra } from 'lazy-aggregate-error';\nimport Bluebird from 'bluebird';\nimport { createProgressEstimator } from '../util/cli-progress';\nimport { consoleLogger } from 'debug-color2/logger';\nimport { console } from 'debug-color2';\nimport { ProgressEstimator } from 'progress-estimator';\nimport { fillPkgHostedInfo, IFillPkgHostedInfoOptions } from '@yarn-tool/pkg-hosted-info';\nimport { ITSRequiredPick } from 'ts-type/lib/type/record';\nimport { sortPackageJson } from 'sort-package-json3';\n\nexport function _handler(cwd: string, ...argv: Parameters<IOptionsPkgListable[\"handler\"]>)\n{\n\treturn {\n\t\t...normalizeListableRowExtra(argv[0], cwd),\n\t\tpkg: argv[1],\n\t}\n}\n\nexport type IEntry = ReturnType<typeof _handler>\n\nexport function _runEachPackagesAsync(list: IEntry[],\n\toptions: ITSRequiredPick<IFillPkgHostedInfoOptions, 'overwriteHostedGitInfo' | 'branch' | 'rootData' | 'hostedGitInfo'>,\n)\n{\n\tconst {\n\t\trootData,\n\t\toverwriteHostedGitInfo,\n\t\thostedGitInfo,\n\t\tbranch,\n\t} = options;\n\n\tlet logger: ProgressEstimator;\n\n\treturn Bluebird.resolve(list)\n\t\t.tap(() =>\n\t\t{\n\t\t\tlogger = createProgressEstimator(rootData.root);\n\n\t\t\tconsoleLogger.info(`auto check/fix packages`);\n\t\t})\n\t\t.mapSeries(async (row) =>\n\t\t{\n\t\t\t//console.dir(row);\n\n\t\t\tconst err = new AggregateErrorExtra();\n\n\t\t\tconst promiseLogger = logger((async () =>\n\t\t\t{\n\n\t\t\t\tconst pkg = new PackageJsonLoader(row.manifestLocation);\n\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tpkgExportsVerify(pkg.data);\n\t\t\t\t}\n\t\t\t\tcatch (e)\n\t\t\t\t{\n\t\t\t\t\terr.push(e);\n\t\t\t\t}\n\n\t\t\t\tfillPkgHostedInfo(pkg.data, {\n\t\t\t\t\ttargetDir: row.location,\n\t\t\t\t\toverwriteHostedGitInfo,\n\t\t\t\t\thostedGitInfo,\n\t\t\t\t\tbranch,\n\t\t\t\t});\n\n\t\t\t\tpkg.data = sortPackageJson(pkg.data);\n\n\t\t\t\tpkg.autofix();\n\t\t\t\tpkg.write();\n\n\t\t\t})().catch(e => err.push(e)), row.name)\n\n\t\t\treturn promiseLogger\n\t\t\t\t.catch(e => err.push(e))\n\t\t\t\t.then(() =>\n\t\t\t\t{\n\t\t\t\t\tif (err.length)\n\t\t\t\t\t{\n\t\t\t\t\t\tconsole.error(err.toString());\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t\t;\n}\n\nexport function _initPkgListableByRootData(rootData: Pick<IFindRootReturnType, 'root' | 'hasWorkspace'>)\n{\n\tlet cwd = rootData.root;\n\n\tif (rootData.hasWorkspace)\n\t{\n\t\treturn wsPkgListable(cwd, {\n\t\t\thandler(...argv)\n\t\t\t{\n\t\t\t\treturn _handler(cwd, ...argv)\n\t\t\t},\n\t\t})\n\t}\n\n\treturn wsPkgListableFromPaths([\n\t\tcwd,\n\t], cwd, {\n\t\thandler(...argv)\n\t\t{\n\t\t\treturn _handler(cwd, ...argv)\n\t\t},\n\t})\n}\n"]}
|
package/lib/root/index.js
CHANGED
|
@@ -7,6 +7,8 @@ const pkg_git_info_1 = require("@yarn-tool/pkg-git-info");
|
|
|
7
7
|
const npm_package_json_loader_1 = require("npm-package-json-loader");
|
|
8
8
|
const ws_scope_1 = require("@yarn-tool/ws-scope");
|
|
9
9
|
const sort_package_json3_1 = require("sort-package-json3");
|
|
10
|
+
const ws_root_scripts_1 = require("@yarn-tool/pkg-entry-util/lib/preset/ws-root-scripts");
|
|
11
|
+
const dummy_1 = require("@yarn-tool/pkg-entry-util/lib/preset/dummy");
|
|
10
12
|
function _fixRoot(options) {
|
|
11
13
|
let { rootData, branch, overwriteHostedGitInfo, hostedGitInfo, targetDir } = options;
|
|
12
14
|
const root_file_package_json = (0, upath2_1.join)(targetDir, 'package.json');
|
|
@@ -35,7 +37,7 @@ function _fixRoot(options) {
|
|
|
35
37
|
}
|
|
36
38
|
exports._fixRoot = _fixRoot;
|
|
37
39
|
function _fixWsRoot(options) {
|
|
38
|
-
var _a
|
|
40
|
+
var _a;
|
|
39
41
|
if (!((_a = options.rootData.ws) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
40
42
|
throw new Error(`Invalid workspaces`);
|
|
41
43
|
}
|
|
@@ -43,10 +45,12 @@ function _fixWsRoot(options) {
|
|
|
43
45
|
...options,
|
|
44
46
|
targetDir: options.rootData.ws,
|
|
45
47
|
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
Object.entries((0, dummy_1.fillDummyScripts)((0, ws_root_scripts_1.defaultWorkspaceRootScripts)())).forEach(([key, value]) => {
|
|
49
|
+
var _a;
|
|
50
|
+
var _b;
|
|
51
|
+
(_a = (_b = runtime.root_pkg_json.data.scripts)[key]) !== null && _a !== void 0 ? _a : (_b[key] = value);
|
|
52
|
+
});
|
|
53
|
+
runtime.root_pkg_json.write();
|
|
50
54
|
let wss = new ws_scope_1.WorkspacesScope(runtime.rootData.ws);
|
|
51
55
|
wss.syncValue();
|
|
52
56
|
wss.save();
|
package/lib/root/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AACA,gEAA0F;AAC1F,mCAA8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B,GAAG,OAAO;QACV,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE;KAC9B,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,IAAA,wBAAgB,EAAC,IAAA,6CAA2B,GAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;;;QAExF,YAAA,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,EAAC,GAAG,wCAAH,GAAG,IAAM,KAAK,EAAC;IACnD,CAAC,CAAC,CAAC;IAEH,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;AAxBD,gCAwBC","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';\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\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarn-tool/fix-all",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "auto check/fix workspaces/package",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"yarn",
|
|
@@ -54,26 +54,26 @@
|
|
|
54
54
|
"tsc:showConfig": "ynpx get-current-tsconfig -p"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@yarn-tool/find-root": "^1.0.
|
|
57
|
+
"@yarn-tool/find-root": "^1.0.60",
|
|
58
58
|
"@yarn-tool/pkg-git-info": "^1.0.24",
|
|
59
|
-
"@yarn-tool/pkg-hosted-info": "^1.0.
|
|
60
|
-
"@yarn-tool/ws-scope": "^1.0.
|
|
59
|
+
"@yarn-tool/pkg-hosted-info": "^1.0.10",
|
|
60
|
+
"@yarn-tool/ws-scope": "^1.0.12",
|
|
61
61
|
"bluebird": "^3.7.2",
|
|
62
|
-
"cache-path": "^2.0.
|
|
62
|
+
"cache-path": "^2.0.29",
|
|
63
63
|
"debug-color2": "^1.2.7",
|
|
64
64
|
"fs-extra": "^10.0.0",
|
|
65
65
|
"lazy-aggregate-error": "^1.0.6",
|
|
66
|
-
"npm-package-json-loader": "^1.0.
|
|
66
|
+
"npm-package-json-loader": "^1.0.71",
|
|
67
67
|
"progress-estimator": "^0.3.0",
|
|
68
|
-
"sort-package-json3": "^1.0.
|
|
68
|
+
"sort-package-json3": "^1.0.49",
|
|
69
69
|
"ts-type": "^2.1.2",
|
|
70
70
|
"tslib": "^2.3.1",
|
|
71
|
-
"upath2": "^3.1.
|
|
72
|
-
"ws-pkg-list": "^1.0.
|
|
71
|
+
"upath2": "^3.1.12",
|
|
72
|
+
"ws-pkg-list": "^1.0.73"
|
|
73
73
|
},
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
77
|
"packageManager": "yarn@^1.22.11",
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "8064859970d5e7ab3e0568475c804767fc70f382"
|
|
79
79
|
}
|