1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

Revert "fix: yarn v4 requires prepack instead of prepare script when building…" (#7373)

Reverts Unleash/unleash#7371
This commit is contained in:
Gastón Fournier 2024-06-12 13:25:51 +02:00 committed by GitHub
parent ffe1305934
commit a0fce0ec12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
39 changed files with 30966 additions and 46803 deletions

View File

@ -11,7 +11,3 @@
!README.md
!frontend
frontend/node_modules
!.yarn/**
!.yarnrc.yml
!frontend/.yarn/**
node_modules

View File

@ -40,9 +40,7 @@ jobs:
with:
node-version: 20.x
cache: 'yarn'
- run: yarn install --immutable
env:
YARN_ENABLE_SCRIPTS: false
- run: yarn install --frozen-lockfile --ignore-scripts
- run: yarn lint
- run: yarn build:backend
- run: yarn run test:report # This adds test results as github check to the workflow

View File

@ -1,47 +0,0 @@
name: PR -> Docker build
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
version: [ 20.14.0-alpine ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup QEmu
uses: docker/setup-qemu-action@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta configuration
uses: docker/metadata-action@v5
id: meta
with:
images: |
unleashorg/unleash-server
tags: |
# only enabled for workflow dispatch except main (assume its a release):
type=semver,pattern={{ version }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},value=${{ inputs.version }}
type=semver,pattern={{ major }}.{{ minor }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},value=${{ inputs.version }}
type=semver,pattern={{ major }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},value=${{ inputs.version }}
# only enabled in main:
type=edge,prefix=main-,suffix=-${{ matrix.version }},enable=${{ github.ref == 'refs/heads/main' }}
# only enabled on workflow_dispatch:
type=sha,suffix=-${{ matrix.version }},enable=${{ github.event_name == 'workflow_dispatch' }}
- name: Login to docker hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build tag and push image to Docker hub
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: NODE_VERSION=${{ matrix.version }}

View File

@ -19,8 +19,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20.x
- run: yarn --immutable
- run: yarn run lint:material:icons
- run: yarn --frozen-lockfile
- run: yarn run lint:check
- run: yarn run test
- run: yarn run ts:check # TODO: optimize

View File

@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [ 20.14.0-alpine ]
version: [20.13.1-alpine]
steps:
- name: Checkout tag v${{ inputs.version }}
if: ${{ inputs.version != '' }}
@ -53,6 +53,10 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build frontend
run: |
yarn --cwd ./frontend install
yarn build:frontend
- name: Build tag and push image to Docker hub
uses: docker/build-push-action@v5
with:

View File

@ -20,10 +20,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Run Cypress
uses: cypress-io/github-action@v6
uses: cypress-io/github-action@v5
with:
working-directory: frontend
env: AUTH_USER=admin,AUTH_PASSWORD=unleash4all
config: baseUrl=${{ github.event.deployment_status.target_url }}
spec: cypress/integration/${{ matrix.test }}
install-command: yarn --immutable

View File

@ -50,9 +50,9 @@ jobs:
YARN_1="yarn --mutex network --cwd ./current"
YARN_2="yarn --mutex network --cwd ./main"
$YARN_1 install &> /dev/null && $YARN_1 build:backend --strictNullChecks true 2> .stderr-current > .out-current &
$YARN_1 install --ignore-scripts &> /dev/null && $YARN_1 build:backend --strictNullChecks true 2> .stderr-current > .out-current &
pid1=$!
$YARN_2 install &> /dev/null && $YARN_2 build:backend --strictNullChecks true 2> .stderr-main > .out-main &
$YARN_2 install --ignore-scripts &> /dev/null && $YARN_2 build:backend --strictNullChecks true 2> .stderr-main > .out-main &
pid2=$!
# wait for the processes that are expected to fail

View File

@ -12,13 +12,12 @@ jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'yarn'
- name: Trigger sync
uses: actions/github-script@v7
env:
@ -43,7 +42,7 @@ jobs:
- name: Build static assets
run: |
cd frontend
yarn install --immutable
yarn install --frozen-lockfile
yarn build
- uses: aws-actions/configure-aws-credentials@v2
with:

View File

@ -30,7 +30,7 @@ jobs:
strategy:
matrix:
node-version: [ 20.x ]
node-version: [20.x]
steps:
- uses: actions/checkout@v4
@ -66,12 +66,10 @@ jobs:
else
echo "No changes to CHANGELOG.md"
fi
- run: yarn install --immutable
env:
YARN_ENABLE_SCRIPTS: false
- run: yarn install --frozen-lockfile --ignore-scripts
- name: npm version
run: |
npm version ${{ github.event.inputs.version }}
npm version ${{ github.event.inputs.version }} --ignore-scripts
git push origin ${{ github.ref_name }}
git push --tags
env:
@ -106,10 +104,8 @@ jobs:
run: git checkout origin/${{ github.ref_name }} -- CHANGELOG.md
- name: lint
run: |
yarn install --immutable
yarn install --frozen-lockfile --ignore-scripts
yarn lint:fix
env:
YARN_ENABLE_SCRIPTS: false
- name: push changes
run: |
git add package.json CHANGELOG.md

View File

@ -27,7 +27,7 @@ jobs:
cache: 'yarn'
- name: Build
run: |
yarn install --immutable
yarn install --frozen-lockfile
- name: Publish to npm
run: |
LATEST=$(npm show unleash-server version)

View File

@ -31,16 +31,14 @@ jobs:
env:
DATABASE_URL: postgres://postgres:unleash@localhost:5432/unleash
DATABASE_SSL: false
YARN_ENABLE_SCRIPTS: false
run: |
yarn install --immutable
yarn install --frozen-lockfile --ignore-scripts
yarn db-migrate up
# run ui tests against previous version of Unleash
- name: Run Cypress
uses: cypress-io/github-action@v6
uses: cypress-io/github-action@v5
with:
working-directory: frontend
env: AUTH_USER=admin,AUTH_PASSWORD=unleash4all
config: baseUrl=http://localhost:4242
spec: cypress/oss/**/*.spec.ts
install-command: yarn --immutable

21
.gitignore vendored
View File

@ -70,24 +70,3 @@ reports/jest-junit.xml
!.yarn/releases
!.yarn/sdks
!.yarn/versions
frontend/.yarn/*
!frontend/.yarn/patches
!frontend/.yarn/plugins
!frontend/.yarn/releases
!frontend/.yarn/sdks
!frontend/.yarn/versions
docker/.yarn/*
!docker/.yarn/patches
!docker/.yarn/plugins
!docker/.yarn/releases
!docker/.yarn/sdks
!docker/.yarn/versions
website/.yarn/*
!website/.yarn/patches
!website/.yarn/plugins
!website/.yarn/releases
!website/.yarn/sdks
!website/.yarn/versions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
yarn dlx lint-staged
npx lint-staged
node .husky/update-openapi-spec-list.js

File diff suppressed because one or more lines are too long

View File

@ -1,3 +0,0 @@
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-4.3.0.cjs

View File

@ -7,10 +7,6 @@ Before you begin:
- Have you read the [code of conduct](CODE_OF_CONDUCT.md)?
- Check out the [existing issues](https://github.com/unleash/Unleash/issues)
- Browse the [developer-guide](./website/docs/contributing/developer-guide.md) for tips on environment setup, running the tests, and running Unleash from source.
- You need
- Node 20
- corepack enabled `corepack enable`
- yarn installed globally `npm install -g yarn`
### Don't see your issue? Open one

View File

@ -6,9 +6,9 @@ WORKDIR /unleash
COPY . /unleash
RUN corepack enable
RUN yarn config set network-timeout 300000
RUN yarn install --immutable && yarn prepare:backend && yarn local:package
RUN yarn install --frozen-lockfile --ignore-scripts && yarn prepare:backend && yarn local:package
# frontend/build should already exist (it needs to be built in the local filesystem but in case of a fresh build we'll build it here)
RUN yarn build:frontend:if-needed
@ -17,7 +17,7 @@ RUN mkdir -p /unleash/build/frontend && mv /unleash/frontend/build /unleash/buil
WORKDIR /unleash/docker
RUN yarn workspaces focus -A --production
RUN yarn install --frozen-lockfile --production=true
FROM node:$NODE_VERSION

View File

@ -53,9 +53,7 @@
"src/test/examples/*.json",
".docusaurus",
"coverage",
"CHANGELOG.md",
"./package.json",
"./frontend/package.json"
"CHANGELOG.md"
]
},
"organizeImports": {
@ -76,9 +74,7 @@
"coverage",
"website/build",
"website/global.js",
".docusaurus",
"./package.json",
"./frontend/package.json"
".docusaurus"
],
"indentWidth": 4
},

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
yarnPath: .yarn/releases/yarn-4.3.0.cjs

View File

@ -14,9 +14,15 @@
"dependencies": {
"unleash-server": "file:../build"
},
"version": "5.12.4",
"resolutions": {
"async": "^3.2.4",
"db-migrate/rc/minimist": "^1.2.5",
"es5-ext": "0.10.64",
"knex/liftoff/object.map/**/kind-of": "^6.0.3",
"knex/liftoff/findup-sync/micromatc/kind-of": "^6.0.3",
"knex/liftoff/findup-sync/micromatc/nanomatch/kind-of": "^6.0.3",
"knex/liftoff/findup-sync/micromatch/define-property/**/kind-of": "^6.0.3",
"node-forge": "^1.0.0",
"set-value": "^4.0.1",
"ansi-regex": "^5.0.1",
@ -33,7 +39,5 @@
"ssh2": "^1.4.0",
"json-schema": "^0.4.0",
"semver": "^7.5.3"
},
"version": "6.0.1",
"packageManager": "yarn@4.3.0"
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,3 +0,0 @@
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-4.3.0.cjs

