Skip to content

Commit

Permalink
Update to node 18 and swap Lerna for Turbo (#1528)
Browse files Browse the repository at this point in the history
* Update to Node 18

See https://alokai.atlassian.net/wiki/spaces/KB/pages/510033965/WIP+Node+version+bump+for+Integrations+and+Storefronts

* Add turborepo

* Collect coverage only from unit tests

Because of turbo, unit tests and integration tests can run in
different order.

Before adding turbo, the test script was like "yarn test:unit && yarn
test:integration". If both tests generated coverage, in the coverage
folder there'd factually be the integration test coverage.

But now that they run out of order, we don't know what's in there.

Here I reverted to a state where coverage from unit tests is only
reported, as you normally collect coverage from unit tests.
  • Loading branch information
sethidden authored May 22, 2024
1 parent 574abe6 commit e4709f9
Show file tree
Hide file tree
Showing 10 changed files with 159 additions and 2,960 deletions.
7 changes: 7 additions & 0 deletions .changeset/large-hotels-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@vue-storefront/magento-api": major
"@vue-storefront/magento-types": major
"@vue-storefront/magento-sdk": major
---

Changed minimum Node version from 16 to 18. The condition that was forcing the Node version to be lower than 19 is also removed.
5 changes: 2 additions & 3 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ concurrency:
jobs:
continous-integration:
name: 'Continuous Integration'
uses: vuestorefront/vue-storefront/.github/workflows/ci-integrations.yml@main
uses: vuestorefront/vue-storefront/.github/workflows/ci-integrations.yml@turbo
secrets: inherit
with:
enterprise: false
node_version: '["16", "18"]'

sonarcloud-api-client:
name: 'SonarCloud API Client'
needs: [continous-integration]
uses: vuestorefront/vue-storefront/.github/workflows/sonarcloud-integrations.yml@main
uses: vuestorefront/vue-storefront/.github/workflows/sonarcloud-integrations.yml@turbo
secrets:
SONARCLOUD_TOKEN: ${{ secrets.SONARCLOUD_TOKEN_API_CLIENT }}
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,4 @@ dist
.graphqlconfig
.idea
docs.sh
.turbo
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
],
"scripts": {
"prepare": "husky install",
"build": "lerna run build",
"test": "lerna run test",
"test:unit": "lerna run test:unit",
"test:integration": "lerna run test:integration",
"lint": "lerna run lint",
"build": "turbo run build",
"test": "turbo run test",
"test:unit": "turbo run test:unit",
"test:integration": "turbo run test:integration",
"lint": "turbo run lint",
"ci": "turbo run build test:unit test:integration lint --cache-dir=.turbo",
"changesets:version": "yarn changeset version && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install && yarn prepare:docs",
"changesets:publish": "yarn build && yarn changeset publish",
"prepare:docs": "cd docs && yarn install && yarn api-extract && yarn copy-changelog"
Expand All @@ -30,13 +31,13 @@
"@vue-storefront/rollup-config": "^0.0.7",
"all-contributors-cli": "^6.20.0",
"esbuild": "^0.14.23",
"lerna": "^4.0.0",
"lint-staged": "^12.3.3",
"rimraf": "^5.0.0",
"turbo": "^1.13.3",
"typescript": "^5"
},
"engines": {
"node": ">=16.x.x",
"node": ">=18",
"yarn": "1.x.x||>=3.x.x"
},
"packageManager": "[email protected]"
Expand Down
4 changes: 2 additions & 2 deletions packages/api-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"dependencies": {
"@apollo/client": "3.8.7",
"@nuxtjs/composition-api": "0.31.0",
"@vue-storefront/middleware": "^3.9.0",
"@vue-storefront/magento-types": "1.2.0",
"@vue-storefront/middleware": "^3.9.0",
"agentkeepalive": "^4.2.1",
"consola": "^3.1.0",
"dotenv": "^16.0.1",
Expand Down Expand Up @@ -57,6 +57,6 @@
"registry": "https://registry.npmjs.org"
},
"engines": {
"node": ">=16.x < 19"
"node": ">=18"
}
}
7 changes: 3 additions & 4 deletions packages/api-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
"license": "MIT",
"scripts": {
"build": "rimraf lib && rollup -c",
"test": "yarn test:unit && yarn test:integration",
"test:unit": "echo 'No test step created for this package'",
"test:integration": "echo 'No test step created for this package'",
"lint": "echo 'Only GraphQL stuff here'",
"prepublish": "yarn build",
"dev": "rollup -c -w"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
},
"engines": {
"node": ">=18"
}
}
7 changes: 0 additions & 7 deletions packages/method-bootstrapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@
"bin": {
"mkmethod": "./index.js"
},
"scripts": {
"build": "echo Skip this step",
"test": "echo Skip this step",
"test:unit": "echo Skip this step",
"test:integration": "echo Skip this step",
"lint": "echo Skip this step"
},
"keywords": [],
"author": "",
"license": "ISC",
Expand Down
16 changes: 8 additions & 8 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@
"build": "rimraf lib server && rollup -c",
"test": "yarn test:unit && yarn test:integration",
"test:unit": "jest ./unit -c ./jest.config.unit.ts --coverage",
"test:integration": "jest ./integration -c ./jest.config.integration.ts --runInBand --coverage",
"test:integration": "jest ./integration -c ./jest.config.integration.ts --runInBand",
"lint": "eslint . --ext .ts,.js",
"prepublish": "yarn build",
"dev": "rimraf lib server && rollup -c -w"
},
"dependencies": {
"@apollo/client": "^3.6.9",
"@vue-storefront/magento-types": "^1.2.0",
"@vue-storefront/sdk": "^1.0.0",
"axios": "^0.27.2",
"@vue-storefront/sdk-axios-request-sender": "1.0.0",
"@apollo/client": "^3.6.9",
"ts-essentials": "^9.3.1",
"@vue-storefront/magento-types": "^1.2.0"
"axios": "^0.27.2",
"ts-essentials": "^9.3.1"
},
"devDependencies": {
"@types/node": "^12.12.14",
"@vue-storefront/magento-api": "^3.1.0",
"nock": "^13.2.9",
"@types/node": "^12.12.14"
"nock": "^13.2.9"
},
"peerDependencies": {
"@vue-storefront/middleware": "^3.5.0"
Expand All @@ -38,6 +38,6 @@
"registry": "https://registry.npmjs.org"
},
"engines": {
"node": ">=16.x < 19"
"node": ">=18"
}
}
27 changes: 27 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["lib/**", "server/**"]
},
"test:unit": {
// Sometimes in unit tests of SDK we refer to the "types" package of the integration
// so this means the dependencies of the packages need to be built
"dependsOn": ["^build"],
"inputs": ["src/**/*.ts", "__tests__/unit/**/*.ts"],
"outputs": ["coverage/**"]
},
"test:integration": {
// Similarly to unit tests, people just freely import stuff from subdeps :(
"dependsOn": ["^build"],
"inputs": ["src/**/*.ts", "__tests__/integration/**/*.ts"],
"outputs": ["coverage/**"]
},
"lint": {
// ESLint fails the 'is this import statement resolveable?' rule if the
// dependencies of some package aren't built
"dependsOn": ["^build"]
}
}
}
Loading

0 comments on commit e4709f9

Please sign in to comment.