Skip to content

Commit

Permalink
fix: issue where cli side effect prevents import as cjs module
Browse files Browse the repository at this point in the history
  • Loading branch information
joshunrau committed Jul 29, 2024
1 parent 6a937fc commit 85d9952
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { Downloader, type DownloaderOptions } from './Downloader';
export { FormatConverter } from './FormatConverter';
export * from './Downloader';
export * from './FormatConverter';
export * from './SongTagsSearch';
export * from './main';
export { main } from './main';
export { YtdlMp3Error } from './utils';
24 changes: 12 additions & 12 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ import { description, name, version } from '../package.json';
import { Downloader } from './Downloader';
import { YtdlMp3Error } from './utils';

const program = new Command();
program.name(name);
program.description(description);
program.version(version);
program.allowExcessArguments(false);
program.argument('<url>', 'url of video to download');
program.option('-o --output-dir <path>', 'path to output directory', Downloader.defaultDownloadsDir);
program.option('-n --no-get-tags', 'skip extracting/applying id3 tags');
program.option('-v --verify-tags', 'verify id3 tags fetched from itunes');
program.option('--verbose', 'enable verbose mode');
program.parse();

export async function main() {
const program = new Command();
program.name(name);
program.description(description);
program.version(version);
program.allowExcessArguments(false);
program.argument('<url>', 'url of video to download');
program.option('-o --output-dir <path>', 'path to output directory', Downloader.defaultDownloadsDir);
program.option('-n --no-get-tags', 'skip extracting/applying id3 tags');
program.option('-v --verify-tags', 'verify id3 tags fetched from itunes');
program.option('--verbose', 'enable verbose mode');
program.parse();

const options = program.opts();
try {
const downloader = new Downloader(options);
Expand Down

0 comments on commit 85d9952

Please sign in to comment.