summary refs log tree commit diff stats
path: root/user/settings/javascript.nix
blob: 197eb86cad64d1af618dcd8271f667bcf6757f47 (plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
{ config, pkgs, ... }:

let
  node = pkgs.nodejs-12_x;
  node10Packages = pkgs.nodePackages_10_x;
in
{ home.packages = (with pkgs; [
    node
  ] ++ (
    if stdenv.isDarwin
    then
    [
    ]
    else
    [
    # npm install may use any of these
    binutils
    gcc
    gnumake
    python2
    ]
  )) ++ (with node10Packages; [
    node2nix
    nodemon
    javascript-typescript-langserver
    typescript-language-server
    vscode-css-languageserver-bin
    vscode-html-languageserver-bin
    csslint
    eslint_d
    typescript
  ]) ++ (with pkgs.node2nixPackages; [
    pkgs.node2nixPackages."pnpm-4.11.6"
    pkgs.node2nixPackages."prettier_d-git://github.com/josephfrazier/prettier_d#b53378114f1ac8331de8d5e49be2190385abbf79"

    node-gyp
    node-gyp-build
    node-pre-gyp

    bunyan
    netlify-cli
    pino-pretty
    dockerfile-language-server-nodejs
    vscode-json-languageserver
    yaml-language-server
  ]);

  home.sessionVariables = {
    NO_UPDATE_NOTIFIER = "1"; # stop npm update-notifier
  };

  programs.zsh.shellAliases = {
    ava = "pnpx ava";
    avt = "pnpx ava --tap";
    avat = "pnpx ava --tap";
    pino = "pino-pretty";
    mocha = "pnpx mocha";
    prettier = "prettier_d";
    standard = "pnpx standard";
    tsc = "pnpx tsc";
    tslint = "pnpx tslint";
    tsnode = "pnpx ts-node";

    p = "pnpm";
    pi = "pnpm install --filter=.";
    pit = "pnpm install-test --filter=.";
    pl = "pnpm ls";
    pr = "pnpm run";
    prb = "pnpm run build";
    pmi = "pnpm multi install";
    pmx = "pnpm multi exec "; # expand command aliases
    pmr = "pnpm multi run";
    pa = "pnpm add";
    pad = "pnpm add --save-dev";
    pd = "pnpm uninstall";
    pou = "pnpm outdated";
    pt = "pnpm test";
    pmt = "pnpm multi test";
    pmit = "pnpm multi install-test";
    pup = "pnpm update";
    ppr = "pnpm prune";
    pli = "pnpm link";
    pdi = "pnpm dislink";
    pul = "pnpm unlink";

    np = "npm";
    npi = "npm install";
    npl = "npm ls";
    npr = "npm run";
    npb = "npm run build";
    nprb = "npm run build";
    npa = "npm install --save";
    npad = "npm install --save-dev";
    npd = "npm uninstall";
    npt = "npm test";
    npup = "npm update";
    nppr = "npm prune";
    npli = "npm link";
    npul = "npm unlink";
  };

  home.file.".npmrc".text = ''
    prefix=''${HOME}/.local
    //registry.npmjs.org/:_authToken=''${NPM_AUTH_TOKEN}
    always-auth=true
    sign-git-tag=true
    rebuild-bundle=false
    update-notifier=false
    registry=https://registry.npmjs.org/
  '';
}