Skip to content

Commit

Permalink
Replace npm with yarn (cvat-ai#113)
Browse files Browse the repository at this point in the history
* package.json: private true

* delete package-lock.json

* cvat-core/package.json: fix path for cvat-data

* replace npm with yarn

* replace npm with yarn

* add yarn.lock files

* replace npm with yarn

* remark: replace npm with yarn

* fixes

* fixes

* alligment

* workflows: replace npm with yarn

* revert husky version

* replace npm with yarn on ci image

* add yarn for ci image

* enable debug mode for main workflow

* debug mode

* v0.0.0

* resolve dependencies issues

* update docs

* exit debug mode

* add yarn.lock to the ui image

* fix three version

* resolve conflicts

* [no ci] use yarn instead of npm

* fix src path
  • Loading branch information
sizov-kirill authored Jul 13, 2022
1 parent 987a092 commit 2240b3f
Show file tree
Hide file tree
Showing 25 changed files with 15,611 additions and 54,316 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ jobs:
done
if [[ ! -z $CHANGED_FILES ]]; then
npm ci
cd tests && npm ci && cd ..
npm install eslint-detailed-reporter --save-dev --legacy-peer-deps
yarn install --frozen-lockfile
yarn add eslint-detailed-reporter -D -W
mkdir -p eslint_report
echo "ESLint version: "$(npx eslint --version)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ jobs:
-c 'python manage.py test cvat/apps cvat-cli -v 2'
docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f docker-compose.ci.yml run cvat_ci /bin/bash \
-c 'cd cvat-data && npm ci --ignore-scripts && cd ../cvat-core && npm ci --ignore-scripts && npm run test'
-c 'yarn --frozen-lockfile --ignore-scripts && yarn workspace cvat-core run test'
- name: Creating a log file from cvat containers
if: failure()
Expand Down Expand Up @@ -300,7 +300,7 @@ jobs:
run: |
docker exec -i cvat /bin/bash -c "echo \"from django.contrib.auth.models import User; User.objects.create_superuser('${DJANGO_SU_NAME}', '${DJANGO_SU_EMAIL}', '${DJANGO_SU_PASSWORD}')\" | python3 ~/manage.py shell"
cd ./tests
npm ci
yarn --frozen-lockfile
shopt -s extglob
if [[ ${{ matrix.specs }} == canvas3d_* ]]; then
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ jobs:
-c 'python manage.py test cvat/apps cvat-cli -k tasks_id -k lambda -k share -v 2'
docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f docker-compose.ci.yml run cvat_ci /bin/bash \
-c 'cd cvat-data && npm ci --ignore-scripts && cd ../cvat-core && npm ci --ignore-scripts && npm run test'
-c 'yarn --frozen-lockfile --ignore-scripts && yarn workspace cvat-core run test'
- name: Creating a log file from cvat containers
if: failure()
Expand Down Expand Up @@ -257,7 +257,7 @@ jobs:
docker exec -i cvat /bin/bash -c "echo \"from django.contrib.auth.models import User; User.objects.create_superuser('${DJANGO_SU_NAME}', '${DJANGO_SU_EMAIL}', '${DJANGO_SU_PASSWORD}')\" | python3 ~/manage.py shell"
cd ./tests
npm ci
yarn --frozen-lockfile
if [ ${{ matrix.specs }} == 'canvas3d_functionality' ]; then
npx cypress run --headed --browser chrome --config-file pr_cypress_canvas3d.json
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/remark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

- name: Run checks
run: |
npm ci
yarn install --frozen-lockfile
mkdir -p remark_report
echo "Remark version: "`npx remark --version`
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ jobs:
-c 'coverage run -a manage.py test cvat/apps cvat-cli && mv .coverage ${CONTAINER_COVERAGE_DATA_DIR}'
docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f docker-compose.ci.yml run cvat_ci /bin/bash \
-c 'cd cvat-data && npm ci --ignore-scripts && cd ../cvat-core && npm ci --ignore-scripts && npm run test && mv ./reports/coverage/lcov.info ${CONTAINER_COVERAGE_DATA_DIR} && chmod a+rwx ${CONTAINER_COVERAGE_DATA_DIR}/lcov.info'
-c 'yarn --frozen-lockfile --ignore-script && yarn workspace cvat-core run test'
docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f docker-compose.ci.yml down -v
Expand Down Expand Up @@ -232,8 +232,8 @@ jobs:
- name: Instrumentation of the code then rebuilding the CVAT UI
run: |
npm ci
npm run coverage
yarn --frozen-lockfile
yarn run coverage
docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f components/serverless/docker-compose.serverless.yml build cvat_ui
- name: Run CVAT instance
Expand Down Expand Up @@ -286,7 +286,7 @@ jobs:
- name: Run tests
run: |
cd ./tests
npm ci
yarn --frozen-lockfile
TESTS_3D=('canvas3d_functionality' 'canvas3d_functionality_2')
for testset in ${TESTS_3D[@]};
Expand Down Expand Up @@ -377,7 +377,7 @@ jobs:
mkdir -p ./nyc_output_tmp
mv ./out_*.json ./nyc_output_tmp
mkdir -p ./.nyc_output
npm ci
yarn --frozen-lockfile
npx nyc merge ./nyc_output_tmp ./.nyc_output/out.json
- name: Sending results to Coveralls
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stylelint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
done
if [[ ! -z $CHANGED_FILES ]]; then
npm ci
yarn install --frozen-lockfile
mkdir -p stylelint_report
echo "StyleLint version: "$(npx stylelint --version)
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ RUN apt-get update && \
google-chrome-stable \
nodejs \
&& \
npm install --global yarn && \
rm -rf /var/lib/apt/lists/*;

COPY cvat/requirements/ /tmp/cvat/requirements/
Expand All @@ -32,7 +33,8 @@ RUN gem install coveralls-lcov

COPY cvat-core ${HOME}/cvat-core
COPY cvat-data ${HOME}/cvat-data
COPY package*.json ${HOME}/
COPY package.json ${HOME}/
COPY yarn.lock ${HOME}/
COPY tests ${HOME}/tests

COPY .coveragerc .
Expand Down
17 changes: 9 additions & 8 deletions Dockerfile.ui
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,25 @@ ENV TERM=xterm \
LC_ALL='C.UTF-8'

# Install dependencies
COPY package*.json /tmp/
COPY cvat-core/package*.json /tmp/cvat-core/
COPY cvat-canvas/package*.json /tmp/cvat-canvas/
COPY cvat-canvas3d/package*.json /tmp/cvat-canvas3d/
COPY cvat-ui/package*.json /tmp/cvat-ui/
COPY cvat-data/package*.json /tmp/cvat-data/
COPY package.json /tmp/
COPY yarn.lock /tmp/
COPY cvat-core/package.json /tmp/cvat-core/
COPY cvat-canvas/package.json /tmp/cvat-canvas/
COPY cvat-canvas3d/package.json /tmp/cvat-canvas3d/
COPY cvat-ui/package.json /tmp/cvat-ui/
COPY cvat-data/package.json /tmp/cvat-data/

# Install common dependencies
WORKDIR /tmp/
RUN npm ci --ignore-scripts
RUN yarn install --ignore-scripts --frozen-lockfile

# Build source code
COPY cvat-data/ /tmp/cvat-data/
COPY cvat-core/ /tmp/cvat-core/
COPY cvat-canvas3d/ /tmp/cvat-canvas3d/
COPY cvat-canvas/ /tmp/cvat-canvas/
COPY cvat-ui/ /tmp/cvat-ui/
RUN npm run build:cvat-ui
RUN yarn run build:cvat-ui

FROM nginx:mainline-alpine
# Replace default.conf configuration to remove unnecessary rules
Expand Down
10 changes: 5 additions & 5 deletions cvat-canvas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ It presents a canvas to viewing, drawing and editing of annotations.

If you make changes in this package, please do following:

- After not important changes (typos, backward compatible bug fixes, refactoring) do: `npm version patch`
- After changing API (backward compatible new features) do: `npm version minor`
- After changing API (changes that break backward compatibility) do: `npm version major`
- After not important changes (typos, backward compatible bug fixes, refactoring) do: `yarn version --patch`
- After changing API (backward compatible new features) do: `yarn version --minor`
- After changing API (changes that break backward compatibility) do: `yarn version --major`

## Commands

- Building of the module from sources in the `dist` directory:

```bash
npm run build
npm run build -- --mode=development # without a minification
yarn run build
yarn run build --mode=development # without a minification
```

## Using
Expand Down
10 changes: 5 additions & 5 deletions cvat-canvas3d/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ It presents a canvas to viewing, drawing and editing of 3D annotations.

If you make changes in this package, please do following:

- After not important changes (typos, backward compatible bug fixes, refactoring) do: `npm version patch`
- After changing API (backward compatible new features) do: `npm version minor`
- After changing API (changes that break backward compatibility) do: `npm version major`
- After not important changes (typos, backward compatible bug fixes, refactoring) do: `yarn version --patch`
- After changing API (backward compatible new features) do: `yarn version --minor`
- After changing API (changes that break backward compatibility) do: `yarn version --major`

## Commands

- Building of the module from sources in the `dist` directory:

```bash
npm run build
npm run build -- --mode=development # without a minification
yarn run build
yarn run build --mode=development # without a minification
```

### API Methods
Expand Down
22 changes: 11 additions & 11 deletions cvat-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,43 @@ It contains the core logic of the Computer Vision Annotation Tool.

If you make changes in this package, please do following:

- After not important changes (typos, backward compatible bug fixes, refactoring) do: `npm version patch`
- After changing API (backward compatible new features) do: `npm version minor`
- After changing API (changes that break backward compatibility) do: `npm version major`
- After not important changes (typos, backward compatible bug fixes, refactoring) do: `yarn version --patch`
- After changing API (backward compatible new features) do: `yarn version --minor`
- After changing API (changes that break backward compatibility) do: `yarn version --major`

### Commands

- Dependencies installation

```bash
npm ci
yarn ci --frozen-lockfile
```

- Building the module from sources in the `dist` directory:

```bash
npm run build
npm run build -- --mode=development # without a minification
yarn run build
yarn run build --mode=development # without a minification
```

- Building the documentation in the `docs` directory:

```bash
npm run-script docs
yarn run docs
```

- Running of tests:

```bash
npm run-script test
yarn run test
```

- Updating of a module version:

```bash
npm version patch # updated after minor fixes
npm version minor # updated after major changes which don't affect API compatibility with previous versions
npm version major # updated after major changes which affect API compatibility with previous versions
yarn version --patch # updated after minor fixes
yarn version --minor # updated after major changes which don't affect API compatibility with previous versions
yarn version --major # updated after major changes which affect API compatibility with previous versions
```

Visual studio code configurations:
Expand Down
2 changes: 1 addition & 1 deletion cvat-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"docs": "jsdoc --readme README.md src/*.js -p -c jsdoc.config.js -d docs",
"coveralls": "cat ./reports/coverage/lcov.info | coveralls",
"type-check": "tsc --noEmit",
"type-check:watch": "npm run type-check -- --watch"
"type-check:watch": "yarn run type-check -- --watch"
},
"author": "Intel",
"license": "MIT",
Expand Down
12 changes: 6 additions & 6 deletions cvat-data/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# cvat-data module

```bash
npm run build # build with minification
npm run build -- --mode=development # build without minification
npm run server # run debug server
yarn run build # build with minification
yarn run build --mode=development # build without minification
yarn run server # run debug server
```

## Versioning

If you make changes in this package, please do following:

- After not important changes (typos, backward compatible bug fixes, refactoring) do: `npm version patch`
- After changing API (backward compatible new features) do: `npm version minor`
- After changing API (changes that break backward compatibility) do: `npm version major`
- After not important changes (typos, backward compatible bug fixes, refactoring) do: `yarn version --patch`
- After changing API (backward compatible new features) do: `yarn version --minor`
- After changing API (changes that break backward compatibility) do: `yarn version --major`
6 changes: 3 additions & 3 deletions cvat-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"main": "src/ts/cvat-data.ts",
"scripts": {
"patch": "cd src/ts && patch --dry-run --forward -p0 < 3rdparty_patch.diff >> /dev/null && patch -p0 < 3rdparty_patch.diff; true",
"build": "npm run patch; webpack --config ./webpack.config.js",
"server": "npm run patch; nodemon --watch config --exec 'webpack-dev-server --config ./webpack.config.js --mode=development --open'",
"build": "yarn run patch; webpack --config ./webpack.config.js",
"server": "yarn run patch; nodemon --watch config --exec 'webpack-dev-server --config ./webpack.config.js --mode=development --open'",
"type-check": "tsc --noEmit",
"type-check:watch": "npm run type-check -- --watch"
"type-check:watch": "yarn run type-check -- --watch"
},
"author": "Intel",
"license": "MIT",
Expand Down
16 changes: 8 additions & 8 deletions cvat-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@ This is a client UI for Computer Vision Annotation Tool based on React, Redux an

If you make changes in this package, please do following:

- After not important changes (typos, bug fixes, refactoring) do: `npm version patch`
- After adding new features do: `npm version minor`
- After significant UI redesign do: `npm version major`
- After not important changes (typos, bug fixes, refactoring) do: `yarn version --patch`
- After adding new features do: `yarn version --minor`
- After significant UI redesign do: `yarn version --major`

Important: If you have changed versions for `cvat-core`, `cvat-canvas`, `cvat-data`,
you also need to do `npm install` to update `package-lock.json`
you also need to do `yarn install` to update `package-lock.json`

## Commands

- Installing dependencies:

```bash
cd ../cvat-core && npm ci && cd - && npm ci
cd ../cvat-core && yarn --frozen-lockfile && cd - && yarn --frozen-lockfile
```

- Running development UI server with autorebuild on change

```bash
npm start
yarn run start
```

- Building the module from sources in the `dist` directory:

```bash
npm run build
npm run build -- --mode=development # without a minification
yarn run build
yarn run build --mode=development # without a minification
```

Important: You also have to run CVAT REST API server (please read `https://openvinotoolkit.github.io/cvat/docs/contributing/`)
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "webpack --config ./webpack.config.js",
"start": "webpack serve --env API_URL=http://localhost:7000 --config ./webpack.config.js --mode=development",
"type-check": "tsc --noEmit",
"type-check:watch": "npm run type-check -- --watch",
"type-check:watch": "yarn run type-check -- --watch",
"lint": "eslint './src/**/*.{ts,tsx}'",
"lint:fix": "eslint './src/**/*.{ts,tsx}' --fix"
},
Expand Down
10 changes: 5 additions & 5 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ module.exports = (stagedFiles) => {

const mapping = {};
const commands = [];
mapping['npm run precommit:cvat-ui -- '] = cvatUI.join(' ');
mapping['npm run precommit:cvat-data -- '] = cvatData.join(' ');
mapping['npm run precommit:cvat-core -- '] = cvatCore.join(' ');
mapping['npm run precommit:cvat-canvas -- '] = cvatCanvas.join(' ');
mapping['npm run precommit:cvat-canvas3d -- '] = cvatCanvas3d.join(' ');
mapping['yarn run precommit:cvat-ui -- '] = cvatUI.join(' ');
mapping['yarn run precommit:cvat-data -- '] = cvatData.join(' ');
mapping['yarn run precommit:cvat-core -- '] = cvatCore.join(' ');
mapping['yarn run precommit:cvat-canvas -- '] = cvatCanvas.join(' ');
mapping['yarn run precommit:cvat-canvas3d -- '] = cvatCanvas3d.join(' ');

for (const command of Object.keys(mapping)) {
const files = mapping[command];
Expand Down
Loading

0 comments on commit 2240b3f

Please sign in to comment.