View File

@ -1,4 +1,3 @@
#!/usr/bin/env sh
if grep -R --include="*.js" --include="*.jsx" --include="*.ts" --include="*.tsx" "from '@mui/icons-material'" src; then
echo "Prohibited import from '@mui/icons-material' found. Use default imports referencing the file instead of the
global package. Example: import Delete from '@mui/icons-material/Delete';'"

View File

@ -2,10 +2,7 @@
"name": "unleash-frontend-local",
"version": "0.0.0",
"private": true,
"files": [
"index.js",
"build"
],
"files": ["index.js", "build"],
"engines": {
"node": ">=18"
},
@ -19,9 +16,9 @@
"start:demo2": "UNLEASH_API=https://sandbox.getunleash.io/ UNLEASH_BASE_PATH=/demo2/ yarn run start",
"start:enterprise": "UNLEASH_API=https://unleash.herokuapp.com VITE_TEST_REDIRECT=true yarn run start",
"start:demo": "UNLEASH_BASE_PATH=/demo/ UNLEASH_API=https://app.unleash-hosted.com/ yarn run start",
"test": "NODE_OPTIONS=\"${NODE_OPTIONS:-0} --no-experimental-fetch\" vitest run",
"test:snapshot": "NODE_OPTIONS=\"${NODE_OPTIONS:-0} --no-experimental-fetch\" yarn test -u",
"test:watch": "NODE_OPTIONS=\"${NODE_OPTIONS:-0} --no-experimental-fetch\" vitest watch",
"test": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" vitest run",
"test:snapshot": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" yarn test -u",
"test:watch": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" vitest watch",
"lint:material:icons": "./check-imports.rc",
"lint": "biome lint src --apply",
"lint:check": "biome check src",
@ -145,16 +142,11 @@
}
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"production": [">0.2%", "not dead", "not op_mini all"],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"packageManager": "yarn@4.3.0"
}
}

