Skip to content

Commit

Permalink
gergo/yarn (specklesystems#753)
Browse files Browse the repository at this point in the history
* yarn first go

* fix frontend build cache loader

* yarn workspaces built server Docker

* build(yarn): add workspaces plugin config

* chore(package defs): clean package*.json -s

* chore(gitignore): ignore yarn error log

* build(yarn): update yarn lock

* build(preview-service webpack): add extra resolved path to preview service webpack config

because of yarn package hoisting, there are no package level node_modules folder anymore.

* build(docker): update dockerignore with yarn specific configs

* build(docker): update Dockerfiles for yarn workspaces utilization

* ci(circleci): update server test job to yarn

* ci(circle): disable cache restore

* ci(circleci): trying the node orb yarn-run

* ci(circleci): yarn-run again

* ci(circleci): disable node orb

* ci(circleci): change base node image for tests

* ci(circleci): add yarn cache

* ci(circleci): remove node install step

* ci(circleci): add server specific cache archives

* ci(circleci): test build and publish

* ci(circleci): change npm auth method to suit yarn

* ci(circleci): trying new builder image

* ci(circleci): another base image, maybe this works

* ci(circleci): force a specific docker engine version

* ci(circleci): add yarn version plugin and its changes

* ci(circleci): cleanup and remove temp branch config

* chore(package defs): moving from npm run to yarn

* explicitly specifying webpack4 as a frontend dep

* chore(package defs): replace npm with yarn everywhere

* docs(root readme): update with some yarn specific docs

* chore(root workspace): update dev scripts and package lock

* ci(circleci): enable package publish step with yarn

Co-authored-by: Fabians <[email protected]>
  • Loading branch information
gjedlicska and fabis94 authored May 19, 2022
1 parent fb5f49c commit 638969c
Show file tree
Hide file tree
Showing 42 changed files with 26,856 additions and 153,309 deletions.
98 changes: 69 additions & 29 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
version: 2.1

orbs:
node: circleci/[email protected]

workflows:
version: 2

Expand All @@ -20,6 +17,7 @@ workflows:
branches:
only:
- main

- docker-build-and-publish-server:
filters: *filters-build
context: &docker-hub-context
Expand Down Expand Up @@ -81,16 +79,16 @@ workflows:
- docker-build-and-publish-monitor-container
- docker-build-and-publish-test-container

# - publish-npm:
# filters:
# tags:
# only: *filters-tag
# branches:
# ignore: /.*/
# context:
# - npm-registry
# requires:
# - get-version
- publish-npm:
filters:
tags:
only: *filters-tag
branches:
ignore: /.*/
context:
- npm-registry
requires:
- get-version

jobs:
get-version:
Expand All @@ -115,7 +113,7 @@ jobs:

test-server:
docker:
- image: cimg/node:lts
- image: cimg/node:16.15
- image: cimg/redis:6.2.6
- image: 'cimg/postgres:12.8'
environment:
Expand All @@ -132,16 +130,30 @@ jobs:
CANONICAL_URL: 'http://localhost:3000'
steps:
- checkout
- node/install-packages:
app-dir: ~/project/packages/server
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-server-{{ checksum "yarn.lock" }}
- run:
name: Install Dependencies
command: yarn workspaces focus
working_directory: 'packages/server'

- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-server-{{ checksum "yarn.lock" }}
paths:
- .yarn/cache
- .yarn/unplugged

- run: 'dockerize -wait tcp://localhost:5432 -timeout 1m'

- run:
command: touch .env.test
working_directory: 'packages/server'

- run:
command: npm run test:report
command: yarn test:report
working_directory: 'packages/server'

- run:
Expand All @@ -157,14 +169,17 @@ jobs:

docker-build-and-publish: &docker-job
docker: &docker-image
- image: cimg/python:3.9-node
- image: cimg/node:16.15
working_directory: *work-dir
steps:
- checkout
- attach_workspace:
at: /tmp/ci/workspace
- run: cat workspace/env-vars >> $BASH_ENV
- setup_remote_docker:
# a weird issue with yarn installing packages throwing EPERM errors
# this fixes it
version: 20.10.12
docker_layer_caching: true
- run:
name: Build and Publish
Expand Down Expand Up @@ -215,25 +230,50 @@ jobs:
- attach_workspace:
at: /tmp/ci/workspace
- run: cat workspace/env-vars >> $BASH_ENV

- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: restore packages
command: |
npm i
npx lerna bootstrap
# this has to be after lerna bootstrap
# otherwise the auth workflow of lerna is borked...
name: Install Dependencies
command: yarn

- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- .yarn/cache
- .yarn/unplugged

- run:
name: auth to npm as Speckle
command: |
echo "@speckle:registry=https://registry.npmjs.org" >> .npmrc
echo "registry=http://registry.npmjs.org/" >> .npmrc
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
echo "npmRegistryServer: https://registry.npmjs.org/" >> .yarnrc.yml
echo "npmAuthToken: ${NPM_TOKEN}" >> .yarnrc.yml
- run:
name: try login to npm
command: npm whoami
command: yarn npm whoami

- run:
name: build public packages
command: yarn workspaces foreach -ptv --no-private run build
- run:
name: bump all versions
# bump all versions in dependency tree order but not in parallel
command: yarn workspaces foreach -tv version $IMAGE_VERSION_TAG

- run:
name: publish to npm
command: npx lerna publish $IMAGE_VERSION_TAG -y --no-git-tag-version --no-push
command: 'yarn workspaces foreach -pv --no-private npm publish --access public --tag next'

# - run:
# name: commit changes
# command: |
# yarn prettier:fix
# git add .
# git commit -m '[ci skip] bump version to $IMAGE_VERSION_TAG'
# git push

publish-helm-chart:
docker: *docker-image
Expand Down
10 changes: 9 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@ test-queries
.editorconfig
Contributing.md
ISSUE_TEMPLATE.md
lerna.json
**/.env
.env.example
.eslintrc.json
.mocharc.js
readme.md
**/Dockerfile

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,14 @@ packages/server/reports*
events.json

# Optional eslint cache
.eslintcache
.eslintcache

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

*yarn-error.log
550 changes: 550 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-version.cjs

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

785 changes: 785 additions & 0 deletions .yarn/releases/yarn-3.2.0.cjs

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions .yarn/versions/9222c3ef.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
undecided:
- '@speckle/fileimport-service'
- '@speckle/frontend'
- '@speckle/objectloader'
- '@speckle/preview-service'
- '@speckle/server'
- '@speckle/viewer'
- '@speckle/viewer-sandbox'
9 changes: 9 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: '@yarnpkg/plugin-version'

yarnPath: .yarn/releases/yarn-3.2.0.cjs
9 changes: 0 additions & 9 deletions lerna.json

This file was deleted.

Loading

0 comments on commit 638969c

Please sign in to comment.