-
Notifications
You must be signed in to change notification settings - Fork 383
fix: make sure generated readmes for lb4 have correct links #608
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,43 @@ | ||
| #!/bin/bash | ||
|
|
||
| # The following is a 5 column list of org, repo, branch, package, and file. | ||
| # - If the branch is NOT specified, then the README for that project | ||
| # will be pulled from npmjs.org instead and will reflect the latest | ||
| # release. | ||
| # The following is a 5 column list of org, repo, branch, file, and module. | ||
| # - If the module is specified, the README for that project will be | ||
| # pulled from npmjs.org instead and will reflect the latest release. | ||
| # For scoped packages such as `@loopback/metadata`, the `/` needs to | ||
| # be encoded as `%2f`. For example `@loopback%2fmetadata`. | ||
| # - If the branch IS specified, it will be used to fetch the README.md | ||
| # from the given github repo. If that branch is NOT master, then the | ||
| # branch name will be appended to the local readme file name. | ||
| # | ||
| # Examples: | ||
| # strongloop loopback-next master packages/metadata/README.md | ||
| # strongloop loopback-next master packages/metadata/README.md @loopback%2fmetadata | ||
| # | ||
| (cat <<LIST_END | ||
| strongloop loopback-next master metadata README.md | ||
| strongloop loopback-next master packages/metadata/README.md | ||
|
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. Does this need to be altered to include all of the packages? It seems like we're only pointing at metadata with this setup.
Contributor
Author
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. For LB4, we only pull in README for |
||
| LIST_END | ||
| ) | while read org repo branch package file; do | ||
| ) | while read org repo branch file module; do | ||
| if [ -z "$file" ]; then | ||
| file="README.md" | ||
| fi | ||
| # Write the README.md to a file named after the repo | ||
| mkdir -p "pages/en/lb4/readmes" | ||
| DEST="pages/en/lb4/readmes/$package.md" | ||
| DEST="pages/en/lb4/readmes/$repo/$file" | ||
| if [ "$branch" != "master" ]; then | ||
| DEST="pages/en/lb4/readmes/$repo-$branch/$file" | ||
| fi | ||
| mkdir -p `dirname "$DEST"` | ||
| # When fetching from a branch of a gh repo | ||
| GHURL="https://raw.githubusercontent.com/$org/$repo/$branch/packages/$package/$file" | ||
| GHURL="https://raw.githubusercontent.com/$org/$repo/$branch/$file" | ||
| # When fetching from the latest release of a node module | ||
| NPMURL="https://registry.npmjs.org/@loopback/$package" | ||
| if [ -z "$branch" ]; then | ||
| NPMURL="https://registry.npmjs.org/$module" | ||
| if [ -n "$module" ]; then | ||
| # No branch means latest release, so fetch from npmjs.org | ||
| echo "fetching @loopback/$package from latest npmjs.org release..." | ||
| echo "fetching $module from latest npmjs.org release..." | ||
| echo $NPMURL | ||
| echo $DEST | ||
| curl -s $NPMURL | jq -r '.readme|rtrimstr("\n")' > $DEST | ||
| else | ||
| # The loopback-example-database repo contains a separate branch for each | ||
| # actual example project, so we need to add the branch name to the readme | ||
| # name. | ||
| if [ "$branch" != "master" ]; then | ||
| DEST="pages/en/lb4/readmes/$package-$branch.md" | ||
| fi | ||
| echo "fetching $org/$repo/$branch/packages/$package from GitHub's raw content domain..." | ||
| echo "fetching $org/$repo/$branch/$file from GitHub's raw content domain..." | ||
| curl -s $GHURL > $DEST | ||
| fi | ||
| done | ||
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 this will not work because we are not publishing loopback-next to npmjs.org. Unless I am missing something?
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 only pull from npmjs if the
modulefield (last one) is specified.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 see. Could you please enhance the comments to explain what is each example showing?