diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml index 9edf18e..70bd9fc 100644 --- a/.circleci/test-deploy.yml +++ b/.circleci/test-deploy.yml @@ -176,16 +176,21 @@ jobs: pkg-manager: yarn cache-version: yarn-v3 app-dir: "~/project/sample" + - run: yarn --version - run: cd ~/project/sample && yarn test integration-test-yarn-berry: + environment: + YARN_ENABLE_IMMUTABLE_INSTALLS: false executor: name: node/default steps: - checkout + - run: mv ~/project/sample/package-berry.json ~/project/sample/package.json - node/install-packages: pkg-manager: yarn-berry - cache-version: yarn-berry-v1 + cache-version: yarn-berry-v2 app-dir: "~/project/sample" + override-ci-command: yarn install - run: cd ~/project/sample && yarn test workflows: diff --git a/sample/package-berry.json b/sample/package-berry.json new file mode 100644 index 0000000..523e443 --- /dev/null +++ b/sample/package-berry.json @@ -0,0 +1,42 @@ +{ + "name": "opd-server", + "packageManager": "yarn@4.3.0", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "dev": "nodemon --watch 'src/**/*.ts' --exec 'ts-node --require dotenv/config' src/index.ts", + "build": "tsc -h", + "start": "node dist/index.js", + "test": "jest jest-tests", + "testmocha": "mocha mocha-tests", + "test:coverage": "jest --coverage jest-tests" + }, + "author": "", + "license": "ISC", + "devDependencies": { + "@types/cors": "^2.8.12", + "@types/dotenv": "^8.2.0", + "@types/express": "^4.17.13", + "@types/node": "^17.0.0", + "@types/node-fetch": "^3.0.2", + "jest": "^27.4.5", + "jest-junit": "^13.0.0", + "mocha-junit-reporter": "2.0.2", + "mocha-multi": "1.1.5", + "nodemon": "^2.0.20", + "ts-node": "^10.4.0", + "tslint": "^6.1.1", + "typescript": "^4.5.4" + }, + "dependencies": { + "axios": "^0.28.0", + "axios-logger": "^2.6.0", + "cors": "^2.8.5", + "dotenv": "^10.0.0", + "express": "^4.19.2", + "mocha": "^9.1.3", + "node-fetch": "^3.2.10", + "yaml": "^1.10.2" + } +} diff --git a/src/commands/install-packages.yml b/src/commands/install-packages.yml index c521b0d..a4253b0 100644 --- a/src/commands/install-packages.yml +++ b/src/commands/install-packages.yml @@ -7,7 +7,9 @@ parameters: type: enum enum: ['npm', 'yarn', 'yarn-berry', 'pnpm'] default: 'npm' - description: Select the default node package manager to use. NPM v5+ Required. + description: | + Select the default node package manager to use. NPM v5+ Required. + To use yarn-berry your package.json must have packageManager set to a yarn berry version, otherwise it will use old yarn. with-cache: type: boolean default: true diff --git a/src/scripts/packages/yarn-berry-install.sh b/src/scripts/packages/yarn-berry-install.sh index a28398b..a095ce4 100644 --- a/src/scripts/packages/yarn-berry-install.sh +++ b/src/scripts/packages/yarn-berry-install.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash - +corepack enable --install-directory ~/bin # Run override ci command if provided, otherwise run default yarn install # See: https://yarnpkg.com/configuration/yarnrc/#cacheFolder if [[ -n "$PARAM_CACHE_PATH" ]]; then @@ -33,12 +33,12 @@ else set -- "$@" --check-cache fi - yarn install --immutable --immutable-cache "$@" + echo y | yarn install --immutable --immutable-cache "$@" if [[ "$PARAM_CHECK_CACHE" == "detect" && -n "$ENABLE_CHECK_CACHE" ]]; then cp yarn.lock "$YARN_LOCKFILE_PATH" fi else - yarn install --immutable + echo y | yarn install --immutable fi fi \ No newline at end of file