0

I don't even know how to put my question into words. So i'll try describing it this way. I have 3 node.js-code-bases, each a git repository on its own:

api
api-base
api-base-specific

"api" delivers some sort of framework, which "api-base" extends from, which then "api-base-specific" extends from. Whereas only the final one is what will ever be in production. Though, each single one should be "node app.js"-able oder "npm test"-able, when git-cloning it on its own.

When working on "api-base-specific", the directory structure would look like this:

.
  app.js
  /lib
    /api        <- git submodule "api"
      api.js
      ....
    /api-base   <- git submodule "api-base"
      api.js
      ...
    /api-base-specific
      api.js
      ...
  /tests

This works well. However, when i "check out" "api-base" on its own, there is no "lib" directory having a "api-base" directory. Get what i mean?

I'd like to build up the "api" and "api-specific" repositories in the same manner as "api-base-specific". And then kind of submodule them in "api-base-specific"/lib, but step in at their "lib/api-base"-directory-level.

Hope you get my "question". Thanks

1 Answer 1

1

Split all of them into separate modules and get a file structure like this:

.
  app.js
  /node_modules
    /api
      api.js
      /node_modules
        /api-base   <- git submodule "api-base"
          api.js
          /node_modules
            /api-base-specific
              api.js
Sign up to request clarification or add additional context in comments.

1 Comment

thanks for pointing me at modules. then require("api-base") will look for "/node_modules/api-base/(index.js|index.node|package.json)": nodejs.org/api/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.