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

Fixes Unhandled Promise Rejections #217

Merged
merged 4 commits into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixes Unhandled Promise Rejections
- Added missing `await` calls to fix Unhandled Promis Rejections
  when renaming the old config name to the new config name.
- Defaults CLI to the `help` command
  • Loading branch information
andreban committed Jun 30, 2020
commit 1ac946d0ab5da9847d9da9a6b149fb468fc5fdf5
2 changes: 1 addition & 1 deletion packages/cli/src/lib/Cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class Cli {
command = 'help';
}
} else {
command = parsedArgs._[0];
command = parsedArgs._[0] || 'help';
}

switch (command) {
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import * as inquirer from 'inquirer';
import {existsSync} from 'fs';
import {promises as fsPromises} from 'fs';

const DEFAULT_CONFIG_FOLDER = join(homedir(), '.bubblewrap-config');
const DEFAULT_CONFIG_FOLDER = join(homedir(), '.bubblewrap');
const DEFAULT_CONFIG_NAME = 'bubblewrap-config.json';
const DEFAULT_CONFIG_FILE_PATH = join(DEFAULT_CONFIG_FOLDER, DEFAULT_CONFIG_NAME);
const LEGACY_CONFIG_FOLDER = join(homedir(), '.llama-pack');
Expand Down Expand Up @@ -58,14 +58,14 @@ async function renameConfigIfNeeded(log = new Log('config')): Promise<void> {
await fsPromises.mkdir(DEFAULT_CONFIG_FOLDER);
await fsPromises.rename(LEGACY_CONFIG_FILE_PATH, DEFAULT_CONFIG_FILE_PATH);
} else {
fsPromises.rename(LEGACY_CONFIG_FOLDER, DEFAULT_CONFIG_FOLDER);
fsPromises.rename(join(DEFAULT_CONFIG_FOLDER, LEGACY_CONFIG_NAME), DEFAULT_CONFIG_FILE_PATH);
await fsPromises.rename(LEGACY_CONFIG_FOLDER, DEFAULT_CONFIG_FOLDER);
await fsPromises
.rename(join(DEFAULT_CONFIG_FOLDER, LEGACY_CONFIG_NAME), DEFAULT_CONFIG_FILE_PATH);
}
}


export async function loadOrCreateConfig(path =
join(DEFAULT_CONFIG_FOLDER, DEFAULT_CONFIG_NAME)): Promise<Config> {
export async function loadOrCreateConfig(path = DEFAULT_CONFIG_FILE_PATH): Promise<Config> {
await renameConfigIfNeeded();
const existingConfig = await Config.loadConfig(path);
if (existingConfig) return existingConfig;
Expand Down