Skip to content

Commit

Permalink
chore: use npm instead of yarn
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Nov 28, 2023
1 parent d7621c1 commit bcd24d0
Show file tree
Hide file tree
Showing 22 changed files with 16,712 additions and 15,443 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ body:
- Snap
- NPM
- Home Assistant Add-on
- Manually built (git clone - yarn build - yarn install
- Manually built (git clone - npm run build - npm install
validations:
required: true
- type: input
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/hass_discovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Home Assistant --> settings --> Integrations --> Z-Wave JS --> Configure --> Cre
Build/Run method:

[ ] Docker
[ ] Git Clone + yarn install + yarn run build + yarn start
[ ] Git Clone + npm install + npm run build + npm start
[ ] Pkg

Z-Wave JS UI version: **[Enter Version Number]**
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ jobs:
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
cache: 'npm'

- name: Install dependencies
run: yarn install --immutable
run: npm ci

- name: Lint
if: matrix['node-version'] == '18.x'
run: yarn run lint
run: npm run lint

- name: Prepare lint auto-fix patch
if: |
Expand All @@ -43,7 +43,7 @@ jobs:
id: lint
run: |
# Run all lint commands and abort if one has unfixable errors
yarn run lint-fix
npm run lint-fix
git diff --name-only || true
if ! git diff --quiet ; then
echo "has changes"
Expand All @@ -65,13 +65,13 @@ jobs:
path: fix.patch

- name: Test
run: yarn run test
run: npm run test

- name: Generate coverage report
if: matrix['node-version'] == '18.x'
run: |
yarn run coverage
yarn run record-coverage
npm run coverage
npm run record-coverage
- name: Coveralls
uses: coverallsapp/github-action@master
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docker-release-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/[email protected]
with:
node-version: 20
cache: 'yarn'
cache: 'npm'

- uses: docker/setup-buildx-action@v3
- uses: docker/setup-qemu-action@v3
Expand Down Expand Up @@ -61,8 +61,8 @@ jobs:
- name: Pre-build frontend and backend files
run: |
yarn install --immutable
yarn build
npm ci
npm run build
- name: build+push
uses: docker/build-push-action@v5
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
cache: 'npm'

- uses: docker/setup-buildx-action@v3
- uses: docker/setup-qemu-action@v3
Expand Down Expand Up @@ -77,8 +77,8 @@ jobs:
- name: Pre-build frontend and backend files
run: |
yarn install --immutable
yarn build
npm ci
npm run build
- name: build+push
timeout-minutes: 120 # prevents this to run indeterminatly
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/package_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache: "npm"

- name: Install and pre-build
run: |
yarn install --immutable
yarn build
npm ci
npm run build
- uses: uraimo/run-on-arch-action@v2
name: Package
Expand All @@ -45,7 +45,7 @@ jobs:
- name: Build for arm64
run: |
yarn pkg --skip-build --arch=arm64
npm run pkg -- --skip-build --arch=arm64
- name: Upload artifacts
if: github.event_name == 'workflow_dispatch'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/package_armv7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache: "npm"

- name: Install and pre-build
run: |
yarn install --immutable
yarn build
npm ci
npm run build
- name: Restore cache
uses: actions/cache@v3
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
export PKG_IGNORE_TAG=true
curl https://github.com/yao-pkg/pkg-binaries/releases/download/node18/built-v18.18.2-linux-armv7 -LOJ
mv built-v18.18.2-linux-armv7 $PKG_CACHE_PATH/built-v${{ matrix.node-version }}-linux-armv7
yarn pkg --skip-build --arch=armv7
npm run pkg -- --skip-build --arch=armv7
- name: Upload artifacts
if: github.event_name == 'workflow_dispatch'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
cache: 'npm'

- name: Install dependencies
run: yarn install --immutable
run: npm ci

- name: Initialize NPM config
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-dep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
uses: actions/[email protected]
with:
node-version: 20.x
cache: 'yarn'
cache: 'npm'

- name: Update dependency
run: |
yarn add ${{github.event.inputs.dep}}${{github.event.inputs.version}}
npm install ${{github.event.inputs.dep}}${{github.event.inputs.version || 'latest'}}
- name: Check for changes
id: check
run: |
Expand Down
6 changes: 4 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"type": "node",
"request": "launch",
"name": "Debug",
"runtimeExecutable": "yarn",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"dev:server"
],
"env": {},
Expand All @@ -18,8 +19,9 @@
"type": "node",
"request": "launch",
"name": "Debug HTTPS",
"runtimeExecutable": "yarn",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"dev:server"
],
"env": {},
Expand Down
893 changes: 0 additions & 893 deletions .yarn/releases/yarn-4.0.2.cjs

This file was deleted.

11 changes: 0 additions & 11 deletions .yarnrc.yml

This file was deleted.

10 changes: 3 additions & 7 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,15 @@ RUN \
build-base \
linux-headers \
python3-dev \
npm=9.6.6-r0 \
\
&& npm install --global yarn
npm=9.6.6-r0

ENV YARN_HTTP_TIMEOUT=300000
# set production env install will not install devDependencies
ENV NODE_ENV=production

COPY . .

# if node_modules does not exist, run it, otherwise skip
RUN [ -d 'node_modules' ] && echo "Skipping install" || yarn install --immutable
RUN [ -d 'node_modules' ] && echo "Skipping install" || npm ci

