Skip to content

Commit

Permalink
feat: add items to the beginning of the redirects array
Browse files Browse the repository at this point in the history
  • Loading branch information
codfish committed Apr 26, 2020
1 parent 116ce32 commit 220ed2b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/commands/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function add(destination, source, statusCode) {
.substring(0, 4)}`;
}

config.redirects.push({
config.redirects.unshift({
source,
destination,
statusCode,
Expand All @@ -38,11 +38,9 @@ async function add(destination, source, statusCode) {
await writeJsonFile(configPath, config);

console.log();
console.log(chalk.cyan(`Redirect added successfully.`));
console.log('Redirect added successfully.');
console.log();
console.log(
chalk.cyan(` > ${chalk.green(source)} now redirects to ${chalk.green(destination)}`),
);
console.log(` > ${chalk.green(source)} now redirects to ${chalk.green(destination)}`);
console.log();
}

Expand Down

0 comments on commit 220ed2b

Please sign in to comment.