From 18c03b290edc3c2359c5ca87113f8a10b7741f18 Mon Sep 17 00:00:00 2001 From: haZya <63403456+haZya@users.noreply.github.com> Date: Tue, 26 Nov 2024 12:22:06 +0530 Subject: [PATCH 1/2] fix: Clean up dist folder before a build to remove any redundant files --- package.json | 1 + scripts/pre-build.mjs | 5 +++++ src/index.ts | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 scripts/pre-build.mjs diff --git a/package.json b/package.json index 80e04469..a7c3f0c3 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ }, "scripts": { "lint": "tslint -p . -t verbose", + "prebuild": "node ./scripts/pre-build.mjs", "build:esm": "tsc -p ./tsconfig.esm.json && node ./scripts/add-extensions.mjs", "build:cjs": "tsc -p ./tsconfig.cjs.json", "build": "yarn build:esm && yarn build:cjs && node ./scripts/add-nested-package-json.mjs", diff --git a/scripts/pre-build.mjs b/scripts/pre-build.mjs new file mode 100644 index 00000000..88a60cd0 --- /dev/null +++ b/scripts/pre-build.mjs @@ -0,0 +1,5 @@ +import { rmSync } from "fs"; + +const dir = "./dist"; + +rmSync(dir, { recursive: true, force: true }); diff --git a/src/index.ts b/src/index.ts index 33bb9521..f65e9e56 100644 --- a/src/index.ts +++ b/src/index.ts @@ -32,7 +32,7 @@ export type ClassifyConfig = { onFrame?: (result: FrameResult) => any; }; -interface NSFWJSOptions { +export interface NSFWJSOptions { size?: number; type?: string; } From aab0f01346c71a603131a9d810dfbb909b4e78c8 Mon Sep 17 00:00:00 2001 From: haZya <63403456+haZya@users.noreply.github.com> Date: Wed, 4 Dec 2024 07:18:53 +0530 Subject: [PATCH 2/2] Add prepare command --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index a7c3f0c3..bd983a08 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "scriptbundle": "browserify ./dist/cjs/nsfwjs.js -s nsfwjs -o ./dist/browser/bundle.js", "minbundle": "terser dist/browser/bundle.js -c -m -o dist/browser/nsfwjs.min.js", "bundle": "yarn build && yarn scriptbundle && yarn minbundle", + "prepare": "yarn bundle", "shipit:precheck": "if [ \"$npm_config_user_agent\" != \"${npm_config_user_agent#*yarn}\" ]; then echo 'Use `npm run shipit` instead of yarn.' && exit 1; fi", "shipit": "npm run shipit:precheck && yarn bundle && np" },