uivonim: use buildNpmPackage
This commit is contained in:
parent
f409c89968
commit
0895c5896e
@ -1,6 +1,11 @@
|
||||
{ lib, mkYarnPackage, fetchFromGitHub, electron, makeWrapper }:
|
||||
{ lib
|
||||
, buildNpmPackage
|
||||
, fetchFromGitHub
|
||||
, electron
|
||||
, makeWrapper
|
||||
}:
|
||||
|
||||
mkYarnPackage rec {
|
||||
buildNpmPackage rec {
|
||||
pname = "uivonim";
|
||||
version = "unstable-2021-05-24";
|
||||
|
||||
@ -11,56 +16,23 @@ mkYarnPackage rec {
|
||||
sha256 = "1b6k834qan8vhcdqmrs68pbvh4b59g9bx5126k5hjha6v3asd8pj";
|
||||
};
|
||||
|
||||
# The spectron dependency has to be removed manually from package.json,
|
||||
# because it requires electron-chromedriver, which wants to download stuff.
|
||||
# It is also good to remove the electron-builder bloat.
|
||||
packageJSON = ./package.json;
|
||||
yarnLock = ./yarn.lock;
|
||||
yarnNix = ./yarn.nix;
|
||||
npmDepsHash = "sha256-9oyw09DdjyAjv1IW30715kp0urf/1v754teEtDY1TaI=";
|
||||
|
||||
yarnPreBuild = ''
|
||||
# workaround for missing opencollective-postinstall
|
||||
mkdir -p $TMPDIR/bin
|
||||
touch $TMPDIR/bin/opencollective-postinstall
|
||||
chmod +x $TMPDIR/bin/opencollective-postinstall
|
||||
export PATH=$PATH:$TMPDIR/bin
|
||||
|
||||
export ELECTRON_SKIP_BINARY_DOWNLOAD=1
|
||||
'';
|
||||
|
||||
# We build (= webpack) uivonim in a separate package,
|
||||
# because this requires devDependencies that we do not
|
||||
# wish to bundle (because they add 250M to the closure size).
|
||||
build = mkYarnPackage {
|
||||
name = "uivonim-build-${version}";
|
||||
inherit version src packageJSON yarnLock yarnNix yarnPreBuild distPhase;
|
||||
|
||||
buildPhase = ''
|
||||
yarn build:prod
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mv deps/uivonim/build $out
|
||||
'';
|
||||
env = {
|
||||
ELECTRON_SKIP_BINARY_DOWNLOAD = 1;
|
||||
};
|
||||
|
||||
# The --production flag disables the devDependencies.
|
||||
yarnFlags = [ "--production" ];
|
||||
npmFlags = [ "--ignore-scripts" ];
|
||||
|
||||
npmBuildScript = "build:prod";
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
postInstall = ''
|
||||
dir=$out/libexec/uivonim/node_modules/uivonim/
|
||||
# need to copy instead of symlink because
|
||||
# otherwise electron won't find the node_modules
|
||||
cp -ra ${build} $dir/build
|
||||
makeWrapper ${electron}/bin/electron $out/bin/uivonim \
|
||||
--set NODE_ENV production \
|
||||
--add-flags $dir/build/main/main.js
|
||||
--add-flags $out/lib/node_modules/uivonim/build/main/main.js
|
||||
'';
|
||||
|
||||
distPhase = ":"; # disable useless $out/tarballs directory
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/smolck/uivonim";
|
||||
description = "Cross-platform GUI for neovim based on electron";
|
||||
|
@ -1,71 +0,0 @@
|
||||
{
|
||||
"name": "uivonim",
|
||||
"author": "smolck",
|
||||
"license": "AGPL-3.0-only",
|
||||
"version": "0.28.0",
|
||||
"description": "Extensible Neovim GUI forked from Veonim",
|
||||
"main": "build/main/main.js",
|
||||
"scripts": {
|
||||
"dev": "npm run build && electron build/main/main.js",
|
||||
"prod": "npm run build:prod && NODE_ENV=production electron build/main/main.js",
|
||||
"prod:start": "NODE_ENV=production electron build/main/main.js",
|
||||
"build": "node tools/build.js",
|
||||
"build:prod": "node tools/build-prod.js",
|
||||
"check-types": "tsc -p src/tsconfig.json --noEmit",
|
||||
"package": "npm run build:prod && electron-builder",
|
||||
"test": "mocha \"test/unit/**/*.js\"",
|
||||
"test:e2e": "mocha test/e2e -t 0",
|
||||
"test:e2e:snapshot": "npm run test:e2e -- --snapshot",
|
||||
"test:integration": "mocha test/integration -t 10000",
|
||||
"test:watch": "npm run test -- -w",
|
||||
"test:integration:watch": "npm run test:integration -- -w",
|
||||
"gen:font-sizes": "electron tools/font-sizer/index.js",
|
||||
"unused-exports": "ts-unused-exports src/tsconfig.json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/smolck/uivonim.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/smolck/uivonim/issues"
|
||||
},
|
||||
"homepage": "https://github.com/smolck/uivonim",
|
||||
"dependencies": {
|
||||
"feather-icons": "^4.28.0",
|
||||
"fuzzaldrin-plus": "^0.6.0",
|
||||
"highlight.js": "^10.7.2",
|
||||
"inferno": "^7.4.8",
|
||||
"marked": "^2.0.5",
|
||||
"neovim": "^4.10.0",
|
||||
"ts-node": "^10.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.14.3",
|
||||
"@babel/core": "^7.14.3",
|
||||
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.14.2",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.14.0",
|
||||
"@babel/preset-typescript": "^7.13.0",
|
||||
"@medv/finder": "^2.0.0",
|
||||
"@types/fuzzaldrin-plus": "^0.6.1",
|
||||
"@types/marked": "^2.0.3",
|
||||
"@types/node": "^15.6.0",
|
||||
"@types/webgl2": "0.0.6",
|
||||
"babel-loader": "^8.2.2",
|
||||
"babel-plugin-inferno": "^6.2.0",
|
||||
"babel-plugin-syntax-jsx": "^6.18.0",
|
||||
"electron": "^12.0.9",
|
||||
"electron-devtools-installer": "^3.2.0",
|
||||
"fs-extra": "^10.0.0",
|
||||
"mocha": "^8.4.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"prettier": "2.3.0",
|
||||
"proxyquire": "^2.1.3",
|
||||
"ts-loader": "^9.2.2",
|
||||
"ts-unused-exports": "^7.0.3",
|
||||
"ttypescript": "^1.5.12",
|
||||
"typescript": "^4.2.4",
|
||||
"webpack": "^5.37.1",
|
||||
"webpack-cli": "^4.7.0"
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user