Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace all yarn appearences with pnpm #6433

Merged
merged 7 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/source/addons/i18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ Your add-on has a `locales` folder with a `.pot` file.
└── volto.po
```

1. Run `yarn i18n` in the context of your add-on.
1. Run `pnpm i18n` in the context of your add-on.
1. Go to each `.po` file in your `locales` folder, and write the translations for each translation literal.

In the context of your project, run `yarn i18n` to merge the add-on translations with the ones of your project.
In the context of your project, run `pnpm i18n` to merge the add-on translations with the ones of your project.


## Override translations

If you have multiple add-ons installed in your project, the translations are loaded in the order your add-ons are listed in `package.json`.
If two add-ons provide different translations for the same message, then the last defined add-on wins.

When running `yarn i18n` in the context of your project, the project's own locales are processed last and can override translations from any add-on.
When running `pnpm i18n` in the context of your project, the project's own locales are processed last and can override translations from any add-on.
2 changes: 1 addition & 1 deletion docs/source/addons/theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ or add a key in your `package.json` project:
or via a `THEME` variable:

```shell
THEME='volto-my-theme' yarn start
THEME='volto-my-theme' pnpm start
```

2. Create a directory `src/theme` in your add-on, then add this file `theme.config`, replacing `<name_of_your_theme>` with your add-on name:
Expand Down
4 changes: 3 additions & 1 deletion docs/source/client/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ These functions can be used in other use cases like command line helpers, script
To install the Javascript Plone client run the following command:

```shell
yarn add @plone/client
pnpm add @plone/client
```

or use your package manager of choice.

## `ploneClient` entry point

The main artifact that the client provides is the `ploneClient` entry point.
Expand Down
38 changes: 19 additions & 19 deletions docs/source/configuration/environmentvariables.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ All configurable environment variables work at runtime, not only at build time.
You could, for example, build your Volto application, then start it in production with the `RAZZLE_API_PATH` environment variable.

```shell
yarn build && RAZZLE_API_PATH=https://plone.org yarn start:prod
pnpm build && RAZZLE_API_PATH=https://plone.org pnpm start:prod
```

This brings you a lot of power since you don't have to rebuild on every configuration change.
Expand All @@ -40,7 +40,7 @@ You can also generate builds on your continuous integration, then deploy them an
However, if you are not able to upgrade the packages `plone.restapi` (8.12.1 or greater) and `plone.rest` (2.0.0a1 or greater) in the backend, you can adjust your web server configuration and use the `RAZZLE_LEGACY_TRAVERSE` flag.

```shell
RAZZLE_LEGACY_TRAVERSE=true yarn start:prod
RAZZLE_LEGACY_TRAVERSE=true pnpm start:prod
```

`VOLTO_ROBOTSTXT`
Expand All @@ -50,7 +50,7 @@ You can also generate builds on your continuous integration, then deploy them an

```shell
VOLTO_ROBOTSTXT="User-agent: *
Disallow: /" yarn start
Disallow: /" pnpm start
```

```{note}
Expand All @@ -67,19 +67,19 @@ You can also generate builds on your continuous integration, then deploy them an
It helps you identify problems with a customization that does not work as you expect.

```shell
DEBUG=volto:shadowing yarn start
DEBUG=volto:shadowing pnpm start
```

`i18n` enables the log of missing internationalization messages in the console.

```shell
DEBUG=volto:i18n yarn start
DEBUG=volto:i18n pnpm start
```

`*` enables logging everywhere it exists in Volto.

```shell
DEBUG=volto:* yarn start
DEBUG=volto:* pnpm start
```

`DEBUG_ADDONS_LOADER`
Expand Down Expand Up @@ -107,34 +107,34 @@ You can also generate builds on your continuous integration, then deploy them an
`ADDONS` can be used to temporarily add an add-on to your build for testing purposes.

```shell
yarn add volto-slate
ADDONS=volto-slate:asDefault yarn start
pnpm add @kitconcept/volto-light-theme
ADDONS=@kitconcept/volto-light-theme pnpm start
```

`ADDONS` can also be used to temporarily enable a feature or a set of customizations.

