-
Notifications
You must be signed in to change notification settings - Fork 11
Update for PureScript 0.15 #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
else do | ||
let contents = Json.stringifyWithIndent 2 $ FormatOptions.toJson cliOptions | ||
FS.writeTextFile UTF8 rcFileName $ contents <> "\n" | ||
rcStats <- Aff.try $ FS.stat rcFileName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exists
was removed as part of the 0.15 updates, as its been recommended against by Node for years. This instead tries to stat the file, and if that throws an exception (the file is missing) then we write the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you use liftEffect $ FSSync.exists
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is also possible, but we can use proper async here via stat (which is also used elsewhere in this file)
bin/Main.purs
Outdated
, export: "main" | ||
} | ||
] | ||
FS.stat bundleLocation $> Worker.unsafeWorkerFromPath bundleLocation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're now expected to always bundle before running the local cli.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep this logic, but add an additional JS entry point that invokes the worker from output. This is useful for me during dev.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
src/Tidy/Operators/Defaults.purs
Outdated
, """Type.Function.($) type 0""" | ||
, """Type.Prelude.(+) type 0""" | ||
, """Type.Row.(+) type 0""" | ||
[ """""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happened here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yikes! I didn't notice right away, but obviously generating the operators isn't working. I'm debugging locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's failing because of removing npm install
on my system, which also means no spago install
, and therefore there's no .spago
directory to read from when executing this in the tmpdir:
./bin/index.js generate-operators '.spago/*/*/src/**/*.purs'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1cf24d1
bin/Bin/Version.js
Outdated
@@ -1 +1,3 @@ | |||
exports.version = require("../../package.json").version; | |||
import packageJson from "../../package.json" assert { type: "json" }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One way around this, would be to add a version
script. I use npm version
to bump the package.json, and as part of the workflow we could write a new Versions.js with the updated version env variable. For example:
"version": "echo 'export const version = \"v'$npm_package_version'\";' > ./bin/Bin/Version.js"
https://docs.npmjs.com/cli/v8/commands/npm-version#description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved the prepublishOnly
script to be preversion
and added tests to it, added your recommended line here as version
, and added a git push
as suggested by the NPM docs in the link you provided to postversion
. Running npm run version
executes all three. If you'd prefer something different please let me know what you'd like instead.
@@ -0,0 +1,8 @@ | |||
#!/usr/bin/env -S node --experimental-json-modules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@natefaubion I've added a separate entrypoint, |
This PR updates the library and executable to work with PureScript 0.15. Two notable points:
src
to accommodate type-level ints, so this will require the next version to be 0.9.0node-esm
branch ofnode-workerbees
, as that library doesn't have a ES modules compatible release yet (we're waiting on it to be able to support non-bundled output when executing a worker). Since it's only used for the executable here that's not a problem for library consumers.