| 10 Dec 2023 |
Lily Foster | In reply to @emma:conduit.rory.gay do you have experience with TypeORM by chance? I do not, no. sorry :( | 21:26:36 |
Emma [it/its] ⚡️ | kinda wish i had a solution for that one but its so weird | 21:26:56 |
Lily Foster | In reply to @lily:lily.flowers
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",
you might also want to add a substituteInPlace src/bundle/start.ts --replace 'execSync("git rev-parse HEAD").toString().trim()' '"${self.rev or "dirty"}"' to postPatch as well, so that way the pre-release commit hash shows up correctly and doesn't depend on running it from a git repo | 21:32:17 |
Emma [it/its] ⚡️ | didnt we just get rid of postPatch? | 21:32:43 |
Lily Foster | In reply to @emma:conduit.rory.gay didnt we just get rid of postPatch? no, i left it there in my diff | 21:34:24 |
Emma [it/its] ⚡️ | oh, the diff claimed it was removedd as far as i saw | 21:34:44 |
Lily Foster | i mostly just got rid of installPhase and used npm to handle the logic | 21:34:44 |
Emma [it/its] ⚡️ | oh wait nvm i confused it for installPhase | 21:34:56 |
Lily Foster | ah, yeah. it happens :) | 21:35:08 |
Emma [it/its] ⚡️ | thanks for the git patch thing btw ^^ | 21:35:21 |
Lily Foster | In reply to @emma:conduit.rory.gay thanks for the git patch thing btw ^^ i'm happy to help! i just noticed i was getting a fatal: not a git repository when running the start-bundle bin and found where git rev-parse HEAD was happening | 21:36:46 |
Emma [it/its] ⚡️ | ah | 21:36:58 |
Emma [it/its] ⚡️ | thats just because stderr from git gets passed through i guess | 21:37:13 |
Lily Foster | In reply to @emma:conduit.rory.gay thats just because stderr from git gets passed through i guess well it also shouldn't be expecting to run from a git repo anyway, that was just how i noticed what it was doing | 21:37:52 |
Emma [it/its] ⚡️ | fair, code already existed when i joined the project anyways | 21:38:18 |
Emma [it/its] ⚡️ | https://github.com/spacebarchat/server/tree/dev/emma-refactors
the branch im working on, btw | 21:44:03 |
Emma [it/its] ⚡️ | Lily Foster do you happen to know how to configure prettier to use .editorconfig? | 22:29:17 |
Emma [it/its] ⚡️ | or does it do so by default? | 22:29:46 |
Lily Foster | In reply to @emma:conduit.rory.gay Lily Foster do you happen to know how to configure prettier to use .editorconfig? should be documented at https://prettier.io/docs/en/configuration#editorconfig | 23:01:55 |
| 11 Dec 2023 |
Emma [it/its] ⚡️ | apparently it does so by default but i had to delete prettierrc due to conflicts | 00:15:35 |
@janik0:matrix.org | What do I do if I have a package where the build just outputs something like dist/index.js and then expects to be run with yarn start, do I move that int $out/share/... and add a wrapper script in bin $out/bin for the yarn start? | 12:41:20 |
@janik0:matrix.org | * What do I do if I have a package where the build just outputs something like dist/index.js and then expects to be run with yarn start, do I move that int $out/share/... and add a wrapper script in $out/bin for the yarn start? | 12:41:53 |
Lily Foster | In reply to @janik0:matrix.org What do I do if I have a package where the build just outputs something like dist/index.js and then expects to be run with yarn start, do I move that int $out/share/... and add a wrapper script in bin $out/bin for the yarn start? yarn start just runs the start script. can you share the package.json? | 12:42:01 |
@janik0:matrix.org | Redacted or Malformed Event | 12:44:06 |
@janik0:matrix.org | https://github.com/excalidraw/excalidraw-room/blob/master/package.json#L32 | 12:44:07 |
Lily Foster | In reply to @janik0:matrix.org https://github.com/excalidraw/excalidraw-room/blob/master/package.json#L32 ugh why are they like this. they could have just added a bin: { exename: "dist/index.js" } and then everything would have worked as the node gods intended. but no, they must make things more difficult for themselves.... | 12:45:52 |
@janik0:matrix.org | In reply to @lily:lily.flowers ugh why are they like this. they could have just added a bin: { exename: "dist/index.js" } and then everything would have worked as the node gods intended. but no, they must make things more difficult for themselves.... i can patch that in my derivation and upstream it if it's just that simple :D | 12:46:25 |
Lily Foster | In reply to @janik0:matrix.org i can patch that in my derivation and upstream it if it's just that simple :D they probably also want a files: [ "dist" "public" ]. but that will only help our npm tooling, not our yarn tooling | 12:47:46 |
@janik0:matrix.org | I also packaged the actual excalidraw (the one above is just the sync server so you can work with multiple people at the same time) and there they just dump everything into a build dir and then you have to bring your own http server, upstream in there docker they use nginx but It also works with python3 -m http.server and stuff. | 12:48:04 |
| 13 Dec 2023 |
hexa | zigbee2mqtt> npm ERR! code 1
zigbee2mqtt> npm ERR! path /build/source/node_modules/unix-dgram
zigbee2mqtt> npm ERR! command failed
zigbee2mqtt> npm ERR! command sh -c node-gyp rebuild
zigbee2mqtt> npm ERR! make: Entering directory '/build/source/node_modules/unix-dgram/build'
zigbee2mqtt> npm ERR! CXX(target) Release/obj.target/unix_dgram/src/unix_dgram.o
zigbee2mqtt> npm ERR! make: Leaving directory '/build/source/node_modules/unix-dgram/build'
zigbee2mqtt> npm ERR! gyp info it worked if it ends with ok
zigbee2mqtt> npm ERR! gyp info using node-gyp@10.0.1
zigbee2mqtt> npm ERR! gyp info using node@20.10.0 | linux | x64
zigbee2mqtt> npm ERR! gyp info find Python using Python version 3.11.6 found at "/nix/store/5k91mg4qjylxbfvrv748smfh51ppjq0g-python3-3.11.6/bin/python3"
zigbee2mqtt> npm ERR! gyp WARN read config.gypi ENOENT: no such file or directory, open '/nix/store/kik2nnknanp1l131ch098cqv4xb4ahas-nodejs-20.10.0-source/include/node/config.gypi'
zigbee2mqtt> npm ERR! gyp info spawn /nix/store/5k91mg4qjylxbfvrv748smfh51ppjq0g-python3-3.11.6/bin/python3
zigbee2mqtt> npm ERR! gyp info spawn args [
zigbee2mqtt> npm ERR! gyp info spawn args '/nix/store/yc5bicc5zs5czjp5q5aygz79km84rmd4-nodejs-20.10.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
zigbee2mqtt> npm ERR! gyp info spawn args 'binding.gyp',
zigbee2mqtt> npm ERR! gyp info spawn args '-f',
zigbee2mqtt> npm ERR! gyp info spawn args 'make',
zigbee2mqtt> npm ERR! gyp info spawn args '-I',
zigbee2mqtt> npm ERR! gyp info spawn args '/build/source/node_modules/unix-dgram/build/config.gypi',
zigbee2mqtt> npm ERR! gyp info spawn args '-I',
zigbee2mqtt> npm ERR! gyp info spawn args '/nix/store/yc5bicc5zs5czjp5q5aygz79km84rmd4-nodejs-20.10.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
zigbee2mqtt> npm ERR! gyp info spawn args '-I',
zigbee2mqtt> npm ERR! gyp info spawn args '/nix/store/kik2nnknanp1l131ch098cqv4xb4ahas-nodejs-20.10.0-source/common.gypi',
zigbee2mqtt> npm ERR! gyp info spawn args '-Dlibrary=shared_library',
zigbee2mqtt> npm ERR! gyp info spawn args '-Dvisibility=default',
zigbee2mqtt> npm ERR! gyp info spawn args '-Dnode_root_dir=/nix/store/kik2nnknanp1l131ch098cqv4xb4ahas-nodejs-20.10.0-source',
zigbee2mqtt> npm ERR! gyp info spawn args '-Dnode_gyp_dir=/nix/store/yc5bicc5zs5czjp5q5aygz79km84rmd4-nodejs-20.10.0/lib/node_modules/npm/node_modules/node-gyp',
zigbee2mqtt> npm ERR! gyp info spawn args '-Dnode_lib_file=/nix/store/kik2nnknanp1l131ch098cqv4xb4ahas-nodejs-20.10.0-source/$(Configuration)/node.lib',
zigbee2mqtt> npm ERR! gyp info spawn args '-Dmodule_root_dir=/build/source/node_modules/unix-dgram',
zigbee2mqtt> npm ERR! gyp info spawn args '-Dnode_engine=v8',
zigbee2mqtt> npm ERR! gyp info spawn args '--depth=.',
zigbee2mqtt> npm ERR! gyp info spawn args '--no-parallel',
zigbee2mqtt> npm ERR! gyp info spawn args '--generator-output',
zigbee2mqtt> npm ERR! gyp info spawn args 'build',
zigbee2mqtt> npm ERR! gyp info spawn args '-Goutput_dir=.'
zigbee2mqtt> npm ERR! gyp info spawn args ]
zigbee2mqtt> npm ERR! gyp info spawn make
zigbee2mqtt> npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
zigbee2mqtt> npm ERR! In file included from ../../nan/nan.h:180,
zigbee2mqtt> npm ERR! from ../src/unix_dgram.cc:5:
zigbee2mqtt> npm ERR! ../../nan/nan_callbacks.h:55:23: error: 'AccessorSignature' is not a member of 'v8'
zigbee2mqtt> npm ERR! 55 | typedef v8::Local<v8::AccessorSignature> Sig;
zigbee2mqtt> npm ERR! | ^~~~~~~~~~~~~~~~~
zigbee2mqtt> npm ERR! ../../nan/nan_callbacks.h:55:40: error: template argument 1 is invalid
zigbee2mqtt> npm ERR! 55 | typedef v8::Local<v8::AccessorSignature> Sig;
zigbee2mqtt> npm ERR! | ^
zigbee2mqtt> npm ERR! ../../nan/nan.h: In function 'bool Nan::IdleNotification(int)':
zigbee2mqtt> npm ERR! ../../nan/nan.h:686:63: warning: 'bool v8::Isolate::IdleNotificationDeadline(double)' is deprecated: Use MemoryPressureNotification() to influence the GC schedule. [-Wdeprecated-declarations]
zigbee2mqtt> npm ERR! 686 | return v8::Isolate::GetCurrent()->IdleNotificationDeadline(
zigbee2mqtt> npm ERR! | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
zigbee2mqtt> npm ERR! 687 | idle_time_in_ms * 0.001);
zigbee2mqtt> npm ERR! | ~~~~~~~~~~~~~~~~~~~~~~~~
zigbee2mqtt> npm ERR! In file included from /nix/store/kik2nnknanp1l131ch098cqv4xb4ahas-nodejs-20.10.0-source/deps/v8/include/v8-initialization.h:13,
zigbee2mqtt> npm ERR! from /nix/store/kik2nnknanp1l131ch098cqv4xb4ahas-nodejs-20.10.0-source/deps/v8/include/v8.h:34,
zigbee2mqtt> npm ERR! from /nix/store/kik2nnknanp1l131ch098cqv4xb4ahas-nodejs-20.10.0-source/src/node.h:73,
zigbee2mqtt> npm ERR! from ../../nan/nan.h:60:
zigbee2mqtt> npm ERR! /nix/store/kik2nnknanp1l131ch098cqv4xb4ahas-nodejs-20.10.0-source/deps/v8/include/v8-isolate.h:1293:8: note: declared here
zigbee2mqtt> npm ERR! 1293 | bool IdleNotificationDeadline(double deadline_in_seconds);
zigbee2mqtt> npm ERR! | ^~~~~~~~~~~~~~~~~~~~~~~~
zigbee2mqtt> npm ERR! ../src/unix_dgram.cc: At global scope:
zigbee2mqtt> npm ERR! /nix/store/kik2nnknanp1l131ch098cqv4xb4ahas-nodejs-20.10.0-source/src/node.h:1172:7: warning: cast between incompatible function types from 'void (*)(v8::Local<v8::Object>)' to 'node::addon_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)'} [-Wcast-function-type]
zigbee2mqtt> npm ERR! 1172 | (node::addon_register_func) (regfunc), \
zigbee2mqtt> npm ERR! | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
zigbee2mqtt> npm ERR! /nix/store/kik2nnknanp1l131ch098cqv4xb4ahas-nodejs-20.10.0-source/src/node.h:1206:3: note: in expansion of macro 'NODE_MODULE_X'
zigbee2mqtt> npm ERR! 1206 | NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
zigbee2mqtt> npm ERR! | ^~~~~~~~~~~~~
zigbee2mqtt> npm ERR! ../src/unix_dgram.cc:404:1: note: in expansion of macro 'NODE_MODULE'
zigbee2mqtt> npm ERR! 404 | NODE_MODULE(unix_dgram, Initialize)
zigbee2mqtt> npm ERR! | ^~~~~~~~~~~
zigbee2mqtt> npm ERR! make: *** [unix_dgram.target.mk:109: Release/obj.target/unix_dgram/src/unix_dgram.o] Error 1
zigbee2mqtt> npm ERR! gyp ERR! build error
zigbee2mqtt> npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
zigbee2mqtt> npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (/nix/store/yc5bicc5zs5czjp5q5aygz79km84rmd4-nodejs-20.10.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
zigbee2mqtt> npm ERR! gyp ERR! System Linux 6.1.20
zigbee2mqtt> npm ERR! gyp ERR! command "/nix/store/yc5bicc5zs5czjp5q5aygz79km84rmd4-nodejs-20.10.0/bin/node" "/nix/store/yc5bicc5zs5czjp5q5aygz79km84rmd4-nodejs-20.10.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
zigbee2mqtt> npm ERR! gyp ERR! cwd /build/source/node_modules/unix-dgram
zigbee2mqtt> npm ERR! gyp ERR! node -v v20.10.0
zigbee2mqtt> npm ERR! gyp ERR! node-gyp -v v10.0.1
zigbee2mqtt> npm ERR! gyp ERR! not ok
zigbee2mqtt>
zigbee2mqtt> npm ERR! Log files were not written due to an error writing to the directory: /nix/store/pdf6vcq0xf1hp7gfcfw5sixnnylsvxgl-zigbee2mqtt-1.34.0-npm-deps/_logs
zigbee2mqtt> npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
zigbee2mqtt>
| 18:46:51 |