@hubspot/cli 7.2.1-experimental.0 → 7.2.2-beta.0

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/lib/commonOpts.js CHANGED
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.addGlobalOptions = addGlobalOptions;
4
7
  exports.addAccountOptions = addAccountOptions;
@@ -7,13 +10,19 @@ exports.addOverwriteOptions = addOverwriteOptions;
7
10
  exports.addCmsPublishModeOptions = addCmsPublishModeOptions;
8
11
  exports.addTestingOptions = addTestingOptions;
9
12
  exports.addUseEnvironmentOptions = addUseEnvironmentOptions;
13
+ exports.addCustomHelpOutput = addCustomHelpOutput;
10
14
  exports.setLogLevel = setLogLevel;
11
15
  exports.getCommandName = getCommandName;
12
16
  exports.getCmsPublishMode = getCmsPublishMode;
17
+ const chalk_1 = __importDefault(require("chalk"));
18
+ const yargs_parser_1 = __importDefault(require("yargs-parser"));
13
19
  const logger_1 = require("@hubspot/local-dev-lib/logger");
14
20
  const files_1 = require("@hubspot/local-dev-lib/constants/files");
15
21
  const config_1 = require("@hubspot/local-dev-lib/config");
16
22
  const lang_1 = require("./lang");
23
+ const errorHandlers_1 = require("./errorHandlers");
24
+ const exitCodes_1 = require("./enums/exitCodes");
25
+ const ui_1 = require("./ui");
17
26
  const i18nKey = 'lib.commonOpts';
18
27
  function addGlobalOptions(yargs) {
19
28
  yargs.version(false);
@@ -70,6 +79,27 @@ function addUseEnvironmentOptions(yargs) {
70
79
  })
71
80
  .conflicts('use-env', 'account');
72
81
  }
