Skip to content

Commit

Permalink
Merge pull request #1176 from nanu-c/switch-to-yarn
Browse files Browse the repository at this point in the history
[axolotl-web] Switch project over to yarn
  • Loading branch information
nanu-c committed Feb 22, 2024
2 parents fbec9fe + 928c39e commit d9342bc
Show file tree
Hide file tree
Showing 14 changed files with 1,323 additions and 24,437 deletions.
27 changes: 12 additions & 15 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ jobs:
uses: actions/checkout@v3

- name: Download dependencies
run: npm --prefix ./axolotl-web ci --loglevel verbose
run: yarn --cwd ./axolotl-web install --frozen-lockfile

- name: Run tests
run: npm --prefix ./axolotl-web test
run: yarn --cwd ./axolotl-web test

- name: Lint application
run: npm --prefix ./axolotl-web run lint
run: yarn --cwd ./axolotl-web run lint

- name: Analyze npm dependencies
run: npm --prefix ./axolotl-web run depcheck
- name: Analyze dependencies
run: yarn --cwd ./axolotl-web run depcheck

- name: Build
run: npm --prefix ./axolotl-web run build
run: yarn --cwd ./axolotl-web run build

- name: Upload build artifacts
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Rust cache
uses: swatinem/rust-cache@v2

Expand All @@ -132,16 +132,13 @@ jobs:
- name: Install tauri-cli
run: cargo install tauri-cli

- name: Install vite
run: npm install -g vite

- name: Download dependencies
run: npm --prefix ./axolotl-web ci --loglevel verbose

- name: Install dependencies
run: yarn --cwd ./axolotl-web install --frozen-lockfile

- name: Build deb package
run: cargo tauri build -b deb --features tauri

- name: Build appimage package
run: cargo tauri build -b appimage --features tauri

Expand Down Expand Up @@ -397,7 +394,7 @@ jobs:
with:
bundle: axolotl.flatpak
manifest-path: flatpak/org.nanuc.Axolotl.yml
branch: ${{ github.head_ref || github.ref_name }}
branch: ${{ github.head_ref || github.ref_name }}
arch: ${{ matrix.arch }}
build-bundle: true
upload-artifact: true
38 changes: 19 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

.PHONY: build clean build-axolotl-web build-axolotl install install-axolotl install-axolotl-web uninstall build-translation run check check-axolotl check-axolotl-web build-dependencies build-dependencies-axolotl-web build-dependencies-axolotl update-version build-dependencies-flatpak install-flatpak build-snap install-snap check-platform-deb-arm64 dependencies-deb-arm64 build-deb-arm64 prebuild-package-deb-arm64 build-package-deb-arm64 install-deb-arm64 uninstall-deb-arm64 check-platform-deb-arm64-cc dependencies-deb-arm64-cc build-deb-arm64-cc prebuild-package-deb-arm64-cc build-package-deb-arm64-cc clean-deb-arm64 package-clean-deb-arm64 uninstall-deb-dependencies-cc

NPM_VERSION := $(shell npm --version 2>/dev/null)
YARN_VERSION := $(shell yarn --version 2>/dev/null)
NODE_VERSION := $(shell node --version 2>/dev/null)
CARGO_VERSION := $(shell cargo --version 2>/dev/null)
GIT_VERSION := $(shell git --version 2>/dev/null)
Expand All @@ -21,7 +21,7 @@ define APPDATA_TEXT=
endef
export APPDATA_TEXT

NPM := $(shell which npm 2>/dev/null)
YARN := $(shell which yarn 2>/dev/null)
GIT := $(shell which git 2>/dev/null)
CARGO := $(shell which cargo 2>/dev/null)
FLATPAK := $(shell which flatpak 2>/dev/null)
Expand Down Expand Up @@ -49,7 +49,7 @@ install: install-axolotl install-axolotl-web
@sudo install -D -m 644 $(CURRENT_DIR)/scripts/axolotl.desktop $(DESTDIR)$(SHARE_PREFIX)/applications/axolotl.desktop
@sudo install -D -m 644 $(CURRENT_DIR)/snap/gui/axolotl.png $(DESTDIR)$(SHARE_PREFIX)/icons/hicolor/128x128/apps/axolotl.png

