Skip to content

Commit

Permalink
type: fix master CI fail (#11289)
Browse files Browse the repository at this point in the history
* type: update type

* fix: fix CI fail

* fix
  • Loading branch information
li-jia-nan authored Jun 15, 2023
1 parent 7c1568e commit 8dc8a73
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/plugin-docs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default (api: IApi) => {
});
}
// 放在 docs/xxx.zh-CN.md 的文档,会被映射到 /zh-CN/docs/xxx 目录
if (route.file.match(/.[a-z]{2}-[A-Z]{2}.md$/)) {
if (route.file!.match(/.[a-z]{2}-[A-Z]{2}.md$/)) {
route.path = route.path.replace(/(.*).([a-z]{2}-[A-Z]{2})$/, '$2/$1');

// 放在 docs/xxx/README.zh-CN.md 格式结尾的文档,会被映射到 /zh-CN/docs 目录
Expand All @@ -64,7 +64,7 @@ export default (api: IApi) => {
if (!locales) return r;
for (const route in r) {
if (r[route].path.match(/^[a-z]{2}-[A-Z]{2}\/.*/)) continue;
const defaultLangFile = r[route].file.replace(
const defaultLangFile = r[route].file!.replace(
/(.[a-z]{2}-[A-Z]{2})?.md$/,
'',
);
Expand Down
6 changes: 3 additions & 3 deletions packages/preset-umi/src/features/apiRoute/apiRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ export default (api: IApi) => {
apiRoutes.map((apiRoute) => {
api.writeTmpFile({
noPluginDir: true,
path: join('api', apiRoute.file),
path: join('api', apiRoute.file!),
tplPath: join(TEMPLATES_DIR, 'apiRoute.tpl'),
context: {
adapterPath: winPath(resolve(__dirname, '../apiRoute/index.js')),
apiRootDirPath: winPath(join(api.paths.absTmpPath, 'api')),
handlerPath: winPath(
join(api.paths.absSrcPath, 'api', apiRoute.file),
join(api.paths.absSrcPath, 'api', apiRoute.file!),
),
apiRoutes: JSON.stringify(apiRoutes),
},
Expand Down Expand Up @@ -161,7 +161,7 @@ export default (api: IApi) => {
await require(join(
api.paths.cwd,
OUTPUT_PATH,
matchedApiRoute.route.file,
matchedApiRoute.route.file!,
).replace('.ts', '.js')).default(req, res);

return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { esbuildIgnorePathPrefixPlugin } from '../utils';
// 将 API 路由的临时文件打包为 Umi Dev Server 可以使用的格式
export default async function (api: IApi, apiRoutes: IRoute[]) {
const apiRoutePaths = apiRoutes.map((r) =>
join(api.paths.absTmpPath, 'api', r.file),
join(api.paths.absTmpPath, 'api', r.file!),
);

const ctx = await esbuild.context({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { esbuildIgnorePathPrefixPlugin } from '../utils';
// 将 API 路由的临时文件打包为 Vercel 的 Serverless Function 可以使用的格式
export default async function (api: IApi, apiRoutes: IRoute[]) {
const apiRoutePaths = apiRoutes.map((r) =>
join(api.paths.absTmpPath, 'api', r.file),
join(api.paths.absTmpPath, 'api', r.file!),
);

const pkg = require(join(api.cwd, './package.json'));
Expand Down

1 comment on commit 8dc8a73

@vercel
Copy link

@vercel vercel bot commented on 8dc8a73 Jun 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.