I starting with a yarn workspace that has packages that are already named. I'd like to change the name of one of the packages but have not been able to find the necessary procedure for doing this.
Here's the current structure of the file:
{
"name": "gatsby-starter-theme-workspace",
"private": true,
"version": "0.0.1",
"main": "index.js",
"license": "0BSD",
"scripts": {
"build": "yarn workspace example build"
},
"workspaces": [
"gatsby-theme-minimal",
"example"
]
}
The workspace name that I'd like to change is gatsby-theme-minimal, I'd also like to know how I'd change the other one example when that becomes necessary, so advice on that would also be appreciated. I appreciate that this is probably a simple process but I am as yet unaware of how it is done.
There are two concepts that is used in your question.
workspacesfield to refer to the new directory namepackage.jsoninsidenamefield for the corresponding workspace. Forgatsby-theme-minimalit is provided insidegatsby-theme-minimal/package.json->name. Just editpackage.jsonand change the name.After making changes via 1) or 2) or both of them you need to run
yarnin order for Yarn to update any installation files that refer to them. If you change workspace package name as per 2) you should also edit and update any code that requires/imports workspace by the old package name.