@extendeal/ext-commons
v0.1.8
Published
Libreria de funciones genericas para utilizar en diferentes proyectos.
Downloads
49
Readme
Extendeal JS Commons Library
Library with common Javascript methods written in Typescript.*
Installation
git clone [email protected]:extendeal/ext-commons.git
cd ext-commons
npm install
Commands
npm run watch - Start a Wepback watcher using development configuration.
npm run lint - Execute TSLint in root directory.
npm run build-dev - Generate a bundle for development.
npm run build-prod - Generate a bundle for production.
npm run prepublish - Command to run before publish in npm.**
Development flow
Extendeal Commons tries to organize in different modules functions corresponding to different types of cases, for example strings, objects, numbers, etc. If you have to add a new functionality, try to add it in the class that most resembles it or create one if necessary.
To test the functionality before publishing it, you can generate a small NodeJS server and include the build to test them. To test it in browser include the build in a static file.
When committing and deploying, the following points must be taken:
- Update the version in the package.json. ***
- Update package-lock.json file. ****
- Commitear con un mensaje lo suficientemente descriptivo.
- Generate a PR into main branch, actually develop.
- Once merged the PR and updated the branch, tag the branch with the same version of the package.json and as a message put the same of the commit.
- Push generated tag.
- Publish in npm.
Example
# Update Main Branch to Start a new Feature / Bug Fix.
git checkout develop
git pull origin develop
# Create Branch to work.
git checkout -b myFeatureBranch
# Resolve task / Update package.json version / Update package-lock.json.
git add .
# Commit with a descriptive message.
git commit -m "Add capitalize methods to strings."
# Push branch and create PR.
git push origin myFeatureBranch
.... PR Review
.... PR Merge on Bitbucket Web Client
# Go to main branch.
git checkout develop
# Update it
git pull origin develop
# Tag branch with current package.json version.
git tag -a v1.0.3 -m "Add capitalize methods to strings."
# Push Tag
git push origin v1.0.3
# Publish package with current package.json version.
npm publish
Notes
* Actually library include translations files. The ideal is to have these files outside the library and include it here, avoiding the need for a deploy of the library for a change in translations.
** This command delete build folder to prevent cache, and copy module declaration for non TS developments.
*** When talk about update version, we try to use this notation: https://blog.codeship.com/best-practices-when-versioning-a-release/
***** package-lock.json
is very important for the server when installing dependencies, that is why the best practice is to delete the file, and run again npm install
to keep it as up-to-date as possible.\