82
+ async function addCustomHelpOutput(yargs, command, describe) {
83
+ try {
84
+ const parsedArgv = (0, yargs_parser_1.default)(process.argv.slice(2));
85
+ if (parsedArgv && parsedArgv.help) {
86
+ // Construct the full command, including positional arguments
87
+ const commandBase = `hs ${parsedArgv._.slice(0, -1).join(' ')}`;
88
+ const fullCommand = `${commandBase.trim()} ${command}`;
89
+ // Format the original help output to be more readable
90
+ let commandHelp = await yargs.getHelp();
91
+ ['Options:', 'Examples:', 'Positionals:'].forEach(header => {
92
+ commandHelp = commandHelp.replace(header, chalk_1.default.bold(header));
93
+ });
94
+ logger_1.logger.log(`${(0, ui_1.uiCommandReference)(fullCommand, false)}\n\n${describe}\n\n${commandHelp}`);
95
+ process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
96
+ }
97
+ }
98
+ catch (e) {
99
+ // Ignore error to allow yargs to show the default help output using the command description
100
+ (0, errorHandlers_1.debugError)(e);
101
+ }
102
+ }
73
103
  function setLogLevel(options) {
74
104
  const { debug } = options;
75
105
  if (debug) {
@@ -8,9 +8,11 @@ exports.logError = logError;
8
8
  exports.debugError = debugError;
9
9
  const logger_1 = require("@hubspot/local-dev-lib/logger");
10
10
  const index_1 = require("@hubspot/local-dev-lib/errors/index");
11
+ const config_1 = require("@hubspot/local-dev-lib/config");
11
12
  const suppressError_1 = require("./suppressError");
12
13
  const lang_1 = require("../lang");
13
14
  const util_1 = __importDefault(require("util"));
15
+ const ui_1 = require("../ui");
14
16
  const i18nKey = 'lib.errorHandlers.index';
15
17
  function logError(error, context) {
16
18
  debugError(error, context);
@@ -41,6 +43,21 @@ function logError(error, context) {
41
43
  // Unknown errors
42
44
  logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.unknownErrorOccurred`));
43
45
  }
46
+ if ((0, index_1.isHubSpotHttpError)(error) && error.code === 'ETIMEDOUT') {
47
+ const config = (0, config_1.getConfig)();
48
+ const defaultTimeout = config?.httpTimeout;
49
+ // Timeout was caused by the default timeout
50
+ if (error.timeout && defaultTimeout === error.timeout) {
51
+ logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.configTimeoutErrorOccurred`, {
52
+ timeout: error.timeout,
53
+ configSetCommand: (0, ui_1.uiCommandReference)('hs config set'),
54
+ }));
55
+ }
56
+ // Timeout was caused by a custom timeout set by the CLI or LDL
57
+ else {
58
+ logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.genericTimeoutErrorOccurred`));
59
+ }
60
+ }
44
61
  }
45
62
  function debugError(error, context) {
46
63
  if ((0, index_1.isHubSpotHttpError)(error)) {
package/lib/localDev.d.ts CHANGED
@@ -14,5 +14,5 @@ export declare function createSandboxForLocalDev(accountId: number, accountConfi
14
14
  export declare function createDeveloperTestAccountForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment): Promise<number>;
15
15
  export declare function useExistingDevTestAccount(env: Environment, account: DeveloperTestAccount): Promise<void>;
16
16
  export declare function createNewProjectForLocalDev(projectConfig: ProjectConfig, targetAccountId: number, shouldCreateWithoutConfirmation: boolean, hasPublicApps: boolean): Promise<Project>;
17
- export declare function createInitialBuildForNewProject(projectConfig: ProjectConfig, projectDir: string, targetAccountId: number): Promise<Build>;
17
+ export declare function createInitialBuildForNewProject(projectConfig: ProjectConfig, projectDir: string, targetAccountId: number, sendIr?: boolean): Promise<Build>;
18
18
  export declare function getAccountHomeUrl(accountId: number): string;
package/lib/localDev.js CHANGED
@@ -294,8 +294,8 @@ function projectUploadCallback(accountId, projectConfig, tempFile, buildId) {
294
294
  }
295
295
  // Create an initial build if the project was newly created in the account
296
296
  // Return the newly deployed build
297
- async function createInitialBuildForNewProject(projectConfig, projectDir, targetAccountId) {
298
- const { result: initialUploadResult, uploadError } = await (0, upload_1.handleProjectUpload)(targetAccountId, projectConfig, projectDir, projectUploadCallback, (0, lang_1.i18n)(`${i18nKey}.createInitialBuildForNewProject.initialUploadMessage`));
297
+ async function createInitialBuildForNewProject(projectConfig, projectDir, targetAccountId, sendIr) {
298
+ const { result: initialUploadResult, uploadError } = await (0, upload_1.handleProjectUpload)(targetAccountId, projectConfig, projectDir, projectUploadCallback, (0, lang_1.i18n)(`${i18nKey}.createInitialBuildForNewProject.initialUploadMessage`), sendIr);
299
299
  if (uploadError) {
300
300
  if ((0, index_1.isSpecifiedError)(uploadError, {
301
301
  subCategory: constants_1.PROJECT_ERROR_TYPES.PROJECT_LOCKED,
@@ -16,6 +16,7 @@ const lang_1 = require("../lang");
16
16
  const errorHandlers_1 = require("../errorHandlers");
17
17
  const ui_1 = require("../ui");
18
18
  const urls_1 = require("./urls");
19
+ const exitCodes_1 = require("../enums/exitCodes");
19
20
  const i18nKey = 'lib.projectBuildAndDeploy';
20
21
  const SPINNER_STATUS = {
21
22
  SPINNING: 'spinning',
@@ -48,6 +49,15 @@ function getSubtaskType(task) {
48
49
  }
49
50
  return task.deployType;
50
51
  }
52
+ function handleTaskStatusError(statusText) {
53
+ logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.makePollTaskStatusFunc.errorFetchingTaskStatus`, {
54
+ taskType: statusText.TYPE_KEY === constants_1.PROJECT_BUILD_TEXT.TYPE_KEY
55
+ ? 'build'
56
+ : 'deploy',
57
+ openCommand: (0, ui_1.uiCommandReference)('hs project open'),
58
+ }));
59
+ process.exit(exitCodes_1.EXIT_CODES.ERROR);
60
+ }
51
61
  function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrings, linkToHubSpot, }) {
52
62
  return async function (accountId, taskName, taskId, deployedBuildId = null, silenceLogs = false) {
53
63
  const displayId = deployedBuildId || taskId;
@@ -111,7 +121,7 @@ function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrin
111
121
  task.subtasks.forEach((subtask, i) => addTaskSpinner(subtask, 4, i === task.subtasks.length - 1));
112
122
  });
