From 50e4af212e1195493f2de7e69001cf8aa301abd0 Mon Sep 17 00:00:00 2001 From: deemkeen Date: Sat, 6 Apr 2024 23:25:09 +0200 Subject: [PATCH 1/3] windows support for bun --- README.md | 40 +++++++++++++++++++ .../src/it/bun-integration/invoker.properties | 2 +- .../src/it/bun-integration/pom.xml | 2 +- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 51cfba120..62edd4d81 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ It's supposed to work on Windows, OS X and Linux. If you prefer [Yarn](https://yarnpkg.com/) over [NPM](https://www.npmjs.com/) for your node package fetching, this plugin can also download Node and Yarn and then run `yarn install` for your project. +The new [Bun](https://bun.sh/) Javascript Toolkit is also supported. + #### What is this plugin meant to do? - Let you keep your frontend and backend builds as separate as possible, by reducing the amount of interaction between them to the bare minimum; using only 1 plugin. @@ -56,9 +58,11 @@ to see how it should be set up: https://github.com/eirslett/frontend-maven-plugi - [Installing node and npm](#installing-node-and-npm) - [Installing node and yarn](#installing-node-and-yarn) + - [Installing bun](#installing-bun) - Running - [npm](#running-npm) - [yarn](#running-yarn) + - [bun](#running-bun) - [bower](#running-bower) - [grunt](#running-grunt) - [gulp](#running-gulp) @@ -171,6 +175,26 @@ https://github.com/eirslett/frontend-maven-plugin/blob/master/frontend-maven-plu ``` +### Installing Bun + +The new alternative is to use Bun, which combines features of a runtime and a package manager. + +```xml + + ... + + install bun runtime + + install-bun + + + + v1.1.2 + target + + +``` + ### Running npm All node packaged modules will be installed in the `node_modules` folder in your [working directory](#working-directory). @@ -274,6 +298,22 @@ Also you can set a registry using a tag `npmRegistryURL` ``` +### Running bun + +This works exactly like yarn, all node packaged modules will be installed in the `node_modules` folder in your [working directory](#working-directory). + +```xml + + bun install + + bun + + + install + + +``` + ### Running bower All bower dependencies will be installed in the `bower_components` folder in your working directory. diff --git a/frontend-maven-plugin/src/it/bun-integration/invoker.properties b/frontend-maven-plugin/src/it/bun-integration/invoker.properties index 93fc8f46c..35a0bebfd 100644 --- a/frontend-maven-plugin/src/it/bun-integration/invoker.properties +++ b/frontend-maven-plugin/src/it/bun-integration/invoker.properties @@ -1 +1 @@ -invoker.os.family = !windows, unix, mac +invoker.os.family = windows, unix, mac diff --git a/frontend-maven-plugin/src/it/bun-integration/pom.xml b/frontend-maven-plugin/src/it/bun-integration/pom.xml index 95122ece6..bd1e6c69a 100644 --- a/frontend-maven-plugin/src/it/bun-integration/pom.xml +++ b/frontend-maven-plugin/src/it/bun-integration/pom.xml @@ -27,7 +27,7 @@ install-bun - v1.0.10 + v1.1.2 From afa6d0b0d9855f5c59dc4a855659cf24b4091c14 Mon Sep 17 00:00:00 2001 From: deemkeen Date: Sat, 6 Apr 2024 23:40:49 +0200 Subject: [PATCH 2/3] windows support for bun --- .../eirslett/maven/plugins/frontend/lib/BunInstaller.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/BunInstaller.java b/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/BunInstaller.java index ad1becc69..1989e3dab 100644 --- a/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/BunInstaller.java +++ b/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/BunInstaller.java @@ -58,9 +58,6 @@ public void install() throws InstallationException { if (!bunIsAlreadyInstalled()) { if (!this.bunVersion.startsWith("v")) { this.logger.warn("Bun version does not start with naming convention 'v'."); - } - if (this.config.getPlatform().isWindows()) { - throw new InstallationException("Unable to install bun on windows!"); } else { installBunDefault(); } From b6e03196e13da89f02c4dff0f50afd3d9344fd8d Mon Sep 17 00:00:00 2001 From: deemkeen Date: Sun, 7 Apr 2024 00:06:42 +0200 Subject: [PATCH 3/3] windows support for bun --- .../eirslett/maven/plugins/frontend/lib/BunInstaller.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/BunInstaller.java b/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/BunInstaller.java index 1989e3dab..3be6339fe 100644 --- a/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/BunInstaller.java +++ b/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/BunInstaller.java @@ -129,8 +129,11 @@ private void installBunDefault() throws InstallationException { } // Search for the bun binary + String binaryFile = OS.guess().equals(OS.Windows) ? "bun.exe" : "bun"; + File bunBinary = - new File(getInstallDirectory(), File.separator + createBunTargetArchitecturePath() + File.separator + "bun"); + new File(getInstallDirectory(), File.separator + createBunTargetArchitecturePath() + File.separator + binaryFile); + if (!bunBinary.exists()) { throw new FileNotFoundException( "Could not find the downloaded bun binary in " + bunBinary); @@ -177,7 +180,7 @@ private String createDownloadUrl() { private String createBunTargetArchitecturePath() { OS os = OS.guess(); Architecture architecture = Architecture.guess(); - String destOs = os.equals(OS.Linux) ? "linux" : os.equals(OS.Mac) ? "darwin" : null; + String destOs = os.equals(OS.Linux) ? "linux" : os.equals(OS.Mac) ? "darwin" : os.equals(OS.Windows) ? "windows" : null; String destArc = architecture.equals(Architecture.x64) ? "x64" : architecture.equals( Architecture.arm64) ? "aarch64" : null; return String.format("%s-%s-%s", INSTALL_PATH, destOs, destArc);