Node or Grunt plugin to watch files access - node.js

We have lot of node modules and grunt plugins to watch the files that change, add or delete but is there any way we get the list of files being accessed?
I need to create a script in node or grunt.js to list down all the files being accessed in the web folder to remove the unused files. Any other suggestions are highly appreciated.
Thanks

Related

Move node_modules folder to different location?

I want to use various cloud sync services to safely backup my project and keep it updated on the cloud. But I do not want to sync the node_modules folder. I am working with a React project setup using create-react-app.
So how can I move the node_modules folder from the project folder to anywhere else on my system? What changes do I need to make in my project files and how can I use npm start to launch hot-reload server like I normally do?

Is there anyway to safely clean up local Firebase project folder?

I'm new to Firebase. Recently, in order to fix certain errors, I tried many different ways until I feel that my local project folder is pretty much messed up, which could cause more other hidden problems. For example, I keep running npm init on many different folders, sometimes manually edited the package.json file, run npm install firebase#5.9.4 --save on several different folders and so on.
So I wonder, is there a way (or tool) that we can scan through our project folder and safely clean it up, e.g. remove redundant/unused dependencies, e.g. node_modules, add required dependencies, fix declarations/referencing errors, and so on without removing user-created assets like .js, .css, images etc.? I want to do that is because I believe this could potentially reduce many hidden problems and help to narrow down my troubleshooting tasks...
Alternatively, can I do the following:
Backup all my JS files.
Empty my Firebase's functions folder.
run firebase init again.
Restore my JS files.
Deploy and troubleshoot my Firebase functions again? Or any steps missing?
Sorry for a silly question. Any advice would be much appreciated, thank you!
If you think there is a problem with the contents of your node_modules folder:
Remove all node_modules folders completely. They don't contain any special information. It is just copies of modules downloaded from the internet.
Rebuild it completely with npm install from the correct location (your functions folder), which uses your package.json to determine what it should contain.

How do I use / utilise the Assets.json file in the Themes directory?

I am starting a new Theme from scratch and have a file called 'Assets.json' in the root directory.
It maps the LESS file from the 'Assets' directory to a CSS file in the 'Styles' directory - great.
Can anyone point me in the right direction as to how I can make use of this, as it's exactly what I want but can't find any information on how to use it.
Thanks!
The Assets.json file is a way to plug into the default gulp script that is provided with Orchard. This script is able to process .less files (and others) in order to generate minified and non-minified versions of scripts or stylesheets, and bundle your grouped assets. This way you don't have to create your own gulp file for each module, just describe the assets you want to be processed and it will do it automatically.
It will also watch the files you described and re-process them when they have changed. The simplest way to use them is to copy-paste one from the core modules, and place them in your own module or theme. Then just run the main gulp file, or enable its support in Visual Studio. You can run npm install from the root folder for this.

User defined folder paths in Grunt

am new to Grunt. Until this time i made a few tasks, compiler for less and sass, some watches.
I would like to have grunt in static folder, but when i start watch sequence i usually need to start it in folder where is my project placed = tons of separate grunts files and node-modules folders.
What i need: static folder for grunt and when i start it i will tell him as a user through console where i need him to watch files (which project). I need to set by user destinations and original folders.
Is it possible in grunt?
Thanks for help
I'm not really sure what you are asking, but a common node pardadigm is to allow users to configure dynamic options through env vars.
To do this grunt could optionally accept and env var
process.env.PATH_TO_WATCH || defaultPathToWatch
If provided it will allow the starter of the grunt processes to specify a dynamic PATH_TO_WATCH.
PATH_TO_WATCH=/some/path node start_grunt.js

Does express.js create folder to mirror javascript files?

I've just checked out a nodejs-expressjs-boilerplate project. After I ran it I've discovered there are a lot of directories mirrored from root 'web/' to newly-created 'public/' directory.
I'm writing here because it looks this question is not covered well in the documentation (Or I'm bad at googling expressjs docs, sorry).
is that true that 'public/' directory in the project root contains copies of files inside 'web/...' directory?
When these copies are created?
Are javascript files from 'public/' executed or from 'web/'?
Do you experience the same behaviour? Is that expressjs feature or project-specific?
Why 'public/' directory is not in '.gitignore'?
Is that true that 'public/' directory in the project root contains copies of files inside 'web/...' directory
When these copies are created?
The Gruntile specifies that, yes. At build time files are compiled/copied.
This task is performed when you execute npm start, as you could see from package.json it calls grunt which executes its default task.
Are javascript files from 'public/' executed or from 'web/'?
In web you have .coffee files, those cannot be run in the browser, that is why there's the need for a dir that holds the compiled .js files.
Do you experience the same behaviour? Is that expressjs feature or project-specific?
This tasks are performed by Grunt, express could be used without these features, also without the Jade templates for instance. It depends on what you need.
Why 'public/' directory is not in '.gitignore'?
I honestly don't know, ask the author :D

Resources