Skip to content

Commit

Permalink
feat: support absolute paths in migrationsDir for the CLI (typeorm#6660)
Browse files Browse the repository at this point in the history
Right now the CLI will ALWAYS prepend the CWD to `options.cli.migrationsDir`. 

This prevents us from using absolute paths there. 

How would we feel about changing that to support absolute paths (by only prepending CLI if the path DOES NOT start with "/")? If we're open to it, I'm happy to make the change for the other CLI commands as well.
  • Loading branch information
tomasreimers authored and Svetlozar committed Jan 12, 2021
1 parent 3f01b35 commit 09e8ff6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/commands/MigrationCreateCommand.ts
Expand Up @@ -59,7 +59,7 @@ export class MigrationCreateCommand implements yargs.CommandModule {
} catch (err) { }
}

const path = process.cwd() + "/" + (directory ? (directory + "/") : "") + filename;
const path = (directory.startsWith("/") ? "" : process.cwd() + "/") + (directory ? (directory + "/") : "") + filename;
await CommandUtils.createFile(path, fileContent);
console.log(`Migration ${chalk.blue(path)} has been generated successfully.`);

Expand Down

0 comments on commit 09e8ff6

Please sign in to comment.