Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/janhancic/npm-helper-tool
A proposal for a Caplin tool that will help us write NPM modules
https://github.com/janhancic/npm-helper-tool
Last synced: 22 days ago
JSON representation
A proposal for a Caplin tool that will help us write NPM modules
- Host: GitHub
- URL: https://github.com/janhancic/npm-helper-tool
- Owner: janhancic
- Created: 2015-07-28T13:09:25.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-07-28T14:25:38.000Z (over 9 years ago)
- Last Synced: 2024-10-16T08:47:52.947Z (2 months ago)
- Size: 188 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Introduction
As part of NPM support in BRJS we will provide a list of tools and best practices on how to develop projects in and with NPM. To make it easier for developers to use this tools we would like to provide them with a tool that makes it easy to do so in a way that doesn't require them to write a lot of boilerplate code or config.
One of the early decisions we made, was to use the NPM scripts as our build "tool". This will allow us to build projects in a standard and community approved way. It also reduces the barrier to entry, as developers familiar with NPM/Node will be able to understand and use our projects without having to know anything about Caplin.
An example of a standard way of developing NPM modules is to have a "build" and "test" NPM commands defined in the projects. This two commands allow a new developer to prepare a fresh project so it can be worked on, and it allows the developer to verify that everything still works. Many CI systems assume those commands to be available and run them by default on Node projects.
A typical project will therefore have many command scripts defined, and many of those commands will be the same across many projects we develop. **We want to provide a solution to make managing this scripts easier**
## Avoiding copy & paste
To avoid developers having to copy&paste a bunch of configuration into their projects and having to manually update them, we would like to create a tool that will make this easier for developers, avoid (too much) duplication, make it easy to follow company conventions whilst also providing the option for developers to easily try out new tools.
We will call this tool "uber" for now.
## Requirements
The tool should:
- maintain the standard way of building NPM modules (have npm `build`, `test` and `serve` commands for example)
- minimise the amount of boilerplate developers need to write
- take advantage of the full set of tools NPM provides (package.json config, ...)
- allow developers to specify versions of the tools they are using (instead of that being defined by "uber")
- allow easy quick customisation of tools via command line arguments (which browsers to use for testing for example)
- allow developers to override commands with their own (don't want to use mocha for testing, that's perfectly fine for example)
- make it easy for projects to be updated when we change "uber"## Proposed solution
Create a tool that will synchronise a project's `package.json` file with some other `package.json` file (provided as a command line argument). This tool would work in an interactive way (same as `npm init`) where it would ask the developer questions such as "do you want to add this script command?" or "do you want to replace this script command?".
With this solution we achieve all of the above mentioned requirements as all we do is help developer write the `package.json` file and nothing else. The developer is in full control.