0.2.0 • Published 6 years ago

generate-swap-generator-example v0.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Installation

Global install to use the generator as a standarlone CLI (recommanded)

$ yarn gobal add generate-swap-generator-example

or

$ npm install --global generate-swap-generator-example

Local install to use as a generate plugin or sub-generator

You should first visit the generator framework, generate to understand how generators, subgenerators and plugins work. See also related projects

$ yarn add generate-swap-generator-example

or

$ npm install --save generate-swap-generator-example

Usage

As a standalone generator (recommanded)

$ generate-swap-generator-example

Should @TODO: describe generator default action

Generated files

@TODO: generated files tree

.
├─┬ dir/
| └─┬ subdir/
|   ├─ example1.txt
|   └─ example2.txt
└── .travis.yml

Example

Usage screenshot

Usage example

As a generate plugin (if you know what you are doing)

You should first visit the generator framework, generate to understand how generators, subgenerators and plugins work.

import generateSwapGeneratorExample from 'generate-swap-generator-example'
import isValid from 'is-valid-app'

export default function (app) {
  if (!isValid(app, 'generate-my-generator')) return

  app.use(generateSwapGeneratorExample)

  // ... your generator's stuff
}

Then you can use directly any 'generate-swap-generator-example' tasks as a generate-my-generator task.

$ gen my-generator:example-task

Should run generate-swap-generator-example:example-task on your own generator instance.

As a generate sub-generator (if you know what you are doing)

You should first visit the generator framework, generate to understand how generators, subgenerators and plugins work.

import generateSwapGeneratorExample from 'generate-swap-generator-example'
import isValid from 'is-valid-app'

export default function (app) {
  if (!isValid(app, 'generate-my-generator')) return

  app.register('swap-generator-example', generateSwapGeneratorExample)

  // ... your generator's stuff
}

Then you can acces easily any generate-swap-generator-example tasks as a generate-my-generator sub-generator task.

$ gen my-generator.swap-generator-example:example-task

Should run generate-swap-generator-example:example-task on your own generator instance.

API

@TODO: document the API here

Contributing

Codebase

The codebase is written using the ESNext Specification (ECMAScript Stage 0), following the StandardJS Code Style

ECMASript JavaScript Style Guide ESLint Babel JS Yarn

We use:

  • Yarn to handle npm dependencies,
  • ESNext CLI to transform ESx code to ESNext,
  • Babel CLI to transpile ESNext code to node/browser compatible javascript,
  • And Standard CLI + ESLint to lint or format ESNext codebase.

Contribution guide

See the contribution guide in a separated document.

Development

Global dependencies

Get the latest node engine (example with nvm):

$ nvm install lts/carbon

Install yarn from npm (for development only):

$ npm install --global yarn

All the rest of the development dependencies are local.

Clone and install

Clone the repo and install dependencies:

$ git clone git@github.com:sirap-group/generate-swap-generator-example.git
$ cd generate-swap-generator-example
$ yarn install

Running test

Finally, run the test pipeline:

$ yarn pipeline:test

Available yarn scripts

Task CommandTask description
yarn clearDelete the ./build/ and ./dist repositories
yarn lintLint source files
yarn lint:esnextLint ESNext source files
yarn buildBuild the whole distribution
yarn build:assetsBuild all the assets
yarn build:assets:imgBuild the images assets
yarn build:assets:templatesBuild the generator's templates
yarn build:libBuild only the lib
yarn build:testsBuild only the tests
yarn build:docsTODO Build only the docs
yarn testRun the tests in ./dist/tests/
yarn testsAn alias for yarn test
yarn travisRun the travis script
yarn docsTODO Serve the docs
yarn pipelineRun the complete pipeline
yarn pipeline:testRun the required jobs to run the tests, then run the tests
yarn pipeline:buildRun the required jobs to build the dist, then build the dist
yarn pipeline:docsTODO Run the required jobs to serve the docs, then serve the docs
yarn pipeline:build:testsRun the required jobs to build the docs, then build the docs
yarn pipeline:build:libRun the required jobs to build the docs, then build the docs
yarn pipeline:build:docsTODO Run the required jobs to build the docs, then build the docs
yarn releaseAn alias to yarn release:patch
yarn release:prereleaseRelease and publish a new semver version (x.y.z-rc+1)
yarn release:patchRelease and publish a new patch semver version (x.y.z+1)
yarn release:minorRelease and publish a new minor semver version (x.y+1.z=0)
yarn release:majorRelease and publish a new major semver version (x+1.y=0.z=0)

Develop in BDD mode

B.D.D. means Behavior-Driven-Development

The project is ready to code in BDD mode. Just run the bdd yarn command:

$ yarn bdd

The project will be lint, built, the BDD unit tests will be run, and the process will watch for any file changes to loop over the previous tasks (lint, build, test, watch).

Releasing a new version

The task yarn pipeline:build generate a ./dist folder in the repository's root directory but this folder is not part of the git repository (there is an entry in the .gitignore file). However the dist folder is included in the package.json#files field.

Thus to release a new, lets say, "patch" version, just run:

$ yarn release:patch

The whole build pipeline is run locally (lint, transpile, test) and then a new git tag and a new npm tag are pushed up.

Related projects

  • generate-swap-generators Generate An ES.Next/StandardJS/UnitTest Ready, Github or Gitlab Project in Seconds! − A generator for SWAP projects github | homepage
  • generate-swap-project Generate An ES.Next/StandardJS/UnitTest Ready, Github or Gitlab Project in Seconds! − A generator for SWAP projects github | homepage
  • generate A new command line tool and developer framework for scaffolding out GitHub projects. Generate offers the robustness and configurability of Yeoman, the expressiveness and simplicity of Slush, and more powerful flow control and composability than either github | homepage
  • base: Framework for rapidly creating high quality node.js applications, using plugins like building blocks | homepage
  • update: Be scalable! Update is a new, open source developer framework and CLI for automating updates… more | homepage
  • verb: Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… more | homepage
  • composer: API-first task runner with three methods: task, run and watch. | homepage
  • engine: Template engine based on Lo-Dash template, but adds features like the ability to register helpers… more | homepage
  • template: Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template… more | homepage

License

Copyright © Groupe SIRAP

See LICENSE