@modern-js/utils 2.60.0 → 2.60.1

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.
@@ -18,12 +18,14 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var commands_exports = {};
20
20
  __export(commands_exports, {
21
+ deprecatedCommands: () => deprecatedCommands,
21
22
  getArgv: () => getArgv,
22
23
  getCommand: () => getCommand,
23
24
  getFullArgv: () => getFullArgv,
24
25
  isDevCommand: () => isDevCommand
25
26
  });
26
27
  module.exports = __toCommonJS(commands_exports);
28
+ var import_logger = require("./logger");
27
29
  const getFullArgv = () => {
28
30
  var _process_env_MODERN_ARGV;
29
31
  return ((_process_env_MODERN_ARGV = process.env.MODERN_ARGV) === null || _process_env_MODERN_ARGV === void 0 ? void 0 : _process_env_MODERN_ARGV.split(" ")) || process.argv;
@@ -40,8 +42,24 @@ const isDevCommand = () => {
40
42
  const command = getCommand();
41
43
  return command === "dev" || command === "start";
42
44
  };
45
+ const deprecatedCommands = (program) => {
46
+ var _program_commandsMap, _program_commandsMap1;
47
+ const lintCommand = (_program_commandsMap = program.commandsMap) === null || _program_commandsMap === void 0 ? void 0 : _program_commandsMap.get("lint");
48
+ if (!lintCommand) {
49
+ program.command("lint [...files]").allowUnknownOption().description("Deprecated").action(() => {
50
+ import_logger.logger.warn('The "modern lint" command is deprecated, please use "eslint" or "biome" instead.');
51
+ });
52
+ }
53
+ const preCommitCommand = (_program_commandsMap1 = program.commandsMap) === null || _program_commandsMap1 === void 0 ? void 0 : _program_commandsMap1.get("pre-commit");
54
+ if (!preCommitCommand) {
55
+ program.command("pre-commit").description("Deprecated").action(() => {
56
+ import_logger.logger.warn('The "modern pre-commit" command is deprecated, please use "lint-staged" instead.');
57
+ });
58
+ }
59
+ };
43
60
  // Annotate the CommonJS export names for ESM import in node:
44
61
  0 && (module.exports = {
62
+ deprecatedCommands,
45
63
  getArgv,
46
64
  getCommand,
47
65
  getFullArgv,
@@ -1,3 +1,4 @@
1
+ import { logger } from "./logger";
1
2
  var getFullArgv = function() {
2
3
  var _process_env_MODERN_ARGV;
3
4
  return ((_process_env_MODERN_ARGV = process.env.MODERN_ARGV) === null || _process_env_MODERN_ARGV === void 0 ? void 0 : _process_env_MODERN_ARGV.split(" ")) || process.argv;
@@ -14,7 +15,23 @@ var isDevCommand = function() {
14
15
  var command = getCommand();
15
16
  return command === "dev" || command === "start";
16
17
  };
18
+ var deprecatedCommands = function(program) {
19
+ var _program_commandsMap, _program_commandsMap1;
20
+ var lintCommand = (_program_commandsMap = program.commandsMap) === null || _program_commandsMap === void 0 ? void 0 : _program_commandsMap.get("lint");
21
+ if (!lintCommand) {
22
+ program.command("lint [...files]").allowUnknownOption().description("Deprecated").action(function() {
23
+ logger.warn('The "modern lint" command is deprecated, please use "eslint" or "biome" instead.');
24
+ });
25
+ }
26
+ var preCommitCommand = (_program_commandsMap1 = program.commandsMap) === null || _program_commandsMap1 === void 0 ? void 0 : _program_commandsMap1.get("pre-commit");
27
+ if (!preCommitCommand) {
28
+ program.command("pre-commit").description("Deprecated").action(function() {
29
+ logger.warn('The "modern pre-commit" command is deprecated, please use "lint-staged" instead.');
30
+ });
31
+ }
32
+ };
17
33
  export {
34
+ deprecatedCommands,
18
35
  getArgv,
19
36
  getCommand,
20
37
  getFullArgv,
@@ -1,3 +1,4 @@
1
+ import { logger } from "./logger";
1
2
  const getFullArgv = () => {
2
3
  var _process_env_MODERN_ARGV;
3
4
  return ((_process_env_MODERN_ARGV = process.env.MODERN_ARGV) === null || _process_env_MODERN_ARGV === void 0 ? void 0 : _process_env_MODERN_ARGV.split(" ")) || process.argv;
@@ -14,7 +15,23 @@ const isDevCommand = () => {
14
15
  const command = getCommand();
15
16
  return command === "dev" || command === "start";
16
17
  };
18
+ const deprecatedCommands = (program) => {
19
+ var _program_commandsMap, _program_commandsMap1;
20
+ const lintCommand = (_program_commandsMap = program.commandsMap) === null || _program_commandsMap === void 0 ? void 0 : _program_commandsMap.get("lint");
21
+ if (!lintCommand) {
22
+ program.command("lint [...files]").allowUnknownOption().description("Deprecated").action(() => {
23
+ logger.warn('The "modern lint" command is deprecated, please use "eslint" or "biome" instead.');
24
+ });
25
+ }
26
+ const preCommitCommand = (_program_commandsMap1 = program.commandsMap) === null || _program_commandsMap1 === void 0 ? void 0 : _program_commandsMap1.get("pre-commit");
27
+ if (!preCommitCommand) {
28
+ program.command("pre-commit").description("Deprecated").action(() => {
29
+ logger.warn('The "modern pre-commit" command is deprecated, please use "lint-staged" instead.');
30
+ });
31
+ }
32
+ };
17
33
  export {
34
+ deprecatedCommands,
18
35
  getArgv,
19
36
  getCommand,
20
37
  getFullArgv,
@@ -1,4 +1,8 @@
1
+ import type { Command } from '../../compiled/commander';
1
2
  export declare const getFullArgv: () => string[];
2
3
  export declare const getArgv: () => string[];
3
4
  export declare const getCommand: () => string;
4
5
  export declare const isDevCommand: () => boolean;
6
+ export declare const deprecatedCommands: (program: Command & {
7
+ commandsMap?: Map<string, Command>;
8
+ }) => void;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.60.0",
18
+ "version": "2.60.1",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -162,9 +162,9 @@
162
162
  "jest": "^29",
163
163
  "typescript": "^5",
164
164
  "webpack": "^5.94.0",
165
- "@modern-js/types": "2.60.0",
166
- "@scripts/build": "2.60.0",
167
- "@scripts/jest-config": "2.60.0"
165
+ "@modern-js/types": "2.60.1",
166
+ "@scripts/build": "2.60.1",
167
+ "@scripts/jest-config": "2.60.1"
168
168
  },
169
169
  "sideEffects": false,
170
170
  "scripts": {