Skip to content

Commit

Permalink
chore: update yarn to latest version (4.4.0) (#199)
Browse files Browse the repository at this point in the history
Updated yarn to the latest version 4.4.0 (yarn berry)
Had to resort to using the yarn pack workaround, there seems to be an
issue with yarn file: protocol when the dependency is pointing to the
top directory
yarnpkg/berry#3580 (comment)


There is a very noticeable performance improvement on CI when running
the tests, especially on windows

| master | yarn 4 |
|--------|--------|
|
![image](https://github.com/user-attachments/assets/65ac8d57-8f82-495a-8e4f-1ddec09ee53a)
|
![image](https://github.com/user-attachments/assets/db4b2170-5860-4a01-95a0-a3836bb7fc8c)
|
  • Loading branch information
danielpza authored Aug 7, 2024
1 parent 2e0d861 commit 2581926
Show file tree
Hide file tree
Showing 10 changed files with 11,732 additions and 8,294 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- run: corepack enable
- run: corepack enable ${{ matrix.os == 'windows-latest' && '--install-directory C:\npm\prefix' || '' }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
Expand All @@ -35,13 +35,18 @@ jobs:
cache: yarn
cache-dependency-path: "**/yarn.lock"

- run: yarn install --frozen-lockfiles
- run: yarn install

- run: yarn build

- name: Generate package archive
run: yarn pack

- name: Install dependencies for testing
run: yarn install --frozen-lockfiles
run: yarn install
working-directory: test
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false

- name: Test
working-directory: test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
cache-dependency-path: "**/yarn.lock"

- name: Install Packages
run: yarn install --frozen-lockfile
run: yarn install

- name: Build
run: yarn build
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ fabric.properties
# Editor-based Rest Client
.idea/httpRequests

test/out.tgz
package.tgz
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
17 changes: 7 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@
"types": "types/index.d.ts",
"scripts": {
"compile": "tsc",
"build": "yarn run clean && yarn run compile",
"test": "yarn --cwd test test",
"build": "rm -rf dist && yarn run clean && yarn run compile",
"test": "yarn test/ install && yarn test/ add-package && yarn test/ test",
"release": "standard-version",
"--------------": "",
"format": "prettier --write .",
"clean": "rimraf -g dist \"**/*.tsbuildinfo\" ./test/projects/nx/dist",
"clean:all": "yarn run clean && rimraf -g node_modules \"**/node_modules\" \"**/yarn.lock\" yarn.lock",
"clean": "rm -rf dist \"**/*.tsbuildinfo\" ./test/projects/nx/dist",
"clean:all": "yarn run clean && rm -rf node_modules \"**/node_modules\" \"**/yarn.lock\" yarn.lock",
"reset": "yarn run clean:all && yarn install && yarn build",
"-------------- ": "",
"prepack": "yarn build",
"pretest": "yarn --cwd test install",
"prebuild": "rimraf -g dist"
"prepack": "yarn build"
},
"keywords": [
"typescript",
Expand Down Expand Up @@ -58,10 +56,9 @@
"@types/minimatch": "^5.1.2",
"@types/node": "^18.19.43",
"@types/ts-expose-internals": "npm:[email protected]",
"@types/ts-node": "npm:ts-node@^10.9.2",
"prettier": "^3.3.3",
"rimraf": "^5.0.10",
"standard-version": "^9.5.0",
"@types/ts-node": "npm:ts-node@^10.9.2",
"ts-patch": "^3.2.1",
"typescript": "^5.5.4"
},
Expand All @@ -71,5 +68,5 @@
"dependencies": {
"minimatch": "^3.1.2"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
"packageManager": "yarn@4.4.0+sha512.91d93b445d9284e7ed52931369bc89a663414e5582d00eea45c67ddc459a2582919eece27c412d6ffd1bd0793ff35399381cb229326b961798ce4f4cc60ddfdb"
}
18 changes: 7 additions & 11 deletions test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"license": "MIT",
"scripts": {
"test": "jest",
"prepare": "node prepare.js"
"g:ts-node": "cd $INIT_CWD && ts-node",
"add-package": "yarn ../ pack && yarn add ../package.tgz",
"postinstall": "node prepare.js"
},
"devDependencies": {
"@nrwl/cli": "^15.9.7",
Expand All @@ -23,15 +25,9 @@
"typescript": "^5.5.4",
"typescript-four-seven": "npm:[email protected]",
"typescript-three": "npm:[email protected]",
"typescript-transform-paths": "file:../"
"typescript-transform-paths": "../package.tgz"
},
"workspaces": {
"packages": [
"projects/*"
],
"nohoist": [
"**/semver/*",
"**/ts-patch/*"
]
}
"workspaces": [
"projects/*"
]
}
4 changes: 2 additions & 2 deletions test/tests/extras.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ describe(`Extra Tests`, () => {

describe(`ts-node register script`, () => {
test(`Works with --transpileOnly`, () => {
const res = execSync("yarn run --silent ts-node --transpileOnly src/index.ts", { cwd: projectRoot }).toString();
const res = execSync("yarn g:ts-node --transpileOnly src/index.ts", { cwd: projectRoot }).toString();
expect(stripAnsi(res)).toMatch(/^null($|\r?\n)/m);
});

test(`Works with --typeCheck`, () => {
const res = execSync("yarn run --silent ts-node --typeCheck src/index.ts", { cwd: projectRoot }).toString();
const res = execSync("yarn g:ts-node --typeCheck src/index.ts", { cwd: projectRoot }).toString();
expect(stripAnsi(res)).toMatch(/^null($|\r?\n)/);
});
});
Expand Down
Loading

0 comments on commit 2581926

Please sign in to comment.