!NhAsaYbbgmzHtXTPQJ:funklause.de

Nix NodeJS

200 Members
58 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
10 Dec 2023
@emma:conduit.rory.gayEmma [it/its] ⚡️this is the non-nix package.json im using as base, by the way20:08:49
@lily:lily.flowersLily Foster
In reply to @emma:conduit.rory.gay
i wrote all of that mess due to a bunch of imports cross-referencing projects
yeah i'm seeing that
20:09:10
@emma:conduit.rory.gayEmma [it/its] ⚡️ Lily Foster i was browsing WebStorm settings... 20:36:47
@emma:conduit.rory.gayEmma [it/its] ⚡️ I wonder if Use paths relative to project, resource or sources roots is a good option to turn on? 20:37:02
@emma:conduit.rory.gayEmma [it/its] ⚡️Screenshot from 2023-12-10 21-37-16.png
Download Screenshot from 2023-12-10 21-37-16.png
20:37:22
@emma:conduit.rory.gayEmma [it/its] ⚡️(for imports, that is)20:38:14
@lily:lily.flowersLily Foster
In reply to @emma:conduit.rory.gay
https://github.com/spacebarchat/server/blob/master/package.json

so this doesn't remove the openapi.json file, but this diff seems to build and run similarly in testing:

diff --git a/flake.nix b/flake.nix
index 71760eff..1391bca1 100644
--- a/flake.nix
+++ b/flake.nix
@@ -15,46 +15,10 @@
 			pname = "spacebar-server-ts";
 			src = ./.;
 			name = "spacebar-server-ts";
-			nativeBuildInputs = with pkgs; [ python3 ];
 			npmDepsHash = "sha256-axzbsD+jOViIQ9+qFSX41j6harBL9vyaXDKdOSaPW8M=";
-			makeCacheWritable = true;
 			postPatch = ''
 				substituteInPlace package.json --replace 'npx patch-package' '${pkgs.nodePackages.patch-package}/bin/patch-package'
 			'';
-			installPhase = ''
-				runHook preInstall
-				set -x
-				#remove packages not needed for production, or at least try to...
-				npm prune --omit dev --no-save $npmInstallFlags "''${npmInstallFlagsArray[@]}" $npmFlags "''${npmFlagsArray[@]}"
-			  find node_modules -maxdepth 1 -type d -empty -delete
-
-				mkdir -p $out/node_modules/
-				cp -r node_modules/* $out/node_modules/
-				cp -r dist/ $out/node_modules/@spacebar
-				for i in dist/**/start.js
-				do
-					makeWrapper ${pkgs.nodejs-slim}/bin/node $out/bin/start-`dirname ''${i/dist\//}` --prefix NODE_PATH : $out/node_modules --add-flags $out/node_modules/@spacebar`dirname ''${i/dist/}`/start.js
-				done
-				set +x
-				substituteInPlace package.json --replace 'dist/' 'node_modules/@spacebar/'
-				find $out/node_modules/@spacebar/ -type f -name "*.js" | while read srcFile; do
-					echo Patching imports in ''${srcFile/$out\/node_modules\/@spacebar//}...
-					substituteInPlace $srcFile --replace 'require("./' 'require(__dirname + "/'
-					substituteInPlace $srcFile --replace 'require("../' 'require(__dirname + "/../'
-					substituteInPlace $srcFile --replace ', "assets"' ', "..", "assets"'
-					#substituteInPlace $srcFile --replace 'require("@spacebar/' 'require("
-				done
-				set -x
-				cp -r assets/ $out/
-				cp package.json $out/
-				rm -v $out/assets/openapi.json
-				#rm -v $out/assets/schemas.json
-
-				#debug utils:
-				#cp $out/node_modules/@spacebar/ $out/build_output -r
-				set +x
-				runHook postInstall
-			'';
 		};
 		devShell = pkgs.mkShell {
 			buildInputs = with pkgs; [
diff --git a/package.json b/package.json
index 83ec9dcc..e0dcf4c9 100644
--- a/package.json
+++ b/package.json
@@ -37,6 +37,16 @@
 	"imports": {
 		"#*": "./dist/*/index.js"
 	},
+	"files": [
+		"dist",
+		"assets"
+	],
+	"bin": {
+		"start-bundle": "dist/bundle/start.js",
+		"start-api": "dist/api/start.js",
+		"start-cdn": "dist/cdn/start.js",
+		"start-gateway": "dist/gateway/start.js"
+	},
 	"homepage": "https://spacebar.chat",
 	"devDependencies": {
 		"@types/amqplib": "^0.8.2",
20:38:21

Show newer messages


Back to Room ListRoom Version: 6