Starter project to get started creating a plugin for Fang quickly.
This project is meant to be cloned and tweaked as needed. It is built to offer your a good starter, without worrying about installing and configuring dependencies. For most of the usage you will not have to change a lot in the core of this project. However, if this is the case, just do not hesitate to create an issue, I will be glad to try to help as I can.
Happy coding!
- Support for Typescript, and generates declaration files
- Lint your files at build time using TSLint
- Contains a test command that will also run a coverage test
- Contains a mutation command (in case you are interested)
- Configured with
peerDependencies
on"@fang/core": "0.*"
- Configured to contain the required
keywords
in thepackage.json
to get your plugin displayed in the website documentation (website coming soon) - Contains a build command to produce an ES5, transpiled, ready to use version of your plugin (which contains your Typescript declaration files)
- Contains a command to publish patch, features and breaking changes using
np
Here is a todolist of what you need to do to well appropriate yourself this repository.
- Clone the project:
git clone https://github.com/khalyomede/fang-starter-plugin YOUR-PLUGIN-NAME
- Go to your repository, and remove the
.git repository
:cd YOUR-PLUGIN-NAME && rm -rf .git
- Initialize git:
git init
- Install the dependencies
- Using NPM:
npm install
- Using Yarn:
yarn install
- Using NPM:
- Add the origin of your repository:
git remote add origin https://github.com/USERNAME/YOUR-PLUGIN-NAME.git
- Change the following key values in the
package.json
- name
- description
- repository
- author
- Add some keywords in the key
keywords
of thepackage.json
(but keep the keywordfang-plugin
) - Change the description of your
README.md
- Add a
LICENSE
file - In the
CHANGELOG.md
file, remove everything below theUnreleased
title - Profit
- 1. Transpile and build files
- 2. Add some test, and run them
- 3. Run the mutation tests
- 4. Publish changes
Run this command in your command line.
npm run build
All the tests are located in the test
folder. You can organize your tests in subfolders. Check the existing file for an example.
All the tests use mocha
and chai
.
Once you are happy with your tests, you can check if they pass using this command.
npm run test
If you are comfortable with the concept of mutations in your tests, or you are curious to see if your tests are not producing mutations, you can run this command to check your mutation score.
npm run mutate
You first need to have published your project before trying to use this command. If you did not published your project yet, use this command.
npm publish
This will push your repository in the NPM package registry so others people will be able to require your package in their project.
Do not forget to create a v0.1.0
tag and publishing it to your repository so people can easily browse your package history by tag.
Once you have published your project, and you add some changes you want to publish, use this command.
npm run release
This will prompt you what kind of change you want to apply, and will handle all the rest, which is:
- testing a last time your project
- checking if you have remaining changes to push or not
- creating the tag (according to your choice) in your github repository, as well as publishing this tag
- publishing the new version on NPM