NPM install github package but skip gitignore - npm

For example bootstrap package .gitignore has
# Ignore docs files
/_site/
How can i install bootstrap package included all file that inside /_site/ ?
I have no experience with git, is there a simple way to do the above with npm?

Related

How do I use videojs playlist?

How do I install the video js playlist plug-in? In the example they ask for this file: path/to/videojs-playlist/dist/videojs-playlist.js, but I don't find a dist folder or the .js file. Clues? I have the video.js file. Thanks!
https://github.com/brightcove/videojs-playlist
Installing NodeJS
Multiple installers are available on their download page.
https://docs.npmjs.com/getting-started/installing-node
Using Npm install
This command installs a package, and any packages that it depends on. It reads the file package.json and installs what ever dependency it requires.
It should install all the files you require to run videojs-playlist
After installing simply execute the following command in your videojs-playlist project folder.
npm install videojs-playlist

Forking and changing an NPM package

I have been using an NPM for angular-4 which support drag and drop objects (ng2-drag-drop). I found a missing functionality and decide to add it to the package.
What I did is forking the original project and adding my changes. after commit/push to my git I then used the following command to install my NPM :
npm install https://github.com/..... --save
the NPM installed successfully however when looking in my node_modules I see that the source files are missing and I have only the root directory including the package.json and some other files . any source files are missing.
I then tried to instal the NPM directly from the author git so instead of running :
npm install ng2-drag-drop --save
I used
npm install https://github.com/ObaidUrRehman/ng2-drag-drop.git --save
and I had the same issue with my fork.
Why the installation is different between the author git and the named package ? isn't it taking the files from the same location ? if no, what should I do to make it work ?
The reason you are not able to see the src folder is
If you see the git repo you will find two files
gitignore & npmignore.
In that npm ignore file you will find the src has been ignored to be prevent it from being added to the package when running npm commands .
Keeping files out of your package
Use a .npmignore file to keep stuff out of your package. If there's no
.npmignore file, but there is a .gitignore file, then npm will ignore
the stuff matched by the .gitignore file. If you want to include
something that is excluded by your .gitignore file, you can create an
empty .npmignore file to override it. Like git, npm looks for
.npmignore and .gitignore files in all subdirectories of your package,
not only the root directory.
You need to overwrite these settings to be able to get src contents in node modules when you do npm install

Using bootstrap sass (npm) with gulp

I git cloned this repo https://github.com/HosseinKarami/fastshell and it has everything worked.
I moved away from compass as fastshell is much faster with gulp. But I'm confused and don't know how to extend it, how can I use boostrap sass (https://github.com/twbs/bootstrap-sass)? do bower install or npm?
Zak's answer will get you on a right track, here is more detailed one based on Fastshell's gulpfile.
1) Install bootstrap-sass
bower install boostrap-sass --save
2) Include bootstrap-sass in Fastshell main scss file
File:
src/scss/style.scss
With
#import "./bower_components/bootstrap-sass/assets/stylesheets/bootstrap.scss";
Use gulp cssafter this, or watch.
3) Override Bootstrap classes further for customization you need in allready included modules/partials .scss files
You can do as following:
1 Install boostrap-sass using the following bower command:
bower install boostrap-sass --save
2 Then use gulp-sass which is already required in the project to access the *.scss files in bower_components/bootstrap-sass/assets.
Cheers!

How can I install npm packages without the source code

Is it possible to install an npm package without all the other artifacts. For instance install only the content of the dist folder for the jQuery npm package?
It remains to the module publisher to exclude such files as sources, docs, tests ... and only include build and binary files when they publish their npm package (via prepublish hooks, .npmignore files, etc ...).
Not all maintainers are aware / take that in account ... The only thing you can do, as a module consumer (when you npm install) is to use the --production flag, not to install devDependencies (but that's not what you're looking for)

Add README.md to published npm package

I already published a package to NPM, but forgot the README. I updated the package, tried npm publish ./ again, but it says I can't publish on top of a published package.
So, how do I send a README to a published package?
You should increment the version. Like 0.0.0 to 0.0.1.
Just open package.json in your text editor, find "version":"0.0.0" and type in the new value.
After incrementing the version. Like 0.0.0 to 0.0.1 in your package.json file
Create a README.md in the project root directory of your package. after writing up your read me. you can now publish your package by running the npm publish. that should work and should show up your readme on the npm site.