```shell
# given a folder './packages/coresandbox', like in vanilla Volto
ADDONS=coresandbox:multilingualFixture yarn start
ADDONS=coresandbox:multilingualFixture pnpm start
```

If you need to specify several add-ons, separate them with a semicolon (`;`):

```shell
ADDONS="test-addon;test-addon2" yarn start
ADDONS="test-addon;test-addon2" pnpm start
```


You can specify profiles for installation:

```shell
ADDONS="test-addon:profile1;test-addon2:profile2" yarn start
ADDONS="test-addon:profile1;test-addon2:profile2" pnpm start
```

The following code snippets demonstrate how to configure add-ons.

First in `package.json`:

```json
"addons": [
"@kitconcept/volto-blocks-grid"
Expand All @@ -152,8 +152,8 @@ You can also generate builds on your continuous integration, then deploy them an
And finally using `ADDONS`:

```shell
yarn add volto-slate
ADDONS=volto-slate:asDefault yarn start
pnpm add volto-slate
ADDONS=volto-slate:asDefault pnpm start
```

As a result, your app will load the add-ons in the following order:
Expand All @@ -165,14 +165,14 @@ You can also generate builds on your continuous integration, then deploy them an
```{important}
The `ADDONS` key is a Volto specific configuration.
Simply setting `ADDONS` doesn't download the JavaScript package.
This has to be covered another way, by either installing the add-on package (with `yarn add`), or loading it as a development package with `mrs-developer`.
This has to be covered another way, by either installing the add-on package (with `pnpm add`), or loading it as a development package with `mrs-developer`.
```

`BUILD_DIR`
This is a runtime-only environment variable that directs the build to run Volto from a specific location, other than the default folder `build`.

```shell
yarn
pnpm install
BUILD_DIR=dist node dist/server.js
```

Expand All @@ -182,7 +182,7 @@ You can also generate builds on your continuous integration, then deploy them an
It can be relative to the current project or absolute.

```shell
VOLTOCONFIG=../../volto.config.js yarn start
VOLTOCONFIG=../../volto.config.js pnpm start
```
````

Expand Down
2 changes: 1 addition & 1 deletion docs/source/configuration/internalproxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const settings = {
or use the environment variable:

```bash
RAZZLE_DEV_PROXY_API_PATH=http://localhost:8081/mysite yarn start
RAZZLE_DEV_PROXY_API_PATH=http://localhost:8081/mysite pnpm start
```

This redefines the request path from the internal proxy of the server side Node.js process to the Plone content backend API, but leaves the frontend Volto process making all content requests to `http://localhost:3000/++api++/`.
Expand Down
4 changes: 2 additions & 2 deletions docs/source/configuration/volto-config-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ This environment variable allows you to specify a custom location for {file}`vol
It can be relative to the current project or absolute.

```shell
VOLTOCONFIG=../../volto.config.js yarn start
VOLTOCONFIG=../../volto.config.js pnpm start
```

```shell
VOLTOCONFIG=$(pwd)/volto.config.js yarn start
VOLTOCONFIG=$(pwd)/volto.config.js pnpm start
```

You can also set it from the root of the monorepo:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/configuration/zero-config-builds.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ In the past (before Volto 13), Volto was configured in build time using several
environment variables, commonly supplied via the command line, such as the following:

```shell
PORT=11001 RAZZLE_API_PATH=https://plone.org/api yarn build`
PORT=11001 RAZZLE_API_PATH=https://plone.org/api pnpm build`
```

and since Razzle is an isomorphic application, some of these values passed on build time, were
Expand Down
11 changes: 8 additions & 3 deletions docs/source/contributing/linting.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ From here we will have access to the commands to check for errors and to fix the
You can run the pnpm `eslint`, `prettier`, and `stylelint` commands from the Volto package folder:

```shell
pnpm lint
pnpm lint
pnpm prettier
pnpm stylelint
```
Expand All @@ -89,8 +89,13 @@ pnpm prettier:fix
pnpm stylelint:fix
```

