Skip to content

Commit 6383cdd

Browse files
committed
fix: change build so development and distributed imports match
1 parent 7b861e4 commit 6383cdd

File tree

8 files changed

+81
-292
lines changed

8 files changed

+81
-292
lines changed

.github/workflows/ci-cd.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ jobs:
5555
- name: "Build"
5656
run: yarn build
5757

58-
- name: "Tests against build"
59-
run: yarn jest --selectProjects dom-package
58+
- name: "Tests against built package"
59+
run: yarn test
6060

6161
test:
6262
name: "Test"
@@ -77,7 +77,7 @@ jobs:
7777
install-command: yarn --frozen-lockfile
7878

7979
- name: "Test"
80-
run: yarn test:coverage --testLocationInResults --reporters=default --reporters=@jamesacarr/jest-reporter-github-actions
80+
run: yarn build:clean && yarn test:coverage --testLocationInResults --reporters=default --reporters=@jamesacarr/jest-reporter-github-actions
8181

8282
- name: "Upload coverage to Codecov"
8383
uses: codecov/codecov-action@v3

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/.idea
22
node_modules
33
/coverage
4-
/dist
4+
/src/**/*.js
5+
/src/**/*.d.ts

.npmignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
*
2-
!/cjs
3-
!/esm
2+
!/src/**/*.js
3+
!/src/**/*.d.ts

jest.config.ts

-16
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,6 @@ export default {
3030
testEnvironment: 'node',
3131
testMatch: ['<rootDir>/src/**/__tests__/ssr.[jt]s?(x)'],
3232
},
33-
34-
// Needed for output bundle testing
35-
{
36-
displayName: 'dom-package',
37-
transformIgnorePatterns: [],
38-
moduleNameMapper: {
39-
'^((?:\\.{1,2}|#[^\\/]*)/.*)\\.js$': '$1',
40-
'^#root/index.js$': '<rootDir>/index.js',
41-
},
42-
transform: {
43-
'^.+\\.[tj]sx?$': '@swc/jest',
44-
},
45-
testEnvironment: 'jsdom',
46-
testMatch: ['<rootDir>/src/**/__tests__/dom.[jt]s?(x)'],
47-
setupFiles: ['./src/__tests__/setup.ts'],
48-
},
4933
],
5034
collectCoverage: false,
5135
coverageDirectory: './coverage',

package.json

+8-10
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,26 @@
2020
"publishConfig": {
2121
"access": "public"
2222
},
23-
"files": [
24-
"dist"
25-
],
2623
"type": "module",
27-
"main": "./dist/index.js",
28-
"types": "./dist/index.d.ts",
24+
"main": "./src/index.js",
25+
"types": "./src/index.d.ts",
2926
"sideEffects": false,
3027
"imports": {
3128
"#root/*": "./src/*"
3229
},
3330
"exports": {
34-
".": "./dist/index.js",
35-
"./*/": "./dist/*/index.js",
36-
"./*": "./dist/*"
31+
".": "./src/index.js",
32+
"./*/": "./src/*/index.js",
33+
"./*": "./src/*"
3734
},
3835
"engines": {
3936
"node": ">=20.0.0"
4037
},
4138
"scripts": {
4239
"prepare": "husky install",
4340
"commit": "git-cz",
44-
"build": "yarn rimraf ./dist && tsc --version && tsc",
41+
"build": "yarn build:clean && tsc --version && tsc",
42+
"build:clean": "yarn rimraf -g ./src/**/*.js ./src/**/*.d.ts",
4543
"new-hook": "node ./utility/add-new-hook.js",
4644
"test": "jest --selectProjects dom ssr",
4745
"test:coverage": "yarn test --coverage",
@@ -81,7 +79,7 @@
8179
},
8280
"devDependencies": {
8381
"@babel/core": "^7.23.6",
84-
"@commitlint/cli": "^17.7.1",
82+
"@commitlint/cli": "^18.4.3",
8583
"@commitlint/config-conventional": "^18.4.3",
8684
"@commitlint/cz-commitlint": "^18.4.3",
8785
"@jamesacarr/jest-reporter-github-actions": "^0.0.4",

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ export type { EffectCallback, EffectHook } from './util/misc.js';
7676
export { resolveHookState } from './util/resolveHookState.js';
7777

7878
// Types
79-
export * from './types.js';
79+
export type * from './types.js';

tsconfig.json

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"module": "NodeNext",
1010
"moduleResolution": "NodeNext",
1111
"declaration": true,
12-
"outDir": "./dist",
1312
"removeComments": true,
1413
"newLine": "lf",
1514
"forceConsistentCasingInFileNames": true,

0 commit comments

Comments
 (0)