113
123
  }
114
- return new Promise((resolve, reject) => {
124
+ return new Promise(resolve => {
115
125
  const pollInterval = setInterval(async () => {
116
126
  let taskStatus;
117
127
  try {
@@ -124,19 +134,11 @@ function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrin
124
134
  accountId,
125
135
  projectName: taskName,
126
136
  }));
127
- return reject(new Error((0, lang_1.i18n)(`${i18nKey}.makePollTaskStatusFunc.errorFetchingTaskStatus`, {
128
- taskType: statusText.TYPE_KEY === constants_1.PROJECT_BUILD_TEXT.TYPE_KEY
129
- ? 'build'
130
- : 'deploy',
131
- })));
137
+ handleTaskStatusError(statusText);
132
138
  }
133
139
  const subtasks = getSubtasks(taskStatus);
134
140
  if (!taskStatus || !taskStatus.status || !subtasks) {
135
- return reject(new Error((0, lang_1.i18n)(`${i18nKey}.makePollTaskStatusFunc.errorFetchingTaskStatus`, {
136
- taskType: statusText.TYPE_KEY === constants_1.PROJECT_BUILD_TEXT.TYPE_KEY
137
- ? 'build'
138
- : 'deploy',
139
- })));
141
+ handleTaskStatusError(statusText);
140
142
  }
141
143
  const { status } = taskStatus;
142
144
  if (SpinniesManager_1.default.hasActiveSpinners()) {
@@ -1,12 +1,11 @@
1
1
  import { PromptConfig } from '../../types/Prompts';
2
2
  import { AccountType } from '@hubspot/local-dev-lib/types/Accounts';
3
- type AccountNamePromptResponse = {
3
+ export type AccountNamePromptResponse = {
4
4
  name: string;
5
5
  };
6
6
  export declare function getCliAccountNamePromptConfig(defaultName?: string): PromptConfig<AccountNamePromptResponse>;
7
- export declare function cliAccountNamePrompt(defaultName: string): Promise<AccountNamePromptResponse>;
7
+ export declare function cliAccountNamePrompt(defaultName?: string): Promise<AccountNamePromptResponse>;
8
8
  export declare function hubspotAccountNamePrompt({ accountType, currentPortalCount, }: {
9
9
  accountType: AccountType;
10
10
  currentPortalCount?: number;
11
11
  }): Promise<AccountNamePromptResponse>;
12
- export {};
@@ -9,7 +9,20 @@ const path_1 = __importDefault(require("path"));
9
9
  const path_2 = require("@hubspot/local-dev-lib/path");
10
10
  const promptUtils_1 = require("./promptUtils");
11
11
  const lang_1 = require("../lang");
12
+ const constants_1 = require("../constants");
12
13
  const i18nKey = 'lib.prompts.createProjectPrompt';
14
+ function validateProjectDirectory(input) {
15
+ if (!input) {
16
+ return (0, lang_1.i18n)(`${i18nKey}.errors.destRequired`);
17
+ }
18
+ if (fs_1.default.existsSync(path_1.default.resolve((0, path_2.getCwd)(), path_1.default.join(input, constants_1.PROJECT_CONFIG_FILE)))) {
19
+ return (0, lang_1.i18n)(`${i18nKey}.errors.invalidDest`);
20
+ }
21
+ if (!(0, path_2.isValidPath)(input)) {
22
+ return (0, lang_1.i18n)(`${i18nKey}.errors.invalidCharacters`);
23
+ }
24
+ return true;
25
+ }
13
26
  function findTemplateByNameOrLabel(projectTemplates, templateNameOrLabel) {
14
27
  return projectTemplates.find(t => t.name === templateNameOrLabel || t.label === templateNameOrLabel);
15
28
  }
@@ -38,18 +51,7 @@ async function createProjectPrompt(promptOptions, projectTemplates) {
38
51
  const projectName = (0, path_2.sanitizeFileName)(promptOptions.name || answers.name);
39
52
  return path_1.default.resolve((0, path_2.getCwd)(), projectName);
40
53
  },
41
- validate: (input) => {
42
- if (!input) {
43
- return (0, lang_1.i18n)(`${i18nKey}.errors.destRequired`);
44
- }
45
- if (fs_1.default.existsSync(input)) {
46
- return (0, lang_1.i18n)(`${i18nKey}.errors.invalidDest`);
47
- }
48
- if (!(0, path_2.isValidPath)(input)) {
49
- return (0, lang_1.i18n)(`${i18nKey}.errors.invalidCharacters`);
50
- }
51
- return true;
52
- },
54
+ validate: validateProjectDirectory,
53
55
  filter: input => {
54
56
  return (0, path_2.untildify)(input);
55
57
  },
@@ -1,5 +1,6 @@
1
+ import { AccountNamePromptResponse } from './accountNamePrompt';
1
2
  import { PromptConfig } from '../../types/Prompts';
2
- type PersonalAccessKeyPromptResponse = {
3
+ export type PersonalAccessKeyPromptResponse = {
3
4
  personalAccessKey: string;
4
5
  env: string;
5
6
  };
@@ -15,6 +16,7 @@ type ClientSecretPromptResponse = {
15
16
  type ScopesPromptResponse = {
16
17
  scopes: string[];
17
18
  };
19
+ export type OauthPromptResponse = AccountNamePromptResponse & AccountIdPromptResponse & ClientIdPromptResponse & ClientSecretPromptResponse & ScopesPromptResponse;
18
20
  /**
19
21
  * Displays notification to user that we are about to open the browser,
20
22
  * then opens their browser to the personal-access-key shortlink
@@ -23,7 +25,5 @@ export declare function personalAccessKeyPrompt({ env, account, }: {
23
25
  env: string;
24
26
  account?: number;
25
27
  }): Promise<PersonalAccessKeyPromptResponse>;
26
- export declare const OAUTH_FLOW: (PromptConfig<{
27
- name: string;
28
- }> | PromptConfig<AccountIdPromptResponse> | PromptConfig<ClientIdPromptResponse> | PromptConfig<ClientSecretPromptResponse> | PromptConfig<ScopesPromptResponse>)[];
28
+ export declare const OAUTH_FLOW: (PromptConfig<AccountNamePromptResponse> | PromptConfig<AccountIdPromptResponse> | PromptConfig<ClientIdPromptResponse> | PromptConfig<ClientSecretPromptResponse> | PromptConfig<ScopesPromptResponse>)[];
29
29
  export {};
package/lib/ui/index.d.ts CHANGED
@@ -7,8 +7,8 @@ export declare function uiLine(): void;
7
7
  export declare function uiLink(linkText: string, url: string): string;
8
8
  export declare function uiAccountDescription(accountId?: number | null, bold?: boolean): string;
9
9
  export declare function uiInfoSection(title: string, logContent: () => void): void;
10
- export declare function uiCommandReference(command: string): string;
11
- export declare function uiFeatureHighlight(commands: string[], title?: string): void;
10
+ export declare function uiCommandReference(command: string, withQuotes?: boolean): string;
11
+ export declare function uiFeatureHighlight(features: string[], title?: string): void;
12
12
  export declare function uiBetaTag(message: string, log?: boolean): string | undefined;
13
13
  export declare function uiDeprecatedTag(message: string): void;
14
14
  export declare function uiCommandDisabledBanner(command: string, url?: string, message?: string): void;
package/lib/ui/index.js CHANGED
@@ -70,21 +70,21 @@ function uiInfoSection(title, logContent) {
70
70
  logger_1.logger.log('');
71
71
  uiLine();
72
72
  }
73
- function uiCommandReference(command) {
73
+ function uiCommandReference(command, withQuotes = true) {
74
74
  const terminalUISupport = getTerminalUISupport();
75
- const commandReference = `\`${command}\``;
75
+ const commandReference = withQuotes ? `\`${command}\`` : command;
76
76
  return chalk_1.default.bold(terminalUISupport.color
77
77
  ? chalk_1.default.hex(exports.UI_COLORS.MARIGOLD_DARK)(commandReference)
78
78
  : commandReference);
79
79
  }
80
- function uiFeatureHighlight(commands, title) {
80
+ function uiFeatureHighlight(features, title) {
81
81
  const i18nKey = 'lib.ui.featureHighlight';
82
82
  uiInfoSection(title ? title : (0, lang_1.i18n)(`${i18nKey}.defaultTitle`), () => {
83
- commands.forEach((c, i) => {
84
- const commandKey = `${i18nKey}.commandKeys.${c}`;
85
- const message = (0, lang_1.i18n)(`${commandKey}.message`, {
86
- command: uiCommandReference((0, lang_1.i18n)(`${commandKey}.command`)),
87
- link: uiLink((0, lang_1.i18n)(`${commandKey}.linkText`), (0, lang_1.i18n)(`${commandKey}.url`)),
83
+ features.forEach((c, i) => {
84
+ const featureKey = `${i18nKey}.featureKeys.${c}`;
85
+ const message = (0, lang_1.i18n)(`${featureKey}.message`, {
86
+ command: uiCommandReference((0, lang_1.i18n)(`${featureKey}.command`)),
87
+ link: uiLink((0, lang_1.i18n)(`${featureKey}.linkText`), (0, lang_1.i18n)(`${featureKey}.url`)),
88
88
  });
89
89
  if (i !== 0) {
90
90
  logger_1.logger.log('');
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.supportsHyperlinkModule = void 0;
4
- const hasFlag_1 = require("../hasFlag");
4
+ const yargsUtils_1 = require("../yargsUtils");
5
5
  //See https://github.com/jamestalmage/supports-hyperlinks (License: https://github.com/jamestalmage/supports-hyperlinks/blob/master/license)
6
6
  function parseVersion(versionString) {
7
7
  if (/^\d{3,4}$/.test(versionString)) {
@@ -22,7 +22,7 @@ function parseVersion(versionString) {
22
22
  }
23
23
  function supportsHyperlink(stream) {
24
24
  const { env } = process;
25
- if ((0, hasFlag_1.hasFlag)('noHyperlinks')) {
25
+ if ((0, yargsUtils_1.hasFlag)('noHyperlinks')) {
26
26
  return false;
27
27
  }
28
28
  if (stream && !stream.isTTY) {
@@ -7,7 +7,7 @@ exports.supportsColor = void 0;
7
7
  const process_1 = __importDefault(require("process"));
8
8
  const os_1 = __importDefault(require("os"));
9
9
  const tty_1 = __importDefault(require("tty"));
10
- const hasFlag_1 = require("../hasFlag");
10
+ const yargsUtils_1 = require("../yargsUtils");
11
11
  const { env } = process_1.default;
12
12
  function translateLevel(level) {
13
13
  if (level === 0) {
@@ -33,7 +33,7 @@ function _supportsColor(haveStream, { streamIsTTY } = {}) {
33
33
  if (env.TERM === 'dumb') {
34
34
  return min;
35
35
  }
36
- if ((0, hasFlag_1.hasFlag)('noColor')) {
36
+ if ((0, yargsUtils_1.hasFlag)('noColor')) {
37
37
  return 0;
38
38
  }
39
39
  if (process_1.default.platform === 'win32') {
@@ -16,6 +16,6 @@ type Meta = {
16
16
  export declare function trackCommandUsage(command: string, meta?: Meta, accountId?: number): Promise<void>;
17
17
  export declare function trackHelpUsage(command: string): Promise<void>;
18
18
  export declare function trackConvertFieldsUsage(command: string): Promise<void>;
19
- export declare function trackAuthAction(command: string, authType: string, step: string, accountId: number): Promise<void>;
19
+ export declare function trackAuthAction(command: string, authType: string, step: string, accountId?: number): Promise<void>;
20
20
  export declare function trackCommandMetadataUsage(command: string, meta?: Meta, accountId?: number): Promise<void>;
21
21
  export {};
@@ -0,0 +1,9 @@
1
+ import { Argv } from 'yargs';
2
+ export declare function hasFlag(flag: string, argv?: string[]): boolean;
3
+ export declare function makeYargsBuilder<T>(callback: (yargs: Argv) => Argv<T>, command: string, describe: string, options: {
4
+ useGlobalOptions?: boolean;
5
+ useAccountOptions?: boolean;
6
+ useConfigOptions?: boolean;
7
+ useUseEnvironmentOptions?: boolean;
8
+ useTestingOptions?: boolean;
9
+ }): (yargs: Argv) => Promise<Argv<T>>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.hasFlag = hasFlag;
7
+ exports.makeYargsBuilder = makeYargsBuilder;
8
+ const process_1 = __importDefault(require("process"));
9
+ const commonOpts_1 = require("./commonOpts");
10
+ // See https://github.com/sindresorhus/has-flag/blob/main/index.js (License: https://github.com/sindresorhus/has-flag/blob/main/license)
11
+ function hasFlag(flag, argv = process_1.default.argv) {
12
+ const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
13
+ const position = argv.indexOf(prefix + flag);
14
+ const terminatorPosition = argv.indexOf('--');
15
+ return (position !== -1 &&
16
+ (terminatorPosition === -1 || position < terminatorPosition));
17
+ }
18
+ function makeYargsBuilder(callback, command, describe, options) {
19
+ return async function (yargs) {
20
+ if (options.useGlobalOptions) {
21
+ (0, commonOpts_1.addGlobalOptions)(yargs);
22
+ }
23
+ if (options.useAccountOptions) {
24
+ (0, commonOpts_1.addAccountOptions)(yargs);
25
+ }
26
+ if (options.useConfigOptions) {
27
+ (0, commonOpts_1.addConfigOptions)(yargs);
28
+ }
29
+ if (options.useUseEnvironmentOptions) {
30
+ (0, commonOpts_1.addUseEnvironmentOptions)(yargs);
31
+ }
32
+ if (options.useTestingOptions) {
33
+ (0, commonOpts_1.addTestingOptions)(yargs);
34
+ }
35
+ const result = callback(yargs);
36
+ // Must go last to pick up available options
37
+ await (0, commonOpts_1.addCustomHelpOutput)(result, command, describe);
38
+ return result;
39
+ };
40
+ }
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "7.2.1-experimental.0",
3
+ "version": "7.2.2-beta.0",
4
4
  "description": "The official CLI for developing on HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "https://github.com/HubSpot/hubspot-cli",
7
7
  "dependencies": {
8
- "@hubspot/local-dev-lib": "3.3.2",
9
- "@hubspot/project-parsing-lib": "0.1.0",
8
+ "@hubspot/local-dev-lib": "3.4.1",
9
+ "@hubspot/project-parsing-lib": "0.1.4",
10
10
  "@hubspot/serverless-dev-runtime": "7.0.2",
11
11
  "@hubspot/theme-preview-dev-server": "0.0.10",
12
- "@hubspot/ui-extensions-dev-server": "0.8.47",
12
+ "@hubspot/ui-extensions-dev-server": "0.8.50",
13
13
  "archiver": "7.0.1",
14
14
  "chalk": "4.1.2",
15
15
  "chokidar": "3.6.0",
package/lib/hasFlag.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare function hasFlag(flag: string, argv?: string[]): boolean;
package/lib/hasFlag.js DELETED
@@ -1,15 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.hasFlag = hasFlag;
7
- const process_1 = __importDefault(require("process"));
8
- // See https://github.com/sindresorhus/has-flag/blob/main/index.js (License: https://github.com/sindresorhus/has-flag/blob/main/license)
9
- function hasFlag(flag, argv = process_1.default.argv) {
10
- const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
11
- const position = argv.indexOf(prefix + flag);
12
- const terminatorPosition = argv.indexOf('--');
13
- return (position !== -1 &&
14
- (terminatorPosition === -1 || position < terminatorPosition));
15
- }