purescript-contrib / governance

Guidelines and resources for the PureScript Contributors organization
15 stars 3 forks source link

index.js vs updater.js #8

Closed milesfrain closed 3 years ago

milesfrain commented 4 years ago

Finally getting around to trying this out, but am encountering an error when following the updater instructions.

nix-shell
...
error: getting attributes of path '/home/miles/projects/purescript/governance/updater/bin/index.js': No such file or directory

Wondering if bin/updater.js should be renamed to bin/index.js or if some mentions of bin/index.js should be replaced with bin/updater.js.

thomashoneyman commented 4 years ago

Do you have this commit locally? https://github.com/purescript-contrib/governance/commit/887a28c24926fc7b15dea5caff337d3bde760b7c

If not, can you pull main? The issue is that if you have never built the project then the Nix expression tries to locate a file which does not yet exist -- the very file the Nix shell produces as part of starting up.

milesfrain commented 4 years ago

Yes, I have that commit.

if you have never built the project

Does this mean I need to run spago build or spago bundle-app first, or should that be handled by nix-shell?

Do the instructions work for you on a fresh clone?

thomashoneyman commented 4 years ago

I had forgotten an entry in the Nix shell still triggering the issue. I've removed it in https://github.com/purescript-contrib/governance/commit/fd2fb5dc59622be4df183e3c2c1bf9a298b7083d and a fresh clone works on my system.

Edit: no, still not quite working correctly. What a nightmare. I ended up just updating the README installation instructions.

https://github.com/purescript-contrib/governance/commit/d45f41c3b7af642f8ffc83b39132064d53017ec3

milesfrain commented 4 years ago

With latest changes:

➜  updater git:(main) git log --oneline
ae2e017 (HEAD -> main, origin/main, origin/HEAD) Update package.json
29e5262 Update package.json
d45f41c Update installation instructions
fd2fb5d Remove unnecessary executable line.
887a28c Update shell.nix
dbe5e44 Allow full installation via the Nix shell. (#7)
4bf6a40 Include bower_components in .gitignore template (#6)
➜  updater git:(main) nix-shell        
audited 2 packages in 0.331s
found 0 vulnerabilities

> contrib-updater@ build /home/miles/projects/purescript/governance/updater
> spago bundle-module --to output/index.js && ncc build --minify --out bin index.js

[info] Installation complete.
[info] Build succeeded.
[info] Bundling first...
[info] Bundle succeeded and output file to output/index.js
[info] Make module succeeded and output file to output/index.js
ncc: Version 0.23.0
ncc: Compiling file index.js
305kB  bin/index.js
305kB  [2215ms] - ncc 0.23.0

[nix-shell:~/projects/purescript/governance/updater]$ alias contrib-updater='node ~/path/to/governance/updater/bin/index.js'

[nix-shell:~/projects/purescript/governance/updater]$ contrib-updater --help
internal/modules/cjs/loader.js:796
    throw err;
    ^

Error: Cannot find module '/home/miles/path/to/governance/updater/bin/index.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
    at Function.Module._load (internal/modules/cjs/loader.js:686:27)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
thomashoneyman commented 4 years ago

Sorry, perhaps these docs are badly written. You'd need to replace /path/to/governance with, for example, ~/miles/governance/updater/bin/index.js or wherever you've checked out this repository.

thomashoneyman commented 3 years ago

Addressed by #9, #7.