uninstall: uninstall-axolotl uninstall-axolotl-web
uninstall: uninstall-axolotl uninstall-axolotl-web

check: check-axolotl check-axolotl-web

Expand All @@ -73,14 +73,14 @@ uninstall-axolotl:

# axolotl-web
build-dependencies-axolotl-web:
$(NPM) install --prefix axolotl-web
$(YARN) install --cwd axolotl-web

build-axolotl-web:
@echo "Building axolotl-web..."
$(NPM) run build --prefix axolotl-web
$(YARN) run build --cwd axolotl-web

check-axolotl-web:
$(NPM) run test --prefix axolotl-web
$(YARN) run test --cwd axolotl-web

install-axolotl-web:
@echo "Installing axolotl-web..."
Expand All @@ -93,7 +93,7 @@ uninstall-axolotl-web:

## utilities
build-translation:
$(NPM) run translate --prefix axolotl-web
$(YARN) run translate --cwd axolotl-web

run:
@echo "Found go with version $(GO_VERSION)"
Expand Down Expand Up @@ -176,7 +176,7 @@ endif
dependencies-deb-arm64: check-platform-deb-arm64
@echo "Installing dependencies for building Axolotl on Debian 'testing' (bookworm)..."
@sudo $(APT) update
@sudo $(APT) install --assume-yes curl wget nodejs npm debmake
@sudo $(APT) install --assume-yes curl wget nodejs yarn debmake
@sudo $(APT) install --assume-yes --no-install-recommends libgtk-3-dev libjavascriptcoregtk-4.1-dev libsoup-3.0-dev libwebkit2gtk-4.1-dev protobuf-compiler
ifneq ($(RUST),${HOME}/.cargo/bin/rustup)
@curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
Expand All @@ -186,10 +186,10 @@ endif

build-deb-arm64: clean-deb-arm64
@echo "Building Axolotl for arm64/aarch64 on Debian - Please use 'testing' release!)."
@echo "Installing dependencies (npm)..."
@cd $(CURRENT_DIR)/axolotl-web && npm ci
@echo "Building (npm)..."
@cd $(CURRENT_DIR)/axolotl-web && npm run build
@echo "Installing dependencies (yarn)..."
@cd $(CURRENT_DIR)/axolotl-web && yarn install --frozen-lockfile
@echo "Building (yarn)..."
@cd $(CURRENT_DIR)/axolotl-web && yarn run build
@echo "Building (rust)..."
$(CARGO_PREFIX)/cargo build --features tauri --release
@echo "Building complete."
Expand Down Expand Up @@ -271,7 +271,7 @@ ifneq ($(DEBIAN_VERSION),bookworm)
endif
@sudo $(APT) update
@sudo dpkg --add-architecture arm64
@sudo $(APT) install --assume-yes curl wget nodejs npm gcc-aarch64-linux-gnu linux-libc-dev-arm64-cross debmake
@sudo $(APT) install --assume-yes curl wget nodejs yarn gcc-aarch64-linux-gnu linux-libc-dev-arm64-cross debmake
@sudo $(APT) install --assume-yes --no-install-recommends libglib2.0-dev:arm64 libgtk-3-dev:arm64 libjavascriptcoregtk-4.1-dev:arm64 protobuf-compiler:arm64 libwebkit2gtk-4.1-dev:arm64 librsvg2-dev:arm64 libayatana-appindicator3-dev:arm64 libssl-dev:arm64 libjavascriptcoregtk-4.1-dev:arm64 g++ g++-aarch64-linux-gnu
ifneq ($(RUST),${HOME}/.cargo/bin/rustup)
@curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
Expand All @@ -293,10 +293,10 @@ endif

