@yarn-tool/fix-all 2.0.12 → 2.0.15

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 CHANGED
@@ -3,6 +3,36 @@
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.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
+
8
+
9
+
10
+ ### 🔖 Miscellaneous
11
+
12
+ * . ([9e54da6](https://github.com/bluelovers/ws-yarn-workspaces/commit/9e54da68adfe290cd74a7ebd3a0c4debcf97b252))
13
+ * . ([157d5dc](https://github.com/bluelovers/ws-yarn-workspaces/commit/157d5dc8959261d9326f6e633987182898ae9670))
14
+ * . ([dafc19c](https://github.com/bluelovers/ws-yarn-workspaces/commit/dafc19c43afb42c904b6e7dcc49d93567897c092))
15
+
16
+
17
+
18
+ ## [2.0.14](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/fix-all@2.0.13...@yarn-tool/fix-all@2.0.14) (2022-08-25)
19
+
20
+
21
+
22
+ ### 📌 Dependencies
23
+
24
+ * update deps ([836ee56](https://github.com/bluelovers/ws-yarn-workspaces/commit/836ee56d294d3b6c85ad1f8b209660c779480a80))
25
+
26
+
27
+
28
+ ## [2.0.13](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/fix-all@2.0.12...@yarn-tool/fix-all@2.0.13) (2022-08-19)
29
+
30
+ **Note:** Version bump only for package @yarn-tool/fix-all
31
+
32
+
33
+
34
+
35
+
6
36
  ## [2.0.12](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/fix-all@2.0.11...@yarn-tool/fix-all@2.0.12) (2022-08-19)
7
37
 
8
38
 
package/lib/pkg/index.js CHANGED
@@ -17,6 +17,9 @@ const types_1 = require("@ts-type/package-dts/lib/package-json/types");
17
17
  const normalize_deps_value_1 = require("@yarn-tool/normalize-deps-value");
18
18
  const getRootCopyStaticFiles_1 = require("@yarn-tool/static-file/lib/root/getRootCopyStaticFiles");
19
19
  const static_file_1 = require("@yarn-tool/static-file");
20
+ const pkg_scripts_1 = require("@yarn-tool/pkg-entry-util/lib/preset/pkg-scripts");
21
+ const path_is_same_1 = require("path-is-same");
22
+ const dummy_1 = require("@yarn-tool/pkg-entry-util/lib/util/scripts/dummy");
20
23
  function _handler(cwd, ...argv) {
21
24
  return {
22
25
  ...(0, ws_pkg_list_1.normalizeListableRowExtra)(argv[0], cwd),
@@ -38,6 +41,7 @@ function _runEachPackagesAsync(list, options) {
38
41
  //console.dir(row);
39
42
  const err = new lazy_aggregate_error_1.AggregateErrorExtra();
40
43
  const promiseLogger = logger((async () => {
44
+ var _a, _b;
41
45
  const pkg = new npm_package_json_loader_1.PackageJsonLoader(row.manifestLocation);
42
46
  const file_map = (0, getRootCopyStaticFiles_1.getRootCopyStaticFilesAuto)({
43
47
  ...rootData,
@@ -69,6 +73,21 @@ function _runEachPackagesAsync(list, options) {
69
73
  pkg.data[field][name] = _value;
70
74
  });
71
75
  });
76
+ pkg.data.scripts = {
77
+ ...(0, pkg_scripts_1.defaultPkgScripts)(),
78
+ ...((_a = pkg.data.scripts) !== null && _a !== void 0 ? _a : {}),
79
+ };
80
+ if ((0, path_is_same_1.pathIsSame)(rootData.root, row.location)) {
81
+ if ((0, path_is_same_1.pathIsSame)(rootData.ws, row.location)) {
82
+ }
83
+ else {
84
+ }
85
+ }
86
+ else {
87
+ if (!((_b = pkg.data.scripts['_preversion']) === null || _b === void 0 ? void 0 : _b.length) && (0, dummy_1.isDummyEchoMaybeOrEmpty)(pkg.data.scripts.preversion)) {
88
+ pkg.data.scripts.preversion = "yarn run test" /* EnumScriptsEntry.preversion */;
89
+ }
90
+ }
72
91
  pkg.data = (0, sort_package_json3_1.sortPackageJson)(pkg.data);
73
92
  pkg.autofix();
74
93
  pk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AG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAA;QAEvC,OAAO,aAAa;aAClB,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACvB,IAAI,CAAC,GAAG,EAAE;YAEV,IAAI,GAAG,CAAC,MAAM,EACd;gBACC,sBAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aACnB;QACF,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CACD;AACH,CAAC;AA9FD,sDA8FC;AAED,SAAgB,0BAA0B,CAAC,QAA4D;IAEtG,IAAI,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC;IAExB,IAAI,QAAQ,CAAC,YAAY,EACzB;QACC,OAAO,IAAA,2BAAa,EAAC,GAAG,EAAE;YACzB,OAAO,CAAC,GAAG,IAAI;gBAEd,OAAO,QAAQ,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;YAC9B,CAAC;SACD,CAAC,CAAA;KACF;IAED,OAAO,IAAA,oCAAsB,EAAC;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';\nimport { fixPkgDepsVersionsCore, ICache, ICacheInput } from '@yarn-tool/fix-ws-versions';\nimport { packageJsonDependenciesFields } from '@ts-type/package-dts/lib/package-json/types';\nimport { normalizeDepsValue } from '@yarn-tool/normalize-deps-value';\nimport { getRootCopyStaticFilesAuto } from '@yarn-tool/static-file/lib/root/getRootCopyStaticFiles';\nimport { copyStaticFiles } from '@yarn-tool/static-file';\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\tlet cache: ICacheInput<IEntry> = {} as any;\n\n\treturn Bluebird.resolve(list)\n\t\t.tap((listable) =>\n\t\t{\n\t\t\tlogger = createProgressEstimator(rootData.root);\n\n\t\t\tconsoleLogger.info(`auto check/fix packages`);\n\n\t\t\tcache.listable = listable;\n\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\tconst file_map = getRootCopyStaticFilesAuto({\n\t\t\t\t\t...rootData,\n\t\t\t\t\tisRoot: false,\n\t\t\t\t});\n\n\t\t\t\tcopyStaticFiles({\n\t\t\t\t\tcwd: row.location,\n\t\t\t\t\tfile_map,\n\t\t\t\t});\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\tfixPkgDepsVersionsCore(pkg.data, cache);\n\n\t\t\t\tpackageJsonDependenciesFields\n\t\t\t\t\t.forEach(field => {\n\n\t\t\t\t\t\tObject.keys(pkg.data[field] ?? {})\n\t\t\t\t\t\t\t.forEach(name => {\n\t\t\t\t\t\t\t\tconst _value = normalizeDepsValue(pkg.data[field][name]);\n\t\t\t\t\t\t\t\tpkg.data[field][name] = _value;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t;\n\n\t\t\t\t\t})\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);\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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,6CAAoH;AAEpH,qEAA4D;AAC5D,8DAA6D;AAC7D,+DAA2D;AAC3D,gEAAgC;AAChC,uDAA+D;AAC/D,gDAAoD;AACpD,+CAAuC;AAEvC,gEAA0F;AAE1F,2DAAqD;AACrD,gEAAyF;AACzF,uEAA4F;AAC5F,0EAAqE;AACrE,mGAAoG;AACpG,wDAAyD;AACzD,kFAAqF;AACrF,+CAA0C;AAC1C,4EAA2F;AAG3F,SAAgB,QAAQ,CAAC,GAAW,EAAE,GAAG,IAAgD;IAExF,OAAO;QACN,GAAG,IAAA,uCAAyB,EAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;QAC1C,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;KACZ,CAAA;AACF,CAAC;AAND,4BAMC;AAID,SAAgB,qBAAqB,CAAC,IAAc,EACnD,OAAuH;IAGvH,MAAM,EACL,QAAQ,EACR,sBAAsB,EACtB,aAAa,EACb,MAAM,GACN,GAAG,OAAO,CAAC;IAEZ,IAAI,MAAyB,CAAC;IAC9B,IAAI,KAAK,GAAwB,EAAS,CAAC;IAE3C,OAAO,kBAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;SAC3B,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QAEjB,MAAM,GAAG,IAAA,sCAAuB,EAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEhD,sBAAa,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QAE9C,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAE3B,CAAC,CAAC;SACD,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAExB,mBAAmB;QAEnB,MAAM,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AC;IAExB,IAAI,QAAQ,CAAC,YAAY,EACzB;QACC,OAAO,IAAA,2BAAa,EAAC,GAAG,EAAE;YACzB,OAAO,CAAC,GAAG,IAAI;gBAEd,OAAO,QAAQ,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;YAC9B,CAAC;SACD,CAAC,CAAA;KACF;IAED,OAAO,IAAA,oCAAsB,EAAC;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';\nimport { fixPkgDepsVersionsCore, ICache, ICacheInput } from '@yarn-tool/fix-ws-versions';\nimport { packageJsonDependenciesFields } from '@ts-type/package-dts/lib/package-json/types';\nimport { normalizeDepsValue } from '@yarn-tool/normalize-deps-value';\nimport { getRootCopyStaticFilesAuto } from '@yarn-tool/static-file/lib/root/getRootCopyStaticFiles';\nimport { copyStaticFiles } from '@yarn-tool/static-file';\nimport { defaultPkgScripts } from '@yarn-tool/pkg-entry-util/lib/preset/pkg-scripts';\nimport { pathIsSame } from 'path-is-same';\nimport { isDummyEchoMaybeOrEmpty } from '@yarn-tool/pkg-entry-util/lib/util/scripts/dummy';\nimport { EnumScriptsEntry } from '@yarn-tool/pkg-entry-util/lib/field/scripts';\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\tlet cache: ICacheInput<IEntry> = {} as any;\n\n\treturn Bluebird.resolve(list)\n\t\t.tap((listable) =>\n\t\t{\n\t\t\tlogger = createProgressEstimator(rootData.root);\n\n\t\t\tconsoleLogger.info(`auto check/fix packages`);\n\n\t\t\tcache.listable = listable;\n\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\tconst file_map = getRootCopyStaticFilesAuto({\n\t\t\t\t\t...rootData,\n\t\t\t\t\tisRoot: false,\n\t\t\t\t});\n\n\t\t\t\tcopyStaticFiles({\n\t\t\t\t\tcwd: row.location,\n\t\t\t\t\tfile_map,\n\t\t\t\t});\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\tfixPkgDepsVersionsCore(pkg.data, cache);\n\n\t\t\t\tpackageJsonDependenciesFields\n\t\t\t\t\t.forEach(field => {\n\n\t\t\t\t\t\tObject.keys(pkg.data[field] ?? {})\n\t\t\t\t\t\t\t.forEach(name => {\n\t\t\t\t\t\t\t\tconst _value = normalizeDepsValue(pkg.data[field][name]);\n\t\t\t\t\t\t\t\tpkg.data[field][name] = _value;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t;\n\n\t\t\t\t\t})\n\t\t\t\t;\n\n\t\t\t\tpkg.data.scripts = {\n\t\t\t\t\t...defaultPkgScripts(),\n\t\t\t\t\t...(pkg.data.scripts ?? {}),\n\t\t\t\t};\n\n\t\t\t\tif (pathIsSame(rootData.root, row.location))\n\t\t\t\t{\n\t\t\t\t\tif (pathIsSame(rootData.ws, row.location))\n\t\t\t\t\t{\n\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (!pkg.data.scripts['_preversion']?.length && isDummyEchoMaybeOrEmpty(pkg.data.scripts.preversion))\n\t\t\t\t\t{\n\t\t\t\t\t\tpkg.data.scripts.preversion = EnumScriptsEntry.preversion;\n\t\t\t\t\t}\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);\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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yarn-tool/fix-all",
3
- "version": "2.0.12",
3
+ "version": "2.0.15",
4
4
  "description": "auto check/fix workspaces/package",
5
5
  "keywords": [
6
6
  "yarn",
@@ -33,7 +33,9 @@
33
33
  "lint": "ynpx --quiet eslint -- **/*.ts",
34
34
  "test": "jest --passWithNoTests",
35
35
  "test:jest": "jest --passWithNoTests",
36
+ "test:jest:snapshot": "yarn run test:jest -- -u",
36
37
  "test:mocha": "ynpx --quiet -p ts-node -p mocha mocha -- --require ts-node/register \"!(node_modules)/**/*.{test,spec}.{ts,tsx}\"",
38
+ "test:snapshot": "yarn run test -- -u",
37
39
  "test:tsdx": "ynpx @bluelovers/tsdx test --passWithNoTests",
38
40
  "build:dts": "ynpx dts-bundle-generator -o ./dist/index.d.ts ./src/index.ts --no-banner & echo build:dts",
39
41
  "build:dts:copy": "copy .\\src\\index.d.ts .\\dist\\index.d.ts & echo build:dts",
@@ -54,29 +56,29 @@
54
56
  "tsc:showConfig": "ynpx get-current-tsconfig -p"
55
57
  },
56
58
  "dependencies": {
57
- "@yarn-tool/find-root": "^2.0.4",
58
- "@yarn-tool/fix-ws-versions": "^2.0.4",
59
- "@yarn-tool/normalize-deps-value": "^1.0.1",
60
- "@yarn-tool/pkg-git-info": "^1.0.33",
61
- "@yarn-tool/pkg-hosted-info": "^2.0.5",
62
- "@yarn-tool/static-file": "^2.0.4",
63
- "@yarn-tool/ws-scope": "^2.0.4",
59
+ "@yarn-tool/find-root": "^2.0.5",
60
+ "@yarn-tool/fix-ws-versions": "^2.0.5",
61
+ "@yarn-tool/normalize-deps-value": "^1.0.3",
62
+ "@yarn-tool/pkg-git-info": "^1.0.34",
63
+ "@yarn-tool/pkg-hosted-info": "^2.0.6",
64
+ "@yarn-tool/static-file": "^2.0.6",
65
+ "@yarn-tool/ws-scope": "^2.0.5",
64
66
  "bluebird": "^3.7.2",
65
- "cache-path": "^3.0.4",
66
- "debug-color2": "^1.3.1",
67
+ "cache-path": "^3.0.5",
68
+ "debug-color2": "^1.3.2",
67
69
  "fs-extra": "^10.1.0",
68
70
  "lazy-aggregate-error": "^1.0.12",
69
- "npm-package-json-loader": "^2.0.10",
71
+ "npm-package-json-loader": "^2.0.12",
70
72
  "progress-estimator": "^0.3.0",
71
- "sort-package-json3": "^2.0.3",
73
+ "sort-package-json3": "^2.0.5",
72
74
  "ts-type": "^2.1.10",
73
75
  "tslib": "^2",
74
76
  "upath2": "^3.1.15",
75
- "ws-pkg-list": "^2.0.4"
77
+ "ws-pkg-list": "^2.0.5"
76
78
  },
77
79
  "packageManager": "yarn@1.22.19",
78
80
  "publishConfig": {
79
81
  "access": "public"
80
82
  },
81
- "gitHead": "04b0e35bd37a6cbe152fd6564f0ec2439625270a"
83
+ "gitHead": "150365d3846067505842c6503564abe98ebe508d"
82
84
  }