Skip to content
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

doc: add new package #1013

Merged
merged 1 commit into from
Feb 20, 2018
Merged

doc: add new package #1013

merged 1 commit into from
Feb 20, 2018

Conversation

jannyHou
Copy link
Contributor

@jannyHou jannyHou commented Feb 16, 2018

Description:

Add some guide on the things to remember when create a new package.
Any other stuff worth mentioning here?

Copy link
Contributor

@shimks shimks left a comment

Choose a reason for hiding this comment

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

Not sure if applicable to the guide here, but should we include a list of all of the files (like index.js, LICENSE, etc.) that need to go into the package?
Also, a reminder to update the copyright headers of each file so that they reflect the package name and the current year should be helpful as well.

I personally think if this section was to exist, it should be detailed enough for anyone to be able to create a new lb4 package. It's outside of scope for your task though, so maybe this is good enough. I'm not sure.

@jannyHou
Copy link
Contributor Author

jannyHou commented Feb 16, 2018

@shimks thanks!

Good point I will add them:

  • LICENSE
  • index files
  • copyright years

It's not part of my task, just some notes, doesn't take big time to write.

@raymondfeng
Copy link
Contributor

raymondfeng commented Feb 16, 2018

@jannyHou Good addition to the docs. I polished it to be the following.

Add a new package

To add a new package, create a folder in packages as the root directory of your module. For example,

cd loopback-next/packages
mkdir <a-new-package>

The package follows the node/npm module layout. You can use npm init or lb4 extension command to scaffold the module, copy/paste from an existing package, or manually add files including package.json.

We have some configuration files at the top level (loopback-next/):

  • .gitignore
  • .prettierignore
  • .nycrc.yml

For consistency across all packages, do not add them at package level unless specific customization is needed.

Please also register the new package in the following files:

By default, npm publishes scoped packages with private access. There are two options to make a new scoped package with public access.

Add the following section to package.json:

  "publishConfig": {
    "access": "public"
  },

Explicitly publish the package with --access=public.

cd packages/<a-new-package>
npm publish --access=public

@jannyHou jannyHou force-pushed the doc/add-package branch 2 times, most recently from 091c868 to 44b209b Compare February 16, 2018 21:28
@jannyHou
Copy link
Contributor Author

@raymondfeng thanks! Much better phrased than mine, I add your doc and @shimks 's suggestion in the new commit.

@bajtos
Copy link
Member

bajtos commented Feb 19, 2018

Great stuff!

I'd like to keep as much of developer docs in docs/DEVELOPING.md, I am already moving parts of MONOREPO.md there - see #1015. As for things to do when adding a new package, here is my checklist: https://github.com/strongloop/loopback-next/blob/docs/improvements/docs/DEVELOPING.md#new-package-checklist

I am proposing the following steps:

  1. Land this pull request ASAP, ignore the changes I am proposing in my Improve developer docs #1015
  2. I'll update my patch to include the new content from this pull request.

@jannyHou
Copy link
Contributor Author

Thanks @bajtos ! I rebased my PR and will land it when CI green to unblock your patch.

@jannyHou jannyHou merged commit 398af72 into master Feb 20, 2018
@jannyHou jannyHou deleted the doc/add-package branch February 21, 2018 22:29
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.

4 participants