Skip to content

Conversation

@raymondfeng
Copy link
Contributor

@raymondfeng raymondfeng commented Feb 6, 2018

This is a follow-up to #588.

The PR introduces page.file to customize the location of the README file.

The update-v4-readmes.sh script now downloads README files into
pages/en/lb4/readmes/loopback-next/packages/<pkg>/README.md and the readme.html Jekyll template honors page.file setting.

For example:

---
lang: en
title: 'Creating decorators'
keywords: LoopBack 4.0, LoopBack 4
layout: readme
source: loopback-next
file: packages/metadata/README.md
tags:
sidebar: lb4_sidebar
permalink: /doc/en/lb4/Creating-decorators.html
summary: A tutorial to use `@loopback/metadata` module to create new decorators
---

The template will use loopback-next/packages/metadata/README.md as the file location and https://github.com/strongloop/loopback-next/blob/master/packages/metadata/README.md as the link.

#
(cat <<LIST_END
strongloop loopback-next master metadata README.md
strongloop loopback-next master packages/metadata/README.md

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For LB4, we only pull in README for metadata at this moment. This is the place you can add more readmes to be imported.

Copy link
Contributor

@bschrammIBM bschrammIBM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are probably aware of this, but the Commit Linter failed.

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if it's a good idea to support both "npm module" and "github branch" modes. What are the rules/guidelines for deciding what source to use when? Could you please describe them in the comment inside update-v4-readmes.sh?

Also, have you verified that "npm module" downloads actually work - that they put the contents to a right place and that the generated link is pointing to the right npm package?

# branch name will be appended to the local readme file name.
#
# Examples:
# strongloop loopback-next master packages/metadata/README.md
Copy link
Member

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?

Copy link
Contributor Author

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 module field (last one) is specified.

Copy link
Member

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?

@bajtos
Copy link
Member

bajtos commented Feb 8, 2018

What are the rules/guidelines for deciding what source to use when?

Maybe we should use the following rule?

  • For public packages published to npmjs.org, we should download the latest published version, because that's the version what our users are going to use and see after running npm install.
  • For private packages (typically examples), we should download the latest version from master, because that's the version our users will get after running lb4 example.

Thoughts?

@bajtos bajtos added this to the February 2018 milestone Feb 8, 2018
@raymondfeng
Copy link
Contributor Author

I am not sure if it's a good idea to support both "npm module" and "github branch" modes. What are the rules/guidelines for deciding what source to use when? Could you please describe them in the comment inside update-v4-readmes.sh?

I didn't invent that. The PR follows what we do for LB v3.

Also, have you verified that "npm module" downloads actually work - that they put the contents to a right place and that the generated link is pointing to the right npm package?

Yes. I did. See the following comments in the script:

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`.

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code changes looks reasonable, I don't see any obvious problem.

I think we should rethink the way how we are mirroring READMEs, but I guess that's beyond the scope of this pull request.

@raymondfeng raymondfeng merged commit 6dca2b0 into gh-pages Feb 9, 2018
@dhmlau dhmlau deleted the fix-lb4-readme-link branch October 10, 2018 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants