I 'm using Spring Boot and Angularjs with bower plugins.
In static directory, 'bower_components' use many space.
How to optimize build please (without extra plugins files)?
You can use bower-installer which is a node package to control which files to be copied to your static resources folder from the downloaded distribution package folder. Please look into below link.
https://www.npmjs.com/package/bower-installer
I followed below steps to select which files to be copied to my lib folder
1) Install bower-installer by runnnig npm install -g bower-installer command
2) Create 'bower_components' folder outside of your src folder.
3) Edit bower.json configuration file(in the 'bower_component's folder ) and specify path for each js library components.
4) Run bower-installer from terminal
Please let me know if you need more details.
Related
There are more and more front-end projects, and each project has its own node_modules folder.
There are a lot of duplicate files in the modules folder.
How can we manage the dependency packages of all front-end projects in one folder like Maven in IDEA?
Demand:
When running and packaging different projects, WebStorm can refer to the dependent packages in a specified folder.
When run npm install, computer will check whether the public dependency package folder has the dependency version that the current project needs to use.
If so, you will not download the installation.
If not, you will download your own dependency to the public folder.
When multiple versions exist in the same dependent package, the project can automatically reference the correct version.
Maybe after reading my question, you know my actual needs better than I do. Thank you.
If you look in the package.json file in any front-end project with npm you will see all the dependencies in the current project and can manage the versions there. npm install installs the dependencies listed in that file.
Read more about package.json here: package.json
Using the yarn workspace
Yarn workspace features, and solves
multiple projects repeat node in large quantities_ Black hole problem of modules disk
when NPM install is executed for a project, all dependent packages will be placed in the node of the project in the current project_ Install it again under the modules folder
2.1 when installing a new dependency package, you should update the package.json of the subproject, and then execute the yarn install in the root directory to install it
Install the yarn tool first
npm i yarn -g
If there are projects project-a and project-b in the root folder, the directory structure is as follows:
root
project-a
project-b
create package.json in the root folder, with the following contents:
{
"private": true,
"workspaces": ["project-a", "project-b"]
}
ensure that the name attribute values in the package.json of project-a and project-b projects are:
Package.json in project-a:
{
...
"name": "project-a"
...
}
Package.json in project-b:
{
...
"name": "project-b"
...
}
use the command line tool to enter the root folder and execute the yarn install
3.1 after installation, you can enter the normal start-up project
tips:
4.1 all dependent packages will be installed at root/node_ Under modules folder
4.2 node of subproject_ The related link file will be generated under the modules folder, do not delete it
4.3 when installing a new dependency package, you should update the package.json of the subproject, and then execute the yarn install in the root directory to install it
So i have a build definition on my team services project
My source code in the repo does not include the packages loaded via bower however I do have a bower.json file in the solution.
I want my bower task in the build to load my bower packages into the project and then to be included in the artifact drop output
My build does run the bower task but I dont see the output packages in the destination folder
Any help would be great
This is my build definition for bowerenter image description here
I assumed that the bower task would restore all the packages to the build maybe I have not ordered the task correctly?
I have created a test to output the bower packages to drop folder with hosted build agent, you can check my steps below and test on your side:
In my test, I just created a bower.json file to install jquery packages. From the build log, we can see the the jquery packages are instlled in folder bower_components. Folder bower_components is created in $(build.sourcesdirectory) by default.
So I just create another Copy Files task, and copy folder bower_components to $(build.artifactstagingdirectory).
Then you'll see folder bower_components will be in drop folder:
We have a project which have to be packaged as a zip so we can distribute it to our cliens. With the normal node_modules directory i have no problems. I just put the directory and the node.exe together in my project folder and can start our project on every other computer without installing node or running any npm command.
But now i have a dependecy on phantomjs which needs to be installed as a global package npm install -g phantomjs.
How do i pack modules like this into our project? I first thought of copying phantomjs into the local node_modules directory and set the path variable NODE_PATH to this directory. It doesn't find phantomjs.
Development and client platforms are both windows.
Well, generally it is fine to install global dependencies with the --save flag and call their bins like ./node_modules/phantomjs/bin/phantomjs /*now executes*/ (just as an illustrative example).
However, with with Phantom it's not that simple, since it's downloading binaries and/or even compiling. You would have three options:
ssh into target and just npm install -g phantomjs before or define it in a manifest e.g. Dockerfile just like that, if you are using containers.
Compile it from source as advised here.
If you are using the CLI, then just the --save approach.
So I hardly advise just making a Docker image out of it and ship it as tarball. You can't zip the platform dependent Phantom installation, unfortunately.
Also lots of dependencies like karma-runner-phantomjs look for the path of the global dependencies to resolve it for their use.
Let be a library A that I compile with CMake. I also want to distribute it via a package (e.g. RPM).
Where should my package install the files AConfig.cmake and AConfigVersion.cmake ?
In /usr/share/cmake/Modules on Linux ?
You should find what you need here:
http://www.cmake.org/Wiki/CMake/Tutorials/Packaging
With the relevant portion of the text:
Consider a project "Foo" that installs the following files:
<prefix>/include/foo-1.2/foo.h
<prefix>/lib/foo-1.2/libfoo.a
It may also provide a CMake package configuration file
<prefix>/lib/foo-1.2/foo-config.cmake
The config files need the be in your install tree. Only the FindXXX.cmake file should go in the modules directory.
I want to install this module: node-poormansmysql.
My nodejs application is installed in C:\Program Files\NodeJS\.
I have here the folder - node_modules.
Here I added a folder - node-poormansmysql. In this folder I copied the content from github.
I still have the error - Can not find module - node-poormansmysql
Where am I going wrong?
Try to copy to C:\Users\{username}\node_modules
Or just type in cmd "C:\Program Files\NodeJS\npm.cmd" install node-poormansmysql
The problem is that node will look for an index.js in the folder (or a package.json) and this library have not been packaged as a module.
So what you need to do is re-name node-poormansmysql.js to index.js
Also make sure you get all the dependencies.