How can you tell laravel mix / npm to exclude searching a specific directory (and it's subdirectories) when you run "npm run prod"? I'm assuming its searching for directories with package.json or bower.json (I ran an strace and found it recursing the offending directory searching for these files)
I have a symlink in my public directory that contains thousands of subdirectories and files. This causes 'npm run prod' to take 20 minutes to finish running (searching through the thousands of subdirectories).
Is there a way to explicitly skip this directory from being recursed?
Related
I am trying to use yarn to add koa to my project folder but the command does not seem to work for me.
When I run the command it gives me the following warnings:
warning package.json: No license field
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
warning No license field
It tells me to remove the package-lock.json file but I don't have one in my folder as I just created the folder through the mkdir command.
I am trying to use Husky with Eslint. I’m trying to create a pre-commit (lint and husky) script that’ll prevent commits with added files if they have lint errors.
However, my project isn’t in a mono-repo format, but rather a custom format. In other words, my .husky folder and the package.json file are both in a sub-directory called “react-client” (seen below). This is problematic because husky always assumes that the .husky folder is in the root folder with the .git folder, but in this case it’s in the “react-client” folder.
Everything that I read on this matter led me to these steps for the husky docs (below), but that didn’t work either. https://typicode.github.io/husky/#/?id=custom-directory
I keep receiving this error message
I’m thinking that I need more than “cd react client” and “npm test” in my .husky pre-commit file. Or that I might need to make changes to my .git folder files. Also, I believe that my package.json scripts (below) could be incorrect/need more configurations
I wasn't adding a file in the correct directory. I had to add a pre-commit file with no file extension under the .husky folder with the following contents:
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
cd ./ClientApp && npx lint-staged
IMPORTANT!! - MAKE SURE THAT YOU ADD THE PRE-COMMIT FILE UNDER THE .HUSKY FOLDER. For me, vscode was adding the pre-commit file to the "_" folder, (which is inside of the husky folder). Instead, Vscode should've just added the pre-commit file directly inside of the .husky folder.
I'm trying to figure out how (and if it's possible) to tell brew that when person x installs my package it has to put some files in a folder and some in others.
For example you usually use /etc/ folder for config files: let's say i have project "project" like
file1.py
file2.js
file3.blablabla
configfile.conf
and i want that when someone launches brew install project file 1, 2 and 3 get put inside default brew folder while configfile.conf gets moved in /etc/project/. I have seen many packages moving files around during installation, but brew's docs don't cover this case and looking it up on google results only in people asking how to move homebrew installation folder.
Is this possible or do i have to organize the whole project inside the same folder?
I finally found the answer, it was not well explained in the docs, but was there:
Here are the docs
The answer is under "just moving some files" section:
Inside your .rb script, you have the def install function. If you look at the docs there is a table containing lots of directories
prefix #{HOMEBREW_PREFIX}/Cellar/#{name}/#{version} /usr/local/Cellar/foo/0.1
opt_prefix #{HOMEBREW_PREFIX}/opt/#{name} /usr/local/opt/foo
bin #{prefix}/bin /usr/local/Cellar/foo/0.1/bin
etc...
These are the directories where you can install files.
For example i had to move my script inside bin folder and a config file inside etc folder, so i wrote
def install
etc.install "config" # move file "config" to etc directory
bin.install "script" # move file "script" to bin directory
end
N.B.: etc and bin are not /etc/ and /bin/ but those specified inside brew's docs. In this case #{HOMEBREW_PREFIX}/etc and #{prefix}/bin where HOMEBREW_PREFIX is /usr/local and prefix is brew's installation folder.
node_modules folder is quite large in term of size. I wonder if we can delete it after Laravel Mix compile everything? Sure, I tried it before (install jquery) and then delete node_modules folder after Laravel Mix compiled everything. My jquery code still running and there's no error at all. So is it okay?
yes, you can remove it after run:
npm run production
after run this command all necessary codes will save in app.js
and when need node_modules you can download them again with :
npm install
You should never commit your node_modules folder to git. That would take forever. Just commit package.json and package-lock.json.
However, you wouldn't want to have to re-install them everytime you build your code. I checked a large project and the total size is 310 M. What situation do you have where you can't keep that in place?
To directly answer your question, Laravel will never run code from the node_modules folder, all of the code used from there is compiled into app.js, so it is safe to delete if you had to.
In my node_module folder I use to have 2 hidden files:
.metadata_never_index
.gitkeep
The first one prevents Spotlight from indexing the folder
(maybe the second file isn't really needed, but that doesn't matter for now).
In the past I used npm to install the modules.
Now i wanted to switch to yarn.
But yarn deletes these two files when using yarn install.
How can I prevent yarn from deleting those files in the node_modules folder?