Skip to content

brainthinks/lame-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

LAME

Informal notes on working with org-scoped projects in the npm registry.

Table of Contents

Create a new org-scoped project

  1. Initialize the project directory:
    1. mkdir lame
  2. Create the lame project on github
  3. Initialize the git project locally:
    1. git init
  4. Associate the local project with github:
    1. git remote add origin https://github.com/brainthinks/lame-test.git
  5. Add some stuff to the project
    1. touch README.md
    2. touch .gitignore
    3. touch .npmrc
  6. Add the .npmrc file with the following:
    1. scope=bandress-dumbasses
    2. access=public
  7. Initialize the node project:
    1. yarn init
    2. Provide the name of the project as @bandress-dumbasses/lame
  8. Commit and push all the files:
    1. git add .
    2. git commit -m "message"
    3. git push -u origin master
  9. Version the project:
    1. yarn version --new-version 0.0.1
    2. git push --tags
  10. Publish the project
    1. npm publish

Observe that the project was published to the org's namespace.

Modify an existing project to have an org scope

  1. Add the .npmrc file that contains the scope and access configurations
  2. Add the repository property to the package.json file, where the value is the git url
    1. e.g. "repository": "https://github.com/brainthinks/lame-test.git",
  3. Find all instances in the project where the name property from the package.json is used
    1. You may need to change them from name to name.split('/').pop()
  4. Commit and push all changes
  5. Version the project:
    1. yarn version --new-version 0.0.1
  6. Publish the project
    1. npm publish

Publish dist or other untracked files

We have a few projects that have build steps which result in dist (as opposed to src) files that need to be included with the published version of the project. Here are the steps I used to implement the build and clean-up steps as part of the publish lifecycle:

  1. add dist to your .gitignore:
    1. the dist files shouldn't be source-controlled
    2. the dist files will be version-controlled via npm packages
  2. add a prepublish script:
    1. e.g. "prepublish": "npm run build",
  3. add a postpublish script:
    1. e.g. "postpublish": "rm -rf dist",
  4. Create a .npmignore file
    1. cp .gitignore .npmignore
    2. remove the dist entry from .npmignore
    3. you will have to keep .npmignore maintained along with .gitignore now...

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published