nestjs runs dist bugs that are not in the root directory - nestjs

When you modify or add files while running in nestjs, it generates the dist directory in the current file instead of the root directory
I want the generated file to be in the root directory instead of the current directory

Related

Why is multiple Gitignore ignored?

The folder structure is as follows.
Created for personal project.
"SERVER" directory works as a server with nodejs, and "CLIENT" directory works with React. So, if you run npm run start inside the "SERVER" folder, the server starts, and the react html generated by "CLIENT" is imported and displayed on the screen.
In git, there is a folder called "GATHER" that contains all of these CLIENT and SERVER folders.
Currently the .gitignore file is only inside the "CLIENT" folder. The contents of the "CLIENT" folder are as follows.
/node_modules
/.pnp
.pnp.js
/build
So, in "SERVER", all parts that need to be added to .gitignore such as node_modules and build are detected as changes.
To solve this problem, I added .gitignore to the parent folder of "CLIENT" and "SERVER", but it doesn't work.
So, as a result of searching, I found that it works even if there are multiple gitignores.
I created a gitignore file in the "SERVER" folder and entered the same code as "CLIENT". But it doesn't work. node_modules are still being tampered with.
I tried git rm --cached node_modules
fatal: pathspec 'node_modules' did not match any files
I only get this error. How can I solve this?
In conclusion, I want to apply .gitignore to each of the "SERVER" and "CLIENT" folders in the GATHER folder.
If your shell current working path is where the .gitignore (and SERVER folder) are, the command to use is:
cd /path/to/repo/GATHER
git rm -r --cached -- SERVER/
To remove the full SERVER content (that you want to ignore).
The OP adds in the comments:
build/ and node_modules/ (directories that should be ignored) are all being ignored.
In addition, since it is recommended to manage only one gitignore file, there were originally two gitignore files: CLIENT internal gitignore and SERVER internal gitignore.
I ended up putting one gitignore in the parent directory of these two directories.
To check if this work, you can use git check-ignore -v
git check-ignore -v -- CLIENT/build/a/file/inside
If you see an ignore rule, the file is ignored.

Ignore src and node modules in Google cloud build

I had deployed a React app to google cloud Build. Deployment is successful. But I have to hide the src and node modules directory.
Currentely Its showing
I have tried adding .gcloudignore with content
node_modules/
*~
Do you have any idea how i can hide my source files. After the build all complied code generates in the dist directory.
I am assuming that the folders node_modules and src are in the top-level directory to be uploaded, then the .gcloudignore file will look like:
#!include:.gitignore
/node_modules/
/src/
*~
The first line #!include:.gitignore allows .gitignore file, 2nd, 3rd and 4th line prevents uploading of node_modules, src directory and any files ending in ~.

Accessing uploaded files outside the dist folder Angular 2 +

I have a folder outside of the Dist directory called uploads. This is where all files uploaded are stored. Namely image files.
I can not figure out how to access these files without them being in the Assets directory in the dist folder. Putting them in the dist folder is not an option here.
If I upload them directly into the dist folder it will work in prod, until I need to take the site down for maintenance, then the whole dist folder will be destroyed on rebuild, and subsequently all the uploads.
If I upload to the assets folder in the src, they won't be displayed because they are not in dist. I am extremely confused and not sure what to do.
The outline of the project is to have uploads ran through a Node.js back end, stored in a local directory called uploads, and then accessed from the dist folder.

npm module missing files after publish

For reference, the repo is https://github.com/microsoftly/luis-response-builder.
The node module files are generated with tsc and output to the dist folder. I have a prepublishOnly step that removes the dist folder, runs tsc, then runs the test against the transpiled js. The tests pass when I publish just fine.
The problem is, when I install the project anywhere else, the dist folder contains only the file with the path dist/src/index.js.
I cannot for the life of me figure out why the file is missing when installed but not when published.
Quoting from npm-publish Documentation:
All files in the package directory are included if no local .gitignore or .npmignore file exists. If both files exist and a file is ignored by .gitignore but not by .npmignore then it will be included.
Your repository's .gitignore file contains the following:
node_modules
dist
*.env
yarn-error.log
Since dist is being ignored, it's not committed with npm publish, as per the documentation.
Check out the package.json documentation about files.
Since you haven't included the files key, it will only include the file specified in main (along with some other default files).
The files value is an array so you can include multiple files and/or folders.
eg:
files: [
"dist",
"config/somefile.js"
]

How to specify node_modules folder for locally referenced node module

We need to specify node_modules folder for locally referenced node
module that resides in an external folder relative to the current
application folder.
We have a scenario where we are referencing an external common module’s js files within another client-side app, however the same node modules being references in both are being duplicated in the final build. we have tried using webpack.optimize.DedupePlugin() without any success.
The directory structure is as follows:
We have a private npm module on the local disk called ‘common’, and then we have our project folder called ‘app’.
Both folders are on the same level in directory structure & are under the same root.
The ‘app’ itself is a npm module & has a package.json file with its own node_modules folder.
|—root
|— common/node_modules
|— app/node_modules
We want to specify via configuration either via npm or web pack a way for the app to resolve references from its specified path of node_modules and not to refer to any other node_modules location including the one in common module.
You can use npm link or just a simple symlink. Do something like that:
cd root/app (your app directory)
npm link ../common
OR
cd root/app (your app directory)
ln -s ../common node_modules/common

Resources