Skip to content

Latest commit

 

History

History
62 lines (45 loc) · 1.74 KB

PROGRAMMING_INTERFACE.md

File metadata and controls

62 lines (45 loc) · 1.74 KB

Programming interface

When using task runners like Gulp and Just, as well as bundlers like webpack and rollup, you need a programming interface to add ctix.

function option descryption
building TCommandBuildOptions Execute the build command
initializing TCommandInitOptions Execute the init command
removing TCommandRemoveOptions, TCommandBuildOptions Execute the remove command

CommonJS Example

const fs = require('node:fs');
const ctix = require('ctix');

const handle = async () => {
  const options = ctix.parseConfig(await fs.promises.readFile('.ctirc'));
  await ctix.building(options);
};

handle();

ESM, TypeScript Example

esm

import { building, parseConfig, TCommandBuildOptions } from 'ctix';
import fs from 'node:fs';

const handle = async () => {
  const options = parseConfig(await fs.promises.readFile('.ctirc'));
  await building(options);
};

handle();

TypeScript

import { building, parseConfig, TCommandBuildOptions } from 'ctix';
import fs from 'node:fs';

const handle = async () => {
  const options = parseConfig(await fs.promises.readFile('.ctirc')) as TCommandBuildOptions;
  await building(options);
};

handle();

Gulp Example

gulp.task('ctix', async () => {
  const options = parseConfig(await fs.promises.readFile('.configs/.ctirc'));
  await building(options);
});