# Fix issue with serialport bindings #2349
RUN npm_config_build_from_source=true npm rebuild @serialport/bindings-cpp
Expand All @@ -50,14 +47,13 @@ RUN npm prune --production && \
docs \
kubernetes \
test \
.yarn \
.github \
.vscode

# add plugin support, space separated
ARG plugins
RUN if [ ! -z "$plugins" ]; \
then echo "Installing plugins ${plugins}"; yarn add ${plugins} ; fi
then echo "Installing plugins ${plugins}"; npm install ${plugins} ; fi

# when update devices arg is set update config files from zwavejs repo
ARG updateDevices
Expand Down
33 changes: 17 additions & 16 deletions docker/Dockerfile.contrib
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@ FROM ${SRC} AS build

# Setup the container
USER root
RUN apt-get update && apt-get install -y jq

### Build node-zwave-js ###
USER node
WORKDIR /home/node/node-zwave-js
ENV YARN_HTTP_TIMEOUT=300000

RUN yarn
RUN yarn build
RUN npm ci
RUN npm run build

# Update the version info to match the branch built
RUN yarn workspaces foreach version $(echo $(yarn node -p 'require("semver").inc(require("zwave-js/package.json").version, "prerelease")+".dev"')-$(git rev-parse --short HEAD)) --deferred && yarn version apply --all
Expand All @@ -56,18 +54,23 @@ RUN cat package.json \
> package2.json \
&& rm package.json && mv package2.json package.json

RUN yarn
RUN yarn build
RUN npm ci
RUN npm run build

# Prune devDependencies
RUN yarn remove $(cat package.json | jq -r '.devDependencies | keys | join(" ")') \
&& rm -rf \
build \
docs \
src \
static \
.yarn \
package.sh
RUN npm prune --production && \
rm -rf \
package-lock.json \
build \
package.sh \
src \
api \
static \
docs \
kubernetes \
test \
.github \
.vscode

# Copy to distribution folder
RUN mkdir my_dist \
Expand All @@ -83,9 +86,7 @@ RUN mkdir my_dist \
snippets \
store \
views \
.yarnrc.yml \
package.json \
yarn.lock \
my_dist

#####################
Expand Down
14 changes: 5 additions & 9 deletions docker/Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,35 @@ RUN apt-get update && apt-get install -y \
python3 \
&& rm -rf /var/lib/apt/lists/*

COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn/releases .yarn/releases

ENV YARN_HTTP_TIMEOUT=300000
# set production env install will not install devDependencies
ENV NODE_ENV=production

COPY . .

# if node_modules does not exist, run it, otherwise skip
RUN [ -d 'node_modules' ] && echo "Skipping install" || yarn install --immutable
RUN [ -d 'node_modules' ] && echo "Skipping install" || npm ci

# Fix issue with serialport bindings #2349
RUN npm_config_build_from_source=true npm rebuild @serialport/bindings-cpp

# Build back and frontend only when not existing
RUN [ -d 'dist' ] && echo "Skipping build" || yarn build
RUN [ -d 'dist' ] && echo "Skipping build" || npm run build

RUN yarn remove $(cat package.json | jq -r '.devDependencies | keys | join(" ")') && \
RUN npm prune --production && \
rm -rf \
build \
package.sh \
src \
api \
static \
docs \
.yarn \
.github \
.vscode

# add plugin support, space separated
ARG plugins
RUN if [ ! -z "$plugins" ]; \
then echo "Installing plugins ${plugins}"; yarn add ${plugins} ; fi
then echo "Installing plugins ${plugins}"; npm install ${plugins} ; fi

# when update devices arg is set update config files from zwavejs repo
ARG updateDevices
Expand Down
8 changes: 4 additions & 4 deletions docs/development/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

Developers who wants to debug the application have to open two terminals.

In first terminal run `yarn dev` to start webpack-dev for front-end developing and hot reloading at <http://localhost:8092>
In first terminal run `npm run dev` to start webpack-dev for front-end developing and hot reloading at <http://localhost:8092>
(**THE PORT FOR DEVELOPING IS 8092**)

In the second terminal run `yarn dev:server` to start the backend server with inspect and auto restart features
In the second terminal run `npm run dev:server` to start the backend server with inspect and auto restart features

To package the application run `yarn pkg` command and follow the steps
To package the application run `npm run pkg` command and follow the steps

## Developing against a different backend

By default running `yarn dev:server` will proxy the requests to a backend listening on _localhost_ on port _8091_.
By default running `npm run dev:server` will proxy the requests to a backend listening on _localhost_ on port _8091_.

If you want to run the development frontend against a different backend you have the following environment variables
that you can use to redirect to a different backend:
Expand Down
8 changes: 4 additions & 4 deletions docs/getting-started/other-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pm2 startup

## NodeJS or PKG version

The most complex way to run Z-Wave JS UI is on bare metal. To do so, you can use the packaged version (you don't need NodeJS/yarn installed) or clone this repository and build the project:
The most complex way to run Z-Wave JS UI is on bare metal. To do so, you can use the packaged version (you don't need NodeJS/NPM installed) or clone this repository and build the project:

- For the packaged version:

Expand All @@ -117,7 +117,7 @@ The most complex way to run Z-Wave JS UI is on bare metal. To do so, you can use
```bash
git clone https://github.com/zwave-js/zwave-js-ui
cd zwave-js-ui
yarn install
yarn run build
yarn start
npm install
npm run build
npm start
```
Loading

0 comments on commit bcd24d0

Please sign in to comment.