Skip to content

Commit ce380a4

Browse files
committed
BREAKING CHANGE: change import
BREAKING CHANGE: change import
1 parent 9afff1f commit ce380a4

File tree

5 files changed

+21
-19
lines changed

5 files changed

+21
-19
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"scripts": {
4747
"clean": "rimraf dist",
4848
"dev": "vite",
49-
"build": "yarn clean && tsc --project tsconfig.build.json && tsc --project tsconfig.build-esm.json && yarn fixImportExtension",
49+
"build": "yarn clean && tsc --project tsconfig.build.json && tsc --project tsconfig.build-esm.json && yarn copy-files && yarn copy-files-esm && yarn fixImportExtension",
5050
"prepare": "npm run build",
5151
"preview": "vite preview",
5252
"type:check": "tsc --noEmit",
@@ -59,6 +59,8 @@
5959
"visualize": "npx vite-bundle-visualizer",
6060
"publish": "yarn build && yarn npm publish",
6161
"clean-cache": "yarn cache clean --all",
62+
"copy-files": "copyfiles -u 1 src/*.d.ts dist/",
63+
"copy-files-esm": "copyfiles -u 1 src/*.d.ts dist/esm",
6264
"fixImportExtension": "ts-add-js-extension --dir=dist",
6365
"example": "cd example && yarn upgrade",
6466
"test": "jest",

src/__tests__/utils.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// import {describe, expect, test} from '@jest/globals';
22

3-
import checkPasswordComplexity from "../utils";
3+
import { checkPasswordComplexity } from "../utils";
44

55
describe('test score', () => {
66
test('abcdefgh is tooWeak', () => {

src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
export {
2-
default as checkPasswordComplexity,
2+
checkPasswordComplexity,
3+
} from './utils';
4+
5+
export {
36
type CheckPasswordOptions,
47
type CheckOptionResult
5-
} from './utils';
8+
} from './types.d';

src/types.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,13 @@ export type ScoreOption = {
1111
};
1212

1313

14+
export type CheckOptionResult = {
15+
checkedRules: CheckOption["name"][];
16+
value: ScoreOption["name"];
17+
length: number;
18+
};
19+
20+
export type CheckPasswordOptions = {
21+
minLength?: number;
22+
allowedSpecialChar?: string;
23+
};

src/utils.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CheckOption, ScoreOption } from './types.d';
1+
import { CheckOption, CheckOptionResult, CheckPasswordOptions, ScoreOption } from './types.d';
22

33
const scoreOptions: ScoreOption[] = [
44
{
@@ -23,18 +23,7 @@ const scoreOptions: ScoreOption[] = [
2323
},
2424
];
2525

26-
export type CheckOptionResult = {
27-
checkedRules: CheckOption["name"][];
28-
value: ScoreOption["name"];
29-
length: number;
30-
};
31-
32-
export type CheckPasswordOptions = {
33-
minLength?: number;
34-
allowedSpecialChar?: string;
35-
};
36-
37-
const checkPasswordComplexity = (
26+
export const checkPasswordComplexity = (
3827
password: string,
3928
options?: CheckPasswordOptions
4029
): CheckOptionResult => {
@@ -96,5 +85,3 @@ const checkPasswordComplexity = (
9685
length: password.length,
9786
};
9887
};
99-
100-
export default checkPasswordComplexity;

0 commit comments

Comments
 (0)