Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap deps to local dev lib part 3 #955

Merged
merged 13 commits into from
Nov 30, 2023
2 changes: 1 addition & 1 deletion packages/cli/commands/accounts/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const {
} = require('../../lib/commonOpts');
const { getAccountName } = require('../../lib/sandboxes');
const { promptUser } = require('../../lib/prompts/promptUtils');
const { getTableContents } = require('@hubspot/cli-lib/lib/table');
const { getTableContents } = require('@hubspot/local-dev-lib/logging/table');
const SpinniesManager = require('../../lib/SpinniesManager');
const { getConfig, deleteAccount } = require('@hubspot/local-dev-lib/config');
const {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/commands/accounts/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const {
} = require('../../lib/commonOpts');
const { loadAndValidateOptions } = require('../../lib/validation');
const { i18n } = require('../../lib/lang');
const { getTableContents } = require('@hubspot/cli-lib/lib/table');
const { getTableContents } = require('@hubspot/local-dev-lib/logging/table');

const i18nKey = 'cli.commands.accounts.subcommands.info';
exports.describe = i18n(`${i18nKey}.describe`);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/commands/accounts/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { getConfig, getConfigPath } = require('@hubspot/local-dev-lib/config');
const {
getTableContents,
getTableHeader,
} = require('@hubspot/cli-lib/lib/table');
} = require('@hubspot/local-dev-lib/logging/table');

const {
addConfigOptions,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/commands/cms/convertFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const fs = require('fs');
const { createIgnoreFilter } = require('@hubspot/local-dev-lib/ignoreRules');
const { isAllowedExtension, getCwd } = require('@hubspot/cli-lib/path');
const { logger } = require('@hubspot/cli-lib/logger');
const { walk } = require('@hubspot/cli-lib/lib/walk');
const { walk } = require('@hubspot/local-dev-lib/fs');
Copy link
Contributor

@brandenrodgers brandenrodgers Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a small change in the behavior of walk. It used to log a debug log and then return an empty array. Now it throws on errors in the catch block. We may need to update all of the usages of walk to catch the thrown error and default to an empty array so we have parity in the behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh good catch!

const { getThemeJSONPath } = require('@hubspot/cli-lib/lib/files');
const { i18n } = require('../../lib/lang');
const {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/commands/cms/lighthouseScore.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { logger } = require('@hubspot/cli-lib/logger');
const {
getTableContents,
getTableHeader,
} = require('@hubspot/cli-lib/lib/table');
} = require('@hubspot/local-dev-lib/logging/table');
const { loadAndValidateOptions } = require('../../lib/validation');
const { promptUser } = require('../../lib/prompts/promptUtils');
const { i18n } = require('../../lib/lang');
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/commands/customObject/schema/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const { createSchema } = require('@hubspot/cli-lib/api/schema');
const {
createSchema: createSchemaFromHubFile,
} = require('@hubspot/cli-lib/api/fileTransport');
const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
const { i18n } = require('../../../lib/lang');

const i18nKey =
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/commands/customObject/schema/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const { updateSchema } = require('@hubspot/cli-lib/api/schema');
const {
updateSchema: updateSchemaFromHubFile,
} = require('@hubspot/cli-lib/api/fileTransport');
const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
const { i18n } = require('../../../lib/lang');

const i18nKey =
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/commands/functions/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { getFunctionArrays } = require('../../lib/getFunctionArrays');
const {
getTableContents,
getTableHeader,
} = require('@hubspot/cli-lib/lib/table');
} = require('@hubspot/local-dev-lib/logging/table');

