-
Notifications
You must be signed in to change notification settings - Fork 4
feat: npm workspaces #326
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
feat: npm workspaces #326
Changes from all commits
29a88de
05c50ec
de05fec
6ccb779
d7fbab4
daa2650
30fe8d5
aa45167
09be6ac
02f909e
9760a4e
98333c7
dadc411
8193fed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "@filecoin-station/spark-api", | ||
"private": true, | ||
"version": "0.0.0", | ||
"license": "MIT", | ||
"repository": "filecoin-station/spark-api", | ||
"type": "module", | ||
"description": "API for SPARK", | ||
"scripts": { | ||
"start": "node bin/spark.js", | ||
"lint": "standard", | ||
"test": "mocha" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the main branch, one could run Is this something you want to preserve in the new monorepo setup? In my proposal, you always have to run the linter from the monorepo root, because that's the place where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer indeed if both would work: linting from the parent and the subpackage. Could we create a standard config that re-exports the parent config? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in daa2650 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I could not find any quick way how to do that, Standard seems to accept config only via CLI args or in the closest The alternative is to eject from standard to eslint, but that's much more work than I am willing to do now. We could also remove the env config from package.json and modify every file to start with the following line:
It would be cleaner because non-test files won't have access to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ended up duplicating the |
||
}, | ||
"devDependencies": { | ||
"light-my-request": "^5.13.0", | ||
"mocha": "^10.4.0", | ||
"standard": "^17.1.0", | ||
"varint": "^6.0.0" | ||
}, | ||
"dependencies": { | ||
"@filecoin-station/spark-impact-evaluator": "^1.0.0", | ||
"@glif/filecoin-address": "^3.0.5", | ||
"@sentry/node": "^8.5.0", | ||
"compare-versions": "^6.1.0", | ||
"ethers": "^6.12.1", | ||
"http-assert": "^1.5.0", | ||
"http-responders": "^2.0.2", | ||
"multiformats": "^13.1.0", | ||
"pg": "^8.11.5", | ||
"postgrator": "^7.2.0", | ||
"raw-body": "^2.5.2" | ||
}, | ||
"standard": { | ||
"env": [ | ||
"mocha" | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"type": "module", | ||
"scripts": { | ||
"start": "node bin/spark-publish.js", | ||
"lint": "standard", | ||
"test": "mocha" | ||
}, | ||
"dependencies": { | ||
"@filecoin-station/spark-impact-evaluator": "^1.0.0", | ||
"@glif/filecoin-address": "^3.0.5", | ||
"@influxdata/influxdb-client": "^1.33.2", | ||
"@ipld/car": "^5.3.0", | ||
"@sentry/node": "^8.4.0", | ||
"@ucanto/core": "^10.0.1", | ||
"@ucanto/principal": "^9.0.1", | ||
"@web3-storage/access": "^18.3.2", | ||
"@web3-storage/w3up-client": "^13.1.1", | ||
"ethers": "^6.12.1", | ||
"p-retry": "^6.2.0", | ||
"p-timeout": "^6.1.2", | ||
"pg": "^8.11.5" | ||
}, | ||
"devDependencies": { | ||
"@flydotio/dockerfile": "^0.5.7", | ||
"mocha": "^10.4.0", | ||
"multiformats": "^13.1.0", | ||
"postgrator": "^7.2.0", | ||
"standard": "^17.1.0" | ||
}, | ||
"standard": { | ||
"env": [ | ||
"mocha" | ||
] | ||
} | ||
} |
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 need to run
standard
for all files in the monorepo, including those that are not in any sub-package, e.g.migrations/index.js
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.
Could we turn
migrations
into a sub-package too?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 am not a fan of this. It adds a lot of boilerplate. We will need to add package.json to
migrations
, add scripts likelint
, addstandard
as a dependency, and so on.Having written that, I also want to get this monorepo setup finished ASAP and choose the setup that works for both of us, so I am going to take the direction you suggested.
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.
Hmm, we would have to turn
bin
andscripts
into sub-packages too. I definitely don't like that.I am going to explore a different setup, where the monorepo root is a package on its own, and then some of the subdirectories are packages (workspaces) too.
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 in daa2650
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 am keeping the
lint-all
step so that we can lint all workspaces in one go, and in parallel with running the tests.The alternative is to lint
spark-api
andspark-publish
as part ofbuild-*
workflows, and then add another workflow to run only files that are not part of any child workspace (bin
,migrations
,scripts
). I am not sure how easy that would be to do, though, so I prefer the current proposal.