Skip to content

Commit da342ca

Browse files
committed
feat: add open URL option for dev server configuration
1 parent 592255a commit da342ca

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ ACTIONS_URL := https://github.com/xdan/jodit/actions/
3232
BUILD_DTS := true
3333
BUILD_ESM := true
3434
UGLIFY_ESM := false
35+
OPEN_URL := ''
3536
LINT_FOLDERS := ./src/ ./test/ ./tools
3637
CHANGELOG_URL := https://github.com/xdan/jodit/blob/main/CHANGELOG.md
3738
NODE_MODULES_BIN := ./node_modules/.bin
@@ -62,6 +63,7 @@ start dev love:
6263
--env excludePlugins=$(excludePlugins) \
6364
--env isTest=$(isTest) \
6465
--env useSWC=$(useSWC) \
66+
--env open=$(OPEN_URL) \
6567
--env fat=$(fat)
6668

6769
.PHONY: build

tools/dev-server/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
import type { Variables } from '../variables';
88

99
import * as path from 'path';
10-
import type { Configuration, Middleware } from 'webpack-dev-server';
10+
import type { Configuration } from 'webpack-dev-server';
1111

12-
export const devServer = ({ port, dirname }: Variables): Configuration => ({
13-
open: '/stand.html',
12+
export const devServer = ({
13+
port,
14+
dirname,
15+
open
16+
}: Variables): Configuration => ({
17+
open: open ? open : '/stand.html',
1418
allowedHosts: 'all',
1519
client: {
1620
progress: true,

tools/variables.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export type Argv = {
3030
es?: ES_TARGET;
3131
outputFolder?: string;
3232
progressFunction?: () => void;
33+
open?: string;
3334
};
3435

3536
export type Variables = {
@@ -71,6 +72,9 @@ export type Variables = {
7172
fat: boolean;
7273
port: number;
7374
useSWC: boolean;
75+
76+
// Open page after start dev server
77+
open?: string;
7478
};
7579

7680
export const variables = (argv: Argv, dir: string): Variables => {
@@ -146,6 +150,7 @@ export const variables = (argv: Argv, dir: string): Variables => {
146150
ES,
147151
ESModern,
148152
ESNext,
149-
useSWC: argv.useSWC ? Bool(argv.useSWC) : !Bool(argv.generateTypes)
153+
useSWC: argv.useSWC ? Bool(argv.useSWC) : !Bool(argv.generateTypes),
154+
open: argv.open
150155
};
151156
};

0 commit comments

Comments
 (0)