@yarn-tool/fix-all 2.0.24 → 2.0.26

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,30 @@
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.26](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/fix-all@2.0.25...@yarn-tool/fix-all@2.0.26) (2022-09-30)
7
+
8
+ **Note:** Version bump only for package @yarn-tool/fix-all
9
+
10
+
11
+
12
+
13
+
14
+ ## [2.0.25](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/fix-all@2.0.24...@yarn-tool/fix-all@2.0.25) (2022-09-29)
15
+
16
+
17
+
18
+ ### 🐛 Bug Fixes
19
+
20
+ * _resetStaticFiles ([3ac7dda](https://github.com/bluelovers/ws-yarn-workspaces/commit/3ac7ddadae5b4f34a1d5bec2d6756c4696fab744))
21
+
22
+
23
+ ### ✨ Features
24
+
25
+ * setupToYargs ([e3b1077](https://github.com/bluelovers/ws-yarn-workspaces/commit/e3b1077f83ca11c3f0293c443d1d0846da8e7e72))
26
+ * _resetStaticFiles ([34e314f](https://github.com/bluelovers/ws-yarn-workspaces/commit/34e314fda7dd32b01d40e769746e63fe010afdea))
27
+
28
+
29
+
6
30
  ## [2.0.24](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/fix-all@2.0.23...@yarn-tool/fix-all@2.0.24) (2022-09-28)
7
31
 
8
32
 
package/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import Bluebird from 'bluebird';
2
2
  export interface INpmAutoFixAll {
3
3
  overwriteHostedGitInfo?: boolean;
4
4
  branch?: string;
5
+ resetStaticFiles?: boolean;
5
6
  }
6
7
  export declare function npmAutoFixAll(cwd: string, options?: INpmAutoFixAll): Bluebird<void>;
7
8
  export default npmAutoFixAll;
package/index.js CHANGED
@@ -12,8 +12,9 @@ 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
14
  const lerna_1 = require("./lib/ws/lerna");
15
+ const reset_1 = require("./lib/file/reset");
15
16
  function npmAutoFixAll(cwd, options) {
16
- return bluebird_1.default.resolve().then(() => {
17
+ return bluebird_1.default.resolve().then(async () => {
17
18
  cwd !== null && cwd !== void 0 ? cwd : (cwd = process.cwd());
18
19
  logger_1.consoleLogger.info(`cwd: ${cwd}`);
19
20
  let rootData = (0, find_root_1.findRootLazy)({
@@ -29,8 +30,13 @@ function npmAutoFixAll(cwd, options) {
29
30
  }
30
31
  console.log(`root:`, rootData.root);
31
32
  console.log(`hasWorkspace:`, rootData.hasWorkspace);
32
- let { branch, overwriteHostedGitInfo } = options !== null && options !== void 0 ? options : {};
33
+ let { branch, overwriteHostedGitInfo, resetStaticFiles } = options !== null && options !== void 0 ? options : {};
33
34
  cwd = rootData.cwd;
35
+ if (resetStaticFiles) {
36
+ (0, reset_1._resetStaticFiles)(rootData.root, {
37
+ rootData,
38
+ });
39
+ }
34
40
  if (rootData.hasWorkspace) {
35
41
  const file_map = (0, wsCopyStaticFiles_1.getWsCopyStaticFiles)();
36
42
  (0, static_file_1.copyStaticFiles)({
@@ -80,6 +86,7 @@ function npmAutoFixAll(cwd, options) {
80
86
  overwriteHostedGitInfo,
81
87
  branch,
82
88
  hostedGitInfo,
89
+ resetStaticFiles,
83
90
  });
84
91
  }).then(() => void 0);
85
92
  }
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,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} 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"]}
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;AAC/C,4CAAqD;AASrD,SAAgB,aAAa,CAAC,GAAW,EAAE,OAAwB;IAElE,OAAO,kBAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;QAEzC,GAAG,aAAH,GAAG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} 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';\nimport { _resetStaticFiles } from './lib/file/reset';\n\nexport interface INpmAutoFixAll\n{\n\toverwriteHostedGitInfo?: boolean;\n\tbranch?: string;\n\tresetStaticFiles?: boolean;\n}\n\nexport function npmAutoFixAll(cwd: string, options?: INpmAutoFixAll)\n{\n\treturn Bluebird.resolve().then(async () =>\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 {\n\t\t\tbranch,\n\t\t\toverwriteHostedGitInfo,\n\t\t\tresetStaticFiles\n\t\t} = options ?? {};\n\n\t\tcwd = rootData.cwd;\n\n\t\tif (resetStaticFiles)\n\t\t{\n\t\t\t_resetStaticFiles(rootData.root, {\n\t\t\t\trootData,\n\t\t\t});\n\t\t}\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\tresetStaticFiles,\n\t\t})\n\t}).then(() => void 0 as void)\n}\n\nexport default npmAutoFixAll\n"]}
@@ -0,0 +1,4 @@
1
+ import { IFindRootReturnType } from '@yarn-tool/find-root';
2
+ export declare function _resetStaticFiles(cwd: string, options: {
3
+ rootData: IFindRootReturnType;
4
+ }): void;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._resetStaticFiles = void 0;
4
+ const upath2_1 = require("upath2");
5
+ const fs_remove_extra_1 = require("fs-remove-extra");
6
+ function _resetStaticFiles(cwd, options) {
7
+ for (const file of [
8
+ '.gitignore',
9
+ '.npmignore',
10
+ 'jest.config.js',
11
+ 'jest-preset.js',
12
+ '.nowignore',
13
+ '.editorconfig.tpl',
14
+ 'jest.config.js.tpl',
15
+ '.yarnrc.yml.tpl',
16
+ 'tsc-multi.json.tpl',
17
+ 'tsconfig.esm.json.tpl',
18
+ 'tsconfig.json.tpl',
19
+ 'tsconfig.tsdx.json.tpl',
20
+ 'tsdx.config.js.tpl',
21
+ '.nycrc.tpl',
22
+ '.npmrc.tpl',
23
+ '.mocharc.yml.tpl',
24
+ '.nowignore',
25
+ '.browserslistrc',
26
+ '.browserslistrc.tpl',
27
+ ]) {
28
+ (0, fs_remove_extra_1.fsRemoveFileSync)((0, upath2_1.resolve)(cwd, file));
29
+ }
30
+ }
31
+ exports._resetStaticFiles = _resetStaticFiles;
32
+ //# sourceMappingURL=reset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reset.js","sourceRoot":"","sources":["reset.ts"],"names":[],"mappings":";;;AACA,mCAAiC;AACjC,qDAAmD;AAEnD,SAAgB,iBAAiB,CAAC,GAAW,EAAE,OAE9C;IAEA,KAAK,MAAM,IAAI,IAAI;QAClB,YAAY;QACZ,YAAY;QACZ,gBAAgB;QAChB,gBAAgB;QAChB,YAAY;QACZ,mBAAmB;QACnB,oBAAoB;QACpB,iBAAiB;QACjB,oBAAoB;QACpB,uBAAuB;QACvB,mBAAmB;QACnB,wBAAwB;QACxB,oBAAoB;QACpB,YAAY;QACZ,YAAY;QACZ,kBAAkB;QAClB,YAAY;QACZ,iBAAiB;QACjB,qBAAqB;KACZ,EACV;QACC,IAAA,kCAAgB,EAAC,IAAA,gBAAO,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAA;KACpC;AACF,CAAC;AA5BD,8CA4BC","sourcesContent":["import { IFindRootReturnType } from '@yarn-tool/find-root';\nimport { resolve } from 'upath2';\nimport { fsRemoveFileSync } from 'fs-remove-extra';\n\nexport function _resetStaticFiles(cwd: string, options: {\n\trootData: IFindRootReturnType\n})\n{\n\tfor (const file of [\n\t\t'.gitignore',\n\t\t'.npmignore',\n\t\t'jest.config.js',\n\t\t'jest-preset.js',\n\t\t'.nowignore',\n\t\t'.editorconfig.tpl',\n\t\t'jest.config.js.tpl',\n\t\t'.yarnrc.yml.tpl',\n\t\t'tsc-multi.json.tpl',\n\t\t'tsconfig.esm.json.tpl',\n\t\t'tsconfig.json.tpl',\n\t\t'tsconfig.tsdx.json.tpl',\n\t\t'tsdx.config.js.tpl',\n\t\t'.nycrc.tpl',\n\t\t'.npmrc.tpl',\n\t\t'.mocharc.yml.tpl',\n\t\t'.nowignore',\n\t\t'.browserslistrc',\n\t\t'.browserslistrc.tpl',\n\t] as const)\n\t{\n\t\tfsRemoveFileSync(resolve(cwd, file))\n\t}\n}\n"]}
@@ -3,6 +3,7 @@ import { IFindRootReturnType } from '@yarn-tool/find-root';
3
3
  import Bluebird from 'bluebird';
4
4
  import { IFillPkgHostedInfoOptions } from '@yarn-tool/pkg-hosted-info';
5
5
  import { ITSRequiredPick } from 'ts-type/lib/type/record';
6
+ import { INpmAutoFixAll } from '../../index';
6
7
  export declare function _handler(cwd: string, ...argv: Parameters<IOptionsPkgListable["handler"]>): {
7
8
  pkg: import("@ts-type/package-dts").IPackageJson<any>;
8
9
  manifestLocation: string;
@@ -13,7 +14,9 @@ export declare function _handler(cwd: string, ...argv: Parameters<IOptionsPkgLis
13
14
  prefix: string;
14
15
  };
15
16
  export type IEntry = ReturnType<typeof _handler>;
16
- export declare function _runEachPackagesAsync(list: IEntry[], options: ITSRequiredPick<IFillPkgHostedInfoOptions, 'overwriteHostedGitInfo' | 'branch' | 'rootData' | 'hostedGitInfo'>): Bluebird<void[]>;
17
+ export interface IOptionsRunEachPackages extends ITSRequiredPick<IFillPkgHostedInfoOptions & INpmAutoFixAll, 'overwriteHostedGitInfo' | 'branch' | 'rootData' | 'hostedGitInfo' | 'resetStaticFiles'> {
18
+ }
19
+ export declare function _runEachPackagesAsync(list: IEntry[], options: IOptionsRunEachPackages): Bluebird<void[]>;
17
20
  export declare function _initPkgListableByRootData(rootData: Pick<IFindRootReturnType, 'root' | 'hasWorkspace'>): {
18
21
  pkg: import("@ts-type/package-dts").IPackageJson<any>;
19
22
  manifestLocation: string;
package/lib/pkg/index.js CHANGED
@@ -22,6 +22,7 @@ const pkg_scripts_1 = require("@yarn-tool/pkg-entry-util/lib/preset/scripts/pkg-
22
22
  const dummy_1 = require("@yarn-tool/pkg-entry-util/lib/util/scripts/dummy");
23
23
  const is_tsdx_1 = require("@yarn-tool/setup-module-env/lib/preset/tsdx/is-tsdx");
24
24
  const fix_1 = require("@yarn-tool/setup-module-env/lib/preset/tsdx/fix");
25
+ const reset_1 = require("../file/reset");
25
26
  function _handler(cwd, ...argv) {
26
27
  return {
27
28
  ...(0, ws_pkg_list_1.normalizeListableRowExtra)(argv[0], cwd),
@@ -30,7 +31,7 @@ function _handler(cwd, ...argv) {
30
31
  }
31
32
  exports._handler = _handler;
32
33
  function _runEachPackagesAsync(list, options) {
33
- const { rootData, overwriteHostedGitInfo, hostedGitInfo, branch, } = options;
34
+ const { rootData, overwriteHostedGitInfo, hostedGitInfo, branch, resetStaticFiles, } = options;
34
35
  let logger;
35
36
  let cache = {};
36
37
  return bluebird_1.default.resolve(list)
@@ -49,6 +50,11 @@ function _runEachPackagesAsync(list, options) {
49
50
  });
50
51
  const { isRoot, isWorkspace } = _rootDataFake;
51
52
  const pkg = new npm_package_json_loader_1.PackageJsonLoader(row.manifestLocation);
53
+ if (resetStaticFiles) {
54
+ (0, reset_1._resetStaticFiles)(_rootDataFake.pkg, {
55
+ rootData: _rootDataFake,
56
+ });
57
+ }
52
58
  const file_map = (0, getRootCopyStaticFiles_1.getRootCopyStaticFilesAuto)(_rootDataFake);
53
59
  (0, static_file_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aACD,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;AAvID,sDAuIC;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, newFakeRootData } 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/scripts/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';\nimport { isTsdxPackage } from '@yarn-tool/setup-module-env/lib/preset/tsdx/is-tsdx';\nimport { fixTsdxPackage } from '@yarn-tool/setup-module-env/lib/preset/tsdx/fix';\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\t\t\t\tconst _rootDataFake = newFakeRootData(rootData, {\n\t\t\t\t\tpkg: row.location,\n\t\t\t\t});\n\n\t\t\t\tconst { isRoot, isWorkspace } = _rootDataFake;\n\n\t\t\t\tconst pkg = new PackageJsonLoader(row.manifestLocation);\n\n\t\t\t\tconst file_map = getRootCopyStaticFilesAuto(_rootDataFake);\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\t\tcwd: row.location,\n\t\t\t\t\t});\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\tif (isTsdxPackage(pkg.data))\n\t\t\t\t{\n\t\t\t\t\tfixTsdxPackage(pkg.data, {\n\t\t\t\t\t\trootData: _rootDataFake,\n\t\t\t\t\t});\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 (isRoot)\n\t\t\t\t{\n\t\t\t\t\tif (isWorkspace)\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 => {\n\t\t\t\te.row = row;\n\t\t\t\terr.push(e);\n\t\t\t}), row.name)\n\n\t\t\treturn promiseLogger\n\t\t\t\t.catch(e => {\n\t\t\t\t\te.row = row;\n\t\t\t\t\terr.push(e);\n\t\t\t\t})\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;AACpH,oDAA4E;AAC5E,qEAA4D;AAC5D,8DAA6D;AAC7D,+DAA2D;AA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AEV,IAAI,GAAG,CAAC,MAAM,EACd;gBACC,sBAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aACnB;QACF,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CACD;AACH,CAAC;AA/ID,sDA+IC;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, newFakeRootData } 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/scripts/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';\nimport { isTsdxPackage } from '@yarn-tool/setup-module-env/lib/preset/tsdx/is-tsdx';\nimport { fixTsdxPackage } from '@yarn-tool/setup-module-env/lib/preset/tsdx/fix';\nimport { _resetStaticFiles } from '../file/reset';\nimport { INpmAutoFixAll } from '../../index';\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 interface IOptionsRunEachPackages extends ITSRequiredPick<IFillPkgHostedInfoOptions & INpmAutoFixAll, 'overwriteHostedGitInfo' | 'branch' | 'rootData' | 'hostedGitInfo' | 'resetStaticFiles'>\n{\n\n}\n\nexport function _runEachPackagesAsync(list: IEntry[],\n\toptions: IOptionsRunEachPackages,\n)\n{\n\tconst {\n\t\trootData,\n\t\toverwriteHostedGitInfo,\n\t\thostedGitInfo,\n\t\tbranch,\n\t\tresetStaticFiles,\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\t\t\t\tconst _rootDataFake = newFakeRootData(rootData, {\n\t\t\t\t\tpkg: row.location,\n\t\t\t\t});\n\n\t\t\t\tconst { isRoot, isWorkspace } = _rootDataFake;\n\n\t\t\t\tconst pkg = new PackageJsonLoader(row.manifestLocation);\n\n\t\t\t\tif (resetStaticFiles)\n\t\t\t\t{\n\t\t\t\t\t_resetStaticFiles(_rootDataFake.pkg, {\n\t\t\t\t\t\trootData: _rootDataFake,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst file_map = getRootCopyStaticFilesAuto(_rootDataFake);\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\t\tcwd: row.location,\n\t\t\t\t\t});\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\tif (isTsdxPackage(pkg.data))\n\t\t\t\t{\n\t\t\t\t\tfixTsdxPackage(pkg.data, {\n\t\t\t\t\t\trootData: _rootDataFake,\n\t\t\t\t\t});\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 (isRoot)\n\t\t\t\t{\n\t\t\t\t\tif (isWorkspace)\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 => {\n\t\t\t\te.row = row;\n\t\t\t\terr.push(e);\n\t\t\t}), row.name)\n\n\t\t\treturn promiseLogger\n\t\t\t\t.catch(e => {\n\t\t\t\t\te.row = row;\n\t\t\t\t\terr.push(e);\n\t\t\t\t})\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"]}
@@ -0,0 +1,9 @@
1
+ import { Argv } from 'yargs';
2
+ import { IYargsSync } from '@yarn-tool/types';
3
+ export declare function setupToYargs<T>(yargs: Argv<T>): IYargsSync<Argv<T & {
4
+ overwriteHostedGitInfo: boolean;
5
+ } & {
6
+ branch: string;
7
+ } & {
8
+ resetStaticFiles: boolean;
9
+ }>>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setupToYargs = void 0;
4
+ function setupToYargs(yargs) {
5
+ const _return = yargs
6
+ .option('overwriteHostedGitInfo', {
7
+ boolean: true,
8
+ alias: ['O', 'overwrite'],
9
+ })
10
+ .option('branch', {
11
+ string: true,
12
+ })
13
+ .option('resetStaticFiles', {
14
+ boolean: true,
15
+ alias: ['S'],
16
+ });
17
+ return _return;
18
+ }
19
+ exports.setupToYargs = setupToYargs;
20
+ //# sourceMappingURL=yargs-setting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yargs-setting.js","sourceRoot":"","sources":["yargs-setting.ts"],"names":[],"mappings":";;;AAGA,SAAgB,YAAY,CAAI,KAAc;IAE7C,MAAM,OAAO,GAAG,KAAK;SACnB,MAAM,CAAC,wBAAwB,EAAE;QACjC,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC;KACzB,CAAC;SACD,MAAM,CAAC,QAAQ,EAAE;QACjB,MAAM,EAAE,IAAI;KACZ,CAAC;SACD,MAAM,CAAC,kBAAkB,EAAE;QAC3B,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,CAAC,GAAG,CAAC;KACZ,CAAC,CACF;IAED,OAAO,OAA4C,CAAA;AACpD,CAAC;AAjBD,oCAiBC","sourcesContent":["import { Argv } from 'yargs';\nimport { IYargsSync, IYargsUnPackArgv } from '@yarn-tool/types';\n\nexport function setupToYargs<T>(yargs: Argv<T>)\n{\n\tconst _return = yargs\n\t\t.option('overwriteHostedGitInfo', {\n\t\t\tboolean: true,\n\t\t\talias: ['O', 'overwrite'],\n\t\t})\n\t\t.option('branch', {\n\t\t\tstring: true,\n\t\t})\n\t\t.option('resetStaticFiles', {\n\t\t\tboolean: true,\n\t\t\talias: ['S'],\n\t\t})\n\t;\n\n\treturn _return as any as IYargsSync<typeof _return>\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yarn-tool/fix-all",
3
- "version": "2.0.24",
3
+ "version": "2.0.26",
4
4
  "description": "auto check/fix workspaces/package",
5
5
  "keywords": [
6
6
  "yarn",
@@ -37,6 +37,7 @@
37
37
  "test:jest:snapshot": "yarn run test:jest -- -u",
38
38
  "test:mocha": "ynpx --quiet -p ts-node -p mocha mocha -- --require ts-node/register \"!(node_modules)/**/*.{test,spec}.{ts,tsx}\"",
39
39
  "test:snapshot": "yarn run test -- -u",
40
+ "test:tsd": "ynpx tsd",
40
41
  "test:tsdx": "ynpx @bluelovers/tsdx test --passWithNoTests",
41
42
  "build:dts": "ynpx dts-bundle-generator -o ./dist/index.d.ts ./src/index.ts --no-banner & echo build:dts",
42
43
  "build:dts:copy": "copy .\\src\\index.d.ts .\\dist\\index.d.ts & echo build:dts",
@@ -58,32 +59,33 @@
58
59
  },
59
60
  "dependencies": {
60
61
  "@ts-type/package-dts": "^2.0.5",
61
- "@yarn-tool/find-root": "^2.0.9",
62
- "@yarn-tool/fix-ws-versions": "^2.0.11",
63
- "@yarn-tool/normalize-deps-value": "^1.0.6",
64
- "@yarn-tool/pkg-git-info": "^1.0.37",
65
- "@yarn-tool/pkg-hosted-info": "^2.0.11",
66
- "@yarn-tool/static-file": "^2.0.11",
67
- "@yarn-tool/write-package-json": "^1.0.8",
68
- "@yarn-tool/ws-scope": "^2.0.9",
62
+ "@yarn-tool/find-root": "^2.0.10",
63
+ "@yarn-tool/fix-ws-versions": "^2.0.12",
64
+ "@yarn-tool/normalize-deps-value": "^1.0.7",
65
+ "@yarn-tool/pkg-git-info": "^1.0.38",
66
+ "@yarn-tool/pkg-hosted-info": "^2.0.12",
67
+ "@yarn-tool/static-file": "^2.0.12",
68
+ "@yarn-tool/write-package-json": "^1.0.9",
69
+ "@yarn-tool/ws-scope": "^2.0.10",
69
70
  "array-hyper-unique": "^2.1.2",
70
71
  "bluebird": "^3.7.2",
71
- "cache-path": "^3.0.9",
72
+ "cache-path": "^3.0.10",
72
73
  "debug-color2": "^1.3.2",
73
74
  "fs-extra": "^10.1.0",
75
+ "fs-remove-extra": "^1.0.2",
74
76
  "lazy-aggregate-error": "^1.0.18",
75
77
  "lodash": "^4.17.21",
76
- "npm-package-json-loader": "^2.0.18",
78
+ "npm-package-json-loader": "^2.0.20",
77
79
  "progress-estimator": "^0.3.0",
78
- "sort-package-json3": "^2.0.8",
80
+ "sort-package-json3": "^2.0.10",
79
81
  "ts-type": "^2.1.10",
80
82
  "tslib": ">=2",
81
- "upath2": "^3.1.16",
82
- "ws-pkg-list": "^2.0.9"
83
+ "upath2": "^3.1.18",
84
+ "ws-pkg-list": "^2.0.10"
83
85
  },
84
86
  "packageManager": "yarn@1.22.19",
85
87
  "publishConfig": {
86
88
  "access": "public"
87
89
  },
88
- "gitHead": "e53c9a786e3d4fcaccd232a4efc7a4f8ca046c8b"
90
+ "gitHead": "bd0713d11a5ada119d8b6b4ab3a3f6a4e08ba4bf"
89
91
  }