View File

@ -165,7 +165,7 @@ describe('NewFeatureStrategyCreate', () => {
expect(screen.getByText(expectedSegmentName)).toBeInTheDocument();
expect(screen.getByText(expectedConstraintValue)).toBeInTheDocument();
}, 10000);
});
test('should change variants settings', async () => {
const { expectedVariantName } = setupComponent();

File diff suppressed because it is too large Load Diff

View File

@ -36,18 +36,21 @@
"copy-templates": "copyfiles -u 1 src/mailtemplates/**/*.mustache dist/",
"build:backend": "tsc --pretty --strictNullChecks false",
"build:frontend": "yarn --cwd ./frontend run build",
"build:frontend:if-needed": "./scripts/build-frontend-if-needed.sh",
"build": "yarn run clean && concurrently \"yarn:copy-templates\" \"yarn:build:frontend\" \"yarn:build:backend\"",
"build:frontend:if-needed": "if [ ! -d ./frontend/build ]; then yarn install --cwd ./frontend --frozen-lockfile --ignore-scripts && yarn build:frontend; fi",
"build": "concurrently \"yarn:copy-templates\" \"yarn:build:frontend\" \"yarn:build:backend\"",
"dev:backend": "TZ=UTC NODE_ENV=development tsc-watch --strictNullChecks false --onSuccess \"node dist/server-dev.js\"",
"dev:frontend": "wait-on tcp:4242 && yarn --cwd ./frontend run dev",
"dev": "concurrently \"yarn:dev:backend\" \"yarn:dev:frontend\"",
"prepare:backend": "concurrently \"yarn:copy-templates\" \"yarn:build:backend\"",
"start:dev": "yarn run clean && TZ=UTC NODE_ENV=development tsc-watch --strictNullChecks false --onSuccess \"node dist/server-dev.js\"",
"prestart:dev": "yarn run clean",
"start:dev": "TZ=UTC NODE_ENV=development tsc-watch --strictNullChecks false --onSuccess \"node dist/server-dev.js\"",
"db-migrate": "db-migrate --migrations-dir ./src/migrations",
"lint": "biome check .",
"lint:fix": "biome check . --write",
"local:package": "del-cli --force build && mkdir build && cp -r dist docs CHANGELOG.md LICENSE README.md package.json build",
"build:watch": "yarn run clean && tsc -w --strictNullChecks false",
"prebuild:watch": "yarn run clean",
"build:watch": "tsc -w --strictNullChecks false",
"prebuild": "yarn run clean",
"prepare": "husky && yarn --cwd ./frontend install && if [ ! -d ./dist ]; then yarn build; fi",
"test": "NODE_ENV=test PORT=4243 node --trace-warnings node_modules/.bin/jest",
"test:unit": "NODE_ENV=test PORT=4243 jest --testPathIgnorePatterns=src/test/e2e --testPathIgnorePatterns=dist",
@ -61,8 +64,7 @@
"seed:serve": "UNLEASH_DATABASE_NAME=unleash_test UNLEASH_DATABASE_SCHEMA=seed yarn run start:dev",
"clean": "del-cli --force dist",
"preversion": "./scripts/check-release.sh",
"heroku-postbuild": "cd frontend && yarn && yarn build",
"prepack": "./scripts/prepack.sh"
"heroku-postbuild": "cd frontend && yarn && yarn build"
},
"jest-junit": {
"suiteName": "Unleash Unit Tests",
@ -80,9 +82,7 @@
"testTimeout": 10000,
"globalSetup": "./scripts/jest-setup.js",
"transform": {
"^.+\\.tsx?$": [
"@swc/jest"
]
"^.+\\.tsx?$": ["@swc/jest"]
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"testPathIgnorePatterns": [
@ -91,13 +91,7 @@
"/frontend/",
"/website/"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json"
],
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json"],
"coveragePathIgnorePatterns": [
"/node_modules/",
"/dist/",
@ -220,7 +214,12 @@
},
"resolutions": {
"async": "^3.2.4",
"db-migrate/rc/minimist": "^1.2.5",
"es5-ext": "0.10.64",
"knex/liftoff/object.map/**/kind-of": "^6.0.3",
"knex/liftoff/findup-sync/micromatc/kind-of": "^6.0.3",
"knex/liftoff/findup-sync/micromatc/nanomatch/kind-of": "^6.0.3",
"knex/liftoff/findup-sync/micromatch/define-property/**/kind-of": "^6.0.3",
"node-forge": "^1.0.0",
"set-value": "^4.0.1",
"ansi-regex": "^5.0.1",
@ -233,12 +232,8 @@
"tough-cookie": "4.1.4"
},
"lint-staged": {
"*.{js,ts}": [
"biome check --write --no-errors-on-unmatched"
],
"*.{jsx,tsx}": [
"biome check --write --no-errors-on-unmatched"
]
},
"packageManager": "yarn@4.3.0"
"*.{js,ts}": ["biome check --write --no-errors-on-unmatched"],
"*.{jsx,tsx}": ["biome check --write --no-errors-on-unmatched"],
"*.json": ["biome format --write --no-errors-on-unmatched"]
}
}

View File

@ -1,4 +0,0 @@
#!/usr/bin/env sh
if [ ! -d ./frontend/build ]; then
yarn --cwd ./frontend install --immutable && yarn build:frontend;
fi

View File

@ -1,2 +0,0 @@
#!/usr/bin/env sh
yarn --cwd ./frontend install && if [ ! -d ./dist ]; then yarn build; fi

View File

@ -46,7 +46,7 @@ default:
.PHONY: prepare
prepare:
@echo "Preparing the environment..."
@yarn --cwd .. install --frozen-lockfile
@yarn --cwd .. install --frozen-lockfile --ignore-scripts
.PHONY: apply-migrations

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
yarnPath: .yarn/releases/yarn-4.3.0.cjs

View File

@ -16,10 +16,9 @@ We have created a set of ADRs to help guide the development of the backend:
Before developing on this project you will need two things:
- PostgreSQL 14.x or newer
- Node.js 20.x or newer
- Node.js 14.x or newer
```sh
corepack enable
yarn install
yarn dev
```

View File

@ -4,7 +4,7 @@ title: Front end
## Frontend overview
The frontend is written in react/typescript. It's a single page application that communicates with the backend via a REST API. The frontend is built using vite and served by the backend.
The frontend is written in react/typescript. It's is a single page application that communicates with the backend via a REST API. The frontend is built using vite and served by the backend.
## ADRs

View File

@ -54,11 +54,7 @@
"semver": "^7.5.3"
},
"browserslist": {
"production": [
">0.5%",
"not dead",
"not op_mini all"
],
"production": [">0.5%", "not dead", "not op_mini all"],
"development": [
"last 1 chrome version",
"last 1 firefox version",
@ -74,6 +70,5 @@
"react-router": "6.23.1",
"replace-in-file": "7.2.0",
"typescript": "5.4.5"
},
"packageManager": "yarn@4.3.0"
}
}

File diff suppressed because it is too large Load Diff

18174
yarn.lock

File diff suppressed because it is too large Load Diff