Skip to content

Commit c8b8985

Browse files
authored
feat: auto-open-url
Feat auto open url
2 parents d78ae59 + 55bef5f commit c8b8985

File tree

4 files changed

+34
-8
lines changed

4 files changed

+34
-8
lines changed

.changeset/plenty-spies-dream.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'alita': patch
3+
---
4+
5+
feat: auto open url

packages/alita/package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,16 @@
4343
"alita": "bin/alita.js"
4444
},
4545
"dependencies": {
46-
"@alita/types": "3.1.2",
4746
"@alita/native": "3.4.3",
48-
"@alita/plugins": "3.5.5",
4947
"@alita/plugin-azure": "3.2.3",
50-
"@umijs/core": "4.3.30",
51-
"@umijs/bundler-webpack": "4.3.30",
48+
"@alita/plugins": "3.5.5",
49+
"@alita/types": "3.1.2",
5250
"@umijs/babel-preset-umi": "4.3.30",
51+
"@umijs/bundler-webpack": "4.3.30",
52+
"@umijs/core": "4.3.30",
5353
"@umijs/preset-umi": "4.3.30",
5454
"@umijs/utils": "4.3.30",
55+
"open": "8.4.0",
5556
"umi": "4.3.30"
5657
}
5758
}

packages/alita/src/features/config/alitaconfig.ts

+13
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,17 @@ export default (api: IApi) => {
102102
},
103103
]);
104104
}
105+
106+
// auto open url
107+
api.onDevCompileDone(async ({ isFirstCompile, ws }) => {
108+
const timer = setTimeout(async () => {
109+
if (isFirstCompile) {
110+
const open = require('open');
111+
await open(`http://localhost:${process.env.PORT}`);
112+
}
113+
}, 2000);
114+
ws?.wss.on('connection', async () => {
115+
clearTimeout(timer);
116+
});
117+
});
105118
};

pnpm-lock.yaml

+11-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)