Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(scripts&webconsole): 需求,webconsole打开支持不带后缀的页面url #84

Merged
merged 1 commit into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/rocketact-scripts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rocketact-scripts",
"version": "1.10.4",
"version": "1.10.5",
"description": "",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -60,7 +60,7 @@
"postcss-loader": "^3.0.0",
"progress-bar-webpack-plugin": "^1.11.0",
"rocketact-dev-utils": "^1.1.4",
"rocketact-web-console": "^1.1.8",
"rocketact-web-console": "^1.1.11",
"sass-loader": "^7.1.0",
"semver": "^6.0.0",
"style-loader": "^0.23.1",
Expand Down
14 changes: 12 additions & 2 deletions packages/rocketact-scripts/src/commands/start.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import path from "path";
import fs from "fs";
import webpack from "webpack";
import WebpackDevServer from "webpack-dev-server";
Expand All @@ -13,6 +12,8 @@ import {
warningBlock,
warning,
resolveToAppRoot,
getValidEntries,
appRoot
} from "rocketact-dev-utils";

import CoreAPI from "../CoreAPI";
Expand All @@ -27,14 +28,22 @@ export default (api: CoreAPI) => {
process.env.NODE_ENV = "development";
process.env.PUBLIC_URL = "";

const validEntries = getValidEntries(appRoot());
const validEntryRewrites = Object.keys(validEntries).map(item => {
return {
from: new RegExp(`${item}`),
to: `/${item}.html`
}
});

return new Promise((resolve, reject) => {
const webpackConfig = api.resolveWebpackConfig();
const devServerOptions: WebpackDevServer.Configuration = {
disableHostCheck: true,
overlay: true,
hot: true,
host: "127.0.0.1",
https: process.env.HTTPS ? true : false,
https: !!process.env.HTTPS,
publicPath: "/",
contentBase:
fs.existsSync(publicDir) &&
Expand All @@ -49,6 +58,7 @@ export default (api: CoreAPI) => {
},
historyApiFallback: {
rewrites: [
...validEntryRewrites,
{
from: /^(\/[^/]*\.html)\/.*$/,
to: (context) => context.match[1],
Expand Down
4 changes: 2 additions & 2 deletions packages/rocketact-web-console/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "rocketact-web-console",
"version": "1.1.10",
"version": "1.1.11",
"description": "Rocketact Web Console",
"main": "index.js",
"keywords": [
"rocketact"
],
"scripts": {
"build": "tsc --project tsconfig-server.json; webpack",
"build": "tsc --project tsconfig-server.json & webpack",
"watch": "tsc --project tsconfig-server.json --watch & webpack --watch",
"watch:client": "webpack --watch",
"watch:server": "tsc --project tsconfig-server.json --watch",
Expand Down
13 changes: 11 additions & 2 deletions packages/rocketact-web-console/src/client/routes/pages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";

import * as API from "../api";

import { Table } from "antd";
import { Table, Tooltip } from "antd";

interface IPage {
name: string;
Expand Down Expand Up @@ -31,7 +31,16 @@ class Pages extends React.PureComponent<{}, IPagesState> {
{
title: "Name",
dataIndex: "name",
key: "name"
key: "name",
render: (text: any, record: IPage) => (
<span>
<Tooltip title={"Open with url without *.html as a suffix"}>
<a href={`/${record.name}`} target="_blank">
{record.name}
</a>
</Tooltip>
</span>
)
},
{
title: "Title",
Expand Down