From ab3c7bada2a11d5bdb99de06a8b3aecdb06d4824 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 30 Jun 2023 03:45:26 -0400 Subject: [PATCH] refactor: change source to build, and add new buildSource var. Add tsconfig.build overrides --- configs/rollup.yaml | 38 +++++++++++++++++++------------------- source/index.ts | 12 +++++++++--- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/configs/rollup.yaml b/configs/rollup.yaml index c100a8e..74c5252 100644 --- a/configs/rollup.yaml +++ b/configs/rollup.yaml @@ -1,21 +1,21 @@ -input: '{source}/index.ts' +input: '{source}/index.js' output: - - file: '{output}/index.js' - format: cjs - sourcemap: true + - file: '{output}/index.js' + format: cjs + sourcemap: true plugins: - - '@apply @rollup/plugin-json[default]' - - '@apply @rollup/plugin-node-resolve[default]' - - - '@apply @rollup/plugin-commonjs[default]' - - extensions: - - .js - - .jsx - - .ts - - .tsx - - '@apply @rollup/plugin-graphql[default]' - - '@apply @rollup/plugin-image[default]' - - '@apply @rollup/plugin-yaml[default]' - - - '@apply rollup-plugin-postcss[default]' - - inject: - insertAt: top - - '@apply rollup-plugin-visualizer[visualizer]' + - '@apply @rollup/plugin-json[default]' + - '@apply @rollup/plugin-node-resolve[default]' + - - '@apply @rollup/plugin-commonjs[default]' + - extensions: + - .js + - .jsx + - .ts + - .tsx + - '@apply @rollup/plugin-graphql[default]' + - '@apply @rollup/plugin-image[default]' + - '@apply @rollup/plugin-yaml[default]' + - - '@apply rollup-plugin-postcss[default]' + - inject: + insertAt: top + - '@apply rollup-plugin-visualizer[visualizer]' diff --git a/source/index.ts b/source/index.ts index d14790f..20b1674 100644 --- a/source/index.ts +++ b/source/index.ts @@ -41,11 +41,13 @@ export type Variable = { source: string; /** the directory containing all the compiled files (default: lib) */ output: string; + buildSource: string; }; export const DEFAULT_VARIABLE: Variable = { - source: 'source', + source: 'build', output: 'lib', + buildSource: 'buildSource', }; /** @@ -71,8 +73,12 @@ export default function (): PresetAsset { scripts: resolve(TEMPLATES, 'scripts.yaml'), noSymlinks: ['rollup.config.ts'], supplementaryConfig: { - gitignore: ['/rollup.config.ts'], - rollup: resolve(CONFIGS, 'rollup.yaml'), + 'gitignore': ['/rollup.config.ts'], + 'rollup': resolve(CONFIGS, 'rollup.yaml'), + 'tsconfig.build': { + include: ['{buildSource}'], + outDir: ['{source}'], + }, }, variable: DEFAULT_VARIABLE, };