Skip to content

Commit

Permalink
Feat: Extract the MinifyResult type (#2)
Browse files Browse the repository at this point in the history
* Feat: Extract the MinifyResult type

* Add publish script
  • Loading branch information
luckrnx09 authored Dec 17, 2023
1 parent 1a40224 commit 0abe112
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/email-minifier.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Sequence } from './sequence';
import { createDocument } from './document';
import { TaskManager } from './task-manager';
import { Context, ComposeOption } from './types';
import { Context, ComposeOption, MinifyResult } from './types';

const DEFAULT_COMPOSE_OPTIONS: ComposeOption = {
minifyIds: true,
Expand Down Expand Up @@ -77,7 +77,7 @@ export class EmailMinifier {
};
}

async minify(options?: ComposeOption) {
async minify(options?: ComposeOption): Promise<MinifyResult> {
const context = await this.createContext();
const taskManager = this.compose(context, options);
const { originalEmailBody, document } = context;
Expand Down
6 changes: 6 additions & 0 deletions lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,9 @@ export type TaskType =
| 'minify-dataset-attrs'
| 'remove-unused-attrs'
| 'minify-styles';

export type MinifyResult = {
original: string;
minified: string | null;
tasks: Task[];
};
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "email-minifier",
"version": "0.1.0",
"version": "1.0.0",
"keywords": [
"compress",
"compressor",
Expand Down Expand Up @@ -36,7 +36,8 @@
"scripts": {
"lint": "npx eslint . --fix",
"build": "npm run lint && rm -rf dist && rollup --config --bundleConfigAsCjs",
"test": "npm run lint && jest"
"test": "npm run lint && jest",
"publish": "npm run build && npm publish"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 0abe112

Please sign in to comment.