Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(frontend): switch to pnpm #304

Merged
merged 16 commits into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/frontend"
schedule:
interval: "daily"

- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
17 changes: 0 additions & 17 deletions .github/renovate.json

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/dependbot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Dependabot auto-merge
on: pull_request

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Approve PR
run: gh pr review --approve "${{ github.event.pull_request.html_url }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Enable auto-merge for non-major update PR
if: steps.metadata.outputs.update-type != 'version-update:semver-major'
run: gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 8 additions & 6 deletions .github/workflows/push-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ jobs:
fmt_clippy:
runs-on: ubuntu-latest
steps:
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- name: Enable corepack
run: corepack enable
- name: Lint (rustfmt)
run: cargo fmt -- --check
- name: Lint (clippy)
Expand All @@ -37,9 +39,6 @@ jobs:
- { target: armv7-unknown-linux-musleabihf, pretty: armv7l-backend, args: --no-default-features }
- { target: aarch64-unknown-linux-musl, pretty: aarch64-backend, args: --no-default-features }
steps:
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- uses: actions/checkout@v3
with:
fetch-depth: 0
Expand All @@ -52,6 +51,9 @@ jobs:
- uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.job.pretty }}
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- name: Install set-cargo-version
run: cargo install set-cargo-version
- name: Change frontend version to commit hash
Expand Down
6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ opt-level = "s"
flate2 = "1.0.24"
walkdir = "2.3.2"

# Install node.js, enable corepack for yarn, and create required directories
[package.metadata.cross.build]
pre-build = ["curl -fsSL https://deb.nodesource.com/setup_16.x | bash", "apt-get install -y nodejs",
"curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor -o /usr/share/keyrings/yarnkey.gpg",
"echo 'deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main' > /etc/apt/sources.list.d/yarn.list",
"apt-get update && apt-get install yarn"]
pre-build = ["curl -fsSL https://deb.nodesource.com/setup_16.x | bash", "apt-get install -y nodejs", "corepack enable", "mkdir /.node && chmod 777 /.node"]
17 changes: 4 additions & 13 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,17 @@ fn main() {
let frontend_path = concat!(env!("CARGO_MANIFEST_DIR"), "/frontend");
let dist_path = concat!(env!("CARGO_MANIFEST_DIR"), "/frontend/dist");

dbg!(std::str::from_utf8(
&std::process::Command::new("sh")
.args(["-c", "yarn version"])
.output()
.unwrap()
.stdout
)
.unwrap());

std::process::Command::new("sh")
.args(["-c", "yarn install"])
.args(["-c", "pnpm install"])
.current_dir(frontend_path)
.output()
.expect("Can't run yarn install");
.expect("Can't run pnpm install");

std::process::Command::new("sh")
.args(["-c", "yarn build"])
.args(["-c", "pnpm build"])
.current_dir(frontend_path)
.output()
.expect("Can't run yarn build");
.expect("Can't run pnpm build");

if std::env::var("PROFILE").unwrap_or_default() == "release" {
for i in walkdir::WalkDir::new(dist_path)
Expand Down
1 change: 0 additions & 1 deletion frontend/microlight.d.ts

This file was deleted.

2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"@sveltejs/vite-plugin-svelte": "1.0.1",
"@tsconfig/svelte": "3.0.0",
"@types/autosize": "4.0.1",
"@types/microlight": "^0.0.0",
"@types/semver-compare-multi": "^1.0.0",
"svelte": "3.49.0",
"svelte-check": "2.8.0",
"svelte-fa": "3.0.3",
Expand Down