From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Dominik Csapak <d.csapak@proxmox.com>
Subject: Re: [pve-devel] [PATCH v2 1/3] ship proper nodejs module 'pve-eslint'
Date: Wed, 25 Aug 2021 18:38:19 +0200 [thread overview]
Message-ID: <5fdfd5ae-d601-3032-37f8-8b5ec618dc9e@proxmox.com> (raw)
In-Reply-To: <20210719103149.3430829-2-d.csapak@proxmox.com>
On 19/07/2021 12:31, Dominik Csapak wrote:
> instead of concatenating the eslint module into our app.js, ship
> a 'pve-eslint' module that exports the built eslint module
>
> to do this, we have to leave the module type on 'umd' instead of
> changing to 'var' so that nodejs can properly import it.
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> Makefile | 2 +-
Does not applies here, did not really investigated yet though:
Applying: ship proper nodejs module 'pve-eslint'
Using index info to reconstruct a base tree...
error: removal patch leaves file contents
error: src/Makefile: patch does not apply
> debian/control | 7 +++++--
> debian/dirs | 1 +
> debian/links | 1 +
> debian/rules | 5 ++++-
> patches/0001-adapt-webpack-config.patch | 19 +++++--------------
> src/Makefile | 15 ---------------
> src/{ => bin}/app.js | 5 ++++-
> src/index.js | 3 +++
> src/package.json | 9 +++++++++
> 10 files changed, 33 insertions(+), 34 deletions(-)
> create mode 100644 debian/dirs
> create mode 100644 debian/links
> delete mode 100644 src/Makefile
> rename src/{ => bin}/app.js (99%)
> create mode 100644 src/index.js
> create mode 100644 src/package.json
>
> diff --git a/Makefile b/Makefile
> index 9dbe3d0..2a6666c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -49,7 +49,7 @@ download:
> # NOTE: needs npm installed, downloads packages from npm
> .PHONY: buildupstream
> buildupstream: ${BUILDSRC}
> - cp ${BUILDSRC}/build/eslint.js ${SRCDIR}/eslint.js
> + cp ${BUILDSRC}/build/eslint.js ${SRCDIR}/lib/eslint.js
>
> ${BUILDSRC}: ${UPSTREAM} patches
> rm -rf $@
> diff --git a/debian/control b/debian/control
> index 3f9b014..7ea3664 100644
> --- a/debian/control
> +++ b/debian/control
> @@ -2,13 +2,16 @@ Source: pve-eslint
> Section: devel
> Priority: optional
> Maintainer: Proxmox Support Team <support@proxmox.com>
> -Build-Depends: debhelper (>= 12~)
> +Build-Depends: debhelper (>= 12~),
> + nodejs,
> + pkg-js-tools (>= 0.8.11)
> Standards-Version: 4.3.0
> Homepage: http://www.proxmox.com
>
> Package: pve-eslint
> Architecture: all
> -Depends: node-commander, node-colors, nodejs, ${misc:Depends},
> +Depends: node-commander, node-colors, nodejs (>= ${nodejs:Version}), ${misc:Depends},
> +Provides: ${nodejs:Provides}
> Description: ESLint for Proxmox Virtual Environment development
> This package contains a version of eslint used to develop the
> Proxmox Virtual Environment, and other Proxmox projects, web GUI.
> diff --git a/debian/dirs b/debian/dirs
> new file mode 100644
> index 0000000..e772481
> --- /dev/null
> +++ b/debian/dirs
> @@ -0,0 +1 @@
> +usr/bin
> diff --git a/debian/links b/debian/links
> new file mode 100644
> index 0000000..99342ed
> --- /dev/null
> +++ b/debian/links
> @@ -0,0 +1 @@
> +usr/share/nodejs/pve-eslint/bin/app.js usr/bin/eslint
> diff --git a/debian/rules b/debian/rules
> index 2d33f6a..b4c4090 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -1,4 +1,7 @@
> #!/usr/bin/make -f
>
> %:
> - dh $@
> + dh $@ --with nodejs
> +
> +execute_after_dh_fixperms:
> + chmod --recursive a+x -- debian/*/usr/share/nodejs/pve-eslint/bin/*
> diff --git a/patches/0001-adapt-webpack-config.patch b/patches/0001-adapt-webpack-config.patch
> index 4698e74..b0201e1 100644
> --- a/patches/0001-adapt-webpack-config.patch
> +++ b/patches/0001-adapt-webpack-config.patch
> @@ -3,21 +3,20 @@ From: Dominik Csapak <d.csapak@proxmox.com>
> Date: Thu, 2 Apr 2020 07:10:18 +0000
> Subject: [PATCH] adapt webpack config
>
> -changes to 'var' from 'umd' since we want to use it in the same file
> adds 'cli-engine' to build (we use it in our wrapper)
> and target 'node' since we will use it on the cli
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> - webpack.config.js | 6 +++---
> - 1 file changed, 3 insertions(+), 3 deletions(-)
> + webpack.config.js | 3 ++-
> + 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/webpack.config.js b/webpack.config.js
> -index 29d60cb4..95027075 100644
> +index a22c99b..9209159 100644
> --- a/webpack.config.js
> +++ b/webpack.config.js
> -@@ -2,14 +2,14 @@
> -
> +@@ -4,8 +4,9 @@ const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
> + /** @type {import("webpack").Configuration} */
> module.exports = {
> mode: "none",
> + target: "node",
> @@ -27,13 +26,5 @@ index 29d60cb4..95027075 100644
> },
> output: {
> filename: "[name].js",
> - library: "[name]",
> -- libraryTarget: "umd",
> -- globalObject: "this"
> -+ libraryTarget: "var"
> - },
> - module: {
> - rules: [
> --
> 2.20.1
> -
> diff --git a/src/Makefile b/src/Makefile
> deleted file mode 100644
> index bef1c57..0000000
> diff --git a/src/app.js b/src/bin/app.js
> similarity index 99%
> rename from src/app.js
> rename to src/bin/app.js
> index 9226234..8a28923 100644
> --- a/src/app.js
> +++ b/src/bin/app.js
> @@ -1,9 +1,12 @@
> -(function() {
> +#!/usr/bin/env node
> +
> +(async function(){
> 'use strict';
>
> const path = require('path');
> const color = require('colors');
> const program = require('commander');
> +const eslint = require('pve-eslint');
>
> program
> .usage('[options] [<file(s) ...>]')
> diff --git a/src/index.js b/src/index.js
> new file mode 100644
> index 0000000..01b9a1d
> --- /dev/null
> +++ b/src/index.js
> @@ -0,0 +1,3 @@
> +const eslint = require('./lib/eslint.js');
> +
> +module.exports = eslint;
> diff --git a/src/package.json b/src/package.json
> new file mode 100644
> index 0000000..b08184b
> --- /dev/null
> +++ b/src/package.json
> @@ -0,0 +1,9 @@
> +{
> + "name": "pve-eslint",
> + "version": "7.28.0",
> + "files": [
> + "index.js",
> + "bin/app.js",
> + "lib/eslint.js"
> + ]
> +}
>
next prev parent reply other threads:[~2021-08-25 16:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-19 10:31 [pve-devel] [PATCH v2 0/3] make linting threaded Dominik Csapak
2021-07-19 10:31 ` [pve-devel] [PATCH v2 1/3] ship proper nodejs module 'pve-eslint' Dominik Csapak
2021-08-25 16:38 ` Thomas Lamprecht [this message]
2021-08-30 9:17 ` Dominik Csapak
2021-08-30 9:25 ` Thomas Lamprecht
2021-08-30 10:06 ` Dominik Csapak
2021-08-30 10:36 ` [pve-devel] applied: " Thomas Lamprecht
2021-08-30 10:43 ` Dominik Csapak
2021-08-30 11:03 ` Thomas Lamprecht
2021-07-19 10:31 ` [pve-devel] [PATCH v2 2/3] remove unnecessary eslint.js Dominik Csapak
2021-07-19 10:31 ` [pve-devel] [PATCH v2 3/3] use worker_threads for linting Dominik Csapak
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=5fdfd5ae-d601-3032-37f8-8b5ec618dc9e@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/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