Skip to content

Commit

Permalink
chore: upgrade to yarn v4 and deprecate turborepo
Browse files Browse the repository at this point in the history
  • Loading branch information
hientominh committed Dec 24, 2024
1 parent 61221db commit ebff1e1
Show file tree
Hide file tree
Showing 35 changed files with 29,677 additions and 271 deletions.
36 changes: 1 addition & 35 deletions .github/workflows/jan-electron-linter-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,9 @@ jobs:
- name: Linter and test
run: |
npm config set registry ${{ secrets.NPM_PROXY }} --global
yarn config set registry ${{ secrets.NPM_PROXY }} --global
make test
env:
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
TURBO_API: '${{ secrets.TURBO_API }}'
TURBO_TEAM: 'macos'
TURBO_TOKEN: '${{ secrets.TURBO_TOKEN }}'

test-on-macos-pr-target:
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
Expand All @@ -131,8 +126,6 @@ jobs:
- name: Linter and test
run: |
npm config set registry https://registry.npmjs.org --global
yarn config set registry https://registry.npmjs.org --global
make test
env:
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
Expand Down Expand Up @@ -182,13 +175,8 @@ jobs:
- name: Linter and test
shell: powershell
run: |
npm config set registry ${{ secrets.NPM_PROXY }} --global
yarn config set registry ${{ secrets.NPM_PROXY }} --global
make test
env:
TURBO_API: '${{ secrets.TURBO_API }}'
TURBO_TEAM: 'windows'
TURBO_TOKEN: '${{ secrets.TURBO_TOKEN }}'
test-on-windows-pr:
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
runs-on: windows-desktop-default-windows-security
Expand Down Expand Up @@ -230,13 +218,7 @@ jobs:
- name: Linter and test
shell: powershell
run: |
npm config set registry ${{ secrets.NPM_PROXY }} --global
yarn config set registry ${{ secrets.NPM_PROXY }} --global
make test
env:
TURBO_API: '${{ secrets.TURBO_API }}'
TURBO_TEAM: 'windows'
TURBO_TOKEN: '${{ secrets.TURBO_TOKEN }}'
test-on-windows-pr-target:
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
Expand Down Expand Up @@ -268,8 +250,6 @@ jobs:
- name: Linter and test
shell: powershell
run: |
npm config set registry https://registry.npmjs.org --global
yarn config set registry https://registry.npmjs.org --global
make test
test-on-ubuntu:
Expand Down Expand Up @@ -311,13 +291,7 @@ jobs:
run: |
export DISPLAY=$(w -h | awk 'NR==1 {print $2}')
echo -e "Display ID: $DISPLAY"
npm config set registry ${{ secrets.NPM_PROXY }} --global
yarn config set registry ${{ secrets.NPM_PROXY }} --global
make test
env:
TURBO_API: '${{ secrets.TURBO_API }}'
TURBO_TEAM: 'linux'
TURBO_TOKEN: '${{ secrets.TURBO_TOKEN }}'
- uses: actions/upload-artifact@v4
if: always()
Expand Down Expand Up @@ -359,15 +333,9 @@ jobs:
run: |
export DISPLAY=$(w -h | awk 'NR==1 {print $2}')
echo -e "Display ID: $DISPLAY"
npm config set registry ${{ secrets.NPM_PROXY }} --global
yarn config set registry ${{ secrets.NPM_PROXY }} --global
make lint
yarn build:test
yarn test:coverage
env:
TURBO_API: '${{ secrets.TURBO_API }}'
TURBO_TEAM: 'linux'
TURBO_TOKEN: '${{ secrets.TURBO_TOKEN }}'
- name: Generate Code Coverage report
id: code-coverage
Expand Down Expand Up @@ -403,6 +371,4 @@ jobs:
run: |
export DISPLAY=$(w -h | awk 'NR==1 {print $2}')
echo -e "Display ID: $DISPLAY"
npm config set registry https://registry.npmjs.org --global
yarn config set registry https://registry.npmjs.org --global
make test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ error.log
node_modules
*.tgz
!charts/server/charts/*.tgz
yarn.lock
dist
build
.DS_Store
Expand Down
2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nmHoistingLimits: workspaces
nodeLinker: node-modules
25 changes: 13 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,22 @@ REPORT_PORTAL_DESCRIPTION ?= "Jan App report"
all:
@echo "Specify a target to run"

# Config yarn version

config-yarn:
corepack enable
corepack prepare [email protected] --activate
yarn --version

# Builds the UI kit
build-joi:
ifeq ($(OS),Windows_NT)
cd joi && yarn config set network-timeout 300000 && yarn install && yarn build
else
build-joi: config-yarn
cd joi && yarn install && yarn build
endif

# Installs yarn dependencies and builds core and extensions
install-and-build: build-joi
ifeq ($(OS),Windows_NT)
yarn config set network-timeout 300000
echo "skip"
endif
yarn global add [email protected]
yarn build:core
yarn build:server
yarn install
Expand Down Expand Up @@ -117,9 +119,8 @@ build: check-file-counts

clean:
ifeq ($(OS),Windows_NT)
-powershell -Command "Get-ChildItem -Path . -Include node_modules, .next, dist, build, out, .turbo -Recurse -Directory | Remove-Item -Recurse -Force"
-powershell -Command "Get-ChildItem -Path . -Include package-lock.json -Recurse -File | Remove-Item -Recurse -Force"
-powershell -Command "Get-ChildItem -Path . -Include yarn.lock -Recurse -File | Remove-Item -Recurse -Force"
-powershell -Command "Get-ChildItem -Path . -Include node_modules, .next, dist, build, out, .turbo, .yarn -Recurse -Directory | Remove-Item -Recurse -Force"
-powershell -Command "Get-ChildItem -Path . -Include package-lock.json, tsconfig.tsbuildinfo -Recurse -File | Remove-Item -Recurse -Force"
-powershell -Command "Remove-Item -Recurse -Force ./pre-install/*.tgz"
-powershell -Command "Remove-Item -Recurse -Force ./extensions/*/*.tgz"
-powershell -Command "Remove-Item -Recurse -Force ./electron/pre-install/*.tgz"
Expand All @@ -131,8 +132,8 @@ else ifeq ($(shell uname -s),Linux)
find . -name "build" -type d -exec rm -rf '{}' +
find . -name "out" -type d -exec rm -rf '{}' +
find . -name ".turbo" -type d -exec rm -rf '{}' +
find . -name ".yarn" -type d -exec rm -rf '{}' +
find . -name "packake-lock.json" -type f -exec rm -rf '{}' +
find . -name "yarn.lock" -type f -exec rm -rf '{}' +
find . -name "package-lock.json" -type f -exec rm -rf '{}' +
rm -rf ./pre-install/*.tgz
rm -rf ./extensions/*/*.tgz
Expand All @@ -146,8 +147,8 @@ else
find . -name "build" -type d -exec rm -rf '{}' +
find . -name "out" -type d -exec rm -rf '{}' +
find . -name ".turbo" -type d -exec rm -rf '{}' +
find . -name ".yarn" -type d -exec rm -rf '{}' +
find . -name "package-lock.json" -type f -exec rm -rf '{}' +
find . -name "yarn.lock" -type f -exec rm -rf '{}' +
rm -rf ./pre-install/*.tgz
rm -rf ./extensions/*/*.tgz
rm -rf ./electron/pre-install/*.tgz
Expand Down
11 changes: 6 additions & 5 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
],
"homepage": "https://jan.ai",
"license": "AGPL-3.0",
"browser": "dist/core.es5.js",
"main": "dist/core.es5.js",
"module": "dist/core.cjs.js",
"module": "dist/index.cjs.js",
"typings": "dist/types/index.d.ts",
"files": [
"dist",
Expand All @@ -36,13 +37,13 @@
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
"test": "jest",
"prebuild": "rimraf dist",
"build": "tsc --module commonjs && rollup -c rollup.config.ts",
"start": "rollup -c rollup.config.ts -w"
"build": "rollup -c rollup.config.ts"
},
"devDependencies": {
"@rollup/plugin-replace": "^5.0.5",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.4",
"@types/node": "^22.10.0",
"@types/pacote": "^11.1.8",
"eslint": "8.57.0",
"eslint-plugin-jest": "^27.9.0",
"jest": "^29.7.0",
Expand All @@ -63,5 +64,5 @@
"rxjs": "^7.8.1",
"ulidx": "^2.3.0"
},
"packageManager": "yarn@1.22.22"
"packageManager": "yarn@4.5.3"
}
8 changes: 4 additions & 4 deletions core/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export default [
// Allow json resolution
json(),
// Compile TypeScript files
typescript({ useTsconfigDeclarationDir: true }),
typescript({ useTsconfigDeclarationDir: true}),
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
commonjs(),
// commonjs(),
// Allow node_modules resolution, so you can use 'external' to control
// which external modules to include in the bundle
// https://github.com/rollup/rollup-plugin-node-resolve#usage
Expand Down Expand Up @@ -70,7 +70,7 @@ export default [
// Allow json resolution
json(),
// Compile TypeScript files
typescript({ useTsconfigDeclarationDir: true }),
typescript({ useTsconfigDeclarationDir: true}),
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
commonjs(),
// Allow node_modules resolution, so you can use 'external' to control
Expand All @@ -82,4 +82,4 @@ export default [
sourceMaps(),
],
},
]
]
4 changes: 1 addition & 3 deletions core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"declarationDir": "dist/types",
"outDir": "dist/lib",
"importHelpers": true,
"types": ["@types/jest"],
"resolveJsonModule": true
},
"include": ["src"],
"exclude": ["**/*.test.ts"]
}
}
3 changes: 1 addition & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,5 @@
"postcss": "^8",
"prettier": "^3.2.5",
"typescript": "^5"
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
}
14 changes: 7 additions & 7 deletions electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@
},
"dependencies": {
"@alumna/reflect": "^1.1.3",
"@janhq/core": "link:./core",
"@janhq/server": "link:./server",
"@janhq/core": "link:../core",
"@janhq/server": "link:../server",
"@kirillvakalov/nut-tree__nut-js": "4.2.1-2",
"@npmcli/arborist": "^7.1.0",
"electron-store": "^8.1.0",
"electron-updater": "^6.1.7",
Expand All @@ -108,12 +109,12 @@
"pacote": "^17.0.4",
"request": "^2.88.2",
"request-progress": "^3.0.0",
"ulidx": "^2.3.0",
"@kirillvakalov/nut-tree__nut-js": "4.2.1-2"
"ulidx": "^2.3.0"
},
"devDependencies": {
"@electron/notarize": "^2.5.0",
"@playwright/test": "^1.38.1",
"@reportportal/agent-js-playwright": "^5.1.7",
"@types/npmcli__arborist": "^5.6.4",
"@types/pacote": "^11.1.7",
"@types/request": "^2.48.12",
Expand All @@ -128,11 +129,10 @@
"eslint-plugin-react": "^7.34.0",
"rimraf": "^5.0.5",
"run-script-os": "^1.1.6",
"typescript": "^5.3.3",
"@reportportal/agent-js-playwright": "^5.1.7"
"typescript": "^5.3.3"
},
"installConfig": {
"hoistingLimits": "workspaces"
},
"packageManager": "yarn@1.22.22"
"packageManager": "yarn@4.5.3"
}
2 changes: 2 additions & 0 deletions extensions/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nmHoistingLimits: workspaces
nodeLinker: node-modules
15 changes: 9 additions & 6 deletions extensions/assistant-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"clean:modules": "rimraf node_modules/pdf-parse/test && cd node_modules/pdf-parse/lib/pdf.js && rimraf v1.9.426 v1.10.88 v2.0.550",
"build-universal-hnswlib": "cd node_modules/hnswlib-node && arch -x86_64 npx node-gyp rebuild --arch=x64 && mv build/Release/addon.node ./addon-amd64.node && node-gyp rebuild --arch=arm64 && mv build/Release/addon.node ./addon-arm64.node && lipo -create -output build/Release/addon.node ./addon-arm64.node ./addon-amd64.node && rm ./addon-arm64.node && rm ./addon-amd64.node",
"build": "yarn clean:modules && tsc --module commonjs && rollup -c rollup.config.ts",
"build:publish:linux": "rimraf *.tgz --glob && yarn build && npm pack && cpx *.tgz ../../pre-install",
"build:publish:darwin": "rimraf *.tgz --glob && yarn build-universal-hnswlib && yarn build && ../../.github/scripts/auto-sign.sh && npm pack && cpx *.tgz ../../pre-install",
"build:publish:win32": "rimraf *.tgz --glob && yarn build && npm pack && cpx *.tgz ../../pre-install",
"build:publish:linux": "rimraf *.tgz --glob || true && yarn build && npm pack && cpx *.tgz ../../pre-install",
"build:publish:darwin": "rimraf *.tgz --glob || true && yarn build-universal-hnswlib && yarn build && ../../.github/scripts/auto-sign.sh && npm pack && cpx *.tgz ../../pre-install",
"build:publish:win32": "rimraf *.tgz --glob || true && yarn build && npm pack && cpx *.tgz ../../pre-install",
"build:publish": "run-script-os"
},
"devDependencies": {
Expand All @@ -28,8 +28,8 @@
"rollup-plugin-define": "^1.0.1",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-typescript2": "^0.36.0",
"typescript": "^5.3.3",
"run-script-os": "^1.1.6"
"run-script-os": "^1.1.6",
"typescript": "^5.3.3"
},
"dependencies": {
"@janhq/core": "file:../../core",
Expand All @@ -48,5 +48,8 @@
"@janhq/core",
"hnswlib-node"
],
"packageManager": "[email protected]"
"installConfig": {
"hoistingLimits": "workspaces"
},
"packageManager": "[email protected]"
}
8 changes: 6 additions & 2 deletions extensions/conversational-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"scripts": {
"test": "jest",
"build": "tsc -b . && webpack --config webpack.config.js",
"build:publish": "rimraf *.tgz --glob && yarn build && npm pack && cpx *.tgz ../../pre-install"
"build:publish": "rimraf *.tgz --glob || true && yarn build && npm pack && cpx *.tgz ../../pre-install"
},
"exports": {
".": "./dist/index.js",
Expand All @@ -19,6 +19,7 @@
"cpx": "^1.5.0",
"rimraf": "^3.0.2",
"ts-loader": "^9.5.0",
"typescript": "^5.7.2",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
},
Expand All @@ -36,5 +37,8 @@
"README.md"
],
"bundleDependencies": [],
"packageManager": "[email protected]"
"installConfig": {
"hoistingLimits": "workspaces"
},
"packageManager": "[email protected]"
}
12 changes: 8 additions & 4 deletions extensions/inference-anthropic-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"scripts": {
"test": "jest test",
"build": "tsc -b . && webpack --config webpack.config.js",
"build:publish": "rimraf *.tgz --glob && yarn build && npm pack && cpx *.tgz ../../pre-install",
"build:publish": "rimraf *.tgz --glob || true && yarn build && npm pack && cpx *.tgz ../../pre-install",
"sync:core": "cd ../.. && yarn build:core && cd extensions && rm yarn.lock && cd inference-anthropic-extension && yarn && yarn build:publish"
},
"exports": {
Expand All @@ -21,9 +21,10 @@
"devDependencies": {
"cpx": "^1.5.0",
"rimraf": "^3.0.2",
"ts-loader": "^9.5.0",
"typescript": "^5.7.2",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4",
"ts-loader": "^9.5.0"
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@janhq/core": "file:../../core",
Expand All @@ -41,5 +42,8 @@
"bundleDependencies": [
"fetch-retry"
],
"packageManager": "[email protected]"
"installConfig": {
"hoistingLimits": "workspaces"
},
"packageManager": "[email protected]"
}
Loading

0 comments on commit ebff1e1

Please sign in to comment.