-
Notifications
You must be signed in to change notification settings - Fork 42
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/depend #659
Feat/depend #659
Conversation
Please find visual snapshots of your changed components here: https://s3-eu-west-1.amazonaws.com/times-components-snaps/50bd60f48fb3b35046eaa33ad21b77ad1770c464/dextrose-test/index.html |
Please find visual snapshots of your changed components here: https://s3-eu-west-1.amazonaws.com/times-components-snaps/f97510138fce2819a495d9dc3985aaa27666ac1c/dextrose-test/index.html |
Please find visual snapshots of your changed components here: https://s3-eu-west-1.amazonaws.com/times-components-snaps/c7d308fda7ac9e8e53ae86d208d27f3f22404781/dextrose-test/index.html |
28d1fdb
to
2f2c2c3
Compare
Please find visual snapshots of your changed components here: https://s3-eu-west-1.amazonaws.com/times-components-snaps/2f2c2c30a3ad6ba618c36cc771449a3013fd2777/dextrose-test/index.html |
266cac4
to
8a64ff9
Compare
Please find visual snapshots of your changed components here: https://s3-eu-west-1.amazonaws.com/times-components-snaps/8a64ff9e9ec70ae356b3e9da190970873b3e4554/dextrose-test/index.html |
Please find visual snapshots of your changed components here: https://s3-eu-west-1.amazonaws.com/times-components-snaps/2ce2cfa24e9a22ee6253534884ee0968bd30c890/dextrose-test/index.html |
7ff3952
to
0e75714
Compare
Please find visual snapshots of your changed components here: https://s3-eu-west-1.amazonaws.com/times-components-snaps/0e75714a39f786265b7ef242d5965d23fac30b3d/dextrose-test/index.html |
0e75714
to
fe1ad8e
Compare
Please find visual snapshots of your changed components here: https://s3-eu-west-1.amazonaws.com/times-components-snaps/fe1ad8e709c14c56f31e3d32e03eaad2cfef2049/dextrose-test/index.html |
Please find visual snapshots of your changed components here: https://s3-eu-west-1.amazonaws.com/times-components-snaps/0b1d5bf9083598a408c9acf0cf4ff95d3208f940/dextrose-test/index.html |
4ffccab
to
93dd2d6
Compare
Please find visual snapshots of your changed components here: https://s3-eu-west-1.amazonaws.com/times-components-snaps/4ffccab58b59b1534a07d4f89abb0ac8f1575d0f/dextrose-test/index.html |
Please find visual snapshots of your changed components here: https://s3-eu-west-1.amazonaws.com/times-components-snaps/93dd2d6b028e856b79c4a24b5421b16a61cccd7d/dextrose-test/index.html |
93dd2d6
to
37904cc
Compare
Please find visual snapshots of your changed components here: https://s3-eu-west-1.amazonaws.com/times-components-snaps/37904cc36a5c6d75eef7cc7b400d47d879fed23b/dextrose-test/index.html |
37904cc
to
a2ecfa3
Compare
Please find visual snapshots of your changed components here: https://s3-eu-west-1.amazonaws.com/times-components-snaps/a2ecfa3d3db1eccfee00aeb3629a2eac0a03ff64/dextrose-test/index.html |
packages/depend/README.md
Outdated
# Usage | ||
|
||
``` | ||
depend -e "packages/*/package.json" [...options] |
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.
As it intends to always be a package dependency tool, cant we remove the need for packages/*/package.json
? Just seems like extra typing
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.
It actually defaults to packages/*/package.json
; maybe it would be better to read this from the lerna.json
file?.
However if you run it within packages/ad
the expression will change.
I've also been using it a lot to analyse the node_modules folder to find out which dependency installs what.
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.
+1 for using the lerna.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.
lerna support added
packages/depend/README.md
Outdated
|
||
fixes the packages that are not in-sync | ||
|
||
## --graph, -g ["{filter}"] |
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.
Worth actually deploying these images somewhere and linking them into the PRs?
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.
It actually only creates a graphviz compatible output that can then be rendered to an image (see PR). Where would you guys suggest to upload those files ?
return (a, b) => s1(a, b) || s2(a, b); | ||
} | ||
|
||
// TODO: support semver ranges |
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.
Worth adding as an issue or a Jira ticket
packages/depend/cli-options.js
Outdated
@@ -0,0 +1,40 @@ | |||
import optimist from "optimist"; |
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.
This packages is deprecated?
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.
true, couldn't get it working with yargs though...
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 we try?
fdf122d
to
c71cd57
Compare
c71cd57
to
3048363
Compare
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.
will merge as now mature and useful but if you could pick up on the comments you can
would be good to fill the test coverage holes too which don't seem too problematic
biggest issue atm is the requirement to provide -l .
for every call which isn't obvious from the README
|
||
Based on the parsed packages, linting rules are computed. Based on those rules, | ||
hints are computed and can be displayed using `--hint` and applied with `--fix`. | ||
Strategies add additional rules for ensuring packages install the same external |
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 can provide your own strategy and additional rules...?
# Linting | ||
|
||
Based on the parsed packages, linting rules are computed. Based on those rules, | ||
hints are computed and can be displayed using `--hint` and applied with `--fix`. |
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 have a message if you pass no flags to advise and a message if there's nothing to change?
# Usage | ||
|
||
``` | ||
depend --lerna "{path/to/lerna/project}" [...options] |
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.
if you run at root guess you don't need to do this? Looks like it needs some error handling too
} | ||
``` | ||
|
||
`depend -g` outputs all dependencies in `.dot` format: |
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.
graph has to take a pattern?
Depend itself does not have any rendering capabilities but `--graph` output can | ||
be directly piped into a [graphviz](https://www.graphviz.org/) renderer. | ||
|
||
`depend -g "@times-components/*=>dextrose@" | fdp -Tsvg -o dextrose.svg` |
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.
might want to mention you need to have graphviz installed at this point?
|
||
`=>jest` | ||
|
||
everything that installs jest |
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.
this seems to output any package that contains jest
in it?
@@ -0,0 +1,54 @@ | |||
import { applyPatch } from "../depend"; | |||
|
|||
describe("depend apply-patch tests", () => { |
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.
ideally these should read as sentences
"fmt": "prettier --write '**/*.*'", | ||
"prettier:diff": "prettier --list-different '**/*.*'", | ||
"lint": "eslint . && npm run prettier:diff", | ||
"test": "jest --bail --ci --coverage" |
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.
we don't use these flags at the package level anymore
packageJson.dependencies[name], | ||
version | ||
]) | ||
.filter(x => x[1]), |
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.
still some cryptic refs like this that should be refactored
this package is a cli tool for dependency analysis for packages.
It implements linting and automatic fixing of version numbers.
Furthermore it can print graphviz compatible description to console.
Once merged we can add a linting and fix commands to our package.json files.
eg.:
depend -e "packages/*/package.json" -s conservative --bail
which would result in an exit code of one if we have divergent package versions or a outdated times-component-package in use.for quick fixing I'd suggest to use:
depend -e "packages/*/package.json" -s majorityProgressive --fix
which would automatically resolve all version number issues by the following rules:
if a dependency is a times-component package, take the latest version
More Examples
depend -g "@times-components/*=>dextrose@" | fdp -Tsvg -o dextrose.svg
depend -g "*/ad@ => *" | circo -Tgif -o ad.gif
depend --hint --strategy majority
depend --list -e "packages/*/package.json"
QuickInstall
Limitations
currently ambitious version ranges are not supported.