Commit 68005ab6 authored by dish's avatar dish
Browse files

home-assistant-custom-lovelace-modules.multiple-entity-row: modernize

Gets rid of mkYarnPackage and its need for a package.json
parent 4599cad6
Loading
Loading
Loading
Loading
+0 −39
Original line number Diff line number Diff line
{
  "name": "multiple-entity-row",
  "version": "4.5.1",
  "description": "Show multiple entity states, attributes and icons on entity rows in Home Assistant's Lovelace UI",
  "keywords": [
    "home-assistant",
    "homeassistant",
    "lovelace",
    "custom-cards",
    "multiple",
    "entity",
    "row"
  ],
  "module": "multiple-entity-row.js",
  "repository": "https://github.com/benct/lovelace-multiple-entity-row.git",
  "author": "benct <ben@tomlin.no>",
  "license": "MIT",
  "dependencies": {
    "custom-card-helpers": "1.8.0",
    "lit": "^2.7.4",
    "memoize-one": "^6.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.22.1",
    "@babel/preset-env": "^7.22.4",
    "babel-loader": "^9.1.2",
    "eslint": "^8.41.0",
    "eslint-config-prettier": "^8.8.0",
    "eslint-plugin-prettier": "^4.2.1",
    "prettier": "^2.8.8",
    "webpack": "^5.84.1",
    "webpack-cli": "^5.1.1"
  },
  "scripts": {
    "lint": "eslint src/**/*.js",
    "dev": "webpack -c webpack.config.js",
    "build": "yarn lint && webpack -c webpack.config.js"
  }
}
+18 −21
Original line number Diff line number Diff line
{
  lib,
  mkYarnPackage,
  stdenv,
  fetchFromGitHub,
  fetchYarnDeps,
  yarnConfigHook,
  yarnBuildHook,
  nodejs,
}:

mkYarnPackage rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "multiple-entity-row";
  version = "4.5.1";

  src = fetchFromGitHub {
    owner = "benct";
    repo = "lovelace-multiple-entity-row";
    rev = "v${version}";
    tag = "v${finalAttrs.version}";
    hash = "sha256-CXRgXyH1NUg7ssQhenqP0tXr1m2qOkHna3Rf30K3SjI=";
  };

  packageJSON = ./package.json;

  offlineCache = fetchYarnDeps {
    yarnLock = "${src}/yarn.lock";
    inherit (finalAttrs) src;
    hash = "sha256-8YIcQhbYf0e2xO620zVHEk/0sssBmzF/jCq+2za+D6E=";
  };

  buildPhase = ''
    runHook preBuild

    yarn --offline build

    runHook postBuild
  '';
  nativeBuildInputs = [
    yarnBuildHook
    yarnConfigHook
    nodejs
  ];

  installPhase = ''
    runHook preInstall

    mkdir $out
    install -m0644 ./deps/multiple-entity-row/multiple-entity-row.js $out
    install -m0644 ./multiple-entity-row.js $out

    runHook postInstall
  '';

  doDist = false;

  meta = with lib; {
  meta = {
    description = "Show multiple entity states and attributes on entity rows in Home Assistant's Lovelace UI";
    homepage = "https://github.com/benct/lovelace-multiple-entity-row";
    changelog = "https://github.com/benct/lovelace-multiple-entity-row/blob/${src.rev}/CHANGELOG.md";
    license = licenses.mit;
    maintainers = with maintainers; [ hexa ];
    changelog = "https://github.com/benct/lovelace-multiple-entity-row/blob/v${finalAttrs.version}/CHANGELOG.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ hexa ];
  };
}
})