This commit is contained in:
熊潇 2025-02-27 00:08:22 +08:00
parent 9eb68a69d7
commit 65ee66d6b4
7 changed files with 56 additions and 36 deletions

2
.npmrc Normal file
View File

@ -0,0 +1,2 @@
//npm.xiongxiao.me/:_authToken=${ME_NPM_TOKEN}
//registry.npmjs.org/:_authToken=${NPM_TOKEN}

View File

@ -1,20 +1,24 @@
{
"name": "router",
"name": "demo-app",
"version": "0.0.1",
"description": "",
"main": "index.js",
"app": {
"key": "demo-app",
"entry": "dist/app.mjs",
"type": "system-app",
"files": [
"dist"
]
},
"scripts": {
"watch": "rollup -c rollup.config.mjs -w",
"dev": "cross-env NODE_ENV=development nodemon --delay 2.5 -e js,cjs,mjs --exec node dist/app.mjs",
"test": "tsx test/**/*.ts",
"dev:watch": "cross-env NODE_ENV=development concurrently -n \"Watch,Dev\" -c \"green,blue\" \"npm run watch\" \"sleep 1 && npm run dev\" ",
"build": "rimraf dist && rollup -c rollup.config.mjs",
"deploy": "rsync -avz --delete ./dist/ --exclude='app.config.json5' light:~/apps/router/dist",
"clean": "rm -rf dist",
"reload": "ssh light pm2 restart router",
"pub": "npm run build && npm run deploy && npm run reload",
"deploy:nova": "rsync -avz --delete ./dist/ --exclude='app.config.json5' nova:~/apps/router/dist",
"start": "pm2 start dist/app.mjs --name router"
"prepub": "envision switch root",
"pub": "npm run build && envision pack -p -u"
},
"keywords": [],
"author": "abearxiong <xiongxiao@xiongxiao.me>",
@ -27,14 +31,15 @@
"src"
],
"dependencies": {
"@kevisual/router": "^0.0.6-alpha-5",
"@kevisual/router": "^0.0.7",
"dayjs": "^1.11.13",
"formidable": "^3.5.2",
"json5": "^2.2.3",
"lodash-es": "^4.17.21"
},
"devDependencies": {
"@kevisual/use-config": "^1.0.7",
"@kevisual/types": "^0.0.6",
"@kevisual/use-config": "^1.0.8",
"@rollup/plugin-alias": "^5.1.1",
"@rollup/plugin-commonjs": "^28.0.2",
"@rollup/plugin-json": "^6.1.0",
@ -44,7 +49,7 @@
"@types/crypto-js": "^4.2.2",
"@types/formidable": "^3.4.5",
"@types/lodash-es": "^4.17.12",
"@types/node": "^22.13.4",
"@types/node": "^22.13.5",
"concurrently": "^9.1.2",
"cross-env": "^7.0.3",
"nodemon": "^3.1.9",

46
pnpm-lock.yaml generated
View File

@ -9,8 +9,8 @@ importers:
.:
dependencies:
'@kevisual/router':
specifier: ^0.0.6-alpha-5
version: 0.0.6-alpha-5
specifier: ^0.0.7
version: 0.0.7
dayjs:
specifier: ^1.11.13
version: 1.11.13
@ -24,9 +24,12 @@ importers:
specifier: ^4.17.21
version: 4.17.21
devDependencies:
'@kevisual/types':
specifier: ^0.0.6
version: 0.0.6
'@kevisual/use-config':
specifier: ^1.0.7
version: 1.0.7
specifier: ^1.0.8
version: 1.0.8
'@rollup/plugin-alias':
specifier: ^5.1.1
version: 5.1.1(rollup@4.34.8)
@ -55,8 +58,8 @@ importers:
specifier: ^4.17.12
version: 4.17.12
'@types/node':
specifier: ^22.13.4
version: 22.13.4
specifier: ^22.13.5
version: 22.13.5
concurrently:
specifier: ^9.1.2
version: 9.1.2
@ -261,11 +264,14 @@ packages:
'@jridgewell/sourcemap-codec@1.5.0':
resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==}
'@kevisual/router@0.0.6-alpha-5':
resolution: {integrity: sha512-YT9cxzzFKjWyE05MYlvhuAp16ymgmwThSMHrr2PNbmnZiYgUqm3O4j8cny40lOhZB4Jy/4nQb9Ql2laL+mZ4zg==}
'@kevisual/router@0.0.7':
resolution: {integrity: sha512-4n1Tp4YLoraJv7jtfy7jbuLGyAj0B2QkTlnlEDHCUTlEUOvOkjtf7DHAe2SL92fTgXhSbod0I/0vUcDF85oj/w==}
'@kevisual/use-config@1.0.7':
resolution: {integrity: sha512-2W1iXdiypugQVgjAz8AGWDVUIcBtegdzLV0FPKq1Rm065yB1EWcI0u0d6qFaAw1RWqtT8o0GT3sR3tzg7nWdjA==}
'@kevisual/types@0.0.6':
resolution: {integrity: sha512-7yxe1QmuC5g7lI/1Hm+zXly8if0z+ZqGM1SVOVv2VNRwRAVYBJDc365zWCCfRwE+5YaB2daWTe5zBOU4EkltkQ==}
'@kevisual/use-config@1.0.8':
resolution: {integrity: sha512-eobq7Ex61dV7k9buKIaBffoUgBwWSZu4/LBlAVS611spVqugQDrl8fx/F3tG3obNjKtMSNRkwrn78L9SIEuFJA==}
'@ljharb/resumer@0.1.3':
resolution: {integrity: sha512-d+tsDgfkj9X5QTriqM4lKesCkMMJC3IrbPKHvayP00ELx2axdXvDfWkqjxrLXIzGcQzmj7VAUT1wopqARTvafw==}
@ -493,8 +499,8 @@ packages:
'@types/node-forge@1.3.11':
resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==}
'@types/node@22.13.4':
resolution: {integrity: sha512-ywP2X0DYtX3y08eFVx5fNIw7/uIv8hYUKgXoK8oayJlLnKcRfEYCxWMVE1XagUdVtCJlZT1AU4LXEABW+L1Peg==}
'@types/node@22.13.5':
resolution: {integrity: sha512-+lTU0PxZXn0Dr1NBtC7Y8cR21AJr87dLLU953CWA6pMxxv/UDc7jYAY90upcrie1nRcD6XNG5HOYEDtgW5TxAg==}
'@types/resolve@1.20.2':
resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==}
@ -1930,7 +1936,7 @@ snapshots:
'@jridgewell/sourcemap-codec@1.5.0': {}
'@kevisual/router@0.0.6-alpha-5':
'@kevisual/router@0.0.7':
dependencies:
path-to-regexp: 8.2.0
selfsigned: 2.4.1
@ -1939,7 +1945,9 @@ snapshots:
- bufferutil
- utf-8-validate
'@kevisual/use-config@1.0.7': {}
'@kevisual/types@0.0.6': {}
'@kevisual/use-config@1.0.8': {}
'@ljharb/resumer@0.1.3':
dependencies:
@ -2134,16 +2142,16 @@ snapshots:
'@types/formidable@3.4.5':
dependencies:
'@types/node': 22.13.4
'@types/node': 22.13.5
'@types/fs-extra@8.1.5':
dependencies:
'@types/node': 22.13.4
'@types/node': 22.13.5
'@types/glob@7.2.0':
dependencies:
'@types/minimatch': 5.1.2
'@types/node': 22.13.4
'@types/node': 22.13.5
'@types/lodash-es@4.17.12':
dependencies:
@ -2155,9 +2163,9 @@ snapshots:
'@types/node-forge@1.3.11':
dependencies:
'@types/node': 22.13.4
'@types/node': 22.13.5
'@types/node@22.13.4':
'@types/node@22.13.5':
dependencies:
undici-types: 6.20.0

View File

@ -8,11 +8,12 @@ import replace from '@rollup/plugin-replace';
import pkgs from './package.json' with {type: 'json'};
const isDev = process.env.NODE_ENV === 'development';
const input = isDev ? './src/dev.ts' : './src/index.ts';
/**
* @type {import('rollup').RollupOptions}
*/
const config = {
input: './src/index.ts',
input,
output: {
dir: './dist',
entryFileNames: 'app.mjs',

8
src/dev.ts Normal file
View File

@ -0,0 +1,8 @@
import { useConfig } from '@kevisual/use-config';
import { app } from './index.ts';
const config = useConfig();
app.listen(config.port, () => {
console.log(`server is running at http://localhost:${config.port}`);
});

View File

@ -1,8 +1,4 @@
import { app } from './app.ts';
import { useConfig } from '@kevisual/use-config';
import './demo-route.ts';
const config = useConfig();
app.listen(config.port, () => {
console.log(`server is running at http://localhost:${config.port}`);
});
export { app };

View File

@ -10,7 +10,7 @@
"baseUrl": "./",
"typeRoots": [
"node_modules/@types",
"node_modules/@kevisual/type"
"node_modules/@kevisual/types"
],
"declaration": true,
"noEmit": false,