Skip to content

Conversation

DamianGlowala
Copy link
Member

resolves #361

This allows for adding a module entry to a Nuxt config file within a layer using --layer <layer_name>.

// Update nuxt.config.ts
if (!ctx.args.skipConfig) {
await updateNuxtConfig(cwd, (config) => {
const rootDir = ctx.args.layer ? resolve(cwd, ctx.args.layer) : cwd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without considering layer names, isn’t it same as —cwd ?

Copy link
Member Author

@DamianGlowala DamianGlowala Mar 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think setting --cwd pointing to the layer dir would affect other places as well, e.g. where module add looks for package.json or where it adds a dependency using nypm util. Correct me if I'm wrong though.

(There might be a better way to achieve it as well, let me know if you have any idea.)

Copy link
Member

@pi0 pi0 Mar 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what is expected is that the module is added to the closest package.json and nuxt.config files found to the specified cwd. (ie: We need a look-up search for both). nypm should do this via package managers by default.

I think it would probably be best first action to resolve any issues that prevents this.

—-

In next steps, —layer would be also good idea but i expect that it loads nuxt.config, and tries to match a layer by its name (which used in extends key) basically as a convenient shortcut and also it should implement safety check that we don’t write to readonly (remote or dependency) layers but instead ask to directly add to the root.

@DamianGlowala DamianGlowala marked this pull request as draft March 30, 2024 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants