Skip to content

Commit

Permalink
Reduce dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Jul 27, 2024
1 parent da90aba commit e8e2323
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
24 changes: 7 additions & 17 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import path from 'node:path';
import process from 'node:process';
import ora from 'ora';
import meow from 'meow';
import createConfig from './config.js';
import { upload, publish, fetchToken } from './wrapper.js';
Expand Down Expand Up @@ -63,17 +62,11 @@ const {
deployPercentage,
} = await createConfig(cli.input[0], cli.flags);

const spinner = ora();
const spinnerStart = text => {
spinner.text = text;
return spinner.start();
};

async function doAutoPublish() {
spinnerStart('Fetching token');
console.log('Fetching token...');

const token = await fetchToken(apiConfig);
spinnerStart(`Uploading ${path.basename(zipPath)}`);
console.log(`Uploading ${path.basename(zipPath)}...`);

const uploadResponse = await upload({
apiConfig,
Expand All @@ -85,24 +78,23 @@ async function doAutoPublish() {
throw uploadResponse;
}

spinnerStart('Publishing');
console.log('Publishing...');
const publishResponse = await publish(
{ apiConfig, token },
trustedTesters && 'trustedTesters',
deployPercentage,
);
spinner.stop();

handlePublishStatus(publishResponse);
}

async function doUpload() {
spinnerStart(`Uploading ${path.basename(zipPath)}`);
console.log(`Uploading ${path.basename(zipPath)}`);
const response = await upload({
apiConfig,
zipPath,
});

spinner.stop();
if (!isUploadSuccess(response)) {
throw response;
}
Expand All @@ -111,20 +103,18 @@ async function doUpload() {
}

async function doPublish() {
spinnerStart('Publishing');
console.log('Publishing');

const response = await publish(
{ apiConfig },
trustedTesters && 'trustedTesters',
deployPercentage,
);
spinner.stop();

handlePublishStatus(response);
}

function errorHandler(error) {
spinner.stop();

console.log(error?.response?.body ?? error);
process.exitCode = 1;

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"chrome-webstore-upload": "^3.1.0",
"junk": "^4.0.1",
"meow": "^12.1.1",
"ora": "^7.0.1",
"recursive-readdir": "^2.2.3",
"yazl": "^2.5.1"
},
Expand Down

0 comments on commit e8e2323

Please sign in to comment.