build-deb-arm64-cc: clean-deb-arm64
@echo "Cross-compiling Axolotl for arm64/aarch64 on Debian 'testing'."
@echo "Installing dependencies (npm)..."
@cd $(CURRENT_DIR)/axolotl-web && npm --target_arch=arm64 ci
@echo "Building (npm)..."
@cd $(CURRENT_DIR)/axolotl-web && npm --target_arch=arm64 run build
@echo "Installing dependencies (yarn)..."
@cd $(CURRENT_DIR)/axolotl-web && npm_config_target_arch=arm64 yarn install --frozen-lockfile
@echo "Building (yarn)..."
@cd $(CURRENT_DIR)/axolotl-web && npm_config_target_arch=arm64 yarn run build
@echo "Building (rust)..."
@sudo systemctl start docker
@HOST_CC=gcc
Expand Down Expand Up @@ -350,12 +350,12 @@ package-clean-deb-arm64:
@rm --recursive --force $(CURRENT_DIR)/axolotl-$(AXOLOTL_VERSION)/

uninstall-deb-dependencies:
@sudo apt purge curl wget git golang nodejs npm debmake
@sudo apt purge curl wget git golang nodejs yarn debmake
@sudo apt autoremove && sudo apt autoclean
@rustup self uninstall

uninstall-deb-dependencies-cc:
@sudo apt purge curl wget git golang nodejs npm gcc-aarch64-linux-gnu debmake linux-libc-dev-arm64-cross docker-ce docker-ce-cli containerd.io libglib2.0-dev:arm64 libgtk-3-dev:arm64 libjavascriptcoregtk-4.1-dev:arm64 protobuf-compiler:arm64 libwebkit2gtk-4.1-dev:arm64 librsvg2-dev:arm64 libayatana-appindicator3-dev:arm64 libssl-dev:arm64 libjavascriptcoregtk-4.1-dev:arm64 g++ g++-aarch64-linux-gnu
@sudo apt purge curl wget git golang nodejs yarn gcc-aarch64-linux-gnu debmake linux-libc-dev-arm64-cross docker-ce docker-ce-cli containerd.io libglib2.0-dev:arm64 libgtk-3-dev:arm64 libjavascriptcoregtk-4.1-dev:arm64 protobuf-compiler:arm64 libwebkit2gtk-4.1-dev:arm64 librsvg2-dev:arm64 libayatana-appindicator3-dev:arm64 libssl-dev:arm64 libjavascriptcoregtk-4.1-dev:arm64 g++ g++-aarch64-linux-gnu
@sudo apt autoremove && sudo apt autoclean
@rustup self uninstall
@sudo rm /etc/apt/sources.list.d/docker.list
6 changes: 3 additions & 3 deletions appimage/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# https://sipb.mit.edu/doc/safe-shell/
set -eu -o pipefail

for build_dependency in go npm appimagetool
for build_dependency in go yarn appimagetool
do
if [ ! -f "$(command -v "${build_dependency}")" ]; then
echo "${dependency} is required!"
Expand All @@ -14,8 +14,8 @@ done

echo "build axolotl-web"
pushd ../axolotl-web
npm ci
npm run build
yarn install --frozen-lockfile
yarn run build
popd

echo "packaging it all up"
Expand Down
10 changes: 5 additions & 5 deletions axolotl-web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ The Axolotl backend is running a web server, and with it serving the frontend bu
This (sub)project is set up to support Node Version Manager (nvm).
To install, see [here](https://github.com/nvm-sh/nvm#installing-and-updating).

Once installed, the node and npm version used by this project can be installed as follows.
Once installed, the node and yarn version used by this project can be installed as follows.

```
nvm install
nvm use
```

Lastly, the npm dependencies needs to be downloaded.
Lastly, the dependencies needs to be downloaded.

```
npm install
yarn install
```

## Run
Expand All @@ -30,7 +30,7 @@ To start just the frontend, use the following command.
Note though, that the intended use of the frontend is generally to be started and used by the backend.

```
npm run serve
yarn run serve
```

## Build
Expand All @@ -39,5 +39,5 @@ To create the bundle, which the backend is serving, a bundle is required.
The bundle contains HTML, javascript and CSS - see `axolotl-web/dist` once finished.

```
npm run build
yarn run build
```
Loading

0 comments on commit d9342bc

Please sign in to comment.