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
/srcdirectory and your builds will be located under the/publicdirectory.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 systemAll 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 buildornpm run buildto build the production version of your software. -
yarn build:devornpm run build:devto build a development version which include a source-map. -
yarn devornpm run devto 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
.prettierrcconfig file in the root directory.You can also run
yarn formatornpm run formatfrom your command line to format all the.jsfiles contained under the/srcdirectory.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 lintornpm run lint.Look at the
.eslintrcfile 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 testornpm run test -
yarn test:coverageornpm run test:coverage -
yarn test:updateornpm run test:update
The
testcommand runs all the tests within your command line.The
test:coveragecommand runs all the tests within your command line and shows a code coverage report. Jest exploits the instanbul coverage report system.The
test:updatecommand 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
.jsdocrcfile for configuration.
Under theoptssection, you can switch theme by changing thetemplateproperty:"template": "node_modules/minami"
or"template": "node_modules/boxy-jsdoc-template"
Type
yarn docsornpm run docsto generate the API for your Team.Type
yarn docs:openornpm run docs:opento open the API webpageAdditional JSDoc's plugin
- typeSignature
Inside a JSDoc block use the@signaturedirective.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.zipfile 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:previewornpm run changelog:previewIt will create a file with all important commits for the release grouped by type.
To commit changelog
yarn changelog:commitornpm run changelog:commitIt 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.