Skip to content

Commit

Permalink
Replace yarn with pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
dschmidt committed Oct 24, 2022
1 parent e519bb9 commit 3da7395
Show file tree
Hide file tree
Showing 25 changed files with 13,193 additions and 21,587 deletions.
86 changes: 35 additions & 51 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ config = {
"branches": [
"master",
],
"yarnlint": True,
"pnpmlint": True,
"e2e": {
"oC10": {
"db": "mysql:5.5",
Expand Down Expand Up @@ -830,10 +830,10 @@ def beforePipelines(ctx):
licenseCheck(ctx) + \
documentation(ctx) + \
changelog(ctx) + \
yarnCache(ctx) + \
pnpmCache(ctx) + \
cacheOcisPipeline(ctx) + \
pipelinesDependsOn(buildCacheWeb(ctx), yarnCache(ctx)) + \
pipelinesDependsOn(yarnlint(ctx), yarnCache(ctx))
pipelinesDependsOn(buildCacheWeb(ctx), pnpmCache(ctx)) + \
pipelinesDependsOn(pnpmlint(ctx), pnpmCache(ctx))

def stagePipelines(ctx):
unit_test_pipelines = unitTests(ctx)
Expand All @@ -844,17 +844,15 @@ def stagePipelines(ctx):
def afterPipelines(ctx):
return build(ctx) + pipelinesDependsOn(notify(), build(ctx))

def yarnCache(ctx):
def pnpmCache(ctx):
return [{
"kind": "pipeline",
"type": "docker",
"name": "cache-yarn",
"name": "cache-pnpm",
"steps": skipIfUnchanged(ctx, "cache") +
installYarn() +
yarnInstallTests() +
rebuildBuildArtifactCache(ctx, "yarn", ".yarn") +
rebuildBuildArtifactCache(ctx, "playwright", ".playwright") +
rebuildBuildArtifactCache(ctx, "tests-yarn", "tests/acceptance/.yarn"),
installPnpm() +
rebuildBuildArtifactCache(ctx, "pnpm", ".pnpm-store") +
rebuildBuildArtifactCache(ctx, "playwright", ".playwright"),
"trigger": {
"ref": [
"refs/heads/master",
Expand All @@ -864,14 +862,14 @@ def yarnCache(ctx):
},
}]

def yarnlint(ctx):
def pnpmlint(ctx):
pipelines = []

if "yarnlint" not in config:
if "pnpmlint" not in config:
return pipelines

if type(config["yarnlint"]) == "bool":
if not config["yarnlint"]:
if type(config["pnpmlint"]) == "bool":
if not config["pnpmlint"]:
return pipelines

result = {
Expand All @@ -883,9 +881,9 @@ def yarnlint(ctx):
"path": config["app"],
},
"steps": skipIfUnchanged(ctx, "lint") +
restoreBuildArtifactCache(ctx, "yarn", ".yarn") +
restoreBuildArtifactCache(ctx, "pnpm", ".pnpm-store") +
restoreBuildArtifactCache(ctx, "playwright", ".playwright") +
installYarn() +
installPnpm() +
lint(),
"trigger": {
"ref": [
Expand Down Expand Up @@ -945,9 +943,9 @@ def build(ctx):
"base": dir["base"],
"path": config["app"],
},
"steps": restoreBuildArtifactCache(ctx, "yarn", ".yarn") +
"steps": restoreBuildArtifactCache(ctx, "pnpm", ".pnpm-store") +
restoreBuildArtifactCache(ctx, "playwright", ".playwright") +
installYarn() +
installPnpm() +
buildRelease(ctx) +
buildDockerImage(),
"trigger": {
Expand Down Expand Up @@ -1062,7 +1060,7 @@ def buildCacheWeb(ctx):
"type": "docker",
"name": "cache-web",
"steps": skipIfUnchanged(ctx, "cache") +
restoreBuildArtifactCache(ctx, "yarn", ".yarn") +
restoreBuildArtifactCache(ctx, "pnpm", ".pnpm-store") +
restoreBuildArtifactCache(ctx, "playwright", ".playwright") +
[{
"name": "build-web",
Expand Down Expand Up @@ -1129,16 +1127,16 @@ def unitTests(ctx):
},
] +
skipIfUnchanged(ctx, "unit-tests") +
restoreBuildArtifactCache(ctx, "yarn", ".yarn") +
restoreBuildArtifactCache(ctx, "pnpm", ".pnpm-store") +
restoreBuildArtifactCache(ctx, "playwright", ".playwright") +
installYarn() +
installPnpm() +
restoreBuildArtifactCache(ctx, "web-dist", "dist") +
[
{
"name": "unit-tests",
"image": OC_CI_NODEJS,
"commands": [
"yarn test:unit --coverage",
"pnpm test:unit --coverage",
],
},
{
Expand Down Expand Up @@ -1215,9 +1213,9 @@ def e2eTests(ctx):
services = []
depends_on = []
steps = skipIfUnchanged(ctx, "e2e-tests") + \
restoreBuildArtifactCache(ctx, "yarn", ".yarn") + \
restoreBuildArtifactCache(ctx, "pnpm", ".pnpm-store") + \
restoreBuildArtifactCache(ctx, "playwright", ".playwright") + \
installYarn() + \
installPnpm() + \
restoreBuildArtifactCache(ctx, "web-dist", "dist") + \
copyFilesForUpload()

Expand Down Expand Up @@ -1255,7 +1253,7 @@ def e2eTests(ctx):
"image": OC_CI_NODEJS,
"environment": environment,
"commands": [
"sleep 10 && yarn test:e2e:cucumber tests/e2e/cucumber/**/*[!.%s].feature" % ("oc10" if server == "oCIS" else "ocis"),
"sleep 10 && pnpm test:e2e:cucumber tests/e2e/cucumber/**/*[!.%s].feature" % ("oc10" if server == "oCIS" else "ocis"),
],
}] + \
uploadTracingResult(ctx) + \
Expand Down Expand Up @@ -1375,9 +1373,6 @@ def acceptance(ctx):
# TODO: don't start services if we skip it -> maybe we need to convert them to steps
steps += skipIfUnchanged(ctx, "acceptance-tests")

steps += restoreBuildArtifactCache(ctx, "tests-yarn", "tests/acceptance/.yarn")
steps += yarnInstallTests()

if (params["oc10IntegrationAppIncluded"]):
steps += restoreBuildArtifactCache(ctx, "web-dist", "dist")
else:
Expand Down Expand Up @@ -1783,27 +1778,15 @@ def installFederatedServer(version, db, dbSuffix = "-federated"):

return [stepDefinition]

def installYarn():
def installPnpm():
return [{
"name": "yarn-install",
"name": "pnpm-install",
"image": OC_CI_NODEJS,
"environment": {
"PLAYWRIGHT_BROWSERS_PATH": ".playwright",
},
"commands": [
"yarn install --immutable",
],
}]

def yarnInstallTests():
return [{
"name": "yarn-install-tests",
"image": OC_CI_NODEJS,
"environment": {
"PLAYWRIGHT_BROWSERS_PATH": ".playwright",
},
"commands": [
"cd tests/acceptance && yarn install --immutable",
"pnpm install",
],
}]

Expand All @@ -1812,7 +1795,7 @@ def lint():
"name": "lint",
"image": OC_CI_NODEJS,
"commands": [
"yarn run lint",
"pnpm lint",
],
}]

Expand Down Expand Up @@ -2420,11 +2403,12 @@ def runWebuiAcceptanceTests(ctx, suite, alternateSuiteName, filterTags, extraEnv
for env in extraEnvironment:
environment[env] = extraEnvironment[env]

return [{
return restoreBuildArtifactCache(ctx, "pnpm", ".pnpm-store") + [{
"name": "webui-acceptance-tests",
"image": OC_CI_NODEJS,
"environment": environment,
"commands": [
"pnpm install --filter ./tests/acceptance",
"cd %s/tests/acceptance && ./run.sh" % dir["web"],
],
"volumes": [{
Expand Down Expand Up @@ -2781,25 +2765,25 @@ def licenseCheck(ctx):
},
"steps": [
{
"name": "yarn-install",
"name": "pnpm-install",
"image": OC_CI_NODEJS,
"commands": [
"yarn install --immutable",
"pnpm install",
],
},
{
"name": "node-check-licenses",
"image": OC_CI_NODEJS,
"commands": [
"yarn licenses:check",
"pnpm licenses:check",
],
},
{
"name": "node-save-licenses",
"image": OC_CI_NODEJS,
"commands": [
"yarn licenses:csv",
"yarn licenses:save",
"pnpm licenses:csv",
"pnpm licenses:save",
],
},
],
Expand Down
25 changes: 0 additions & 25 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,6 @@ tests/testing-app

/coverage

# 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.*

tests/acceptance/.yarn/*
!tests/acceptance/.yarn/patches
!tests/acceptance/.yarn/releases
!tests/acceptance/.yarn/plugins
!tests/acceptance/.yarn/sdks
!tests/acceptance/.yarn/versions

# acceptance test artifacts
logfile.txt
comments.file
Expand Down
6 changes: 3 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"editor.formatOnSave": true,
"eslint.alwaysShowStatus": false,
"eslint.format.enable": true,
"eslint.packageManager": "yarn",
"eslint.packageManager": "pnpm",
"jest.autoRun": {
"watch": false,
"onStartup": true
},
"jest.jestCommandLine": "yarn test:unit",
"npm.packageManager": "yarn",
"jest.jestCommandLine": "pnpm test:unit",
"npm.packageManager": "pnpm",
"typescript.format.enable": false
}
768 changes: 0 additions & 768 deletions .yarn/releases/yarn-3.1.0.cjs

This file was deleted.

6 changes: 0 additions & 6 deletions .yarnrc.yml

This file was deleted.

6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ RELEASE := ${CURDIR}/release
OCX_RELEASE := $(CURDIR)/build/dist
NODE_MODULES := ${CURDIR}/node_modules

node_modules: package.json yarn.lock
yarn install --immutable && touch ${NODE_MODULES}
node_modules: package.json pnpm-lock.yaml
pnpm install && touch ${NODE_MODULES}

.PHONY: clean
clean:
Expand Down Expand Up @@ -65,4 +65,4 @@ l10n-read: node_modules

.PHONY: l10n-write
l10n-write: node_modules
make -C packages/web-runtime/l10n translations
make -C packages/web-runtime/l10n translations
14 changes: 7 additions & 7 deletions Makefile.release
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SHELL := /bin/bash

YARN := $(shell command -v yarn 2> /dev/null)
ifndef YARN
$(error yarn is not available on your system, please install npm)
PNPM := $(shell command -v pnpm 2> /dev/null)
ifndef PNPM
$(error pnpm is not available on your system, please install npm)
endif

app_name=web
Expand Down Expand Up @@ -33,8 +33,8 @@ build: build-web copy-config

.PHONY: build-web
build-web:
$(YARN) install --immutable
$(YARN) build
$(PNPM) install
$(PNPM) build

.PHONY: copy-config
copy-config:
Expand All @@ -60,8 +60,8 @@ package-ocx: ocx-app-config sign ocx-app-bundle

.PHONY: package-licenses
package-licenses:
yarn licenses:csv
yarn licenses:save
pnpm licenses:csv
pnpm licenses:save
cd $(third_party_licenses_dir) && tar -czf $(CURDIR)/release/third-party-licenses.tar.gz -C $(third_party_licenses_dir) *

.PHONY: sign
Expand Down
2 changes: 1 addition & 1 deletion docs/backend-oc10.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ In the local Web checkout, copy the `config/config.json.sample-oc10` file to `co
## Running Web

- if running from source, make sure to [build Web]({{< ref "./building.md" >}}) first
- run by launching a rollup dev server `yarn serve`
- run by launching a rollup dev server `pnpm serve`
- when working on the Web code, rollup will recompile the code automatically

## Running acceptance tests
Expand Down
4 changes: 2 additions & 2 deletions docs/backend-ocis.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ geekdocFilePath: backend-ocis.md
## Setting up Web

- Clone the [repository](https://github.com/owncloud/web/)
- Initally install all dependencies by running `yarn install`
- Initally install all dependencies by running `pnpm install`
- Copy `./config/config.json.sample-ocis` to `./config/config.json` and adjust values if required

## Running Web

- Start bundling web with a watcher by running `yarn build:w`
- Start bundling web with a watcher by running `pnpm build:w`

## Setting up oCIS

Expand Down
6 changes: 3 additions & 3 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ geekdocFilePath: building.md

## Building ownCloud Web

- Run `yarn install` to install dependencies
- Run `yarn build` to build Web and all apps included in the `packages` folder
- Run `pnpm install` to install dependencies
- Run `pnpm build` to build Web and all apps included in the `packages` folder

## Updating dependencies

- Run `yarn upgrade` to update dependencies
- Run `pnpm upgrade` to update dependencies

## Building the documentation

Expand Down
4 changes: 2 additions & 2 deletions docs/custom-apps/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This page documents how you can set up an example app within your frontend repo
## Setting up the example "skeleton app"

{{< hint info >}}
This guide assumes you have either an oCIS or ownCloud 10 backend running and followed the [getting started guide]({{< ref "../getting-started.md" >}}) for setting up a development environment with the `web` frontend, having it running via either `yarn serve` or `yarn build:w`. You should be able to use the web UI on localhost using the respective port you've assigned (defaults are `:8080` for OC10 and `:9200` for oCIS) and see changes to your .
This guide assumes you have either an oCIS or ownCloud 10 backend running and followed the [getting started guide]({{< ref "../getting-started.md" >}}) for setting up a development environment with the `web` frontend, having it running via either `pnpm serve` or `pnpm build:w`. You should be able to use the web UI on localhost using the respective port you've assigned (defaults are `:8080` for OC10 and `:9200` for oCIS) and see changes to your .
{{< /hint >}}

From the root of the [web repository](https://github.com/owncloud/web), change into the example skeleton app by running
Expand All @@ -32,7 +32,7 @@ cd packages/web-app-skeleton/
Then, you can install the necessary dependencies, bundle the code and start a development server by running

```sh
yarn install && yarn serve
pnpm install && pnpm serve
```

In your terminal, you should see a success message and rollup (our bundler of choice) serving the content under `localhost:3000`. However, there's nothing to find under this address.
Expand Down
Loading

0 comments on commit 3da7395

Please sign in to comment.