Skip to content

sketch7/ssv-tools

Repository files navigation

@ssv/tools

CI npm version

tools and utilities used for builds and develop sketch7 (ssv) libraries. includes sharing of the following configs:

  • .eslintrc
  • .stylelintrc
  • tslint.json
  • tsconfig.json

In order to contribute please read the Contribution guidelines.

Quick links

Change logs | Project Repository | Contribution guidelines

Installation

Get library via npm

npm install @ssv/tools --save

Usage

API

import { compileTsc, rollup } from "@ssv/tools";

// compile typescript - execute typescript with cli
compileTsc({
  module: "es2015",
  configPath: "./tsconfig.build.json",
  continueOnError: args.continueOnError
});

// rollup - execute rollup with cli
rollup({ continueOnError: args.continueOnError });

// prepare for prepublish, as copy files such as `README.md`, `CHANGELOG.md`, copy and transform `package.json`
buildResources();

// prepare release build such as update version placeholder
prepareReleaseBuild();

gulp utils

import { setGulpContext, registerGulpMultiTargetBuilds } from "@ssv/tools";
import gulp from "gulp";

// before geting started with gulp utils, you need to invoke this once in order to share same instance of gulp.
setGulpContext(gulp)

// generates and register task for gulp by convention for multi-targetting build e.g. amd, umd, es2015 etc...
// e.g. compile:styles (all) | compile:styles:dev (dev target) | compile:styles:TARGET etc... (compile:styles:es2015).
registerGulpMultiTargetBuilds({
    taskName: "html",
    action: compileHtml,
    config: { 
        buildTargets: [
            "es2015",
            "amd",
            "umd"
        ],
	    devTarget: "amd",
    }
});

ES5

for usage with es5, use as following:

const ssvTools = require("@ssv/tools");
ssvTools.compileTsc(...);

Base configs

eslint

{
    "extends": "./node_modules/@ssv/tools/config/.eslintrc"
}

tslint

{
    "extends": [
        "./node_modules/@ssv/tools/config/tslint.json"
    ]
}

tsconfig

{
    "extends": "./node_modules/@ssv/tools/config/tsconfig.json"
}

stylelint

{
    "extends": "./node_modules/@ssv/tools/config/.stylelintrc"
}

Getting Started

Setup Machine for Development

Install/setup the following:

  • NodeJS v18+
  • Visual Studio Code or similar code editor
  • TypeScript 5.0+
  • Git + SourceTree, SmartGit or similar (optional)
  • Ensure to install global NPM modules using the following:
npm install -g git gulp

Cloning Repo

  • Run git clone https://github.com/sketch7/ssv-tools.git

Project Setup

The following process need to be executed in order to get started.

npm install

Building the code

npm run build