feat: test project
This commit is contained in:
parent
2feffe52cd
commit
2480d41e20
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# node modules
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# build files
|
||||||
|
dist/
|
12
build.js
Normal file
12
build.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// 将当前时间写入dist/index.html
|
||||||
|
console.log('start build');
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const moment = require('moment');
|
||||||
|
const buildTime = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||||
|
const indexPath = path.resolve(__dirname, 'index.html');
|
||||||
|
const distIndexPath = path.resolve(__dirname, 'dist/index.html');
|
||||||
|
const indexContent = fs.readFileSync(indexPath, 'utf-8');
|
||||||
|
const newIndexContent = indexContent.replace(/<span id="build-time">.*<\/span>/, `<span id="build-time">${buildTime}</span>`);
|
||||||
|
fs.writeFileSync(distIndexPath, newIndexContent, 'utf-8');
|
||||||
|
console.log('build success');
|
0
dist/.gitkeep
vendored
Normal file
0
dist/.gitkeep
vendored
Normal file
12
index.html
Normal file
12
index.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
<span id="build-time">Unk Time</span>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
16
package.json
Normal file
16
package.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "ci-publish-test",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"build": "node build.js"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"moment": "^2.30.1"
|
||||||
|
}
|
||||||
|
}
|
22
pnpm-lock.yaml
Normal file
22
pnpm-lock.yaml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
lockfileVersion: '9.0'
|
||||||
|
|
||||||
|
settings:
|
||||||
|
autoInstallPeers: true
|
||||||
|
excludeLinksFromLockfile: false
|
||||||
|
|
||||||
|
importers:
|
||||||
|
|
||||||
|
.:
|
||||||
|
dependencies:
|
||||||
|
moment:
|
||||||
|
specifier: ^2.30.1
|
||||||
|
version: 2.30.1
|
||||||
|
|
||||||
|
packages:
|
||||||
|
|
||||||
|
moment@2.30.1:
|
||||||
|
resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==}
|
||||||
|
|
||||||
|
snapshots:
|
||||||
|
|
||||||
|
moment@2.30.1: {}
|
Loading…
Reference in New Issue
Block a user