Skip to content

Commit

Permalink
OHRI-2043 Yarn v4 and migrates monorepo to use yarn workspaces (UCSF-…
Browse files Browse the repository at this point in the history
…IGHS#1750)

* OHRI-2043 Yarn v4 and migrates monorepo to use yarn workspaces

* updates ci publish to yarn
  • Loading branch information
pirupius authored Jan 11, 2024
1 parent 689dd4b commit e294482
Show file tree
Hide file tree
Showing 9 changed files with 6,326 additions and 10,048 deletions.
54 changes: 29 additions & 25 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '18'

- name: Cache dependencies
id: cache
Expand Down Expand Up @@ -62,10 +62,11 @@ jobs:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/dev' }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'

- name: Cache dependencies
Expand All @@ -79,37 +80,40 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable

- run: yarn lerna version "$(node -e "console.log(require('./lerna.json').version)")-pre.${{ github.run_number }}" --no-git-tag-version --yes
- name: Version
run: yarn workspaces foreach --worktree --topological --exclude @ohri/openmrs-esm-ohri version "$(node -e "console.log(require('semver').inc(require('./package.json').version, 'patch'))")-pre.${{ github.run_number }}"

# Disable the step to updated configs of migration
# - name: Test and Generate Badges
# run: yarn badges
- name: Build
run: yarn turbo run build --color --concurrency=5

- name: setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: commit
run: |
git add .
git commit -m "Prerelease version" --no-verify
- run: yarn run ci:prepublish
- run: git config user.email "<>" && git config user.name "GitHub Actions Bot"
- run: git add . && git commit -m "Prerelease version" --no-verify

- name: Pre-release
run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn run ci:prepublish
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: packages
path: |
packages/**/dist
release:
runs-on: ubuntu-latest

needs: pre_release
needs: build

if: ${{ github.event_name == 'release' }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '18'
registry-url: 'https://registry.npmjs.org'

- name: Cache dependencies
Expand All @@ -123,8 +127,8 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable

- name: Publish to NPM
run: yarn run ci:publish
- run: yarn turbo run build --color
- run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn run ci:publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

Expand Down
541 changes: 0 additions & 541 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

783 changes: 0 additions & 783 deletions .yarn/releases/yarn-3.2.2.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.2.cjs

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
nodeLinker: node-modules
compressionLevel: mixed

enableGlobalCache: false

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.2.2.cjs
yarnPath: .yarn/releases/yarn-4.0.2.cjs
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ OpenMRS HIV Reference Implementation (OHRI) packages built on top of OpenMRS Fro

* [Node](https://nodejs.org/en/download/)
* [Git](https://git-scm.com/downloads)
* [Yarn](https://yarnpkg.com)

### Setup OHRI Module

Expand Down
14 changes: 0 additions & 14 deletions lerna.json

This file was deleted.

15 changes: 5 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,12 @@
"test": "jest --config jest.config.js --verbose false --passWithNoTests",
"test-watch": "jest --watch --config jest.config.js",
"verify": "turbo run lint && turbo run typescript && yarn test --coverage",
"ci:prepublish": "lerna publish from-package --no-git-reset --yes --dist-tag next",
"ci:prerelease": "lerna version prerelease --no-git-tag-version --yes",
"ci:publish": "lerna publish from-package --yes",
"ci:release": "lerna version --no-git-tag-version",
"ci:prepublish": "yarn workspaces foreach --all --topological --exclude @ohri/openmrs-esm-ohri npm publish --access public --tag next",
"ci:publish": "yarn workspaces foreach --all --topological --exclude @ohri/openmrs-esm-ohri npm publish --access public --tag latest",
"release": "yarn workspaces foreach --all --topological version",
"coverage": "yarn test --coverage",
"badges": "yarn coverage && yarn jest-coverage-badges --output './badges' ",
"extract-translations": "lerna run extract-translations -- --config ../../tools/i18next-parser.config.js",
"ci:publish-next": "lerna publish from-package --no-git-reset --dist-tag next --yes",
"ci:publish-next-patch": "lerna version patch && lerna publish from-package --no-git-reset --dist-tag next --yes",
"release": "lerna version --no-git-tag-version",
"extract-translations": "turbo extract-translations -- --config ../../tools/i18next-parser.config.js",
"ci:bump-form-engine-lib": "yarn up @openmrs/openmrs-form-engine-lib@next"
},
"devDependencies": {
Expand Down Expand Up @@ -75,7 +71,6 @@
"jest-cli": "^28.1.2",
"jest-coverage-badges": "1.1.2",
"jest-environment-jsdom": "^28.1.2",
"lerna": "^4.0.0",
"lodash": "^4.17.21",
"openmrs": "next",
"prettier": "^2.2.1",
Expand All @@ -100,5 +95,5 @@
"@types/react": "^18.0.14",
"@types/react-dom": "^18.0.5"
},
"packageManager": "yarn@3.2.2"
"packageManager": "yarn@4.0.2"
}
Loading

0 comments on commit e294482

Please sign in to comment.