switch from yarn to npm
This eases build setup. Where Yarn requires a separate package repository, npm is available in the standard one. yarn's package repository signature was recently expired, and apparently will expire again in a year. Avoid dealing with that. Fixes #110.
This commit is contained in:
parent
ed521521a4
commit
44039889c5
|
@ -47,16 +47,10 @@ jobs:
|
|||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- uses: actions/cache@v2
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- run: cd ui && yarn install
|
||||
- run: cd ui && yarn build
|
||||
- run: cd ui && yarn lint
|
||||
${{ runner.os }}-node-
|
||||
- run: cd ui && npm ci
|
||||
- run: cd ui && npm run build
|
||||
- run: cd ui && npm run lint
|
||||
|
|
|
@ -30,8 +30,8 @@ FROM --platform=$BUILDPLATFORM dev-common AS build-ui
|
|||
LABEL maintainer="slamb@slamb.org"
|
||||
WORKDIR /var/lib/moonfire-nvr/src/ui
|
||||
COPY ui /var/lib/moonfire-nvr/src/ui
|
||||
RUN --mount=type=cache,target=/var/lib/moonfire-nvr/src/ui/node_modules,sharing=locked,mode=1777 \
|
||||
yarn install && yarn build
|
||||
RUN --mount=type=tmpfs,target=/var/lib/moonfire-nvr/src/ui/node_modules \
|
||||
npm ci && npm run build
|
||||
|
||||
# Build the Rust components. Note that dev.sh set up an environment variable
|
||||
# in .buildrc that similarly changes the target dir path.
|
||||
|
@ -65,7 +65,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
|
|||
rm -rf /var/lib/apt/lists/* && \
|
||||
ln -s moonfire-nvr /usr/local/bin/nvr
|
||||
COPY --from=build-server /usr/local/bin/moonfire-nvr /usr/local/bin/moonfire-nvr
|
||||
COPY --from=build-ui /var/lib/moonfire-nvr/ui/dist /usr/local/lib/moonfire-nvr/ui
|
||||
COPY --from=build-ui /var/lib/moonfire-nvr/src/ui/dist /usr/local/lib/moonfire-nvr/ui
|
||||
|
||||
# The install instructions say to use --user in the docker run commandline.
|
||||
# Specify a non-root user just in case someone forgets.
|
||||
|
|
|
@ -9,25 +9,17 @@ export DEBIAN_FRONTEND=noninteractive
|
|||
|
||||
packages=()
|
||||
|
||||
apt-get update
|
||||
|
||||
# Add yarn repository.
|
||||
apt-get --assume-yes --no-install-recommends install curl gnupg ca-certificates
|
||||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" \
|
||||
>> /etc/apt/sources.list.d/yarn.list
|
||||
|
||||
# Install all packages necessary for building (and some for testing/debugging).
|
||||
packages+=(
|
||||
build-essential
|
||||
curl
|
||||
pkgconf
|
||||
locales
|
||||
nodejs
|
||||
npm
|
||||
sudo
|
||||
sqlite3
|
||||
tzdata
|
||||
vim-nox
|
||||
yarn
|
||||
)
|
||||
apt-get update
|
||||
apt-get install --assume-yes --no-install-recommends "${packages[@]}"
|
||||
|
|
|
@ -111,6 +111,8 @@ To build the server, you will need the following C libraries installed:
|
|||
* [`ncursesw`](https://www.gnu.org/software/ncurses/), the UTF-8 version of
|
||||
the `ncurses` library.
|
||||
|
||||
To build the UI, you'll need [node and npm](https://nodejs.org/en/download/).
|
||||
|
||||
On recent Ubuntu or Raspbian Linux, the following command will install
|
||||
all non-Rust dependencies:
|
||||
|
||||
|
@ -122,6 +124,7 @@ $ sudo apt-get install \
|
|||
libavutil-dev \
|
||||
libncurses-dev \
|
||||
libsqlite3-dev \
|
||||
npm \
|
||||
pkgconf \
|
||||
sqlite3 \
|
||||
tzdata
|
||||
|
@ -131,15 +134,12 @@ On macOS with [Homebrew](https://brew.sh/) and Xcode installed, try the
|
|||
following command:
|
||||
|
||||
```
|
||||
$ brew install ffmpeg yarn
|
||||
$ brew install ffmpeg node
|
||||
```
|
||||
|
||||
Next, you need Rust 1.45+ and Cargo. The easiest way to install them is by
|
||||
following the instructions at [rustup.rs](https://www.rustup.rs/).
|
||||
|
||||
Finally, building the UI requires [yarn](https://yarnpkg.com/en/). (On macOS,
|
||||
the `brew` command above installs it for you. On Linux, follow yarn's guide.)
|
||||
|
||||
Once prerequisites are installed, you can build the server and find it in
|
||||
`target/release/moonfire-nvr`:
|
||||
|
||||
|
@ -149,12 +149,12 @@ $ cargo test
|
|||
$ cargo build --release
|
||||
```
|
||||
|
||||
You can build the UI via `yarn` and find it in the `ui/dist` directory:
|
||||
You can build the UI via `npm` and find it in the `ui/dist` directory:
|
||||
|
||||
```
|
||||
$ cd ui
|
||||
$ yarn
|
||||
$ yarn build
|
||||
$ npm install
|
||||
$ npm run build
|
||||
```
|
||||
|
||||
### Running interactively straight from the working copy
|
||||
|
|
|
@ -21,7 +21,7 @@ this in the webpack documentation.
|
|||
Checkout the branch you want to work on and type
|
||||
|
||||
$ cd ui
|
||||
$ yarn start
|
||||
$ npm run start
|
||||
|
||||
This will pack and prepare a development setup. By default the development
|
||||
server that serves up the web page(s) will listen on
|
||||
|
@ -55,7 +55,7 @@ as described
|
|||
Thus one could connect to a remote Moonfire NVR by specifying its URL as
|
||||
follows:
|
||||
|
||||
$ MOONFIRE_URL=https://nvr.example.com/ yarn start
|
||||
$ MOONFIRE_URL=https://nvr.example.com/ npm run start
|
||||
|
||||
This allows you to test a new UI against your stable, production Moonfire NVR
|
||||
installation with real data.
|
||||
|
@ -64,7 +64,7 @@ The default `MOONFIRE_DEV_HOST` is suitable for connecting to the proxy server
|
|||
from a browser running on the same machine. If you want your server to be
|
||||
externally accessible, you may want to bind to `0.0.0.0` instead:
|
||||
|
||||
$ MOONFIRE_DEV_HOST=0.0.0.0 yarn start
|
||||
$ MOONFIRE_DEV_HOST=0.0.0.0 npm run start
|
||||
|
||||
Be careful, though: it's insecure to send your production credentials over a
|
||||
non-`https` connection, as described more below.
|
||||
|
|
File diff suppressed because it is too large
Load Diff
7567
ui/yarn.lock
7567
ui/yarn.lock
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue