@seges/angular-language-picker
v2.0.3
Published
For the time being the project scaffold expects TypeScript files.
Downloads
85
Readme
How to create and publish NPM modules.
For the time being the project scaffold expects TypeScript files.
For a full documentation of npm usage and commands see https://docs.npmjs.com
New project
This describes how to create a new module from scratch. If you want to fork an existing project (recommended for new npm modules), see the step "Forking a project" further down.
- Create a Git repository.
- Clone the newly created repository to a folder on your machine.
- Create a folder in the project named src, all the source code will go here.
- Run
npm init
from a console window (cmd/bash etc.) in the project root and follow the steps displayed to create package.json.
- Ensure that the package name is prefixed with
@seges
.
- Create an
index.ts
(TypeScript) orindex.js
(JavaScript) file depending on what language you wish to use. - In the index file, export the modules from the src folder that you wish to expose.
- Run
npm publish
from the root of the project (double check that the project name inpackage.json
has@seges/
as prefix, otherwise the package is published outside the seges organization scope).
- Scoped packages are private by default, to make it public, run
npm publish --access public
instead.
- Remember to also checkin changes in Git.
Now the module should be available for installation by running npm install <name-of-your-package>
from any other project.
Updating an existing package.
- Checkout the module's Git repository.
- Perform your needed changes.
- When done with your changes run
npm version major|minor|patch -m <message>
from the root of the project.
- For more information on semantic versioning see: http://semver.org/.
- Publish your package by running
npm publish
ornpm publish --access public
. - Remember to also push changes to Git.
The module should be updated.
Logging in to http://www.npmjs.org you should be able to find and see the new version of the updated package.
Unpublishing a package
In general you should not unpublish packages as other projects might depend on them.
Instead you should update the package with a new version containing fixes of the broken version by following the steps above.
But in the event you need to unpublish, you can run npm unpublish <@scope/><package name>@<version>
to unpublish that version.
Note that even though a version is unpublished, a new publish of the same version is not possible unless the entire project is taken down.
Forking a project
The SEGES_NPM
project can be used as a scaffold or base for a new npm module as it contains various necessary files required to run unit tests.
To fork a project:
- Create a new git repository.
- Check out the SEGES_NPM project.
- Open a console at the root of the SEGES_NPM project.
- Run the command
git remote set-url origin <url-of-the-project-created-in-step-1>
- Run the command
git push origin master
- Rename your root project folder to the name of the repository created in step 1.
OR
- Remove the project locally and checkout the repository created in step 1.
Run through the package.json
and remove comments, as they are not valid JSON
.
You should now have a new project with the contents of SEGES_NPM.