Skip to content

Commit

Permalink
feat: 使用 haoma compile 构建
Browse files Browse the repository at this point in the history
  • Loading branch information
fjc0k committed Mar 16, 2021
1 parent 5b9d127 commit 41cb7c6
Show file tree
Hide file tree
Showing 7 changed files with 2,990 additions and 407 deletions.
21 changes: 21 additions & 0 deletions haoma-compile.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { getCompileConfig } from 'haoma'

export default [
getCompileConfig({
name: 'esm',
inputFiles: ['src/**/*.ts'],
module: 'esm',
target: file => (/helpers/.test(file) ? 'browser' : 'node'),
outDir: 'lib/esm',
rollupDts: true,
rollupDtsFiles: ['**/index.d.ts'],
}),
getCompileConfig({
name: 'cjs',
inputFiles: ['src/**/*.ts'],
module: 'cjs',
target: file => (/helpers/.test(file) ? 'browser' : 'node'),
outDir: 'lib/cjs',
emitDts: false,
}),
]
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"lib"
],
"scripts": {
"build": "shx rm -rf ./lib && tsc -P tsconfig.esm.json && tsc -P tsconfig.cjs.json",
"build": "haoma compile",
"docs": "typedoc --out docs --theme minimal --mode file src/types.ts && gh-pages --dist docs --dest v3",
"release": "yarn testOnly && standard-version -a && yarn build && git push --follow-tags origin master && yarn docs && npm publish",
"releaseBeta": "yarn testOnly && standard-version -a --release-as patch --prerelease beta && yarn build && git push --follow-tags origin master && npm publish --tag next",
Expand All @@ -55,6 +55,7 @@
]
},
"dependencies": {
"@babel/runtime": "^7.13.10",
"@types/json-schema": "^7.0.1",
"change-case": "^3.0.2",
"consola": "^2.3.0",
Expand All @@ -73,9 +74,8 @@
"swagger-client": "^3.12.0",
"to-json-schema": "^0.2.5",
"ts-node": "^8.0.2",
"tslib": "^2.0.0",
"typescript": "^3.9.7",
"vtils": "^3.32.1"
"typescript": "^4.2.3",
"vtils": "^4.33.0"
},
"devDependencies": {
"@types/fs-extra": "^5.0.4",
Expand All @@ -90,7 +90,7 @@
"codecov": "^3",
"eslint": "^7",
"gh-pages": "^2.0.1",
"haoma": "^2.3.0",
"haoma": "^2.28.0",
"husky": "^4",
"jest": "^26",
"lint-staged": "^10",
Expand Down
2 changes: 1 addition & 1 deletion src/SwaggerToYApiServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class SwaggerToYApiServer {
async start(): Promise<string> {
const yapiData = await this.getYApiData()
// eslint-disable-next-line no-async-promise-executor
await new Promise(async resolve => {
await new Promise<void>(async resolve => {
this.httpServer = http
.createServer(async (req, res) => {
const { pathname } = url.parse(req.url || '')
Expand Down
4 changes: 2 additions & 2 deletions tests/Generator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'path'
import tempy from 'tempy'
import { forOwn } from 'vtils'
import { Generator } from '../src/Generator'
import { OneOrMany } from 'vtils/types'
import { OneOrMore } from 'vtils/types'
import { ServerConfig } from '../src'

afterEach(() => {
Expand All @@ -20,7 +20,7 @@ const generatorFactory = ({
onlyMatchPath,
noUpdateTimeComment,
}: {
id: OneOrMany<0 | 82 | 87 | 151 | -82 | -87 | -151>
id: OneOrMore<0 | 82 | 87 | 151 | -82 | -87 | -151>
typesOnly?: boolean
enableReactHooks?: boolean
target?: ServerConfig['target']
Expand Down
7 changes: 0 additions & 7 deletions tsconfig.cjs.json

This file was deleted.

8 changes: 0 additions & 8 deletions tsconfig.esm.json

This file was deleted.

Loading

0 comments on commit 41cb7c6

Please sign in to comment.