Skip to content

Commit 6695ba2

Browse files
committed
graphql-language-service-cli: init at 3.5.0
Previously packaged by `node2nix`, removed in 776868c
1 parent 0e65727 commit 6695ba2

File tree

2 files changed

+128
-0
lines changed

2 files changed

+128
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// derived from graphql-vscode/esbuild.js
2+
const { build } = require('esbuild');
3+
4+
build({
5+
entryPoints: ['bin/graphql.js'],
6+
bundle: true,
7+
minify: true,
8+
sourcemap: false,
9+
platform: 'node',
10+
outdir: 'out/',
11+
external: [
12+
'pnpapi',
13+
// Avoid bundling @vue/compiler-sfc's dynamic dependencies
14+
'squirrelly',
15+
'teacup',
16+
'coffee-script',
17+
'marko',
18+
'slm',
19+
'vash',
20+
'plates',
21+
'babel-core',
22+
'htmling',
23+
'ractive',
24+
'mote',
25+
'eco',
26+
'jqtpl',
27+
'hamljs',
28+
'jazz',
29+
'hamlet',
30+
'whiskers',
31+
'haml-coffee',
32+
'hogan.js',
33+
'templayed',
34+
'walrus',
35+
'mustache',
36+
'just',
37+
'ect',
38+
'toffee',
39+
'twing',
40+
'dot',
41+
'bracket-template',
42+
'vscode',
43+
'velocityjs',
44+
'dustjs-linkedin',
45+
'atpl',
46+
'liquor',
47+
'twig',
48+
],
49+
});
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
lib,
3+
fetchFromGitHub,
4+
fetchYarnDeps,
5+
gitUpdater,
6+
graphql-language-service-cli,
7+
makeWrapper,
8+
nodejs,
9+
stdenv,
10+
testers,
11+
yarnBuildHook,
12+
yarnConfigHook,
13+
}:
14+
15+
stdenv.mkDerivation (finalAttrs: {
16+
pname = "graphql-language-service-cli";
17+
version = "3.5.0";
18+
19+
src = fetchFromGitHub {
20+
owner = "graphql";
21+
repo = "graphiql";
22+
tag = "graphql-language-service-cli@${finalAttrs.version}";
23+
hash = "sha256-NJTggaMNMjOP5oN+gHxFTwEdNipPNzTFfA6f975HDgM=";
24+
};
25+
26+
yarnOfflineCache = fetchYarnDeps {
27+
yarnLock = "${finalAttrs.src}/yarn.lock";
28+
hash = "sha256-ae6KP2sFgw8/8YaTJSPscBlVQ5/bzbvHRZygcMgFAlU=";
29+
};
30+
31+
nativeBuildInputs = [
32+
yarnConfigHook
33+
yarnBuildHook
34+
nodejs
35+
makeWrapper
36+
];
37+
38+
installPhase = ''
39+
runHook preInstall
40+
41+
mkdir -p $out/{bin,lib}
42+
43+
pushd packages/graphql-language-service-cli
44+
45+
# even with dev dependencies stripped, node_modules is over 1GB
46+
# just bundle what we need
47+
cp ${./esbuild.js} esbuild.js
48+
node esbuild.js
49+
50+
# copy package.json for --version command
51+
mv {out/graphql.js,package.json} $out/lib
52+
53+
makeWrapper ${nodejs}/bin/node $out/bin/graphql-lsp \
54+
--add-flags $out/lib/graphql.js \
55+
56+
popd
57+
58+
runHook postInstall
59+
'';
60+
61+
passthru = {
62+
updateScript = gitUpdater {
63+
rev-prefix = "graphql-language-service-cli@";
64+
};
65+
66+
tests.version = testers.testVersion {
67+
package = graphql-language-service-cli;
68+
};
69+
};
70+
71+
meta = {
72+
description = "The official, runtime independent Language Service for GraphQL";
73+
homepage = "https://github.com/graphql/graphiql";
74+
changelog = "https://github.com/graphql/graphiql/blob/${finalAttrs.src.tag}/packages/graphql-language-service-cli/CHANGELOG.md";
75+
license = lib.licenses.mit;
76+
maintainers = with lib.maintainers; [ nathanregner ];
77+
mainProgram = "graphql-lsp";
78+
};
79+
})

0 commit comments

Comments
 (0)