Skip to content

Commit

Permalink
Merge pull request DSpace#3173 from alanorth/use-npm
Browse files Browse the repository at this point in the history
Use npm instead of Yarn
  • Loading branch information
tdonohue authored Sep 6, 2024
2 parents b5c00dd + 8144d1b commit ba05b22
Show file tree
Hide file tree
Showing 11 changed files with 24,421 additions and 12,441 deletions.
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ npm-debug.log.*

# Webpack files
webpack.records.json
package-lock.json

# Yarn no longer used
yarn.lock
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ However, reviewers may request that you complete any actions in this list if you

- [ ] 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).
- [ ] 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.
- [ ] My PR **passes [ESLint](https://eslint.org/)** validation using `yarn lint`
- [ ] My PR **doesn't introduce circular dependencies** (verified via `yarn check-circ-deps`)
- [ ] My PR **passes [ESLint](https://eslint.org/)** validation using `npm run lint`
- [ ] My PR **doesn't introduce circular dependencies** (verified via `npm run check-circ-deps`)
- [ ] 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.
- [ ] 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).
- [ ] My PR **aligns with [Accessibility guidelines](https://wiki.lyrasis.org/display/DSDOC8x/Accessibility)** if it makes changes to the user interface.
Expand Down
40 changes: 20 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,39 +69,39 @@ jobs:
fi
google-chrome --version
# https://github.com/actions/cache/blob/main/examples.md#node---yarn
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache Yarn dependencies
# https://github.com/actions/cache/blob/main/examples.md#node---npm
- name: Get NPM cache directory
id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
- name: Cache NPM dependencies
uses: actions/cache@v4
with:
# Cache entire Yarn cache directory (see previous step)
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
# Cache key is hash of yarn.lock. Therefore changes to yarn.lock will invalidate cache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
# Cache entire NPM cache directory (see previous step)
path: ${{ steps.npm-cache-dir.outputs.dir }}
# Cache key is hash of package-lock.json. Therefore changes to package-lock.json will invalidate cache
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-

- name: Install Yarn dependencies
run: yarn install --frozen-lockfile
- name: Install NPM dependencies
run: npm clean-install

- name: Build lint plugins
run: yarn run build:lint
run: npm run build:lint

- name: Run lint plugin tests
run: yarn run test:lint:nobuild
run: npm run test:lint:nobuild

- name: Run lint
run: yarn run lint:nobuild --quiet
run: npm run lint:nobuild -- --quiet

- name: Check for circular dependencies
run: yarn run check-circ-deps
run: npm run check-circ-deps

- name: Run build
run: yarn run build:prod
run: npm run build:prod

- name: Run specs (unit tests)
run: yarn run test:headless
run: npm run test:headless

# Upload code coverage report to artifact (for one version of Node only),
# so that it can be shared with the 'codecov' job (see below)
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
# Run tests in Chrome, headless mode (default)
browser: chrome
# Start app before running tests (will be stopped automatically after tests finish)
start: yarn run serve:ssr
start: npm run serve:ssr
# Wait for backend & frontend to be available
# NOTE: We use the 'sites' REST endpoint to also ensure the database is ready
wait-on: http://127.0.0.1:8080/server/api/core/sites, http://127.0.0.1:4000
Expand Down Expand Up @@ -167,7 +167,7 @@ jobs:
# Start up the app with SSR enabled (run in background)
- name: Start app in SSR (server-side rendering) mode
run: |
nohup yarn run serve:ssr &
nohup npm run serve:ssr &
printf 'Waiting for app to start'
until curl --output /dev/null --silent --head --fail http://127.0.0.1:4000/home; do
printf '.'
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ webpack.records.json

morgan.log

# Yarn no longer used
yarn.lock
yarn-error.log

*.css

package-lock.json

.java-version

.env
Expand Down
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ WORKDIR /app
ADD . /app/
EXPOSE 4000

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

# When running in dev mode, 4GB of memory is required to build & launch the app.
# This default setting can be overridden as needed in your shell, via an env file or in docker-compose.
Expand All @@ -25,4 +23,4 @@ ENV NODE_OPTIONS="--max_old_space_size=4096"
# NOTE: At this time it is only possible to run Docker container in Production mode
# if you have a public URL. See https://github.com/DSpace/dspace-angular/issues/1485
ENV NODE_ENV development
CMD yarn serve --host 0.0.0.0
CMD npm run serve -- --host 0.0.0.0
6 changes: 3 additions & 3 deletions Dockerfile.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ FROM node:18-alpine AS build
RUN apk add --update python3 make g++ && rm -rf /var/cache/apk/*

WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --network-timeout 300000
COPY package.json package-lock.json ./
RUN npm install

ADD . /app/
RUN yarn build:prod
RUN npm run build:prod

FROM node:18-alpine
RUN npm install --global pm2
Expand Down
Loading

0 comments on commit ba05b22

Please sign in to comment.