Skip to content

Commit

Permalink
fix(cli-plugin-service): add 'luban' alias to map src/.luban
Browse files Browse the repository at this point in the history
  • Loading branch information
front-end-captain committed Jun 13, 2021
1 parent 4442a09 commit 7715c55
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 13 deletions.
1 change: 1 addition & 0 deletions packages/@luban/cli-plugin-service/src/config/resolve.ts
Expand Up @@ -12,6 +12,7 @@ class Resolve implements ConfigPluginInstance {
.add(api.resolve("node_modules"))
.end()
.alias.set("@", api.resolve("src"))
.set("luban", api.resolve("src/.luban"))
.end();

const aliasKeys = Object.keys(projectConfig.alias);
Expand Down
Expand Up @@ -150,11 +150,6 @@ export interface ExtraPageProps {
}


export interface LayoutProps extends Omit<CustomRendererParams, "rendered"> {
originRouteList: Array<OriginNestedRouteItem>;
children: ReactElement;
}

export interface CustomRenderer {
(params: CustomRendererParams): ReactElement;
}
Expand Down
@@ -1,7 +1,8 @@
import { ReactElement } from "react";
import { RouteComponentProps } from "react-router-dom";
import { StaticContext } from "react-router";
import { Config, Context as _Context } from "./store";
import { OriginRouteConfig, ExtraPageProps } from "./definitions";
import { OriginRouteConfig, ExtraPageProps, CustomRendererParams, OriginNestedRouteItem } from "./definitions";

export interface EnhancedRouteComponentProps<
M extends Record<PropertyKey, unknown> = {},
Expand All @@ -17,6 +18,11 @@ export interface PreparerProps {
initialing: boolean | null;
}

export interface LayoutProps extends Omit<CustomRendererParams, "rendered"> {
originRouteList: Array<OriginNestedRouteItem>;
children: ReactElement;
}

export interface Context extends _Context {}

export function run(config: Config) {
Expand Down
@@ -1,5 +1,5 @@
import React from "react";
import { run } from "@/.luban";
import { run } from "luban";

import { Layout } from "./layout";

Expand Down
@@ -1,4 +1,4 @@
import { LayoutProps } from "@/.luban/definitions";
import { LayoutProps } from "luban/definitions";
import React, { FunctionComponent } from "react";
import { NavLink } from "react-router-dom";

Expand Down
@@ -1,5 +1,5 @@
import React from "react";
import { EnhancedRouteComponentProps } from "@/.luban";
import { EnhancedRouteComponentProps } from "luban";

import { Welcome } from "@/components/Welcome";

Expand Down
@@ -1,5 +1,5 @@
import React from "react";
import { EnhancedRouteComponentProps, Page } from "@/.luban";
import { EnhancedRouteComponentProps, Page } from "luban";

import { Welcome } from "@/components/Welcome";

Expand Down
Expand Up @@ -2,7 +2,7 @@
* DO NOT MOVE THIS FILE ELSEWHERE
*/

import { route } from "@/.luban";
import { route } from "luban";

export default route({
routes: [
Expand Down
@@ -1,5 +1,5 @@
import React from "react";
import { Context as LubanPageContext } from "@/.luban";
import { Context as LubanPageContext } from "luban";

declare module "react" {
export = React;
Expand Down
Expand Up @@ -30,7 +30,9 @@
"esModuleInterop": true,
"moduleResolution": "node",
"paths": {
"@/*": ["src/*"]
"@/*": ["src/*"],
"luban": ["src/.luban/index.ts"],
"luban/*": ["src/.luban/*"],
},

/* Linter Checks */
Expand Down

0 comments on commit 7715c55

Please sign in to comment.