````{note}
The same commands can be found in your Volto add-on projects, as seen in the [`package.json.tpl`](https://github.com/plone/volto/blob/main/packages/generator-volto/generators/app/templates/package.json.tpl#L10) file.
```{versionadded} Volto 18.0.0-alpha.43
[Cookieplone](https://github.com/plone/cookieplone) is now the recommended way to develop Volto projects, using it as a boilerplate generator.
Cookieplone uses the frontend code installed using `pnpm` instead of `yarn`.
```

````{deprecated} Volto 18.0.0
The same commands can be found in your Volto legacy add-ons and projects created with `@plone/generator-volto`, as seen in the [`package.json.tpl`](https://github.com/plone/volto/blob/main/packages/generator-volto/generators/app/templates/package.json.tpl#L10) file.

You will use similar commands to run the linting commands, but with `yarn` instead of `pnpm`:

Expand Down
5 changes: 2 additions & 3 deletions docs/source/contributing/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ This makes it faster and easier to test code changes.

In GitHub workflows or for testing add-ons, it's useful to use an alternate Jest configuration.
Volto provides a way to do so using a file {file}`jest.config.js`, or pointing the test runner to a file of your choice, using the `RAZZLE_JEST_CONFIG` environment variable.
Because the Volto add-ons and Volto add-ons projects still use `yarn`, you must run the test command using `yarn` instead of `pnpm`.

```shell
RAZZLE_JEST_CONFIG=my-custom-jest-config.js yarn test
RAZZLE_JEST_CONFIG=my-custom-jest-config.js pnpm test
```

```{note}
Expand All @@ -85,7 +84,7 @@ Sometimes you need to enable different configurations and enable optional compon
You can use the `ADDONS` environment variable to define them.

```bash
ADDONS=test-addon,test-addon2 yarn start
ADDONS=test-addon,test-addon2 pnpm start
```

See {doc}`../configuration/environmentvariables` for more information.
8 changes: 4 additions & 4 deletions docs/source/deploying/seamless-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ All the environment variables that are configurable now work at runtime, not at
Before Volto 13, you'd do:

```bash
RAZZLE_API_PATH=https://plone.org yarn build && yarn start:prod
RAZZLE_API_PATH=https://plone.org pnpm build && pnpm start:prod
```

From Volto 13 onwards, you can now do:

```bash
yarn build && RAZZLE_API_PATH=https://plone.org yarn start:prod
pnpm build && RAZZLE_API_PATH=https://plone.org pnpm start:prod
```
````

Expand Down Expand Up @@ -130,15 +130,15 @@ server {
error_log /dev/stdout;

# [seamless mode] Recommended as default configuration, using seamless mode new plone.rest traversal
# yarn build && yarn start:prod
# pnpm build && pnpm start:prod
location ~ /\+\+api\+\+($|/.*) {
rewrite ^/\+\+api\+\+($|/.*) /VirtualHostBase/http/myservername.org/Plone/++api++/VirtualHostRoot/$1 break;
proxy_pass http://backend;
}

# Legacy deployment example, using RAZZLE_LEGACY_TRAVERSE Volto won't append ++api++ automatically
# Recommended only if you can't upgrade to latest `plone.restapi` and `plone.rest`
# yarn build && RAZZLE_API_PATH=http://myservername.org/api RAZZLE_LEGACY_TRAVERSE=true yarn start:prod
# pnpm build && RAZZLE_API_PATH=http://myservername.org/api RAZZLE_LEGACY_TRAVERSE=true pnpm start:prod
# location ~ /api($|/.*) {
# rewrite ^/api($|/.*) /VirtualHostBase/http/myservername.org/Plone/VirtualHostRoot/_vh_api$1 break;
# proxy_pass http://backend;
Expand Down
4 changes: 2 additions & 2 deletions docs/source/deploying/sentry.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ SENTRY_AUTH_TOKEN=foo \
SENTRY_ORG=my_organization \
SENTRY_PROJECT=new_project \
SENTRY_RELEASE=2.0.0 \
SENTRY_DSN=https://boo@sentry.com/1 yarn build
SENTRY_DSN=https://boo@sentry.com/1 pnpm build
node build/server.js
```

Expand Down Expand Up @@ -265,7 +265,7 @@ SENTRY_PROJECT=new_project
SENTRY_RELEASE=2.0.0
SENTRY_DSN=https://boo@sentry.com/1
SENTRY_FRONTEND_CONFIG='{"tags":{"site":"www.test.com","app":"test_app"},"extras":{"logger":"javascript-frontend", "release":"1.4.1"}}'
SENTRY_BACKEND_CONFIG='{"tags":{"site":"www.test.com","app":"test_app"} yarn build
SENTRY_BACKEND_CONFIG='{"tags":{"site":"www.test.com","app":"test_app"} pnpm build
node build/server.js
```

Expand Down
6 changes: 3 additions & 3 deletions docs/source/deploying/simple.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ myst:
Volto is a Node.js application that runs on your machine/server and listens to a port. Once you are ready to deploy it, you should build it running:

```bash
$ yarn build
$ pnpm build
```

The Volto configuration determines the external URL Volto will be served, so if you just issue this command, the build will get that values and build an static bundle with that values (PORT=3000, API_PATH=http://localhost:8080/Plone).

In order to make Volto work on a server under an specific DNS name, you must parametrize the build like:

```bash
$ PORT=volto_node_process_port RAZZLE_API_PATH=https://mywebsite.com/api yarn build
$ PORT=volto_node_process_port RAZZLE_API_PATH=https://mywebsite.com/api pnpm build
```

After the build, the bundle is created in `/build` folder, then in order to launch your application you can run:

```bash
$ yarn start:prod
$ pnpm start:prod
```
or
```bash
Expand Down
57 changes: 6 additions & 51 deletions docs/source/development/creating-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,60 +9,15 @@ myst:

# Create a Volto project without a backend

This document shows how to create a Volto project with the frontend only when you have your own existing backend, such as Plone {term}`Classic UI`, {term}`Nick`, or {term}`Guillotina`.
```{versionadded} Volto 18.0.0-alpha.43
```

[Cookieplone](https://github.com/plone/cookieplone) is now the recommended way to develop Volto projects, using it as a boilerplate generator.
stevepiercy marked this conversation as resolved.
Show resolved Hide resolved
Even if you don't need the backend, you can create a Plone project, then use only the {file}`frontend` folder for your purposes.
As a bonus, it will contain the means for deploying your project.

```{seealso}
To create a full Plone project with both frontend and backend, see {doc}`plone:install/create-project` instead.

To contribute to Volto, see {doc}`../contributing/developing-core`.
```

For using Volto for a project—in other words, use Volto as a library—you should use Volto's project generator `@plone/generator-volto`.
It's a boilerplate project generator based on Yeoman that will provide you with the basic files and folder structure to bootstrap a Volto site.
In addition to bootstrapping stand-alone Volto projects, it can also bootstrap Volto add-ons.

1. Open a terminal and execute:

```shell
npm install -g yo @plone/generator-volto
# Install the latest and stable release of Volto with the following command
yo @plone/volto
# or you can install the "canary" release, including any alpha release
yo @plone/volto --canary
# or you can install any specific released version
yo @plone/volto --volto=15.0.0
# you can even pass a GitHub repo and specific branch
yo @plone/volto --volto=plone/volto#16.0.0
# you can bootstrap with add-ons
yo @plone/volto --addon=volto-form-block
```

2. Answer the questions when prompted, and provide the name of the new app (folder) to be created.
For the sake of this documentation, use `myvoltoproject` as the project name.

````{note}
You can run the generator with parameters to tailor your requirements.

```shell
yo @plone/volto --help
```

```{seealso}
[`@plone/generator-volto` `README.md`](https://github.com/plone/volto/blob/main/packages/generator-volto/README.md).
```
````

3. Change your working directory to the newly created folder `myvoltoproject` (or whatever name you entered).

```shell
cd myvoltoproject
```

4. `@plone/generator-volto` installed the dependencies for you.
Start the project.

```shell
yarn start
```

This starts the development server, which compiles the project code, and when done, it serves the app at http://localhost:3000.
Loading
Loading