@plone/scripts v3.7.0
@plone/scripts package
This package is a library of scripts that are useful to automate certain tasks when developing Volto core or Volto projects.
i18n
It scans and detects i18n messages from the code and adds them to the i18n machinery.
See https://6.docs.plone.org/volto/development/i18n.html for more information.
This script is installed in the node_modules/.bin
directory and can be called via yarn i18n
or directly in the scripts
package.json
part.
volto-update-deps
Given an existing project path, volto-update-deps
updates the Volto dependencies
and devDependencies
for the existing Volto (@plone/volto
) version in the package.json
file.
If you are in the process of upgrading your project to a given Volto version, you should update the package.json
@plone/volto
dependencies key to use the updated version, then run the script.
The script is included in the @plone/scripts
package.
You can run it from inside your project's directory root.
pnpm exec volto-update-deps .
Or run it directly from the .bin
folder.
./node_modules/.bin/volto-update-deps.js path/to/my/project
Deprecated utilites
The following utilities are no longer used by core or in projects.
changelogupdater
It updates the change log according the current defaults in the Volto project.
See how Volto core uses it, along with release-it
, to automate the release process:
https://github.com/plone/volto/blob/4f52bf61062d1e34e3391ed0a36781b8df98a316/package.json#L173-L192
Bump
Given the version, you can update the first unreleased
literal. release-it
provides it as a version
variable.
yarn changelogupdater bump ${version}
Excerpt
It generates the change log of the version to be released. This is useful when creating the Release information and sending it to GitHub.
yarn changelogupdater.js excerpt
Back
It creates the blank placeholder for the next release. Given the (next) version, it will be added to the placeholder.
yarn changelogupdater.js back ${version}
addon
This script creates and configures a vanilla project using the Volto generator. The project is configured to have the current add-on installed and ready to work with. This script is useful to bootstrap an isolated environment that can be used to quickly develop the add-on or for demo purposes. It's also useful when testing an add-on in a CI environment.
Note: It's quite similar when you develop a Plone backend add-on in the Python side, and embed a ready to use Plone build (using buildout or pip) in order to develop and test the package.
Unfortunately, the NodeJS tooling does not work well with symlinks or outside the root of the project. This script proceeds in the following way:
- Generates a vanilla project using the official Volto Yo Generator (@plone/generator-volto)
- Configures it to use the add-on with the name stated in the
package.json
- Copies over the root of the add-on (
src
and essential files) inside the created project
After this, you can change directory to the created project, by default addon-testing-project
.
The name of the created project is parameterizable.
After that you can use the full fledged project, and run any standard Volto command for linting, acceptance test or unit tests.
clone (git)
Given the add-on remote git repository, it pulls and configures it into the vanilla project generated by the script.
npx -p @plone/scripts addon clone [options] <source> [destination]
Usage: addon clone [options] <source> [destination]
clone a repository into a newly created directory
Options:
-p, --private set if the repo is private, then GITHUB_TOKEN is used
-b, --branch <branch> set the repo branch, defaults to main
-c, --canary downloads latest Volto canary (alpha) version
-h, --help display help for command
This next command downloads the volto-blocks-grid
add-on from its git repository's main
branch, and will generate a project with the latest Volto canary (alpha) version.
npx -p @plone/scripts addon clone https://github.com/kitconcept/volto-blocks-grid.git --branch main --canary
This will create a directory named addon-testing-project
, and will bootstrap a new project using Volto's standard project generator.
It will adjust the configuration of this project to setup the add-on in the project using mrs-developer
, and the git URL given to fetch the add-on contents.
You can specify the branch to be used, if the project should use the latest alpha available.
For private repositories, it uses the GITHUB_TOKEN
present in your environment variables to fetch it.
After this, as a developer you can use the usual project commands to run tests (unit, linting, acceptance) inside the generated addon-testing-project
.
You can configure the CI of your choice for automated testing, you can take a look at how it's done in: https://github.com/kitconcept/volto-blocks-grid/tree/main/.github/workflows
The idea is to issue commands inside the generated addon-testing-project
project and do your checks.
Take special care on how to pass down to the npx
command the current pull request branch.
Depending on your CI system, this might be different.
clone local
You can also clone the local add-on using:
npx -p @plone/scripts addon clone .
This only works if you execute the command from the root of your add-on directory.
consolidate
While developing, you might have done changes inside the generated project, and you most probably want to consolidate them, back into the root of the repository.
By running this script, it copies over from addon-testing-project/src/addons/<my-addon>
to the root of your repository.
It should be run at the root of the add-on, and it gets an optional source
argument in case you have specified a directory other than addon-testing-project
.
npx -p @plone/scripts addon consolidate --help
Usage: addon consolidate [options] [source]
Consolidate a cloned project
Options:
-h, --help display help for command
2 months ago
7 months ago
9 months ago
9 months ago
10 months ago
10 months ago
11 months ago
11 months ago
11 months ago
12 months ago
12 months ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago