Skip to content

there should be a single place that holds the dependencies #13740

@nikikalwar

Description

@nikikalwar

Is your proposal related to a problem?

Yes, I was checking the comments where I saw it is mentioned in TODO, to have a single place to hold dependencies instead of hard-coding the values during declaration.

no, it's not a problem just checking comments

(Write your answer here.)

Describe the solution you'd like

// dependencies.js
module.exports = ['react', 'react-dom', 'react-scripts'];

//createReactApp.js
const dependencies = require('./dependencies').sort();

Instead of hardcoding the values in a place, I think we can have a single dependencies file which holds the dependencies array

(Describe your proposed solution here.)

Describe alternatives you've considered

(Write your answer here.)

Additional context

// TODO: there should be a single place that holds the dependencies
const dependencies = ['react', 'react-dom', 'react-scripts'].sort();
if (dependencies.includes(appName)) {
console.error(
chalk.red(
Cannot create a project named ${chalk.green( "${appName}" )} because a dependency with the same name exists.\n +
Due to the way npm works, the following names are not allowed:\n\n
) +
chalk.cyan(dependencies.map(depName => ${depName}).join('\n')) +
chalk.red('\n\nPlease choose a different project name.')
);
process.exit(1);
}
}

I thought I will give it a try, could you please take a look once you are free.

(Write your answer here.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions