From: selfisekai <selfisekai@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] nodejs build style
Date: Sun, 03 Jan 2021 04:41:15 +0100 [thread overview]
Message-ID: <20210103034115.UbGGij1yrPv4SrKGZRNUYz7wvFinPs-8a1m9niZGB7c@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-23947@inbox.vuxu.org>
[-- Attachment #1: Type: text/plain, Size: 367 bytes --]
There is an updated pull request by selfisekai against master on the void-packages repository
https://github.com/selfisekai/void-packages node-build-style
https://github.com/void-linux/void-packages/pull/23947
nodejs build style
intended mostly for (bleh) electron packages
A patch file from https://github.com/void-linux/void-packages/pull/23947.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-node-build-style-23947.patch --]
[-- Type: text/x-diff, Size: 4348 bytes --]
From 135796b8cfb80c0449d5d42e57134e9a6881dee2 Mon Sep 17 00:00:00 2001
From: selfisekai <laura@selfisekai.rocks>
Date: Thu, 30 Jul 2020 11:19:10 +0200
Subject: [PATCH 1/3] nodejs build style
---
common/build-style/nodejs.sh | 37 ++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 common/build-style/nodejs.sh
diff --git a/common/build-style/nodejs.sh b/common/build-style/nodejs.sh
new file mode 100644
index 00000000000..c9e749d3342
--- /dev/null
+++ b/common/build-style/nodejs.sh
@@ -0,0 +1,37 @@
+#
+# This helper is for templates for Node.js packages (including Electron.js)
+#
+
+do_configure() {
+ if [ -f "yarn.lock" ]; then
+ : ${nodejs_packager:=yarn}
+ else
+ : ${nodejs_packager:=npm}
+ fi
+
+ $nodejs_packager install
+}
+
+do_build() {
+ if [ -f "yarn.lock" ]; then
+ : ${nodejs_packager:=yarn}
+ else
+ : ${nodejs_packager:=npm}
+ fi
+
+ : ${nodejs_build_script:=build}
+
+ $nodejs_packager run $nodejs_build_script
+}
+
+do_install() {
+ if [ -f "yarn.lock" ]; then
+ : ${nodejs_packager:=yarn}
+ else
+ : ${nodejs_packager:=npm}
+ fi
+
+ : ${nodejs_install_script:=pack} # name suggested by https://github.com/electron-userland/electron-builder#quick-setup-guide
+
+ $nodejs_packager run $nodejs_install_script
+}
From e02f50d0f5f80e97adccff6034c7ab8eb2d3f8f4 Mon Sep 17 00:00:00 2001
From: selfisekai <laura@selfisekai.rocks>
Date: Thu, 5 Nov 2020 19:04:58 +0100
Subject: [PATCH 2/3] node build_style: set NODE_ENV
---
common/build-style/nodejs.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/common/build-style/nodejs.sh b/common/build-style/nodejs.sh
index c9e749d3342..98268b33de0 100644
--- a/common/build-style/nodejs.sh
+++ b/common/build-style/nodejs.sh
@@ -3,6 +3,7 @@
#
do_configure() {
+ : ${NODE_ENV:=production}
if [ -f "yarn.lock" ]; then
: ${nodejs_packager:=yarn}
else
@@ -13,6 +14,7 @@ do_configure() {
}
do_build() {
+ : ${NODE_ENV:=production}
if [ -f "yarn.lock" ]; then
: ${nodejs_packager:=yarn}
else
@@ -24,7 +26,9 @@ do_build() {
$nodejs_packager run $nodejs_build_script
}
+# it's really likely that it won't suit anybody's needs but whatever
do_install() {
+ : ${NODE_ENV:=production}
if [ -f "yarn.lock" ]; then
: ${nodejs_packager:=yarn}
else
From 35ec9daad070692ef6fb121dcacd33b14c3bc937 Mon Sep 17 00:00:00 2001
From: Laura Liberda <laura@selfisekai.rocks>
Date: Sat, 2 Jan 2021 21:14:42 +0100
Subject: [PATCH 3/3] docs: nodejs build style basic information
---
Manual.md | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/Manual.md b/Manual.md
index 4f954b840be..b08e3686b37 100644
--- a/Manual.md
+++ b/Manual.md
@@ -915,6 +915,9 @@ depend on additional packages. This build style does not install
dependencies to the root directory, and only checks if a binary package is
available in repositories.
+- `nodejs` For apps made in Node.js that get built with npm or yarn
+(including Electron.js apps).
+
- `R-cran` For packages that are available on The Comprehensive R Archive
Network (CRAN). The build style requires the `pkgname` to start with
`R-cran-` and any dashes (`-`) in the CRAN-given version to be replaced
@@ -1616,6 +1619,23 @@ The following variables influence how Haskell packages are built:
- `make_build_args`: This is passed as-is to `stack build ...`, so
you can add your `--flag ...` parameters there.
+<a id="pkgs_nodejs"></a>
+### Node.js packages
+
+Node.js packages should be built with the `nodejs` build style, if possible.
+The `nodejs` build style takes care of downloading yarn/npm dependencies
+and running builds via package.json scripts.
+
+The following template variables influence how Node.js packages are built:
+- `nodejs_build_script`: the package.json script that builds the app files
+ (default: `build`).
+- `nodejs_install_script`: app installing script, which most probably
+ doesn't even exist and you should redefine `do_install`
+ in your build script.
+- `nodejs_packager`: whether the build script should use yarn or npm.
+ Set to `yarn` if the `yarn.lock` file exists, else it's set to `npm`
+- `NODE_ENV`: set to `production` by default
+
<a id="pkgs_font"></a>
### Font packages
next prev parent reply other threads:[~2021-01-03 3:41 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-30 9:19 [PR PATCH] " selfisekai
2020-08-03 20:08 ` Chocimier
2020-08-16 23:37 ` fosslinux
2020-09-04 16:02 ` Anachron
2020-11-05 18:04 ` [PR PATCH] [Updated] " selfisekai
2020-11-15 23:41 ` fosslinux
2020-12-30 7:19 ` the-maldridge
2021-01-02 20:15 ` [PR PATCH] [Updated] " selfisekai
2021-01-02 20:20 ` selfisekai
2021-01-02 21:59 ` fosslinux
2021-01-02 22:20 ` [PR REVIEW] " the-maldridge
2021-01-03 3:41 ` selfisekai [this message]
2021-01-29 3:00 ` ericonr
2021-01-29 3:00 ` ericonr
2021-01-29 3:00 ` ericonr
2021-01-29 3:01 ` ericonr
2021-01-29 5:03 ` fosslinux
2021-01-29 5:18 ` ericonr
2021-04-03 23:14 ` [PR PATCH] [Closed]: " selfisekai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210103034115.UbGGij1yrPv4SrKGZRNUYz7wvFinPs-8a1m9niZGB7c@z \
--to=selfisekai@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).