I have a project that include a gulp task for building and packaging the sources and release in a directory called dist. My goal is publish it as a npm package,
dist folderThe natural way to achieve that, according to the npm approach, is to publish the folder which is to be the root. There are several ways to do that, depends on the final environment you want to work with:
npm publish dist.npm install relative/path/to/distnode_modules in another project in case you'd like to have the changes in your original package reflected instantly in other project. In your case you first cd dist and run npm link and then go to the other project and run npm link robsonrosa-ui-alert.Prerequisite: in any case above, prior to the publish/install/link, you have to put in your dist folder at least a proper package.json file. In your case, you have to have the package name defined in your package.json file as "name": "robsonrosa-ui-alert". Typically, you'll want there also some other files like README.md or LICENSE.
Automation example
You can automate the publishing process using the prepare script, combined with build script. Additionally, you can protect your package against an accidental publishing of the package root folder with "private": true field put in the package.json, located in the root directory of your package repo. Here is an example:
"private": true,
"scripts": {
"build": "rm -rf dist && gulp build && cat ./package.json | grep -v '\"private\":' > dist/package.json",
"prepare": "npm run build"
},
This way you won't publish the root folder and get the package built and package.json copied to the dist folder automatically, within the publishing process.