Skip to content

Commit

Permalink
feat: auto-open-url
Browse files Browse the repository at this point in the history
Feat auto open url
  • Loading branch information
xiaohuoni authored Jan 8, 2025
2 parents d78ae59 + 55bef5f commit c8b8985
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/plenty-spies-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'alita': patch
---

feat: auto open url
9 changes: 5 additions & 4 deletions packages/alita/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,16 @@
"alita": "bin/alita.js"
},
"dependencies": {
"@alita/types": "3.1.2",
"@alita/native": "3.4.3",
"@alita/plugins": "3.5.5",
"@alita/plugin-azure": "3.2.3",
"@umijs/core": "4.3.30",
"@umijs/bundler-webpack": "4.3.30",
"@alita/plugins": "3.5.5",
"@alita/types": "3.1.2",
"@umijs/babel-preset-umi": "4.3.30",
"@umijs/bundler-webpack": "4.3.30",
"@umijs/core": "4.3.30",
"@umijs/preset-umi": "4.3.30",
"@umijs/utils": "4.3.30",
"open": "8.4.0",
"umi": "4.3.30"
}
}
13 changes: 13 additions & 0 deletions packages/alita/src/features/config/alitaconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,17 @@ export default (api: IApi) => {
},
]);
}

// auto open url
api.onDevCompileDone(async ({ isFirstCompile, ws }) => {
const timer = setTimeout(async () => {
if (isFirstCompile) {
const open = require('open');
await open(`http://localhost:${process.env.PORT}`);
}
}, 2000);
ws?.wss.on('connection', async () => {
clearTimeout(timer);
});
});
};
15 changes: 11 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c8b8985

Please sign in to comment.