Skip to content

Commit

Permalink
Merge pull request #3 from phshy0607/fix-types
Browse files Browse the repository at this point in the history
Fix types
  • Loading branch information
Hao authored Mar 31, 2022
2 parents 6627bc7 + da95148 commit 291cb1a
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 24 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.

## [0.6.6] - Unreleased

### Fix
- fix `types` is missing in `package.json`
- fix react-frame-component does not provide an export named `default`

### Added
- add `exports` in `package.json`

### Changed
- `start` api will start server

## [0.6.5] - 2022-03-30

### Added
Expand Down
28 changes: 18 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
{
"name": "@blizzbolts/docit",
"version": "0.6.5",
"version": "0.6.6",
"license": "MIT",
"bin": {
"docit": "bin/docit.js"
},
"types": "./build/index.d.ts",
"author": {
"name": "phshy0607",
"email": "[email protected]"
},
"type": "module",
"main": "./build/node/index.js",
"module": "./build/node/index.js",
"type": "module",
"types": "./build/node/index.d.ts",
"exports": {
".": {
"import": "./build/node/index.js",
"types": "./build/node/index.d.ts"
}
},
"scripts": {
"dev": "rm -rf build && run-p dev-node entry-prepare dev-client",
"dev": "rimraf -rf build && run-p dev-node entry-prepare dev-client",
"dev-node": "tsc -w -p src/node",
"dev-client": "tsc -w -p src/client",
"entry-prepare": "node scripts/cpEntryFile.js",
Expand All @@ -21,10 +31,8 @@
"docs": "run-p dev docs-dev",
"docs-dev": "node ./bin/docit start",
"docs-build": "node ./bin/docit build docs",
"clean": "rm -rf node_modules build docs-dist",
"test": "vitest",
"publish:pages": "node scripts/gh.js",
"release": "yarn build && yarn publish && yarn publish:pages"
"release": "yarn build && yarn publish && node scripts/gh.js"
},
"files": [
"build",
Expand All @@ -34,9 +42,6 @@
"scripts",
"docs-dist"
],
"engines": {
"node": ">=14"
},
"devDependencies": {
"@types/fs-extra": "^9.0.13",
"@types/lodash-es": "^4.17.6",
Expand Down Expand Up @@ -97,6 +102,9 @@
"resolutions": {
"react-is": "16.13.1"
},
"engines": {
"node": ">=14"
},
"publishConfig": {
"registry": "https://registry.npmjs.org",
"access": "public"
Expand Down
9 changes: 3 additions & 6 deletions src/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@ let server: ViteDevServer = null;
const bootstrap = () => {
readUserConfigFile(configFilePath).then((userConfig) => {
if (command === "start") {
start(merge({ root }, userConfig))
.then((s) => s.listen())
.then((s) => {
server = s;
s.printUrls();
});
start(merge({ root }, userConfig)).then((s) => {
server = s;
});
}
if (command === "build") {
build(merge({ root }, userConfig));
Expand Down
1 change: 1 addition & 0 deletions src/node/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const docit = async (config: ResolvedUserConfig): Promise<Plugin[]> => {
"react-live",
"core-js",
"highlight.js",
"react-frame-component",
],
},
build: {
Expand Down
19 changes: 12 additions & 7 deletions src/node/start.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { createServer as createViteServer } from 'vite';
import { resolveConfig } from './config.js';
import { UserConfig } from './types.js';
import { docit } from './plugins/index.js';
import { createServer as createViteServer } from "vite";
import { resolveConfig } from "./config.js";
import { UserConfig } from "./types.js";
import { docit } from "./plugins/index.js";

export const start = async (userConfig: UserConfig) => {
const config = await resolveConfig(userConfig, 'start');
const config = await resolveConfig(userConfig, "start");
return createViteServer({
base: '/',
base: "/",
plugins: [await docit(config)],
});
})
.then((s) => s.listen())
.then((s) => {
s.printUrls();
return s;
});
};
2 changes: 1 addition & 1 deletion src/node/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"baseUrl": ".",
"outDir": "../../build/node",
"types": ["node"],
"jsx": "react"
"declaration": true
},
"include": ["."]
}

0 comments on commit 291cb1a

Please sign in to comment.