const {
addConfigOptions,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/commands/project/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const {

const { buildSandbox } = require('../../lib/sandbox-create');
const { syncSandbox } = require('../../lib/sandbox-sync');
const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
const {
logApiErrorInstance,
ApiErrorContext,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/commands/project/listBuilds.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const {
const {
getTableContents,
getTableHeader,
} = require('@hubspot/cli-lib/lib/table');
} = require('@hubspot/local-dev-lib/logging/table');
const { getCwd } = require('@hubspot/cli-lib/path');
const { uiBetaTag, uiLink } = require('../../lib/ui');
const { loadAndValidateOptions } = require('../../lib/validation');
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/commands/project/logs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { getEnv } = require('@hubspot/local-dev-lib/config');
const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
const { ENVIRONMENTS } = require('@hubspot/cli-lib/lib/constants');
const {
addAccountOptions,
Expand All @@ -17,7 +17,7 @@ const {
const {
getTableContents,
getTableHeader,
} = require('@hubspot/cli-lib/lib/table');
} = require('@hubspot/local-dev-lib/logging/table');
// const {
// getProjectAppFunctionLogs,
// getLatestProjectAppFunctionLog,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/commands/sandbox/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const { promptUser } = require('../../lib/prompts/promptUtils');
const { syncSandbox } = require('../../lib/sandbox-sync');
const { logErrorInstance } = require('../../lib/errorHandlers/standardErrors');
const { isMissingScopeError } = require('../../lib/errorHandlers/apiErrors');
const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');

const i18nKey = 'cli.commands.sandbox.subcommands.create';

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/commands/sandbox/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const {
isSpecifiedError,
isSpecifiedHubSpotAuthError,
} = require('../../lib/errorHandlers/apiErrors');
const { deleteSandbox } = require('@hubspot/cli-lib/sandboxes');
const { deleteSandbox } = require('@hubspot/local-dev-lib/sandboxes');
const { i18n } = require('../../lib/lang');
const { deleteSandboxPrompt } = require('../../lib/prompts/sandboxesPrompt');
const {
Expand All @@ -31,7 +31,7 @@ const {
} = require('../../lib/prompts/accountsPrompt');
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
const { promptUser } = require('../../lib/prompts/promptUtils');
const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');

const { getAccountName } = require('../../lib/sandboxes');
const { getValidEnv } = require('@hubspot/local-dev-lib/environment');
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/commands/sandbox/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const { loadAndValidateOptions } = require('../../lib/validation');
const { i18n } = require('../../lib/lang');
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
const { getAccountConfig, getEnv } = require('@hubspot/local-dev-lib/config');
const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
const { promptUser } = require('../../lib/prompts/promptUtils');
const { uiLine } = require('../../lib/ui');
const {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/lib/links.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const { getEnv } = require('@hubspot/local-dev-lib/config');
const { ENVIRONMENTS } = require('@hubspot/cli-lib/lib/constants');
const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
const { logger } = require('@hubspot/cli-lib/logger');
const {
getTableContents,
getTableHeader,
} = require('@hubspot/cli-lib/lib/table');
} = require('@hubspot/local-dev-lib/logging/table');

const open = require('open');

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/lib/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const OAuth2Manager = require('@hubspot/cli-lib/lib/models/OAuth2Manager');
const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
const { addOauthToAccountConfig } = require('@hubspot/cli-lib/oauth');
const { handleExit } = require('./process');
const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
const { logger } = require('@hubspot/cli-lib/logger');
const { ENVIRONMENTS } = require('@hubspot/cli-lib/lib/constants');

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/lib/projectStructure.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require('fs');
const path = require('path');
const { walk } = require('@hubspot/cli-lib/lib/walk');
const { walk } = require('@hubspot/local-dev-lib/fs');
const { logger } = require('@hubspot/cli-lib/logger');

const COMPONENT_TYPES = Object.freeze({
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/lib/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const chalk = require('chalk');
const findup = require('findup-sync');
const { logger } = require('@hubspot/cli-lib/logger');
const { getEnv } = require('@hubspot/local-dev-lib/config');
const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
const {
ENVIRONMENTS,
FEEDBACK_INTERVAL,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/lib/prompts/personalAccessKeyPrompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const {
DEFAULT_OAUTH_SCOPES,
} = require('@hubspot/cli-lib/lib/constants');
const { deleteEmptyConfigFile } = require('@hubspot/local-dev-lib/config');
const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
const { logger } = require('@hubspot/cli-lib/logger');
const { promptUser } = require('./promptUtils');
const { accountNamePrompt } = require('./enterAccountNamePrompt');
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/lib/prompts/projectDevTargetAccountPrompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { i18n } = require('../lang');
const { uiAccountDescription, uiCommandReference } = require('../ui');
const { isSandbox, getAccountName } = require('../sandboxes');
const { getAccountId } = require('@hubspot/local-dev-lib/config');
const { getSandboxUsageLimits } = require('@hubspot/cli-lib/sandboxes');
const { getSandboxUsageLimits } = require('@hubspot/local-dev-lib/sandboxes');
const { logger } = require('@hubspot/cli-lib/logger');

const i18nKey = 'cli.lib.prompts.projectDevTargetAccountPrompt';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/lib/sandbox-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ const {
isMissingScopeError,
isSpecifiedError,
} = require('./errorHandlers/apiErrors');
const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
const { getEnv, getAccountId } = require('@hubspot/local-dev-lib/config');
const { createSandbox } = require('@hubspot/cli-lib/sandboxes');
const { createSandbox } = require('@hubspot/local-dev-lib/sandboxes');
const { getValidEnv } = require('@hubspot/local-dev-lib/environment');

const i18nKey = 'cli.lib.sandbox.create';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/lib/sandbox-sync.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const SpinniesManager = require('./SpinniesManager');
const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
const { logger } = require('@hubspot/cli-lib/logger');
const { i18n } = require('./lang');
const {
Expand All @@ -10,7 +10,7 @@ const {
sandboxTypeMap,
syncTypes,
} = require('./sandboxes');
const { initiateSync } = require('@hubspot/cli-lib/sandboxes');
const { initiateSync } = require('@hubspot/local-dev-lib/sandboxes');
const {
debugErrorAndContext,
logErrorInstance,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/lib/sandboxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const {
fetchTaskStatus,
fetchTypes,
getSandboxUsageLimits,
} = require('@hubspot/cli-lib/sandboxes');
} = require('@hubspot/local-dev-lib/sandboxes');
const {
accountNameExistsInConfig,
getConfig,
Expand All @@ -21,7 +21,7 @@ const {
} = require('@hubspot/local-dev-lib/config');
const CliProgressMultibarManager = require('./CliProgressMultibarManager');
const { promptUser } = require('./prompts/promptUtils');
const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
const {
personalAccessKeyPrompt,
} = require('./prompts/personalAccessKeyPrompt');
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/lib/upload.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('path');
const { walk } = require('@hubspot/cli-lib/lib/walk');
const { walk } = require('@hubspot/local-dev-lib/fs');
const { createIgnoreFilter } = require('@hubspot/local-dev-lib/ignoreRules');
const { fieldsJsPrompt } = require('../lib/prompts/cmsFieldPrompt');
const { isAllowedExtension } = require('@hubspot/cli-lib/path');
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/lib/usageTracking.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { trackUsage } = require('@hubspot/cli-lib/api/fileMapper');
const { trackUsage } = require('@hubspot/local-dev-lib/trackUsage');
const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized that our trackUsage in local-dev-lib never returns anything. There are areas in the CLI that rely on a response being returned (like here).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like trackAuthAction is the only place the return value is used, and nothing uses the return value of trackAuthAction so I think we're safe to just remove it in the example you linked

isTrackingAllowed,
getAccountConfig,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"dependencies": {
"@hubspot/cli-lib": "^7.0.0",
"@hubspot/local-dev-lib": "^0.0.9",
"@hubspot/local-dev-lib": "^0.0.10",
"@hubspot/serverless-dev-runtime": "5.0.3-beta.1",
"@hubspot/ui-extensions-dev-server": "^0.8.0",
"archiver": "^5.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/serverless-dev-runtime/lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { logger, setLogLevel, LOG_LEVEL } = require('@hubspot/cli-lib/logger');
const {
getTableContents,
getTableHeader,
} = require('@hubspot/cli-lib/lib/table');
} = require('@hubspot/local-dev-lib/logging/table');

const { validateInputs } = require('./validation');
const { getValidatedFunctionData } = require('./data');
Expand Down
2 changes: 1 addition & 1 deletion packages/serverless-dev-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "Apache-2.0",
"dependencies": {
"@hubspot/cli-lib": "^7.0.0",
"@hubspot/local-dev-lib": "^0.0.9",
"@hubspot/local-dev-lib": "^0.0.10",
"body-parser": "^1.19.0",
"chalk": "^4.1.0",
"chokidar": "^3.4.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack-cms-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"dependencies": {
"@hubspot/cli-lib": "^7.0.0",
"@hubspot/local-dev-lib": "^0.0.9"
"@hubspot/local-dev-lib": "^0.0.10"
},
"gitHead": "0659fd19cabc3645af431b177c11d0c1b089e0f8"
}
Loading
Loading