UNPKG

kt-extendscript-builder

Version:

Vite based builder for transpile TypeScript to ExtendScript

62 lines (61 loc) 1.58 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.baseOptionsRules = void 0; const modeRule = (options) => { if (options.mode === 'production') { return { ...options, watch: false // test: false }; } else if (options.mode === 'development') { return { ...options, watch: true }; } return options; }; const testRule = (options) => { if (options.test) { const ruledOptions = {}; if (options.test === true) { if (options['tsconfig-test-path'] === undefined) { ruledOptions['tsconfig-template'] = true; } } return { ...options, ...ruledOptions }; } return options; }; const tsconfigRule = (options) => { const tsconfigOption = {}; if (!options.tsconfig && !options['tsconfig-test-path']) { tsconfigOption['tsconfig-template'] = true; } else { tsconfigOption['tsconfig-template'] = false; } return { ...options, ...tsconfigOption }; }; const cleanRule = (options) => { const cleanedOptions = {}; if (!options.clean) { cleanedOptions.clean = ['false']; } if (!Array.isArray(cleanedOptions.clean) && typeof cleanedOptions.clean === 'string') { cleanedOptions.clean = [cleanedOptions.clean]; } return { ...options, ...cleanedOptions }; }; exports.baseOptionsRules = { modeRule, testRule, tsconfigRule };