Merge pull request #933 from felipecrs/volta
Use Volta to manage Node and Yarn version
This commit is contained in:
@@ -1,10 +1,9 @@
|
|||||||
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-16
|
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04
|
||||||
|
|
||||||
# Install Docker
|
USER vscode
|
||||||
ENV DOCKER_BUILDKIT="1"
|
|
||||||
# https://github.com/microsoft/vscode-dev-containers/commits/main/script-library/docker-debian.sh
|
# Install Volta
|
||||||
ARG DOCKER_SCRIPT_VERSION="364972b0d7d20ee5de40c1084e65f3f1bc6d5951"
|
ARG HOME="/home/vscode"
|
||||||
RUN bash -c "$(curl -fsSL "https://raw.githubusercontent.com/microsoft/vscode-dev-containers/${DOCKER_SCRIPT_VERSION}/script-library/docker-debian.sh")" \
|
ENV VOLTA_HOME="${HOME}/.volta"
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
ENV PATH="${VOLTA_HOME}/bin:${PATH}"
|
||||||
ENTRYPOINT ["/usr/local/share/docker-init.sh"]
|
RUN bash -c "$(curl -fsSL https://get.volta.sh)" -- --skip-setup
|
||||||
CMD ["sleep", "infinity"]
|
|
||||||
|
|||||||
@@ -2,8 +2,15 @@
|
|||||||
{
|
{
|
||||||
"dockerComposeFile": "../docker-compose.yml",
|
"dockerComposeFile": "../docker-compose.yml",
|
||||||
"service": "dev",
|
"service": "dev",
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
|
||||||
|
"moby": false,
|
||||||
|
"dockerDashComposeVersion": "v2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"workspaceFolder": "${localWorkspaceFolder}",
|
"workspaceFolder": "${localWorkspaceFolder}",
|
||||||
"shutdownAction": "stopCompose",
|
"shutdownAction": "stopCompose",
|
||||||
|
"forwardPorts": [10001, "hass:8123", "frigate:5000"],
|
||||||
"portsAttributes": {
|
"portsAttributes": {
|
||||||
"10001": {
|
"10001": {
|
||||||
"label": "Rollup",
|
"label": "Rollup",
|
||||||
@@ -18,9 +25,10 @@
|
|||||||
"onAutoForward": "silent"
|
"onAutoForward": "silent"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"forwardPorts": [10001, "hass:8123", "frigate:5000"],
|
|
||||||
"initializeCommand": ".devcontainer/initialize.sh",
|
"initializeCommand": ".devcontainer/initialize.sh",
|
||||||
"postCreateCommand": "yarn install",
|
"postCreateCommand": "yarn install",
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"github.vscode-pull-request-github",
|
"github.vscode-pull-request-github",
|
||||||
"eamodio.gitlens",
|
"eamodio.gitlens",
|
||||||
@@ -48,3 +56,5 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,11 +16,17 @@ jobs:
|
|||||||
name: Test build
|
name: Test build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Checkout
|
||||||
- name: Build
|
uses: actions/checkout@v3
|
||||||
run: |
|
|
||||||
yarn install
|
- name: Setup Node and Yarn
|
||||||
yarn run build
|
uses: volta-cli/action@v3
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --immutable
|
||||||
|
|
||||||
|
- name: Build the file
|
||||||
|
run: yarn run build
|
||||||
|
|
||||||
- name: HACS build validation
|
- name: HACS build validation
|
||||||
uses: "hacs/action@21.12.1"
|
uses: "hacs/action@21.12.1"
|
||||||
|
|||||||
@@ -11,13 +11,17 @@ jobs:
|
|||||||
name: Prepare release
|
name: Prepare release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Node and Yarn
|
||||||
|
uses: volta-cli/action@v3
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --immutable
|
||||||
|
|
||||||
# Build
|
|
||||||
- name: Build the file
|
- name: Build the file
|
||||||
run: |
|
run: yarn run build
|
||||||
yarn install
|
|
||||||
yarn run build
|
|
||||||
|
|
||||||
# Upload build file to the release as an asset.
|
# Upload build file to the release as an asset.
|
||||||
- name: Upload zip to release
|
- name: Upload zip to release
|
||||||
|
|||||||
+9
-1
@@ -2,9 +2,17 @@
|
|||||||
/.rpt2_cache/
|
/.rpt2_cache/
|
||||||
package-lock.json
|
package-lock.json
|
||||||
/dist
|
/dist
|
||||||
/.yarn/
|
|
||||||
|
|
||||||
.env
|
.env
|
||||||
.envrc
|
.envrc
|
||||||
|
|
||||||
stats.html
|
stats.html
|
||||||
|
|
||||||
|
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
|
||||||
|
.pnp.*
|
||||||
|
.yarn/*
|
||||||
|
!.yarn/patches
|
||||||
|
!.yarn/plugins
|
||||||
|
!.yarn/releases
|
||||||
|
!.yarn/sdks
|
||||||
|
!.yarn/versions
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
nodeLinker: node-modules
|
||||||
@@ -3281,6 +3281,10 @@ This card heavily uses [Embla Carousel](https://www.embla-carousel.com/) -- a li
|
|||||||
|
|
||||||
### Building
|
### Building
|
||||||
|
|
||||||
|
This project uses [Volta](https://github.com/volta-cli/volta) to ensure a consistent version of Node and Yarn are used during development. If you install Volta in your environment, you should not need to worry about which version of both to choose. **Note:** the dev container already comes with Volta installed.
|
||||||
|
|
||||||
|
However, if you are not using Volta, you can check the `volta` key in the [`package.json`](./package.json) for a reference on which version of Node and Yarn should be used.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ git clone https://github.com/dermotduffy/frigate-hass-card
|
$ git clone https://github.com/dermotduffy/frigate-hass-card
|
||||||
$ cd frigate-hass-card
|
$ cd frigate-hass-card
|
||||||
@@ -3292,9 +3296,9 @@ Resultant build will be at `dist/frigate-hass-card.js`. This could be installed
|
|||||||
|
|
||||||
### Dev Container
|
### Dev Container
|
||||||
|
|
||||||
[](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/dermotduffy/frigate-hass-card)
|
[](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/dermotduffy/frigate-hass-card)
|
||||||
|
|
||||||
You can use the [VS Code Remote - Containers](https://code.visualstudio.com/docs/remote/containers) extension to speed up the development environment creation. Simply:
|
You can use the [VS Code Dev Containers](https://code.visualstudio.com/docs/remote/containers) extension to speed up the development environment creation. Simply:
|
||||||
|
|
||||||
1. Clone the repository to your machine
|
1. Clone the repository to your machine
|
||||||
1. Open VS Code on it
|
1. Open VS Code on it
|
||||||
@@ -3303,9 +3307,9 @@ You can use the [VS Code Remote - Containers](https://code.visualstudio.com/docs
|
|||||||
|
|
||||||
Everything should just work without any additional configuration. Under the hood, the dev container setup takes care of bringing up:
|
Everything should just work without any additional configuration. Under the hood, the dev container setup takes care of bringing up:
|
||||||
|
|
||||||
* Home Assistant (port `48123:8123`)
|
* Home Assistant (port `8123` or the next available one)
|
||||||
* Frigate (ports `45000:5000`, `41935:1935`)
|
* Frigate (ports `5000` or the next available one)
|
||||||
* MQTT (port `41883:1883`)
|
* MQTT (port `1883` or the next available one)
|
||||||
|
|
||||||
As docker-compose containers.
|
As docker-compose containers.
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
version: '3'
|
|
||||||
services:
|
services:
|
||||||
dev:
|
dev:
|
||||||
user: node
|
|
||||||
init: true
|
init: true
|
||||||
build: .devcontainer
|
build: .devcontainer
|
||||||
|
entrypoint: /usr/local/share/docker-init.sh
|
||||||
|
command: sleep infinity
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
+4
-1
@@ -74,12 +74,15 @@
|
|||||||
"ts-prune": "^0.10.3",
|
"ts-prune": "^0.10.3",
|
||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@3.4.1",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "rollup -c --watch",
|
"start": "rollup -c --watch",
|
||||||
"build": "yarn run lint && yarn run rollup",
|
"build": "yarn run lint && yarn run rollup",
|
||||||
"lint": "eslint 'src/**/*.ts'",
|
"lint": "eslint 'src/**/*.ts'",
|
||||||
"rollup": "rollup -c",
|
"rollup": "rollup -c",
|
||||||
"prune": "ts-prune"
|
"prune": "ts-prune"
|
||||||
|
},
|
||||||
|
"volta": {
|
||||||
|
"node": "18.14.0",
|
||||||
|
"yarn": "3.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user