Issue Creation Checklist
Bug Description
When using sequelize init with a .js config file path (via .sequelizerc),
the generated config file contains raw JSON content instead of valid JavaScript.
This breaks the dynamic configuration use case documented in the official docs.
Reproducible Example
- Create a
.sequelizerc file:
const path = require('path');
module.exports = {
config: path.resolve('config', 'config.js'),
};
- Run:
What do you expect to happen?
config/config.js should be generated with valid JS content:
module.exports = {
development: {
username: 'root',
password: null,
database: 'database_development',
host: '127.0.0.1',
dialect: 'mysql'
}
}
What is actually happening?
config/config.js is created but filled with raw JSON content:
{
"development": {
"username": "root",
"password": null,
"database": "database_development",
"host": "127.0.0.1",
"dialect": "mysql"
}
}
A .js file containing JSON is invalid as a dynamic configuration file and
breaks the use case documented here:
https://sequelize.org/docs/v6/other-topics/migrations/#dynamic-configuration
Environment
- Sequelize-cli version: 6.6.5
- Node.js version: 20.19.4
- If TypeScript related: N/A
- Database & Version: N/A
- Connector library & Version: N/A
Would you be willing to resolve this issue by submitting a Pull Request?
Issue Creation Checklist
Bug Description
When using
sequelize initwith a.jsconfig file path (via.sequelizerc),the generated config file contains raw JSON content instead of valid JavaScript.
This breaks the dynamic configuration use case documented in the official docs.
Reproducible Example
.sequelizercfile:What do you expect to happen?
config/config.jsshould be generated with valid JS content:What is actually happening?
config/config.jsis created but filled with raw JSON content:{ "development": { "username": "root", "password": null, "database": "database_development", "host": "127.0.0.1", "dialect": "mysql" } }A
.jsfile containing JSON is invalid as a dynamic configuration file andbreaks the use case documented here:
https://sequelize.org/docs/v6/other-topics/migrations/#dynamic-configuration
Environment
Would you be willing to resolve this issue by submitting a Pull Request?