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

[full-ci] Build idp and settings frontends with pnpm #4892

Merged
merged 2 commits into from
Oct 27, 2022
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
4 changes: 3 additions & 1 deletion .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,8 @@ def settingsUITests(ctx, storage = "ocis", accounts_hash_difficulty = 4):
# TODO: settings/package.json has all the acceptance test dependencies
# they shouldn't be needed since we could also use them from web:/tests/acceptance/package.json
"cd %s/services/settings" % dirs["base"],
"retry -t 3 'yarn install --immutable'",
"pnpm config set store-dir ./.pnpm-store",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does pnpm by default use the lock file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"retry -t 3 'pnpm install'",
"make test-acceptance-webui",
],
"volumes": [{
Expand Down Expand Up @@ -1816,6 +1817,7 @@ def makeNodeGenerate(module):
"CHROMEDRIVER_SKIP_DOWNLOAD": "true", # install fails on arm and chromedriver is a test only dependency
},
"commands": [
"pnpm config set store-dir ./.pnpm-store",
"retry -t 3 '%s ci-node-generate'" % (make),
],
"volumes": [stepVolumeGo],
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Please use this Dockerfile only if
# you want to build an image from source without
# Yarn and Go installed on your dev machine.
# pnpm and Go installed on your dev machine.

# You can build oCIS using this Dockerfile
# by running following command:
Expand All @@ -10,7 +10,7 @@
# following command instead:
# `make -C ocis dev-docker`
# It will build a `owncloud/ocis:dev` image for you
# and use your local Yarn and Go caches and therefore
# and use your local pnpm and Go caches and therefore
# is a lot faster than the build steps below.


Expand Down
9 changes: 9 additions & 0 deletions changelog/unreleased/change-build-service-frontends-with-pnpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Change: Build service frontends with pnpm instead of yarn

We changed the Node.js packager from Yarn to pnpm to make it more consistent with the main Web repo.
pnpm offers better package isolation and prevents a whole class of errors.
This is only relevant for developers.


https://github.com/owncloud/ocis/pull/4878
https://github.com/owncloud/web/pull/7835
2 changes: 1 addition & 1 deletion docs/ocis/development/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ So we are trying to reflect this in the tooling. It should be kept simple and qu
Besides standard development tools like git and a text editor, you need the following software for development:

- Go >= v1.18 ([install instructions](https://golang.org/doc/install))
- Yarn ([install instructions](https://classic.yarnpkg.com/en/docs/install))
- pnpm ([install instructions](https://pnpm.io/installation))
- docker ([install instructions](https://docs.docker.com/get-docker/))
- docker-compose ([install instructions](https://docs.docker.com/compose/install/))

Expand Down
2 changes: 1 addition & 1 deletion docs/services/idp/theming.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Every image placed in `idp/ui/src/images` can be directly import into components
If you need to edit or add new locales, you can do so with json files in the `idp/ui/src/locales` folder. If adding new locale, make sure to add it also in the `index.js` file in the same folder.

## Building assets
In order to build all assets, run `yarn build` in the `idp` folder. This script will compile all assets and output them into `idp/assets` folder.
In order to build all assets, run `pnpm build` in the `idp` folder. This script will compile all assets and output them into `idp/assets` folder.

At this point, you have two possible ways how to deploy your new theme:
- run `make generate` in the root folder of your oCIS clone and generate the new assets
Expand Down
2 changes: 1 addition & 1 deletion docs/services/settings/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ geekdocFilePath: releasing.md

## Requirements

You need a working installation of [the Go programming language](https://golang.org/), [the Node runtime](https://nodejs.org/) and [the Yarn package manager](https://yarnpkg.com/) installed to build the assets for a working release.
You need a working installation of [the Go programming language](https://golang.org/), [the Node runtime](https://nodejs.org/) and [the pnpm package manager](https://pnpm.io) installed to build the assets for a working release.

## Releasing

Expand Down
6 changes: 3 additions & 3 deletions docs/services/settings/tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ geekdocFilePath: tests.md

## Requirements

You need a working installation of [the Go programming language](https://golang.org/), [the Node runtime](https://nodejs.org/) and [the Yarn package manager](https://yarnpkg.com/) installed to run the acceptance tests. You may also want to use [Docker](https://www.docker.com/) to start the necessary services in their respective containers.
You need a working installation of [the Go programming language](https://golang.org/), [the Node runtime](https://nodejs.org/) and [the pnpm package manager](https://pnpm.io/) installed to run the acceptance tests. You may also want to use [Docker](https://www.docker.com/) to start the necessary services in their respective containers.

## Acceptance Tests

Expand All @@ -23,7 +23,7 @@ Make sure you've cloned the [web frontend repo](https://github.com/owncloud/web/
Install dependencies and bundle the frontend with a watcher by running

```bash
yarn && yarn build:w
pnpm install && pnpm build:w
```

If you skip the step above, the currently bundled frontend from the oCIS binary will be used.
Expand All @@ -43,7 +43,7 @@ docker compose up selenium middleware-ocis vnc
Navigate into the settings service via `cd ../settings/` and install dependencies and build the bundled settings UI with a watcher by running

```bash
yarn && yarn watch
pnpm install && pnpm watch
```

#### Start oCIS from binary
Expand Down
18 changes: 1 addition & 17 deletions services/idp/.gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1 @@
# yarn2 with Zero-Installs: https://yarnpkg.com/features/zero-installs
#.yarn/*
#!.yarn/cache
#!.yarn/patches
#!.yarn/plugins
#!.yarn/releases
#!.yarn/sdks
#!.yarn/versions

# yarn2 not using Zero-Installs: https://yarnpkg.com/features/zero-installs
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
.pnpm-store/
2 changes: 2 additions & 0 deletions services/idp/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
auto-install-peers=true
public-hoist-pattern[]=*
768 changes: 0 additions & 768 deletions services/idp/.yarn/releases/yarn-3.1.0.cjs

This file was deleted.

6 changes: 0 additions & 6 deletions services/idp/.yarnrc.yml

This file was deleted.

20 changes: 10 additions & 10 deletions services/idp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ci-go-generate: # CI runs ci-node-generate automatically before this target
ci-node-generate: assets

.PHONY: assets
assets: yarn-build \
assets: pnpm-build \
assets/identifier/static \
assets/identifier/static/logo.svg \
assets/identifier/static/favicon.ico
Expand All @@ -50,22 +50,22 @@ FAVICON_URL = https://github.com/owncloud/assets/main/favicon.ico
assets/identifier/static/favicon.ico:
curl --fail -o assets/identifier/static/favicon.ico ${FAVICON_URL}

.PHONY: yarn-build
yarn-build: node_modules
#yarn lint #TODO: activate
#yarn test #TODO: activate
yarn build
.PHONY: pnpm-build
pnpm-build: node_modules
#pnpm lint #TODO: activate
#pnpm test #TODO: activate
pnpm build

.PHONY: node_modules
node_modules:
yarn install --immutable
pnpm install

############ licenses ############
.PHONY: ci-node-check-licenses
ci-node-check-licenses: node_modules
yarn licenses:check
pnpm licenses:check

.PHONY: ci-node-save-licenses
ci-node-save-licenses: node_modules
yarn licenses:csv
yarn licenses:save
pnpm licenses:csv
pnpm licenses:save
12 changes: 6 additions & 6 deletions services/idp/i18n/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Tools

YARN ?= yarn
PNPM ?= pnpm
MSGCAT ?= msgcat
MSGMERGE ?= msgmerge
MSGFMT ?= msgfmt
Expand All @@ -19,12 +19,12 @@ build: json
json:
@for po in $(POS); do \
lang=$$(echo $$po | sed "s/\.po//"); \
$(YARN) i18next-conv -K --skipUntranslated -l $$lang -s ../i18n/$$po -t ../src/locales/$$lang/translation.json; \
$(PNPM) i18next-conv -K --skipUntranslated -l $$lang -s i18n/$$po -t ../src/locales/$$lang/translation.json; \
done
$(YARN) node ../i18n/build-json.js ../src/locales/locales.json $(POS)
$(PNPM) node i18n/build-json.js ../src/locales/locales.json $(POS)

dev-translation.json: FORCE
$(YARN) i18next --fail-on-warnings
$(PNPM) i18next --fail-on-warnings

.PHONY: extract
extract: pot
Expand All @@ -34,8 +34,8 @@ pot: dev-translation.json
@tmpfile1=$(shell mktemp).po; \
tmpfile2=$(shell mktemp).po; \
trap 'rm -f "$$tmpfile1" "$$tmpfile2"' EXIT; \
$(YARN) i18next-conv --project "LibreGraph Connect Identifier" -K -l en -s i18n/dev-translation.json -t $$tmpfile1; \
$(YARN) node i18n/build-pot.js $$tmpfile1 $$tmpfile2; \
$(PNPM) i18next-conv --project "LibreGraph Connect Identifier" -K -l en -s i18n/dev-translation.json -t $$tmpfile1; \
$(PNPM) node i18n/build-pot.js $$tmpfile1 $$tmpfile2; \
$(MSGCAT) --no-wrap -o $(POT) $$tmpfile2

.PHONY: merge
Expand Down
Loading