Is it possible provide two version of a same package npm ?
I have a git repository with :
MyRepo
|- library
|- FolderToHide
|- package.json
|- .npmignore
File package.json is containing :
{
"name": "myRepo",
"repository": {
"type": "git",
"url": "https://somewhere"
},
...
}
How can I configure my package to create a version with FolderToHide and another without ?
I want to have something like this :
MyRepo2
|- node_modules
|- myRepo
|- library
MyRepo3
|- node_modules
|- myRepo
|- library
|- FolderToHide
MyRepo3 can be used as debug repository, maybe is it possible to create a debug version for a package ?
If you want it to be single npm package, e.g.
my-package(not two separate packagesmy-packageandmy-package-with-hidden-folder) you can use dist-tags for this.FolderToHideto your.npmignore.-limitedto version of your package inpackage.json(so it looks like2.1.0-limited) and runnpm publish --tag limited(you can replacelimitedwith any name you want). This will publish version of package withoutFolderToHidewith taglimited.FolderToHidefrom.npmignore-limitedinpackage.jsonto-fulland runnpm publish --tag full(again,fullcan be any name you wish). This will publish new version of package withFolderToHideincluded.Then, when you want to install your package in another project you run either
npm install my-package@limitedornpm install my-package@full.Alternatively, you can decide to have one of versions as default option. In this case you should omit dist-tag for it. So instead of
npm publish --tag fullyou just runnpm publish. This will (implicitly) assign taglatestto published version. And when you install package without specifying tag (npm install my-package), npm will use package withlatesttag.