Skip to content

chrisblossom/backtrack-preset-node

Repository files navigation

@backtrack/preset-node

npm

About

backtrack preset that sets up a node project.

Features

Installation

npm install --save-dev @backtrack/preset-node

Usage

// backtrack.config.js

'use strict';

module.exports = {
	// see settings below
	presets: [
		[
			'@backtrack/node',
			{
				mode: 'module',
				syntax: 'node',
			},
		],
	],
};

Settings

'use strict';

module.exports = {
	presets: [
		[
			'@backtrack/node',
			{
				/**
				 * Project mode type
				 *
				 * Required
				 *
				 * Available modes:
				 *     module - npm module
				 *     app - node application
				 *
				 */
				mode: 'app',

				/**
				 * Javascript syntax
				 *
				 * Required
				 *
				 * Available syntax:
				 *     node: Target package.json's engines.node (no compilation)
				 *
				 *     babel: Use babel to provide latest javascript features
				 *         - app requirements:
				 *             - npm install --save source-map-support core-js@3
				 *
				 *     typescript: Use Typescript
				 *         - requirements
				 *             - npm install --save-dev typescript
				 *         - app requirements:
				 *             - npm install --save source-map-support core-js@3
				 */
				syntax: 'typescript',

				/**
				 * Specify node version
				 *
				 * module default: '>=14.15.0'
				 * app default: '^16.13.0'
				 */
				nodeVersion: '^18.0.0',

				/**
				 * Enable/disable Windows-only features
				 *
				 * module default: true
				 * app default: false
				 */
				windows: false,
			},
		],
	],
};