turbo-gulp
Gulp tasks to boost high-quality projects.
Last updated 2 months ago by demurgos .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install turbo-gulp 
SYNC missed versions from official npm registry.

Turbo Gulp

Gulp tasks to boost high-quality projects.

npm GitHub repository Build status Codecov Greenkeeper badge

This package was known as demurgos-web-build-tools before v0.15.2 (2017-11-09).

This project started out because I wanted to avoid repeating complex configurations in every one of my projects. I solved it by centralizing most of logic for the tasks I need in this package. To further reduce the overhead of the configuration, the defaults use a sensible directory structure for Node projects.

The main features are:

  • Support for multiple targets in a single project (for example lib and example)
  • Typescript builds, with support for custom typings, watch mode and custom compiler options
  • Tslint verification with type information
  • Mocha unit tests
  • Code coverage with c8
  • Typedoc generation
  • Assets management: copy resources

Installation

Install the library as a dev-dependency:

npm install -D turbo-gulp

Builds of the master branch are also regularly released using the next tag:

npm install -D turbo-gulp@next

Quick start

TODO: Add better guide to configure repo and Travis CI, code coverage and codecov integrations. For the moment, take a look at this reference project: Incident.

Then use it in your Gulp file, here is an example:

// Import the build tools and the gulp instance for this project
import * as buildTools from "turbo-gulp";
import * as gulp from "gulp";

// Project config shared by all the targets
const project: buildTools.Project = {
  root: __dirname,
  packageJson: "package.json",
  buildDir: "build",
  distDir: "dist",
  srcDir: "src",
};

// Configuration for a "library" target
const lib: buildTools.LibTarget = {
  // Project-wide config
  project,
  // Name (used as a prefix for the tasks)
  name: "lib",
  // Override srcDir
  srcDir: "src/lib",
  scripts: ["**/*.ts"],
  mainModule: "index",
  customTypingsDir: "src/custom-typings",
  tscOptions: {
    skipLibCheck: true,
  },
  typedoc: {
    dir: "typedoc",
    name: "Example lib",
  },
  copy: [
    {
      name: "json",
      files: ["**/*.json"],
    },
  ],
  clean: {
    dirs: ["build/lib", "dist/lib"],
  },
};

// Generate and register project-wide tasks
buildTools.projectTasks.registerAll(gulp, project);
// Generate and register the tasks for the lib target
buildTools.registerLibTasks(gulp, lib);

You can then start using the tasks, for example gulp lib:build. Use gulp --tasks to list all the tasks. Check the documentation for the list of available tasks and configuration.

Recommended project layout

Here

.
├── build/          # Development builds
├── dist/           # Distributed files (this goes to npm)
├── docs/           # Custom documentation for the library
├── src/            # Scripts, assets and tests
| ├── lib/          # Library source code
| └── test/         # Tests source code
├── CHANGELOG.md    # Description of the changes for each version
├── CONTRIBUTING.md # How to build and work on the project
├── LICENSE.md      # License file
├── NOTICE.md       # Notice for third-party tools (required by some licenses)
├── README.md       # Projects presentation
├── package.json    # Project's metadata
├── tsconfig.ts     # Default TS config file, used for the gulp file and to help the IDE
└── gulpfile.ts     # Definition of Gulp tasks

Usage

The build tools use the following hierarchy:

  • Project: It represents a unit of code to implement a library or application, it usually corresponds to a git repo or a single gulp file. A project is a set of targets (see below). The project configuration is shared by all the targets, it defines the general structure of your project: what is the root directory, the build directory, the base Typescript options, etc.
  • Target: A target represents a unit of output. You can have some shared source code and use it to build multiple targets: for example, a library importable by other projects, a runnable demo, a test build using Mocha, a bundled version for the browser, etc. The target options are specific to each type of output and allow you to configure how each task is applied.
  • Task: A task represents an operation provided by a target: build, run, test, etc. This is what you actually use when calling Gulp. The task names have the form targetName:taskName. For example to generate the documentation of the library target lib using Typedoc, you can use gulp lib:typedoc. There are main tasks to do high-level actions, and other tasks for fine-grained that are mostly available to integrate with other tools.

License

MIT License

Current Tags

  • 0.20.1                                ...           latest (2 months ago)
  • 0.19.0-build.659                                ...           next (2 months ago)

60 Versions

  • 0.20.1                                ...           2 months ago
  • 0.20.0                                ...           2 months ago
  • 0.19.0-build.659                                ...           2 months ago
  • 0.19.0                                ...           3 months ago
  • 0.18.0-build.650                                ...           3 months ago
  • 0.18.0-build.647                                ...           3 months ago
  • 0.18.0                                ...           8 months ago
  • 0.17.1-build.622                                ...           8 months ago
  • 0.18.0-build.615                                ...           8 months ago
  • 0.17.1-build.555                                ...           a year ago
  • 0.17.1-build.552                                ...           a year ago
  • 0.17.1-build.549                                ...           a year ago
  • 0.17.1-build.541                                ...           a year ago
  • 0.17.1-build.529                                ...           a year ago
  • 0.17.1-build.517                                ...           a year ago
  • 0.17.1-build.515                                ...           a year ago
  • 0.17.1-build.513                                ...           a year ago
  • 0.17.1-build.510                                ...           a year ago
  • 0.17.1-build.508                                ...           a year ago
  • 0.17.1-build.505                                ...           a year ago
  • 0.17.1                                ...           a year ago
  • 0.17.1-build.499                                ...           a year ago
  • 0.17.0                                ...           a year ago
  • 0.17.0-build.491                                ...           a year ago
  • 0.16.2-build.486                                ...           a year ago
  • 0.16.2-build.472                                ...           a year ago
  • 0.16.2-build.469                                ...           a year ago
  • 0.16.2-build.459                                ...           a year ago
  • 0.16.2-build.445                                ...           a year ago
  • 0.16.2-build.435                                ...           a year ago
  • 0.16.2-build.421                                ...           a year ago
  • 0.16.2                                ...           a year ago
  • 0.16.1-build.409                                ...           a year ago
  • 0.16.1-build.406                                ...           a year ago
  • 0.16.1-build.402                                ...           a year ago
  • 0.16.1                                ...           a year ago
  • 0.16.0-build.383                                ...           a year ago
  • 0.16.0-build.379                                ...           2 years ago
  • 0.16.0-build.372                                ...           2 years ago
  • 0.16.0                                ...           2 years ago
  • 0.15.8-build.354                                ...           2 years ago
  • 0.15.8-build.352                                ...           2 years ago
  • 0.15.8-build.347                                ...           2 years ago
  • 0.15.8-build.345                                ...           2 years ago
  • 0.15.8-build.343                                ...           2 years ago
  • 0.15.8-build.341                                ...           2 years ago
  • 0.15.8-build.332                                ...           2 years ago
  • 0.15.8-build.328                                ...           2 years ago
  • 0.15.8-build.322                                ...           2 years ago
  • 0.15.8                                ...           2 years ago
  • 0.15.7-build.310                                ...           2 years ago
  • 0.15.7                                ...           2 years ago
  • 0.15.6                                ...           2 years ago
  • 0.15.5-build.289                                ...           2 years ago
  • 0.15.5-build.278                                ...           2 years ago
  • 0.15.5                                ...           2 years ago
  • 0.15.4                                ...           2 years ago
  • 0.15.3-build.265                                ...           2 years ago
  • 0.15.3                                ...           2 years ago
  • 0.15.2-build.251                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 63
Last Day 0
Last Week 60
Last Month 122
Dependencies (46)
Dev Dependencies (18)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |