🚀 Stéréorepo 🚀
[Alban
These packages are "npm scoped packages" like @babel/core.
The packages list
Maintain the packages
Set up your npm account
First, you need to init your npm account infos. You only have to do it once.
npm set init.author.name "Your Name"
npm set init.author.email "Your Email"
npm set init.author.url "Your Website"
npm adduser
Then just login to npm via your terminal.
npm login
How to use Lerna
Update version
You can update your package version by running lerna version
.
lerna version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease]
This command will only update your package via git, not publish it to npm.
Publish a new version
To publish a new version of your package you just have to run lerna publish
.
lerna publish
This command, unlike the preceding, will push your new version to git and publish it on your npm repo.
Scoped packages common shit
You'll need to create a new organization on npm to be able to publish your scoped packages. The organization needs to have your repo's name.
Example :
For "@stereorepo/sac" to work you'll need to create an organization named "stereorepo"
If it's your package's first time, you'll need to say to npm that it is public and change some things :
// package.json
...
"name": "@stereorepo/[*package-name*]",
"main": "src/index.js",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/stereosuper/stereorepo/packages/[*package-name*]"
},
...
Run some tests on our packages
In order to run some tests on our awesome new libraries we run a test webpack project.
The test project
At the project root there's a package.json which contains some scripts :
//package.json
...
"scripts": {
"dev": "webpack-dev-server --mode development --open",
"link": "sh npm-link.sh",
"unlink": "sh npm-unlink.sh",
}
...
npm run dev
This command is configured to run a development server at the address 0.0.0.0:3000 with hot reloading, sass, eslint, postcss, etc.
npm run link
This command will simply npm link all @stereorepo's packages to the test (./src) directory in order to update package without having to publish new versions.
npm run unlink
This command will npm unlink all @stereorepo's packages when you're done with testing them