Skip to content

Commit

Permalink
build(main): move remove temp files from build to rollup-plugin-delete
Browse files Browse the repository at this point in the history
  • Loading branch information
diegopf authored and joseacabaneros committed Aug 22, 2024
1 parent 4472ebd commit 4892454
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
13 changes: 0 additions & 13 deletions packages/x-components/build/build.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
import * as path from 'path';
import fs from 'fs';
import { OutputOptions, rollup } from 'rollup';
import { cssDeprecatedRollupConfig, rollupConfig } from './rollup.config';

const rootDir = path.resolve(__dirname, '../');

/**
* Function for deleting useless folders.
*/
function removeTempFiles() {
fs.rmSync(path.join(rootDir, 'temp'), { recursive: true });
}

/**
* Entry point for building the project.
*/
Expand All @@ -21,8 +10,6 @@ async function build() {

const bundleCssDeprecatedComponents = await rollup(cssDeprecatedRollupConfig);
await bundleCssDeprecatedComponents.write(cssDeprecatedRollupConfig.output as OutputOptions);

removeTempFiles();
}

// eslint-disable-next-line no-console
Expand Down
9 changes: 8 additions & 1 deletion packages/x-components/build/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ export const rollupConfig: RollupOptions = {
);
},
plugins: [
del({ targets: [`${buildPath}/*`, `${path.join(rootDir, 'docs')}/*`] }),
del({
targets: [
`${buildPath}/*`,
`${path.join(rootDir, 'docs')}/*`,
`${path.join(rootDir, 'temp')}/*`
]
}),
typescript({
useTsconfigDeclarationDir: true,
tsconfig: path.resolve(rootDir, 'tsconfig.json'),
Expand All @@ -81,6 +87,7 @@ export const rollupConfig: RollupOptions = {
}
}) as Plugin,
styles({
minimize: true,
mode: [
'inject',
varname => {
Expand Down

0 comments on commit 4892454

Please sign in to comment.