yarn-package-experiment
v1.1.0
Published
Experimenting with Yarn to create a package and upload/publish in the npm registery & github registery
Readme
YARN Package Experiment
Start
Initialize yarn for the project
yarn initCreating a Package
Create a index.js file which is the entry point for the package. Inside the index.js file add a console.log to see if the package can be used in other projects.
Testing
Initially to test the package we can create a test.js file use the index.js from local and then test the exported objects. But this is not a perfect approach since we want to test the package as a package in other projects. Since it will be not published in npm registery we cannot use to test it directly.
Link Package
To use the package in other projects locally we can just use the following command in this project.
yarn linkTo use this in the project that we want to use this package we can use the following command in that particular project directory
yarn link yarn-package-experimentUnlinking Package
Once linking is not required we can unlink the package.
yarn unlinkUnlinking the package in the different project where it is used
yarn unlink yarn-package-experimentPack
We can also test the package in the same way it will be used once published by using the follwing command.
yarn packAdding it to the project
yarn add ~/Personal/Sandboxes/Yarn/yarn-package-experiment/yarn-package-experiment.v1.0.0.tgz