yarn-package-experiment

1.1.0 • Public • Published

YARN Package Experiment

Start

Initialize yarn for the project

yarn init

Creating 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 link

To 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-experiment

Unlinking Package

Once linking is not required we can unlink the package.

yarn unlink

Unlinking the package in the different project where it is used

yarn unlink yarn-package-experiment

Pack

We can also test the package in the same way it will be used once published by using the follwing command.

yarn pack

Adding it to the project

yarn add ~/Personal/Sandboxes/Yarn/yarn-package-experiment/yarn-package-experiment.v1.0.0.tgz

Dependents (0)

Package Sidebar

Install

npm i yarn-package-experiment

Weekly Downloads

3

Version

1.1.0

License

MIT

Unpacked Size

1.88 kB

Total Files

4

Last publish

Collaborators

  • prajwal-hebbar-07