Commit 53e5d09b authored by Robert Schütz's avatar Robert Schütz
Browse files

bibtex-tidy: use buildNpmPackage

parent ff9296f9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ mapAliases {
  "@githubnext/github-copilot-cli" = pkgs.github-copilot-cli; # Added 2023-05-02
  "@google/clasp" = pkgs.google-clasp; # Added 2023-05-07
  "@nestjs/cli" = pkgs.nest-cli; # Added 2023-05-06
  bibtex-tidy = pkgs.bibtex-tidy; # added 2023-07-30
  bitwarden-cli = pkgs.bitwarden-cli; # added 2023-07-25
  eslint_d = pkgs.eslint_d; # Added 2023-05-26
  manta = pkgs.node-manta; # Added 2023-05-06
+0 −1
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@
, "awesome-lint"
, "balanceofsatoshis"
, "bash-language-server"
, "bibtex-tidy"
, "bower"
, "bower2nix"
, "browserify"
+0 −18
Original line number Diff line number Diff line
@@ -94386,24 +94386,6 @@ in
    bypassCache = true;
    reconstructLock = true;
  };
  bibtex-tidy = nodeEnv.buildNodePackage {
    name = "bibtex-tidy";
    packageName = "bibtex-tidy";
    version = "1.11.0";
    src = fetchurl {
      url = "https://registry.npmjs.org/bibtex-tidy/-/bibtex-tidy-1.11.0.tgz";
      sha512 = "jbY7PxjYQlRQIWpqdCxEVtW0T9xTLecXxvGPFGMs3FlzKNTylTr5yutC2qWsFyfNQgMHvAzyCdqT5YIU9p/ZHg==";
    };
    buildInputs = globalBuildInputs;
    meta = {
      description = "Tidy bibtex files";
      homepage = "https://github.com/FlamingTempura/bibtex-tidy";
      license = "MIT";
    };
    production = true;
    bypassCache = true;
    reconstructLock = true;
  };
  bower = nodeEnv.buildNodePackage {
    name = "bower";
    packageName = "bower";
+35 −0
Original line number Diff line number Diff line
{ lib
, buildNpmPackage
, fetchFromGitHub
}:

buildNpmPackage rec {
  pname = "bibtex-tidy";
  version = "1.11.0";

  src = fetchFromGitHub {
    owner = "FlamingTempura";
    repo = "bibtex-tidy";
    rev = "v${version}";
    hash = "sha256-VjQuMQr3OJgjgX6FdH/C4mehf8H7XjDZ9Rxs92hyQVo=";
  };

  patches = [
    # downloads Google fonts during `npm run build`
    ./remove-google-font-loader.patch
  ];

  npmDepsHash = "sha256-u2lyG95F00S/bvsVwu0hIuUw2UZYQWFakCF31LIijSU=";

  env = {
    PUPPETEER_SKIP_DOWNLOAD = true;
  };

  meta = {
    changelog = "https://github.com/FlamingTempura/bibtex-tidy/blob/${src.rev}/CHANGELOG.md";
    description = "Cleaner and Formatter for BibTeX files";
    homepage = "https://github.com/FlamingTempura/bibtex-tidy";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ bertof ];
  };
}
+52 −0
Original line number Diff line number Diff line
diff --git a/build.ts b/build.ts
index ae4e350..3498ae7 100644
--- a/build.ts
+++ b/build.ts
@@ -312,7 +312,6 @@ async function buildWebBundle() {
 		target: ['esnext'],
 		plugins: [
 			sveltePlugin({ preprocess: autoPreprocess() }),
-			googleFontPlugin,
 			regexpuPlugin,
 		],
 	});
@@ -344,7 +343,6 @@ async function serveWeb() {
 				preprocess: autoPreprocess(),
 				compilerOptions: { enableSourcemap: true },
 			}),
-			googleFontPlugin,
 		],
 	});
 	const server = await ctx.serve({ servedir: WEB_PATH });
@@ -375,31 +373,6 @@ const regexpuPlugin: Plugin = {
 	},
 };
 
-// Downloads google fonts and injects them as base64 urls into bundle css
-const googleFontPlugin: Plugin = {
-	name: 'google-font-loader',
-	setup(build) {
-		build.onResolve({ filter: /^https?:\/\/fonts\./ }, (args) => ({
-			path: args.path,
-			namespace: 'http-url',
-		}));
-		build.onLoad(
-			{ filter: /.*/, namespace: 'http-url' },
-			async (args): Promise<OnLoadResult> => {
-				const res = await fetch(args.path, {
-					headers: {
-						// ensures google responds with woff2 fonts
-						'User-Agent': 'Mozilla/5.0 Firefox/90.0',
-					},
-				});
-				const contents = Buffer.from(await res.arrayBuffer());
-				const loader = args.path.endsWith('.woff2') ? 'dataurl' : 'css';
-				return { contents, loader };
-			}
-		);
-	},
-};
-
 /**
  * swc converts js syntax to support older browsers. ESBuild can kinda do this
  * but only for more recent browsers. swc is also far easier to configure than
Loading