A pre-configured bundle which includes all you need to speed up your development with vanilla Javascript.
What does it include?
Packaging and Modern Javascript
-
Module bundler + Code transpiler
[Webpack 2 & Dev Server] + Babel [Stage 2 preset]
By default, your source code is placed under the
/src
directory and your builds will be located under the/public
directory.The default project's structure is as follows:
- __coverage__ --> Contains tests' coverage reports - __docs__ --> Contains the API documentation - __jsDoc__ --> Private for JSDoc only - __test__ --> Contains all your spec files (testing) - index.html --> Just an example page - public --> Contains all the public assets - build --> Contains the .js production file - src --> Contains all the source js files |- index.js --> A single entry point for your build system
All the directories starting with
__
are private and their content could change during your development. For this reason, don't manipulate them or their content manually.Use the following commands to build your software:
-
yarn build
ornpm run build
to build the production version of your software. -
yarn build:dev
ornpm run build:dev
to build a development version which include a source-map. -
yarn dev
ornpm run dev
to compile your code and start the Development Server
-
Code Quality
-
Code Formatting
Prettier
Removes all original styling and ensures that all outputted code conforms to a consistent style.
Have a look at the
.prettierrc
config file in the root directory.You can also run
yarn format
ornpm run format
from your command line to format all the.js
files contained under the/src
directory.However, the best way to deal with Prettier is by configuring your favorite code editor to apply format changes on save.
-
Javascript Linting
EsLint + Airbnb Styleguide
Eslint runs while you're developing, check the editor's console for errors or install one of the available plugins for your code editor.
You can also run Eslint manually with
yarn lint
ornpm run lint
.Look at the
.eslintrc
file for configuration (currently, this kit uses the airbnb presets in combination with Prettier) -
Pre-commit
It ensures that your npm test (or other specified scripts) passes before you can commit your changes.
-
Testing
Jest
Jest is installed end pre-configured. All the test files are located under the
__test__
directory.Use the following commands to run your tests:
-
yarn test
ornpm run test
-
yarn test:coverage
ornpm run test:coverage
-
yarn test:update
ornpm run test:update
The
test
command runs all the tests within your command line.The
test:coverage
command runs all the tests within your command line and shows a code coverage report. Jest exploits the instanbul coverage report system.The
test:update
command allows you to take snapshot. With snapshots it’s possible to test and assert the output of any serializable value. -
Documentation
-
Create your API
JsDoc 3 + Doxdox
JSDoc 3 is an API documentation generator for JavaScript, similar to Javadoc or phpDocumentor. You add documentation comments directly to your source code, right alongside the code itself. The JSDoc tool will scan your source code and generate an HTML documentation website for you.
Pre-installed templates:
- Minami - (Default)
- Boxy
.jsdocrc
file for configuration.
Under theopts
section, you can switch theme by changing thetemplate
property:"template": "node_modules/minami"
or"template": "node_modules/boxy-jsdoc-template"
Type
yarn docs
ornpm run docs
to generate the API for your Team.Type
yarn docs:open
ornpm run docs:open
to open the API webpageAdditional JSDoc's plugin
- typeSignature
Inside a JSDoc block use the@signature
directive.For example:
@signature add :: (Number, Number) -> Number
This will generate an additional block in your API like:
Doxdox is a documentation generator that converts JSDoc comment blocks into easy to read Bootstrap and Markdown documentation files. ES6 Starter Kit comes with doxdox pre-configured in such a way to exploit JSDocs comments to generate the GitHub Wiki automatically. After you ran one of the previous generator commands, the System will generate the
wiki.zip
file for you.
Software Versioning
-
Automatic Releases
Semantic-release
Semantic-release + semantic-release-tamia is a fully automated package publishing System which take trace of changes you’ve made through semantic commits.
For example, if you write a commit in the following way:
git commit -m "fix: <message>"
Semantic-release understands what you've made (fixed a bug) and it will update the software's release accordingly at the nextgit push
.To release a new version, you'll need to create a commit with Changelog type. To generate changelog draft run
yarn changelog:preview
ornpm run changelog:preview
It will create a file with all important commits for the release grouped by type.
To commit changelog
yarn changelog:commit
ornpm run changelog:commit
It will make a commit without changes (git commit --allow-empty) of type Changelog and changelog in commit message body.
More information about the semantic-release-tamia plugin.
A commit message consists of a header, body and footer. The header has a type, scope and subject:
<type>(<scope>): <subject> <BLANK LINE> <body> <BLANK LINE> <footer>
To understand how to write semantic commits, use this reference documentation.