Skip to content

Commit

Permalink
Simplify API definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Domi04151309 committed Dec 23, 2024
1 parent 88a74ec commit 81c6a2d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 18 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ const ROOT_DIRECTORY = 'public';

await build({
directories: [ROOT_DIRECTORY],
ignoreList: [
'.d.ts',
'.git',
'.test.js'
],
outDirectory: 'out',
rootDirectory: ROOT_DIRECTORY
});
Expand Down
5 changes: 2 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ const DEFAULT_VERSION = Math.floor(Date.now() / 1000).toString();

/** @type {InternalBuildOptions} */
export const DEFAULT_BUILD_OPTIONS = {
builder: {
keepList: []
},
bundler: {
entryDocumentExtensions: [
'.html',
Expand Down Expand Up @@ -66,6 +63,8 @@ export const DEFAULT_BUILD_OPTIONS = {
format: 'esm',
minify: true
},
ignoreList: [],
keepList: [],
thirdPartyModules: [
'node_modules/',
'vendor/'
Expand Down
2 changes: 1 addition & 1 deletion src/modules/builder/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class Builder {
* @returns {boolean}
*/
#shouldKeep(file) {
return this.#options.builder.keepList.some(
return this.#options.keepList.some(
entry => file.includes(entry)
);
}
Expand Down
4 changes: 1 addition & 3 deletions src/modules/shared/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ import { stat } from 'node:fs/promises';
/** @type {FullBuildOptions} */
export const BUILD_OPTIONS = {
...DEFAULT_BUILD_OPTIONS,
builder: {
keepList: ['index.js']
},
directories: ['src'],
ignoreList: ['.test.js'],
keepList: ['index.js'],
outDirectory: 'out',
rootDirectory: 'src'
};
Expand Down
8 changes: 2 additions & 6 deletions src/modules/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ export interface FileInfo {
path: string;
}

export interface BuilderOptions {
keepList: string[];
}

export interface BundlerOptions {
entryDocumentExtensions: string[];
external: string[];
Expand All @@ -18,17 +14,17 @@ export interface CleanerOptions {
}

export interface InternalBuildOptions {
builder: BuilderOptions;
bundler: BundlerOptions;
cleaner: CleanerOptions;
commonEsbuildOptions: import('esbuild').BuildOptions;
ignoreList: string[];
keepList: string[];
thirdPartyModules: string[];
version: string;
}

export interface ExternalBuildOptions {
directories: string[];
ignoreList: string[];
outDirectory: string;
rootDirectory: string;
}
Expand Down

0 comments on commit 81c6a2d

Please sign in to comment.