Contains several packages that are used in Yard | Digital Agency WordPress projects.
- Copy
.npmrc.exampleto.npmrcand add your tokens. - Run
npm installin the root directory to install all dependencies for all packages.
- Run
npm linkinside thegutenberg-package/packages/<package>directory. - Run
npm link <package-json-name>inside the project or theme directory.
This creates a symbolic link between the packages, allowing you to work on the package while making changes in the project or theme by running npm start.
- To unlink a package from your theme, run
npm unlink --no-save <package>.
Note: Omitting --no-save will remove the package from your package.json file.
- Run
npm unlinkinside thegutenberg-package/packages/<package>directory.
Alternatively, running npm install in your theme will also remove the linked version.
Run HUSKY=0 lerna publish to publish packages to the GitHub Package Registry. Lerna checks each package for changes and lets you decide which version to upgrade. It then pushes the changes to GitHub.
As a general rule, only update packages from the master branch. For feature branches or development, you can publish alpha releases.
Lerna identifies individual package changes, even when the package itself is not modified. For example, if a package called package-foo depends on package-bar, and you make changes to package-bar, Lerna will update the package.json file of package-foo.
Lerna uses git tags to track published versions. If a publish fails, you need to remove these tags and the newly created commits and try again. Here's how to recover:
- Check which tags were created. Remove them from origin
git push -d origin {tagname} - Sync your local tags with the tags from origin
git fetch --prune --prune-tags - Remove the created commits
git reset HEAD~{number-of-commits} --hard - Push your git history
git push --force-with-lease
After completing these steps, address the issue that caused the publish to fail and try publishing again.
This repository includes built-in support for ESLint and Prettier. Husky ensures that all files are automatically formatted and linted with each commit. Additionally, a GitHub action runs to verify and enforce code formatting and linting with every commit.