Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to rename base layers dir #111

Open
noveogroup-amorgunov opened this issue Oct 21, 2024 · 3 comments
Open

Possibility to rename base layers dir #111

noveogroup-amorgunov opened this issue Oct 21, 2024 · 3 comments
Labels
PRIORITY | LOW Can wait until after release TYPE | enhancement New feature or request

Comments

@noveogroup-amorgunov
Copy link

Hey! I use nextjs application with page router architecture. Nextjs reserves directories app and pages. If I use app dir, nextjs automatically start use it as app router architecture and I can't block it in some config. So for FSD we use renamed directory for app layer (we rename to appp).

I would like to be able to change the directory name and set new name in the config. I see example in other issue how can be look #69 (comment) :

import fsd from "@feature-sliced/steiger-plugin";

export default [
  ...fsd.configs.custom({
    layerNames: {
      app: "appp",
    },
  }),
];

But I think It just a prototype and not release yet. Do you have any plans to implement this feature?

@illright
Copy link
Member

We're thinking about it, yes, but there's still some unresolved questions, such as how do we stop people from using this to redefine names of layers significantly, or maybe we shouldn't stop them from doing that.

However, it would always be best if the layers didn't have to be renamed. Does the strategy from the docs not work in your situation? If so, could you please open an issue on the docs repo about it?

@noveogroup-amorgunov
Copy link
Author

noveogroup-amorgunov commented Oct 21, 2024

However, it would always be best if the layers didn't have to be renamed. Does the strategy from the docs not work in your situation? If so, could you please open an issue on the docs repo about it?

I see two strategies from the docs:

  1. rename layer :) https://feature-sliced.design/docs/guides/tech/with-nextjs#renaming-the-pages-layer-within-the-fsd-structure. I think It right way and this issue about this one.
  2. move app folder out of src folder. It not working in our case, because we use page router and nextjs version >13.5, when nextjs automatically start use app router if you have app folder in the project. But anyway, if we didn't use it page router (and use app router), I think it's a bad way to move source code out of src folder by semantic. Also, nextjs in any major version can disallow app/page folder out of src and we will make it impossible to use nextjs and FSD together without renaming the layer.

@noveogroup-amorgunov
Copy link
Author

noveogroup-amorgunov commented Oct 21, 2024

If so, could you please open an issue on the docs repo about it?

Well, I will create this issue in the docs repo.

FYI

Now we use https://github.com/javierbrea/eslint-plugin-boundaries (which used in official fsd eslint plugin) as linter in the project and it allows rename layer very easy:

// patch this file /node_modules/@feature-sliced/eslint-config/utils/layers.js
 const FS_LAYERS = [
-     "app",
+     "appp",
     "pages",
     "widgets",
     // ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PRIORITY | LOW Can wait until after release TYPE | enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants