Skip to content

Commit

Permalink
fix: change build so development and distributed imports match
Browse files Browse the repository at this point in the history
  • Loading branch information
xobotyi committed Dec 20, 2023
1 parent 7b861e4 commit 6383cdd
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 292 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ jobs:
- name: "Build"
run: yarn build

- name: "Tests against build"
run: yarn jest --selectProjects dom-package
- name: "Tests against built package"
run: yarn test

test:
name: "Test"
Expand All @@ -77,7 +77,7 @@ jobs:
install-command: yarn --frozen-lockfile

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

- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v3
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.idea
node_modules
/coverage
/dist
/src/**/*.js
/src/**/*.d.ts
4 changes: 2 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
*
!/cjs
!/esm
!/src/**/*.js
!/src/**/*.d.ts
16 changes: 0 additions & 16 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,6 @@ export default {
testEnvironment: 'node',
testMatch: ['<rootDir>/src/**/__tests__/ssr.[jt]s?(x)'],
},

// Needed for output bundle testing
{
displayName: 'dom-package',
transformIgnorePatterns: [],
moduleNameMapper: {
'^((?:\\.{1,2}|#[^\\/]*)/.*)\\.js$': '$1',
'^#root/index.js$': '<rootDir>/index.js',
},
transform: {
'^.+\\.[tj]sx?$': '@swc/jest',
},
testEnvironment: 'jsdom',
testMatch: ['<rootDir>/src/**/__tests__/dom.[jt]s?(x)'],
setupFiles: ['./src/__tests__/setup.ts'],
},
],
collectCoverage: false,
coverageDirectory: './coverage',
Expand Down
18 changes: 8 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,26 @@
"publishConfig": {
"access": "public"
},
"files": [
"dist"
],
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"main": "./src/index.js",
"types": "./src/index.d.ts",
"sideEffects": false,
"imports": {
"#root/*": "./src/*"
},
"exports": {
".": "./dist/index.js",
"./*/": "./dist/*/index.js",
"./*": "./dist/*"
".": "./src/index.js",
"./*/": "./src/*/index.js",
"./*": "./src/*"
},
"engines": {
"node": ">=20.0.0"
},
"scripts": {
"prepare": "husky install",
"commit": "git-cz",
"build": "yarn rimraf ./dist && tsc --version && tsc",
"build": "yarn build:clean && tsc --version && tsc",
"build:clean": "yarn rimraf -g ./src/**/*.js ./src/**/*.d.ts",
"new-hook": "node ./utility/add-new-hook.js",
"test": "jest --selectProjects dom ssr",
"test:coverage": "yarn test --coverage",
Expand Down Expand Up @@ -81,7 +79,7 @@
},
"devDependencies": {
"@babel/core": "^7.23.6",
"@commitlint/cli": "^17.7.1",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@commitlint/cz-commitlint": "^18.4.3",
"@jamesacarr/jest-reporter-github-actions": "^0.0.4",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ export type { EffectCallback, EffectHook } from './util/misc.js';
export { resolveHookState } from './util/resolveHookState.js';

// Types
export * from './types.js';
export type * from './types.js';
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"module": "NodeNext",
"moduleResolution": "NodeNext",
"declaration": true,
"outDir": "./dist",
"removeComments": true,
"newLine": "lf",
"forceConsistentCasingInFileNames": true,
Expand Down

0 comments on commit 6383cdd

Please sign in to comment.