添加自动映射端口并尝试添加工作流
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"name": "Node.js",
|
"name": "Node.js",
|
||||||
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-18-bullseye",
|
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-18-bullseye",
|
||||||
|
"forwardPorts": [
|
||||||
|
3000
|
||||||
|
],
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"settings": {},
|
"settings": {},
|
||||||
@@ -11,7 +12,6 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"portsAttributes": {
|
"portsAttributes": {
|
||||||
"3000": {
|
"3000": {
|
||||||
"label": "Hello Remote World",
|
"label": "Hello Remote World",
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
# For more details, see https://containers.dev/guide/dependabot
|
|
||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "devcontainers"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: weekly
|
|
||||||
41
.gitea/workflows/lint.yaml
Normal file
41
.gitea/workflows/lint.yaml
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
name: Code Linting
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- develop
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- develop
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
name: Lint JavaScript Code
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Check for syntax errors
|
||||||
|
run: node -c server.js
|
||||||
|
|
||||||
|
- name: Run ESLint (if configured)
|
||||||
|
run: |
|
||||||
|
if [ -f ".eslintrc.json" ] || [ -f ".eslintrc.js" ] || [ -f "eslint.config.js" ]; then
|
||||||
|
npx eslint . --ext .js
|
||||||
|
else
|
||||||
|
echo "ESLint not configured, skipping..."
|
||||||
|
fi
|
||||||
|
continue-on-error: true
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.2 KiB |
14
server.js
14
server.js
@@ -1,12 +1,13 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Mengning Software. 2025. All rights reserved.
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Authors: DevStar Team,
|
||||||
*--------------------------------------------------------------------------------------------*/
|
* Create: 2025-12-09
|
||||||
|
* Description: TODO
|
||||||
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
const PORT = 3000;
|
const PORT = 3000;
|
||||||
@@ -17,8 +18,5 @@ app.get('/', (req, res) => {
|
|||||||
res.send('Hello remote world!\n');
|
res.send('Hello remote world!\n');
|
||||||
});
|
});
|
||||||
|
|
||||||
// 提供 favicon.ico 静态资源
|
|
||||||
app.use('/favicon.ico', express.static(path.join(__dirname, 'favicon.ico')));
|
|
||||||
|
|
||||||
app.listen(PORT, HOST);
|
app.listen(PORT, HOST);
|
||||||
console.log(`Running on http://${HOST}:${PORT}`);
|
console.log(`Running on http://${HOST}:${PORT}`);
|
||||||
Reference in New Issue
Block a user