Skip to content

Commit 407ce79

Browse files
committed
fix: remove alias leftovers from dist bundles
Signed-off-by: Jakub Freisler <[email protected]>
1 parent 64f45c6 commit 407ce79

13 files changed

+28
-24
lines changed

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
},
3636
"license": "MIT",
3737
"scripts": {
38-
"build": "del-cli dist && microbundle src/{constants,plugins,support}.ts --target node -f cjs,modern",
38+
"build": "del-cli dist && microbundle src/{support,plugins,constants}.ts --target node --tsconfig tsconfig.build.json -f cjs,modern && del-cli dist/src \"dist/*.{hook,utils}.d.ts\"",
3939
"lint": "eslint '**/*.ts' --ignore-pattern '**/*.d.ts'",
4040
"lint:fix": "yarn lint --fix",
4141
"lint:ci": "yarn lint --max-warnings 0",
@@ -46,8 +46,9 @@
4646
"release:ci": "yarn release --yes",
4747
"release:test": "yarn release --no-git-tag-version --no-push --skip-npm",
4848
"test": "cd example && yarn test:ct:ci && yarn test:e2e:ci && yarn test:integration:ci",
49-
"test:integration": "vitest",
50-
"test:integration:coverage": "vitest --coverage",
49+
"test:integration": "vitest run",
50+
"test:integration:watch": "vitest",
51+
"test:integration:coverage": "vitest run --coverage",
5152
"test:integration:ci": "CI=true vitest run --coverage",
5253
"test:ct": "cd example && yarn test:ct",
5354
"test:ct:ci": "cd example && yarn test:ct:ci",

src/afterScreenshot.hook.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { it, expect, describe } from "vitest";
22
import path from "path";
33
import { promises as fs, existsSync } from "fs";
4-
import { initAfterScreenshotHook } from "@/afterScreenshot.hook";
4+
import { initAfterScreenshotHook } from "./afterScreenshot.hook";
55
import { dir, file, setGracefulCleanup } from "tmp-promise";
6-
import { IMAGE_SNAPSHOT_PREFIX } from "@/constants";
6+
import { IMAGE_SNAPSHOT_PREFIX } from "./constants";
77

88
setGracefulCleanup();
99

src/afterScreenshot.hook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import path from "path";
22
import fs from "fs";
33
import moveFile from "move-file";
4-
import { IMAGE_SNAPSHOT_PREFIX } from "@/constants";
4+
import { IMAGE_SNAPSHOT_PREFIX } from "./constants";
55

66
type NotFalsy<T> = T extends false | null | undefined ? never : T;
77

src/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FILE_SUFFIX, LINK_PREFIX, TASK } from "@/constants";
1+
import { FILE_SUFFIX, LINK_PREFIX, TASK } from "./constants";
22
import type pixelmatch from "pixelmatch";
33
import * as Base64 from "@frsource/base64";
44

src/plugins.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { it, expect, describe, vi } from "vitest";
2-
import { initTaskHook } from "@/task.hook";
3-
import { initAfterScreenshotHook } from "@/afterScreenshot.hook";
4-
import { initPlugin } from "@/plugins";
2+
import { initTaskHook } from "./task.hook";
3+
import { initAfterScreenshotHook } from "./afterScreenshot.hook";
4+
import { initPlugin } from "./plugins";
55

6-
vi.mock("@/task.hook.ts", () => ({
6+
vi.mock("./task.hook.ts", () => ({
77
initTaskHook: vi.fn().mockReturnValue("task"),
88
}));
9-
vi.mock("@/afterScreenshot.hook.ts", () => ({
9+
vi.mock("./afterScreenshot.hook.ts", () => ({
1010
initAfterScreenshotHook: vi.fn().mockReturnValue("after:screenshot"),
1111
}));
1212

src/plugins.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { initTaskHook } from "@/task.hook";
2-
import { initAfterScreenshotHook } from "@/afterScreenshot.hook";
1+
import { initTaskHook } from "./task.hook";
2+
import { initAfterScreenshotHook } from "./afterScreenshot.hook";
33

44
/* c8 ignore start */
55
const initForceDeviceScaleFactor = (on: Cypress.PluginEvents) => {

src/support.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { it, expect, describe, vi } from "vitest";
22
import { setGracefulCleanup, withFile } from "tmp-promise";
33
import { promises as fs } from "fs";
44
import { cy } from "@mocks/cypress.mock";
5-
import { cachedReadFile, generateOverlayTemplate } from "@/support";
5+
import { cachedReadFile, generateOverlayTemplate } from "./support";
66

77
setGracefulCleanup();
88

9-
vi.mock("@/commands.ts", () => ({}));
9+
vi.mock("./commands.ts", () => ({}));
1010

1111
const fileContent = "file content";
1212

src/support.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Base64 from "@frsource/base64";
2-
import "@/commands";
3-
import { FILE_SUFFIX, LINK_PREFIX, OVERLAY_CLASS, TASK } from "@/constants";
2+
import "./commands";
3+
import { FILE_SUFFIX, LINK_PREFIX, OVERLAY_CLASS, TASK } from "./constants";
44

55
/* c8 ignore start */
66
function queueClear() {

src/task.hook.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
doesFileExistTask,
88
getScreenshotPathTask,
99
CompareImagesCfg,
10-
} from "@/task.hook";
10+
} from "./task.hook";
1111
import { file, setGracefulCleanup, withFile } from "tmp-promise";
1212

1313
setGracefulCleanup();

src/task.hook.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { PNG } from "pngjs";
44
import pixelmatch, { PixelmatchOptions } from "pixelmatch";
55
import moveFile from "move-file";
66
import sanitize from "sanitize-filename";
7-
import { FILE_SUFFIX, IMAGE_SNAPSHOT_PREFIX, TASK } from "@/constants";
8-
import { alignImagesToSameSize, importAndScaleImage } from "@/image.utils";
7+
import { FILE_SUFFIX, IMAGE_SNAPSHOT_PREFIX, TASK } from "./constants";
8+
import { alignImagesToSameSize, importAndScaleImage } from "./image.utils";
99

1010
export type CompareImagesCfg = {
1111
scaleFactor: number;

tsconfig.build.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": ["src/*.ts"],
4+
"exclude": ["src/*.test.ts"]
5+
}

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"esModuleInterop": true,
99
"baseUrl": ".",
1010
"paths": {
11-
"@/*": ["src/*"],
1211
"@fixtures/*": ["__tests__/partials/*"],
1312
"@mocks/*": ["__tests__/mocks/*"]
1413
}

vitest.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ export default defineConfig({
2222
},
2323
alias: {
2424
'@fixtures/*': path.resolve(__dirname, '__tests__', 'partials'),
25-
'@mocks/*': path.resolve(__dirname, '__tests__', 'mocks'),
26-
'@/*': path.resolve(__dirname, 'src')
25+
'@mocks/*': path.resolve(__dirname, '__tests__', 'mocks')
2726
}
2827
},
2928
});

0 commit comments

Comments
 (0)