Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-yeager committed Dec 18, 2024
1 parent 5e09d4a commit 34b23c6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 91 deletions.
14 changes: 6 additions & 8 deletions commands/project/upload.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// @ts-nocheck
import util from 'util';

const {
addAccountOptions,
addConfigOptions,
Expand Down Expand Up @@ -55,19 +53,19 @@ exports.handler = async options => {
intermediateRepresentation = await translate({
projectSourceDir: path.join(projectDir, projectConfig.srcDir),
platformVersion: projectConfig.platformVersion,
accountId,
accountId: derivedAccountId,
});
console.log(util.inspect(intermediateRepresentation, false, null, true));
} catch (e) {
if (isTranslationError(e)) {
return logger.error(e.toString());
logger.error(e.toString());
} else {
logError(e);
}
logError(e);
return process.exit(EXIT_CODES.ERROR);
}
}

trackCommandUsage('project-upload', { type: accountType }, accountId);
trackCommandUsage('project-upload', { type: accountType }, derivedAccountId);

validateProjectConfig(projectConfig, projectDir);

Expand Down Expand Up @@ -158,7 +156,7 @@ exports.builder = yargs => {
});

yargs.option('translate', {
describe: 'Translate the project files',
hidden: true,
type: 'boolean',
default: false,
});
Expand Down
35 changes: 12 additions & 23 deletions lib/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,27 +369,15 @@ const uploadProjectFiles = async (
let error;

try {
if (intermediateRepresentation) {
const { data: upload } = await uploadProject(
accountId,
projectName,
filePath,
uploadMessage,
platformVersion,
intermediateRepresentation
);
buildId = upload.buildId;
} else {
const { data: upload } = await uploadProject(
accountId,
projectName,
filePath,
uploadMessage,
platformVersion
);

buildId = upload.buildId;
}
const { data: upload } = await uploadProject(
accountId,
projectName,
filePath,
uploadMessage,
platformVersion,
intermediateRepresentation
);
buildId = upload.buildId;

SpinniesManager.succeed('upload', {
text: i18n(`${i18nKey}.uploadProjectFiles.succeed`, {
Expand All @@ -411,7 +399,6 @@ const uploadProjectFiles = async (
projectName,
}),
});

error = err;
}

Expand Down Expand Up @@ -569,7 +556,7 @@ const handleProjectUpload = async (
})
);

const { buildId, error } = await uploadProjectFiles(
const data = await uploadProjectFiles(
accountId,
projectConfig.name,
tempFile.name,
Expand All @@ -578,6 +565,8 @@ const handleProjectUpload = async (
intermediateRepresentation
);

const { buildId, error } = data;

if (error) {
uploadResult.uploadError = error;
} else if (callbackFunc) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "Apache-2.0",
"repository": "https://github.com/HubSpot/hubspot-cli",
"dependencies": {
"@hubspot/local-dev-lib": "3.0.1",
"@hubspot/project-parsing-lib": "file:../project-translation-layer",
"@hubspot/local-dev-lib": "^3.1.0",
"@hubspot/project-parsing-lib": "^0.0.1",
"@hubspot/serverless-dev-runtime": "7.0.0",
"@hubspot/theme-preview-dev-server": "0.0.10",
"@hubspot/ui-extensions-dev-server": "0.8.33",
Expand Down
70 changes: 12 additions & 58 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1463,34 +1463,10 @@
semver "^6.3.0"
unixify "^1.0.0"

"@hubspot/[email protected]":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@hubspot/local-dev-lib/-/local-dev-lib-3.0.1.tgz#1dd22f439d6e262353f14915a354115bbc1f5f76"
integrity sha512-h1jOmZJNdHZFbrOA5Gn815YCsix8eY81A4dkrUuDZI4MzVaJH3o4RoRalMl+Hr2e35nDrbrbcIR1RMQADPSmwg==
dependencies:
address "^2.0.1"
axios "^1.3.5"
chalk "^2.4.2"
chokidar "^3.5.3"
content-disposition "^0.5.4"
cors "^2.8.5"
debounce "^1.2.0"
express "^4.18.2"
extract-zip "^2.0.1"
findup-sync "^5.0.0"
fs-extra "^11.1.0"
ignore "^5.1.4"
js-yaml "^4.1.0"
moment "^2.29.4"
p-queue "^6.0.2"
prettier "^3.3.0"
semver "^6.3.0"
unixify "^1.0.0"

"@hubspot/local-dev-lib@^3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@hubspot/local-dev-lib/-/local-dev-lib-3.0.1.tgz#1dd22f439d6e262353f14915a354115bbc1f5f76"
integrity sha512-h1jOmZJNdHZFbrOA5Gn815YCsix8eY81A4dkrUuDZI4MzVaJH3o4RoRalMl+Hr2e35nDrbrbcIR1RMQADPSmwg==
"@hubspot/local-dev-lib@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@hubspot/local-dev-lib/-/local-dev-lib-3.1.0.tgz#76b5d524aa694aad2bfc6e199ee1dac314f15774"
integrity sha512-iop3PgZ0ZWejCH6PmSeYnnGwV8vGIuA4F+w7SxukdX3QfhivlczClATWPaZanv1CYJHdflqoItq1kdF8ASJJmA==
dependencies:
address "^2.0.1"
axios "^1.3.5"
Expand All @@ -1511,10 +1487,12 @@
semver "^6.3.0"
unixify "^1.0.0"

"@hubspot/project-parsing-lib@file:../project-translation-layer":
"@hubspot/project-parsing-lib@^0.0.1":
version "0.0.1"
resolved "https://registry.yarnpkg.com/@hubspot/project-parsing-lib/-/project-parsing-lib-0.0.1.tgz#fd1f823abbe410d97446bd5fc804b2e9bf40402e"
integrity sha512-7Qqc6YplKTYG2skswVtNc02iCIuPd816vZT3I4HTYzJRQ9EqYTPZ7QLrL9VSTkLNkUyHw0AJE1qeQJqye1eAfQ==
dependencies:
"@hubspot/local-dev-lib" "^3.0.1"
"@hubspot/local-dev-lib" "^3.1.0"
ajv "^8.17.1"
ajv-draft-04 "^1.0.0"

Expand Down Expand Up @@ -10463,16 +10441,7 @@ string-length@^4.0.1:
char-regex "^1.0.2"
strip-ansi "^6.0.0"

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -10541,7 +10510,7 @@ stringify-object@^3.2.1, stringify-object@^3.3.0:
is-obj "^1.0.1"
is-regexp "^1.0.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand All @@ -10555,13 +10524,6 @@ strip-ansi@^5.2.0:
dependencies:
ansi-regex "^4.1.0"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^7.0.1:
version "7.1.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
Expand Down Expand Up @@ -11548,7 +11510,8 @@ wordwrap@^1.0.0:
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
name wrap-ansi-cjs
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -11566,15 +11529,6 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

0 comments on commit 34b23c6

Please sign in to comment.