Unverified Commit 4dd0c3cf authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

Merge pull request #229184 from gador/pgadmin-fix-yarn

parents ea8e21f9 8cad3dbe
Loading
Loading
Loading
Loading
+33 −23
Original line number Diff line number Diff line
{ lib
, python3
, fetchurl
, fetchFromGitHub
, fetchYarnDeps
, zlib
, mkYarnModules
, nixosTests
, pkgs
, postgresqlTestHook
, postgresql
, yarn
, fixup_yarn_lock
, nodejs
, server-mode ? true
}:

@@ -14,24 +16,21 @@ let
  pname = "pgadmin";
  version = "7.0";

  src = fetchurl {
    url = "https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v${version}/source/pgadmin4-${version}.tar.gz";
    hash = "sha256-iYsICW9aTG47eWB0g3MlWo5F1BStQLiM84+qxFq7G70=";
  src = fetchFromGitHub {
    owner = "pgadmin-org";
    repo = "pgadmin4";
    rev = "REL-${lib.versions.major version}_${lib.versions.minor version}";
    hash = "sha256-m2mO37qNjrznpdKeFHq6yE8cZx4sHBvPB2RHUtS1Uis=";
  };

  yarnDeps = mkYarnModules {
    pname = "${pname}-yarn-deps";
    inherit version;
    packageJSON = ./package.json;
    yarnLock = ./yarn.lock;
    yarnNix = ./yarn.nix;
  };


  # keep the scope, as it is used throughout the derivation and tests
  # this also makes potential future overrides easier
  pythonPackages = python3.pkgs.overrideScope (final: prev: rec {
  });
  pythonPackages = python3.pkgs.overrideScope (final: prev: rec { });

  offlineCache = fetchYarnDeps {
    yarnLock = src + "/web/yarn.lock";
    hash = "sha256-cnn7CJcnT+TUeeZoeJVX3bO85vuJmVrO7CPR/CYTCS0=";
  };

in

@@ -81,14 +80,12 @@ pythonPackages.buildPythonApplication rec {
    echo Creating required directories...
    mkdir -p pip-build/pgadmin4/docs

    # build the documentation
    echo Building the documentation
    cd docs/en_US
    sphinx-build -W -b html -d _build/doctrees . _build/html

    # Build the clean tree
    cd ../../web
    cp -r * ../pip-build/pgadmin4
    cd ../docs
    cd ..
    cp -r * ../pip-build/pgadmin4/docs
    for DIR in `ls -d ??_??/`
    do
@@ -99,7 +96,20 @@ pythonPackages.buildPythonApplication rec {
    done
    cd ../

    cp -r ${yarnDeps}/* pip-build/pgadmin4
    # mkYarnModules and mkYarnPackage have problems running the webpacker
    echo Building the web frontend...
    cd web
    export HOME="$TMPDIR"
    yarn config --offline set yarn-offline-mirror "${offlineCache}"
    fixup_yarn_lock yarn.lock
    yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
    patchShebangs node_modules/
    yarn webpacker
    cp -r * ../pip-build/pgadmin4
    # save some disk space
    rm -rf ../pip-build/pgadmin4/node_modules

    cd ..

    echo Creating distro config...
    echo HELP_PATH = \'../../docs/en_US/_build/html/\' > pip-build/pgadmin4/config_distro.py
@@ -115,7 +125,7 @@ pythonPackages.buildPythonApplication rec {
    cp -v ../pkg/pip/setup_pip.py setup.py
  '';

  nativeBuildInputs = with pythonPackages; [ cython pip sphinx ];
  nativeBuildInputs = with pythonPackages; [ cython pip sphinx yarn fixup_yarn_lock nodejs ];
  buildInputs = [
    zlib
    pythonPackages.wheel
+0 −195
Original line number Diff line number Diff line
{
  "//": [
    "IMPORTANT:",
    "If runtime or build time dependencies are changed in this file, the ",
    "committer *must* ensure the DEB and RPM package maintainers are informed ",
    "as soon as possible."
  ],
  "license": "PostgreSQL",
  "devDependencies": {
    "@babel/core": "^7.10.2",
    "@babel/eslint-parser": "^7.21.3",
    "@babel/eslint-plugin": "^7.17.7",
    "@babel/plugin-proposal-object-rest-spread": "^7.10.1",
    "@babel/plugin-syntax-jsx": "^7.16.0",
    "@babel/preset-env": "^7.10.2",
    "@babel/preset-typescript": "^7.8.3",
    "@emotion/core": "^10.0.14",
    "@emotion/memoize": "^0.7.5",
    "@emotion/react": "^11.1.5",
    "@emotion/styled": "^10.0.14",
    "@emotion/utils": "^1.0.0",
    "@svgr/webpack": "^6.2.1",
    "@typescript-eslint/eslint-plugin": "^5.57.0",
    "@typescript-eslint/parser": "^5.57.0",
    "@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
    "autoprefixer": "^10.2.4",
    "axios-mock-adapter": "^1.17.0",
    "babel-loader": "^8.1.0",
    "browserify": "^17.0.0",
    "buffer": "^6.0.3",
    "copy-webpack-plugin": "^7.0.0",
    "core-js": "^3.2.1",
    "cross-env": "^7.0.3",
    "css-loader": "^6.7.2",
    "css-minimizer-webpack-plugin": "^3.0.0",
    "enzyme": "^3.11.0",
    "eslint": "^8.37.0",
    "eslint-plugin-react": "^7.20.5",
    "eslint-plugin-react-hooks": "^4.3.0",
    "exports-loader": "^2.0.0",
    "html-react-parser": "^1.2.7",
    "image-minimizer-webpack-plugin": "^2.2.0",
    "imagemin-mozjpeg": "^10.0.0",
    "imagemin-optipng": "^8.0.0",
    "imagemin-pngquant": "^9.0.2",
    "imports-loader": "^4.0.1",
    "is-docker": "^2.1.1",
    "istanbul-instrumenter-loader": "^3.0.1",
    "jasmine-core": "3.10.1",
    "jasmine-enzyme": "^7.1.2",
    "karma": "^6.3.15",
    "karma-babel-preprocessor": "^8.0.0",
    "karma-browserify": "^8.0.0",
    "karma-chrome-launcher": "^3.1.0",
    "karma-jasmine": "^4.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "karma-requirejs": "~1.1.0",
    "karma-source-map-support": "^1.4.0",
    "karma-sourcemap-loader": "^0.4.0",
    "karma-webpack": "^5.0.0",
    "loader-utils": "^3.2.1",
    "mini-css-extract-plugin": "^1.3.5",
    "postcss-loader": "^7.1.0",
    "process": "^0.11.10",
    "prop-types": "^15.7.2",
    "resize-observer-polyfill": "^1.5.1",
    "sass": "^1.24.4",
    "sass-loader": "^11.0.0",
    "sass-resources-loader": "^2.2.1",
    "shim-loader": "^1.0.1",
    "style-loader": "^3.3.2",
    "stylis": "^4.0.7",
    "svgo": "^2.7.0",
    "svgo-loader": "^2.2.0",
    "terser-webpack-plugin": "^5.1.1",
    "typescript": "^3.2.2",
    "url-loader": "^4.1.1",
    "webfonts-loader": "^8.0.1",
    "webpack": "^5.76.3",
    "webpack-bundle-analyzer": "^4.8.0",
    "webpack-cli": "^4.5.0",
    "yarn-audit-html": "^4.0.0"
  },
  "dependencies": {
    "@babel/plugin-proposal-class-properties": "^7.10.4",
    "@babel/preset-react": "^7.12.13",
    "@date-io/core": "^1.3.6",
    "@date-io/date-fns": "1.x",
    "@emotion/sheet": "^1.0.1",
    "@material-ui/core": "4.11.0",
    "@material-ui/icons": "^4.11.2",
    "@material-ui/lab": "4.0.0-alpha.58",
    "@material-ui/pickers": "^3.2.10",
    "@projectstorm/react-diagrams": "^6.6.1",
    "@simonwep/pickr": "^1.5.1",
    "@szhsin/react-menu": "^2.2.0",
    "@types/classnames": "^2.2.6",
    "@types/react": "^16.7.18",
    "@types/react-dom": "^17.0.11",
    "ajv": "^8.8.2",
    "anti-trojan-source": "^1.4.0",
    "aspen-decorations": "^1.0.2",
    "axios": "^0.21.1",
    "babelify": "~10.0.0",
    "bignumber.js": "^9.0.1",
    "bootstrap": "^4.3.1",
    "brace": "^0.11.1",
    "browserfs": "^1.4.3",
    "chart.js": "^3.0.0",
    "chartjs-plugin-zoom": "^1.2.1",
    "classnames": "^2.2.6",
    "closest": "^0.0.1",
    "codemirror": "^5.59.2",
    "convert-units": "^2.3.4",
    "cssnano": "^5.0.2",
    "dagre": "^0.8.4",
    "date-fns": "^2.24.0",
    "diff-arrays-of-objects": "^1.1.8",
    "html2canvas": "^1.0.0-rc.7",
    "immutability-helper": "^3.0.0",
    "insert-if": "^1.1.0",
    "ip-address": "^7.1.0",
    "jquery": "^3.6.0",
    "jquery-contextmenu": "^2.9.2",
    "json-bignumber": "^1.0.1",
    "jsoneditor": "^9.5.4",
    "karma-coverage": "^2.0.3",
    "leaflet": "^1.5.1",
    "lodash": "4.*",
    "ml-matrix": "^6.5.0",
    "moment": "^2.29.4",
    "moment-timezone": "^0.5.34",
    "mousetrap": "^1.6.3",
    "notificar": "^1.0.1",
    "notistack": "^1.0.10",
    "path-fx": "^2.0.0",
    "pathfinding": "^0.4.18",
    "paths-js": "^0.4.9",
    "popper.js": "^1.16.1",
    "postcss": "^8.2.15",
    "raf": "^3.4.1",
    "rc-dock": "^3.2.9",
    "react": "^17.0.1",
    "react-aspen": "^1.1.0",
    "react-checkbox-tree": "^1.7.2",
    "react-data-grid": "https://github.com/pgadmin-org/react-data-grid.git#200d2f5e02de694e3e9ffbe177c279bc40240fb8",
    "react-dnd": "^16.0.1",
    "react-dnd-html5-backend": "^16.0.1",
    "react-dom": "^17.0.1",
    "react-draggable": "^4.4.4",
    "react-dropzone": "^14.2.1",
    "react-leaflet": "^3.2.2",
    "react-resize-detector": "^8.0.3",
    "react-rnd": "^10.3.5",
    "react-router-dom": "^6.2.2",
    "react-select": "^5.7.2",
    "react-table": "^7.6.3",
    "react-timer-hook": "^3.0.5",
    "react-virtualized-auto-sizer": "^1.0.6",
    "react-window": "^1.8.5",
    "snapsvg-cjs": "^0.0.6",
    "socket.io-client": "^4.5.0",
    "split.js": "^1.5.10",
    "styled-components": "^5.2.1",
    "tempusdominus-core": "^5.19.3",
    "uplot": "^1.6.24",
    "uplot-react": "^1.1.4",
    "valid-filename": "^2.0.1",
    "webcabin-docker": "https://github.com/pgadmin-org/wcdocker#460fc6d90ba170bb177faaa8277f5fbb8279522a",
    "wkx": "^0.5.0",
    "xterm": "^4.11.0",
    "xterm-addon-fit": "^0.5.0",
    "xterm-addon-search": "^0.8.0",
    "xterm-addon-web-links": "^0.4.0"
  },
  "scripts": {
    "linter": "yarn eslint --no-eslintrc -c .eslintrc.js --ext .js  --ext .jsx --ext .ts --ext .tsx .",
    "webpacker": "yarn run webpack --config webpack.config.js --progress",
    "webpacker:watch": "yarn run webpack --config webpack.config.js --progress --watch",
    "bundle:watch": "yarn run linter && yarn run webpacker:watch",
    "bundle:dev": "yarn run linter && yarn run webpacker",
    "bundle:analyze": "cross-env NODE_ENV=production ANALYZE=true yarn run bundle:dev",
    "bundle": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=8192 yarn run bundle:dev",
    "test:karma-once": "yarn run linter && yarn run karma start --single-run",
    "test:karma": "yarn run linter && yarn run karma start",
    "test:karma-coverage": "yarn run test:karma-once --reporters coverage,progress",
    "test:feature": "yarn run bundle && python regression/runtests.py --pkg feature_tests",
    "test": "yarn run test:karma-once && yarn run bundle && python regression/runtests.py",
    "pep8": "pycodestyle --config=../.pycodestyle ../docs && pycodestyle --config=../.pycodestyle ../pkg && pycodestyle --config=../.pycodestyle ../tools && pycodestyle --config=../.pycodestyle ../web",
    "auditjs-html": "yarn audit --json | yarn run yarn-audit-html --output ../auditjs.html",
    "auditjs": "yarn audit --groups dependencies",
    "auditpy": "safety check --full-report -i 51668 -i 52495",
    "audit": "yarn run auditjs && yarn run auditpy"
  }
}
+0 −27
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl wget jq yarn2nix yarn common-updater-scripts

set -eu -o pipefail

scriptDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd)
nixpkgs=$(realpath "$scriptDir"/../../../..)

newest_version="$(curl -s https://www.pgadmin.org/versions.json | jq -r .pgadmin4.version)"
old_version=$(nix-instantiate --eval -E "(import \"$nixpkgs\" { config = {}; overlays = []; }).pgadmin4.version" | tr -d '"')
url="https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v${newest_version}/source/pgadmin4-${newest_version}.tar.gz"

if [[ $newest_version == $old_version ]]; then
  echo "Already at latest version $newest_version"
  exit 0
fi
echo "New version: $newest_version"

pushd $(mktemp -d --suffix=-pgadmin4-updater)
wget $url
tar -xzf "pgadmin4-$newest_version.tar.gz"
cd "pgadmin4-$newest_version/web"
yarn2nix > yarn.nix
cp yarn.nix yarn.lock package.json "$nixpkgs/pkgs/tools/admin/pgadmin/"
popd

update-source-version pgadmin4 "$newest_version" --print-changes
+0 −10755

File deleted.

Preview size limit exceeded, changes collapsed.

pkgs/tools/admin/pgadmin/yarn.nix

deleted100644 → 0
+0 −11647

File deleted.

Preview size limit exceeded, changes collapsed.