about summary refs log tree commit diff
path: root/pkgs/by-name/sh/shopify-cli/package.nix
blob: c850d4740b80af2cc5b3ac1a8c2bef24300c71c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{ buildNpmPackage, lib, makeWrapper, bundlerEnv, testers, shopify-cli }:
let
  version = "3.63.2";

  # Package the legacy ruby CLI.
  rubyGems = bundlerEnv {
    name = "shopify-cli-legacy";
    gemdir = ./.;
  };
in
buildNpmPackage {
  pname = "shopify";
  version = version;

  src = lib.fileset.toSource {
    root = ./.;
    fileset = with lib.fileset; unions [
      ./package.json
      ./package-lock.json
    ];
  };

  npmDepsHash = "sha256-6CEDcWXZXYHFrT2xpbj5NwMrbDZXH6HclgTGkfKDlJs=";
  dontNpmBuild = true;

  nativeBuildInputs = [ makeWrapper ];

  passthru = {
    updateScript = ./update.sh;
    tests.version = testers.testVersion {
      package = shopify-cli;
      command = "shopify version";
    };
  };

  postInstall = ''
    # Disable the installCLIDependencies function.
    substituteInPlace $(grep -r -l 'await installCLIDependencies' $out/lib/node_modules/shopify/node_modules/@shopify/cli/dist) \
      --replace-fail 'await installCLIDependencies' '// await installCLIDependencies'

    wrapProgram $out/bin/shopify \
      --set SHOPIFY_RUBY_BINDIR  ${rubyGems.wrappedRuby}/bin \
      --prefix PATH : ${rubyGems}/bin \
      --set SHOPIFY_CLI_VERSION ${version} \
      --set SHOPIFY_CLI_BUNDLED_THEME_CLI 0
  '';

  meta = {
    platforms = lib.platforms.all;
    mainProgram = "shopify";
    description = "CLI which helps you build against the Shopify platform faster";
    homepage = "https://github.com/Shopify/cli";
    changelog = "https://github.com/Shopify/cli/releases/tag/${version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ fd onny ];
  };
}