mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-07-14 11:21:54 -04:00
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
18
.github/workflows/ci.yml
vendored
18
.github/workflows/ci.yml
vendored
@ -47,16 +47,10 @@ jobs:
|
|||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: '14'
|
node-version: '14'
|
||||||
- name: Get yarn cache directory path
|
path: ~/.npm
|
||||||
id: yarn-cache-dir-path
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
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') }}
|
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-yarn-
|
${{ runner.os }}-node-
|
||||||
- run: cd ui && yarn install
|
- run: cd ui && npm ci
|
||||||
- run: cd ui && yarn build
|
- run: cd ui && npm run build
|
||||||
- run: cd ui && yarn lint
|
- run: cd ui && npm run lint
|
||||||
|
@ -30,8 +30,8 @@ FROM --platform=$BUILDPLATFORM dev-common AS build-ui
|
|||||||
LABEL maintainer="slamb@slamb.org"
|
LABEL maintainer="slamb@slamb.org"
|
||||||
WORKDIR /var/lib/moonfire-nvr/src/ui
|
WORKDIR /var/lib/moonfire-nvr/src/ui
|
||||||
COPY ui /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 \
|
RUN --mount=type=tmpfs,target=/var/lib/moonfire-nvr/src/ui/node_modules \
|
||||||
yarn install && yarn build
|
npm ci && npm run build
|
||||||
|
|
||||||
# Build the Rust components. Note that dev.sh set up an environment variable
|
# Build the Rust components. Note that dev.sh set up an environment variable
|
||||||
# in .buildrc that similarly changes the target dir path.
|
# in .buildrc that similarly changes the target dir path.
|
||||||
@ -65,7 +65,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
|
|||||||
rm -rf /var/lib/apt/lists/* && \
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
ln -s moonfire-nvr /usr/local/bin/nvr
|
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-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.
|
# The install instructions say to use --user in the docker run commandline.
|
||||||
# Specify a non-root user just in case someone forgets.
|
# Specify a non-root user just in case someone forgets.
|
||||||
|
@ -9,25 +9,17 @@ export DEBIAN_FRONTEND=noninteractive
|
|||||||
|
|
||||||
packages=()
|
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).
|
# Install all packages necessary for building (and some for testing/debugging).
|
||||||
packages+=(
|
packages+=(
|
||||||
build-essential
|
build-essential
|
||||||
|
curl
|
||||||
pkgconf
|
pkgconf
|
||||||
locales
|
locales
|
||||||
nodejs
|
npm
|
||||||
sudo
|
sudo
|
||||||
sqlite3
|
sqlite3
|
||||||
tzdata
|
tzdata
|
||||||
vim-nox
|
vim-nox
|
||||||
yarn
|
|
||||||
)
|
)
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install --assume-yes --no-install-recommends "${packages[@]}"
|
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
|
* [`ncursesw`](https://www.gnu.org/software/ncurses/), the UTF-8 version of
|
||||||
the `ncurses` library.
|
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
|
On recent Ubuntu or Raspbian Linux, the following command will install
|
||||||
all non-Rust dependencies:
|
all non-Rust dependencies:
|
||||||
|
|
||||||
@ -122,6 +124,7 @@ $ sudo apt-get install \
|
|||||||
libavutil-dev \
|
libavutil-dev \
|
||||||
libncurses-dev \
|
libncurses-dev \
|
||||||
libsqlite3-dev \
|
libsqlite3-dev \
|
||||||
|
npm \
|
||||||
pkgconf \
|
pkgconf \
|
||||||
sqlite3 \
|
sqlite3 \
|
||||||
tzdata
|
tzdata
|
||||||
@ -131,15 +134,12 @@ On macOS with [Homebrew](https://brew.sh/) and Xcode installed, try the
|
|||||||
following command:
|
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
|
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/).
|
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
|
Once prerequisites are installed, you can build the server and find it in
|
||||||
`target/release/moonfire-nvr`:
|
`target/release/moonfire-nvr`:
|
||||||
|
|
||||||
@ -149,12 +149,12 @@ $ cargo test
|
|||||||
$ cargo build --release
|
$ 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
|
$ cd ui
|
||||||
$ yarn
|
$ npm install
|
||||||
$ yarn build
|
$ npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running interactively straight from the working copy
|
### 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
|
Checkout the branch you want to work on and type
|
||||||
|
|
||||||
$ cd ui
|
$ cd ui
|
||||||
$ yarn start
|
$ npm run start
|
||||||
|
|
||||||
This will pack and prepare a development setup. By default the development
|
This will pack and prepare a development setup. By default the development
|
||||||
server that serves up the web page(s) will listen on
|
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
|
Thus one could connect to a remote Moonfire NVR by specifying its URL as
|
||||||
follows:
|
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
|
This allows you to test a new UI against your stable, production Moonfire NVR
|
||||||
installation with real data.
|
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
|
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:
|
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
|
Be careful, though: it's insecure to send your production credentials over a
|
||||||
non-`https` connection, as described more below.
|
non-`https` connection, as described more below.
|
||||||
|
10373
ui/package-lock.json
generated
Normal file
10373
ui/package-lock.json
generated
Normal file
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…
x
Reference in New Issue
Block a user