`sequelize init` writes JSON content into `.js` config file when using `.sequelizerc`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- javascript
Research direction
Reproduce the issue with a .sequelizerc that points config to config/config.js, then run npx sequelize-cli init. Inspect the sequelize init path that generates the config file and compare its output with the dynamic configuration example in the linked documentation. Done means a .js config contains valid JavaScript and supports the documented dynamic configuration use case.
Written by the indexing model from the issue text.
Description
Issue Creation Checklist
- I understand that my issue will be automatically closed if I don't fill in the requested information
- I have read the contribution guidelines
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
.sequelizercfile:
const path = require('path');
module.exports = {
config: path.resolve('config', 'config.js'),
};
- Run:
npx sequelize-cli init
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?
- Yes, I have the time and I know how to start.
- Dominant language
- JavaScript
- Stars
- 2.6k
- Forks
- 524
- PR merge metrics
- No merged PRs in 30d
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sequelize/cli
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
parse-community/parse-server#10699 · 1 comment ·
Maintainers usually reply within 1 day
-
area: dashboard bug perceived difficulty: 3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Nitjsefnie-Harness-Commons/daedalus#1179 ·
Maintainers usually reply within 1 day
-
Aframe enhancement javascript
Difficulty 1/5 Under an hour Newbie friendliness 92/100
webarkit/Aframe-nft#17 ·
-
spec-feedback
Difficulty 2/5 1-3 hours Newbie friendliness 75/100