3
votes

I was reading Yarn blog and found it supports yarn create just like create-react-app.

https://yarnpkg.com/blog/2017/05/12/introducing-yarn/

I tried locally... basically made very simple application with following package.json.

{
  "name": "create-test-app",
  "version": "1.0.0",
  "bin": {
    "create-test-app": "./index.js"
  },
  "dependencies": {
    ...
  }
}

But somehow,,, it is complaining that it can't find the package. "error Couldn't find package "create-test-app" on the "npm" registry.

In order to use "yarn create", I should upload on "npm" registry? Can't try it in locally? Thanks in advance.

3
If you just want to use create-react-app through yarn, try yarn create react-app my-app - jchook

3 Answers

2
votes

The way to use this is yarn create <starter-kit-package>. Starter kit package must have been installed globally. You can find create-* starter kit packages in the npm registry.

Here is the link to documentation for Yarn create

1
votes

To add to @Oluwafemi Sule 's answer.

The way to use this is yarn create <starter-kit-package>. Starter kit package must have been installed globally. You can find create-* starter kit packages in the npm registry.

This means that for it to work you need to install it to your yarn global or publish it to npm registry.

Fortunately you can install your local package globally. So start by creating a starter kit package then do this:

yarn global add file:/path/to/create-kit-package

Then after this you can do:

yarn create kit-package

In the above kit-package is the name of the package without create, since you are supposed to create the package with a name that matches the following format:

create-package-name

so on the cli you call the command as :

yarn create package-name

to invoke once it is installed globally.

You can publish this to NPM once you are happy with the package so that someone else or yourself can install it the normal way without first adding the package globally.

0
votes

Yarn takes from NPM and does not have its own mechanism for creating packages. When you create a package on NPM, Yarn will actually grab its details through the NPM Registry.

More information: http://blog.npmjs.org/post/151660845210/hello-yarn