Skip to content

Commit ba05b22

Browse files
authored
Merge pull request DSpace#3173 from alanorth/use-npm
Use npm instead of Yarn
2 parents b5c00dd + 8144d1b commit ba05b22

11 files changed

Lines changed: 24421 additions & 12441 deletions

File tree

.dockerignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,6 @@ npm-debug.log.*
2525

2626
# Webpack files
2727
webpack.records.json
28-
package-lock.json
28+
29+
# Yarn no longer used
30+
yarn.lock

.github/pull_request_template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ However, reviewers may request that you complete any actions in this list if you
2121

2222
- [ ] My PR is **created against the `main` branch** of code (unless it is a backport or is fixing an issue specific to an older branch).
2323
- [ ] My PR is **small in size** (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
24-
- [ ] My PR **passes [ESLint](https://eslint.org/)** validation using `yarn lint`
25-
- [ ] My PR **doesn't introduce circular dependencies** (verified via `yarn check-circ-deps`)
24+
- [ ] My PR **passes [ESLint](https://eslint.org/)** validation using `npm run lint`
25+
- [ ] My PR **doesn't introduce circular dependencies** (verified via `npm run check-circ-deps`)
2626
- [ ] My PR **includes [TypeDoc](https://typedoc.org/) comments** for _all new (or modified) public methods and classes_. It also includes TypeDoc for large or complex private methods.
2727
- [ ] My PR **passes all specs/tests and includes new/updated specs or tests** based on the [Code Testing Guide](https://wiki.lyrasis.org/display/DSPACE/Code+Testing+Guide).
2828
- [ ] My PR **aligns with [Accessibility guidelines](https://wiki.lyrasis.org/display/DSDOC8x/Accessibility)** if it makes changes to the user interface.

.github/workflows/build.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,39 +69,39 @@ jobs:
6969
fi
7070
google-chrome --version
7171
72-
# https://github.com/actions/cache/blob/main/examples.md#node---yarn
73-
- name: Get Yarn cache directory
74-
id: yarn-cache-dir-path
75-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
76-
- name: Cache Yarn dependencies
72+
# https://github.com/actions/cache/blob/main/examples.md#node---npm
73+
- name: Get NPM cache directory
74+
id: npm-cache-dir
75+
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
76+
- name: Cache NPM dependencies
7777
uses: actions/cache@v4
7878
with:
79-
# Cache entire Yarn cache directory (see previous step)
80-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
81-
# Cache key is hash of yarn.lock. Therefore changes to yarn.lock will invalidate cache
82-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
83-
restore-keys: ${{ runner.os }}-yarn-
79+
# Cache entire NPM cache directory (see previous step)
80+
path: ${{ steps.npm-cache-dir.outputs.dir }}
81+
# Cache key is hash of package-lock.json. Therefore changes to package-lock.json will invalidate cache
82+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
83+
restore-keys: ${{ runner.os }}-npm-
8484

85-
- name: Install Yarn dependencies
86-
run: yarn install --frozen-lockfile
85+
- name: Install NPM dependencies
86+
run: npm clean-install
8787

8888
- name: Build lint plugins
89-
run: yarn run build:lint
89+
run: npm run build:lint
9090

9191
- name: Run lint plugin tests
92-
run: yarn run test:lint:nobuild
92+
run: npm run test:lint:nobuild
9393

9494
- name: Run lint
95-
run: yarn run lint:nobuild --quiet
95+
run: npm run lint:nobuild -- --quiet
9696

9797
- name: Check for circular dependencies
98-
run: yarn run check-circ-deps
98+
run: npm run check-circ-deps
9999

100100
- name: Run build
101-
run: yarn run build:prod
101+
run: npm run build:prod
102102

103103
- name: Run specs (unit tests)
104-
run: yarn run test:headless
104+
run: npm run test:headless
105105

106106
# Upload code coverage report to artifact (for one version of Node only),
107107
# so that it can be shared with the 'codecov' job (see below)
@@ -131,7 +131,7 @@ jobs:
131131
# Run tests in Chrome, headless mode (default)
132132
browser: chrome
133133
# Start app before running tests (will be stopped automatically after tests finish)
134-
start: yarn run serve:ssr
134+
start: npm run serve:ssr
135135
# Wait for backend & frontend to be available
136136
# NOTE: We use the 'sites' REST endpoint to also ensure the database is ready
137137
wait-on: http://127.0.0.1:8080/server/api/core/sites, http://127.0.0.1:4000
@@ -167,7 +167,7 @@ jobs:
167167
# Start up the app with SSR enabled (run in background)
168168
- name: Start app in SSR (server-side rendering) mode
169169
run: |
170-
nohup yarn run serve:ssr &
170+
nohup npm run serve:ssr &
171171
printf 'Waiting for app to start'
172172
until curl --output /dev/null --silent --head --fail http://127.0.0.1:4000/home; do
173173
printf '.'

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ webpack.records.json
2828

2929
morgan.log
3030

31+
# Yarn no longer used
32+
yarn.lock
3133
yarn-error.log
3234

3335
*.css
3436

35-
package-lock.json
36-
3737
.java-version
3838

3939
.env

Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ WORKDIR /app
1111
ADD . /app/
1212
EXPOSE 4000
1313

14-
# We run yarn install with an increased network timeout (5min) to avoid "ESOCKETTIMEDOUT" errors from hub.docker.com
15-
# See, for example https://github.com/yarnpkg/yarn/issues/5540
16-
RUN yarn install --network-timeout 300000
14+
RUN npm install
1715

1816
# When running in dev mode, 4GB of memory is required to build & launch the app.
1917
# This default setting can be overridden as needed in your shell, via an env file or in docker-compose.
@@ -25,4 +23,4 @@ ENV NODE_OPTIONS="--max_old_space_size=4096"
2523
# NOTE: At this time it is only possible to run Docker container in Production mode
2624
# if you have a public URL. See https://github.com/DSpace/dspace-angular/issues/1485
2725
ENV NODE_ENV development
28-
CMD yarn serve --host 0.0.0.0
26+
CMD npm run serve -- --host 0.0.0.0

Dockerfile.dist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ FROM node:18-alpine AS build
1111
RUN apk add --update python3 make g++ && rm -rf /var/cache/apk/*
1212

1313
WORKDIR /app
14-
COPY package.json yarn.lock ./
15-
RUN yarn install --network-timeout 300000
14+
COPY package.json package-lock.json ./
15+
RUN npm install
1616

1717
ADD . /app/
18-
RUN yarn build:prod
18+
RUN npm run build:prod
1919

2020
FROM node:18-alpine
2121
RUN npm install --global pm2

0 commit comments

Comments
 (0)