Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: switch to npm, upgrade to node 14 #813

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ defaults: &defaults
- GITOPS_PR_WEBHOOK: "https://w603b5hwp1.execute-api.us-east-1.amazonaws.com/dev/pullrequests"
- GLOBAL_CACHE_VERSION: “v3”
docker:
- image: circleci/node:12-stretch
- image: cimg/node:14.18

jobs:
install-dependencies:
Expand All @@ -28,13 +28,13 @@ jobs:
- checkout
- restore_cache:
keys:
- reaction-v3-node-modules-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- reaction-v3-node-modules-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}
- reaction-v3-node-modules-{{ .Branch }}
- run:
name: Install yarn dependencies
command: yarn install --production=false --frozen-lockfile --non-interactive
name: Install dependencies
command: npm install --production=false --frozen-lockfile --non-interactive
- save_cache:
key: reaction-v3-node-modules-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
key: storefront-v6-node-modules-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}
paths:
- node_modules
- save_cache:
Expand All @@ -59,35 +59,35 @@ jobs:
- checkout
- restore_cache:
keys:
- reaction-v3-node-modules-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- reaction-v3-node-modules-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}
- reaction-v3-node-modules-{{ .Branch }}
- run:
name: Lint JavaScript
command: yarn run lint
command: npm run lint

test-unit:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- reaction-v3-node-modules-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- reaction-v3-node-modules-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}
- reaction-v3-node-modules-{{ .Branch }}
- run:
name: Run Unit Tests
command: yarn run test:ci
command: npm run test:ci

release:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- reaction-v3-node-modules-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- reaction-v3-node-modules-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}
- reaction-v3-node-modules-{{ .Branch }}
- run:
name: Push the latest version to npm
command: yarn run semantic-release
command: npm run semantic-release

docker-build-push:
<<: *defaults
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ npm-debug.log
pids
results
allure-results
package-lock.json

.reaction/config.json

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.14.1
14.18.1
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:12-alpine
FROM node:14-alpine

ARG NEXTJS_DOTENV

Expand All @@ -21,17 +21,17 @@ COPY --chown=node:node ./ ./
USER node

# Install ALL dependencies. We need devDependencies for the build command.
RUN yarn install --production=false --frozen-lockfile --ignore-scripts --non-interactive --no-cache
RUN npm install --production=false --frozen-lockfile --ignore-scripts --non-interactive --no-cache

ENV BUILD_ENV=production NODE_ENV=production

# hadolint ignore=SC2046
RUN export $(grep -v '^#' .env.${NEXTJS_DOTENV:-prod} | xargs -0) && yarn build
RUN export $(grep -v '^#' .env.${NEXTJS_DOTENV:-prod} | xargs -0) && npm run build

# Install only prod dependencies now that we've built, to make the image smaller
RUN rm -rf node_modules/*
RUN yarn install --production=true --frozen-lockfile --ignore-scripts --non-interactive
RUN npm install --production=true --frozen-lockfile --ignore-scripts --non-interactive

# If any Node flags are needed, they can be set in the NODE_OPTIONS env variable.
CMD ["tini", "--", "yarn", "start"]
CMD ["tini", "--", "npm", "start"]
LABEL com.reactioncommerce.name="example-storefront"
4 changes: 1 addition & 3 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ version: '3.4'

services:
web:
image: reactioncommerce/node-dev:12.14.1-v3
image: reactioncommerce/node-dev:14.18.1-v1
command: "./bin/start"
volumes:
- .:/usr/local/src/app
- web-yarn:/home/node/.cache/yarn
# Do not link in node_modules from the host
# This allows IDEs to run lint etc with native add-ons for host OS
# Without interfering with native add-ons in container
- empty_node_modules:/usr/local/src/app/node_modules

volumes:
web-yarn:
empty_node_modules:
Loading