packages/preset-cjs/source/index.ts
/*
* *** MIT LICENSE ***
* -------------------------------------------------------------------------
* This code may be modified and distributed under the MIT license.
* See the LICENSE file for details.
* -------------------------------------------------------------------------
*
* @summary Preset for a ESM project
*
* @author Alvis HT Tang <alvis@hilbert.space>
* @license MIT
* @copyright Copyright (c) 2022 - All Rights Reserved.
* -------------------------------------------------------------------------
*/
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import type { PresetAsset } from 'presetter-types';
const DIR = fileURLToPath(dirname(import.meta.url));
// paths to the template directory
const CONFIGS = resolve(DIR, '..', 'configs');
export type { PresetConfig, Variable } from 'presetter-preset-esm';
/**
* get the list of templates provided by this preset
* @returns list of preset templates
*/
export default async function (): Promise<PresetAsset> {
return {
extends: ['presetter-preset-esm'],
supplementaryConfig: {
jest: resolve(CONFIGS, 'jest.yaml'),
tsconfig: resolve(CONFIGS, 'tsconfig.yaml'),
},
supplementaryScripts: resolve(CONFIGS, 'scripts.yaml'),
};
}