Skip to content

Commit

Permalink
build: add deps and configurations to improve build/release process
Browse files Browse the repository at this point in the history
  • Loading branch information
platypusrex committed Jan 8, 2022
1 parent abd28d4 commit 7484745
Show file tree
Hide file tree
Showing 9 changed files with 1,879 additions and 504 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
commitlint.config.js
jest.config.js
jest.setup.ts
.eslintrc.js
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit $1
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint:fix
yarn test
4 changes: 4 additions & 0 deletions .versionrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
releaseCommitMessageFormat: 'chore(release): update change logs for {{currentTag}}',
tagPrefix: '@release/',
};
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional']
};
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,31 @@
"test": "tsdx test --coverage",
"lint": "tsdx lint",
"lint:fix": "tsdx lint --fix",
"prepare": "tsdx build"
"prepare": "tsdx build && husky install",
"release": "standard-version"
},
"peerDependencies": {
"next": ">=10.x"
},
"husky": {
"hooks": {
"pre-commit": "tsdx lint"
}
},
"prettier": {
"printWidth": 80,
"semi": true,
"singleQuote": true,
"trailingComma": "es5"
},
"devDependencies": {
"@commitlint/cli": "^16.0.1",
"@commitlint/config-conventional": "^16.0.0",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.1",
"babel-jest": "^26.3.0",
"eslint-config-react-app": "^5.2.1",
"husky": "^4.3.0",
"husky": "^7.0.4",
"jest-fetch-mock": "^3.0.3",
"next": "^10.0.8",
"next": "^12.0.7",
"standard-version": "^9.3.2",
"tsdx": "^0.13.3",
"tslib": "^2.0.1",
"typescript": "^4.0.2"
"typescript": "^4.4.4"
}
}
2 changes: 1 addition & 1 deletion test/mergeProps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('merge props', () => {
);
});

it('should merge static object properties and return a revalidate property if provided by any static function', async () => {
it('should merge static object properties and return a revalidate property if provided', async () => {
fetch.mockResponseOnce(JSON.stringify(sampleUserData));
const getStaticProps = mergeProps(getStaticFooProps, getStaticBarProps);

Expand Down
21 changes: 17 additions & 4 deletions test/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
import { User } from '../next-example/interfaces';
import { PropsResult } from '../src/types';
import { GetServerSideFooProps } from '../next-example/lib/getServerSideFooProps';
import { GetServerSideBarProps } from '../next-example/lib/getServerSideBarProps';
import { GetServerSideUserProps } from '../next-example/lib/getServerSideUserProps';

interface User {
id: number;
name: string;
}

interface GetServerSideUserProps {
users: User[];
}

interface GetServerSideFooProps {
foo: 'foo';
}

interface GetServerSideBarProps {
bar: 'bar';
}

export const getServerSideFooProps = async (): Promise<PropsResult<
GetServerSideFooProps
Expand Down
Loading

0 comments on commit 7484745

Please sign in to comment.