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

question: Ideal local routing-controllers development setup #861

Closed
driescroons opened this issue Mar 21, 2022 · 3 comments
Closed

question: Ideal local routing-controllers development setup #861

driescroons opened this issue Mar 21, 2022 · 3 comments
Labels
type: question Questions about the usage of the library.

Comments

@driescroons
Copy link

driescroons commented Mar 21, 2022

When I was creating my (use)Interceptor priorty PR it took me some time to get a working setup and I was wondering if there were some docs on how to ideally setup a local dev enviroment to test routing-controllers (against already existing projects).

A lot of the steps below were added because the (pre)publishing happens in the github workflow. I was curious if there is a better, easier alternative to test out local routing-controllers changes against already existing projects?

I've currently setup the project to support local development and use routing-controllers as a local (symlinked) package like so:

  1. Install yalc globally
  2. Install fs-extra as a devDependency and create a file copyFiles.js in the root of routing-controllers:
const fse = require('fs-extra');

const buildFolders = ['/cjs', '/esm2015', '/types'];

buildFolders.forEach(folder => {
  fse.copySync(`./build${folder}`, `.${folder}`, { overwrite: true }, function (err) {
    if (err) {
      console.error(err);
    } else {
      console.log('success!');
    }
  });
});
  1. Add the following lines to .gitignore in routing-controllers:
/cjs
/esm2015
/types
  1. Create a .prettierignore file and add the following in routing-controllers:
build
types
cjs
esm2015
  1. Create a .yalcignore file in routing-controllers
/docs
/lang
/node_modules
/sample
/src
/test
/.github
/build

!cjs
!esm2015
!types
  1. Add the following script to your package.json in routing-controllers:
 "preyalcpublish": "npm run build && npm run build:es2015 && npm run build:types && node copyFiles"
  1. Run yalc publish in this (or forked) repository to publish to the local package store. This will show a message that the package has been published. In my case [email protected] published in store.
  2. In your consuming project, run yalc link [email protected]. This will add a folder .yalc folder in your project and symlink it to therouting-controllers in your node_modules. (Make sure to check your version specified in package.json and not straight up copy paste the version I'm using)
  3. Whenever you change something in the routing-controllers package, publish again and run yalc update in the consuming package.

For the people using this setup; please do not add these files to version control (maybe even add them to .gitignore)

@driescroons driescroons added the type: question Questions about the usage of the library. label Mar 21, 2022
@attilaorosz
Copy link
Member

@driescroons I have made a config in webstorm to build everything and do an npm link automatically.

@attilaorosz
Copy link
Member

Closing this as stale.

If the issue still persists, you may open a new Q&A in the discussions tab and someone from the community may be able to help.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: question Questions about the usage of the library.
Development

No branches or pull requests

2 participants