Compare commits
13 Commits
56d203c4f0
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71f48885cd | ||
|
|
cb2576c138 | ||
|
|
f69b349835 | ||
|
|
e93db2d65f | ||
|
|
dcf554806b | ||
|
|
c22b8d6b73 | ||
|
|
a415b53549 | ||
|
|
81a47c5f31 | ||
|
|
4488ae5a5f | ||
|
|
1d11984211 | ||
| 5b36a3ae43 | |||
| 33c3b07254 | |||
| 3a37b24aa4 |
125
.gitignore
vendored
125
.gitignore
vendored
@@ -1,125 +0,0 @@
|
|||||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
||||||
# how to include another gitignore?
|
|
||||||
# https://stackoverflow.com/questions/7005142/can-i-include-other-gitignore-file-in-a-gitignore-file-like-include-in-c-li
|
|
||||||
# https://github.com/github/gitignore
|
|
||||||
# https://github.com/SlideWave/gitignore-include?tab=readme-ov-file#examples
|
|
||||||
# https://gitignore.io
|
|
||||||
|
|
||||||
### .gitignore.global.txt ###
|
|
||||||
|
|
||||||
# Self defined pattern to ignore
|
|
||||||
?*.gitignore
|
|
||||||
?*.gitignore/
|
|
||||||
?*.gitignore.*
|
|
||||||
?*.gitignore.*/
|
|
||||||
*.gitomit
|
|
||||||
*.gitomit.*
|
|
||||||
*.gitomit/
|
|
||||||
*.gitomit.*/
|
|
||||||
*.nogit
|
|
||||||
*.nogit.*
|
|
||||||
*.nogit/
|
|
||||||
*.nogit.*/
|
|
||||||
# 保留
|
|
||||||
!.gitignore
|
|
||||||
!.gitignore.*
|
|
||||||
!.gitkeep
|
|
||||||
|
|
||||||
# 通用
|
|
||||||
.svn/
|
|
||||||
.deploy_git/
|
|
||||||
.idea/
|
|
||||||
.sass-cache/
|
|
||||||
.wrangler/
|
|
||||||
/test/unit/coverage/
|
|
||||||
/test/e2e/reports/
|
|
||||||
node_modules/
|
|
||||||
*.aab
|
|
||||||
*.apk
|
|
||||||
*.ipa
|
|
||||||
*.rar
|
|
||||||
*.tgz
|
|
||||||
*.zip
|
|
||||||
*.min.js
|
|
||||||
*.min.css
|
|
||||||
*.min.html
|
|
||||||
*.iml
|
|
||||||
*.njsproj
|
|
||||||
*.ntvs*
|
|
||||||
*.sw*
|
|
||||||
*.sln
|
|
||||||
*.suo
|
|
||||||
.gitattributes
|
|
||||||
.umi
|
|
||||||
.umi-production
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
yarn.lock
|
|
||||||
selenium-debug.log
|
|
||||||
Thumbs.db
|
|
||||||
thumbs.db
|
|
||||||
_desktop.ini
|
|
||||||
|
|
||||||
# vue-cli 项目
|
|
||||||
/dist/
|
|
||||||
|
|
||||||
# 来自 vue-cli 创建项目的 .gitignore
|
|
||||||
.project
|
|
||||||
|
|
||||||
# hexo
|
|
||||||
/public/
|
|
||||||
|
|
||||||
# Hardhat
|
|
||||||
/artifacts/
|
|
||||||
/cache/
|
|
||||||
|
|
||||||
# seafile 临时文件
|
|
||||||
._*
|
|
||||||
|
|
||||||
.$*
|
|
||||||
|
|
||||||
# office 暂存文件
|
|
||||||
~$*
|
|
||||||
|
|
||||||
# 用户shell配置脚本
|
|
||||||
.bashrc_custom
|
|
||||||
|
|
||||||
# 苹果系统临时文件
|
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
# 安卓缓存文件夹
|
|
||||||
.thumbnails
|
|
||||||
|
|
||||||
# local env files
|
|
||||||
.env.local
|
|
||||||
.env.*.local
|
|
||||||
|
|
||||||
# hexo
|
|
||||||
/db.json
|
|
||||||
|
|
||||||
# wo
|
|
||||||
# 服务端
|
|
||||||
/_archive/*
|
|
||||||
/_datastore/*
|
|
||||||
/_filestore/*
|
|
||||||
/_logstore/*
|
|
||||||
/_webroot/*
|
|
||||||
/_ssl/*
|
|
||||||
# uniapp 客户端
|
|
||||||
/unpackage/*
|
|
||||||
!/unpackage/res/
|
|
||||||
package-lock.json
|
|
||||||
pages4loader.json5
|
|
||||||
|
|
||||||
### .gitignore.local.txt ###
|
|
||||||
|
|
||||||
# 被自动复制的文件:
|
|
||||||
/androidPrivacy.json
|
|
||||||
/App.html
|
|
||||||
/App.theme.scss
|
|
||||||
/cli-pack-config.json
|
|
||||||
/appenv.json
|
|
||||||
/manifest.json
|
|
||||||
/pages.json
|
|
||||||
*/root/tencent*.txt
|
|
||||||
68
env_loc.js
68
env_loc.js
@@ -3,6 +3,7 @@
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
|
const readline = require('readline')
|
||||||
|
|
||||||
const params = process.argv.slice(2)
|
const params = process.argv.slice(2)
|
||||||
|
|
||||||
@@ -28,21 +29,66 @@ const defaultEnv = {
|
|||||||
openShare: fs.existsSync('../../npm') ? path.resolve('../../npm') : fs.existsSync(`${os.homedir()}/opx`) ? path.resolve(`${os.homedir()}/opx`) : '',
|
openShare: fs.existsSync('../../npm') ? path.resolve('../../npm') : fs.existsSync(`${os.homedir()}/opx`) ? path.resolve(`${os.homedir()}/opx`) : '',
|
||||||
}
|
}
|
||||||
|
|
||||||
const localEnv = Object.assign(
|
const paramDefaults = params.reduce((acc, cur) => {
|
||||||
{},
|
|
||||||
params.reduce((acc, cur) => {
|
|
||||||
// 把参数名数组转化为对象
|
// 把参数名数组转化为对象
|
||||||
acc[cur] = ''
|
acc[cur] = ''
|
||||||
return acc
|
return acc
|
||||||
}, {}),
|
}, {})
|
||||||
defaultEnv, // 继承所有默认值
|
|
||||||
fs.existsSync('./env_loc.gitomit.sfomit.json') ? require(path.resolve('./env_loc.gitomit.sfomit.json')) : {}
|
|
||||||
)
|
|
||||||
|
|
||||||
fs.writeFileSync(path.resolve('./env_loc.gitomit.sfomit.json'), JSON.stringify(localEnv, null, 2), 'utf8')
|
const existingEnv = fs.existsSync('./env_loc.gitomit.sfomit.json') ? require(path.resolve('./env_loc.gitomit.sfomit.json')) : {}
|
||||||
|
|
||||||
console.log('\n::*** Configuring local enviroment:')
|
const baseEnv = Object.assign({}, paramDefaults, defaultEnv, existingEnv)
|
||||||
|
|
||||||
console.log(localEnv)
|
const isEmptyValue = (value) => value === '' || value === undefined || value === null
|
||||||
|
|
||||||
module.exports = localEnv
|
const askKeyValues = (keys) =>
|
||||||
|
new Promise((resolve) => {
|
||||||
|
if (!keys.length || !process.stdin.isTTY) {
|
||||||
|
resolve({})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const rl = readline.createInterface({
|
||||||
|
input: process.stdin,
|
||||||
|
output: process.stdout,
|
||||||
|
})
|
||||||
|
const values = {}
|
||||||
|
let index = 0
|
||||||
|
|
||||||
|
const askNext = () => {
|
||||||
|
if (index >= keys.length) {
|
||||||
|
rl.close()
|
||||||
|
resolve(values)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const key = keys[index]
|
||||||
|
rl.question(`Input value for "${key}" (Enter to keep empty): `, (answer) => {
|
||||||
|
values[key] = answer === '' ? '' : answer
|
||||||
|
index += 1
|
||||||
|
askNext()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
askNext()
|
||||||
|
})
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
const keysToPrompt = Object.keys(baseEnv).filter((key) => isEmptyValue(baseEnv[key]))
|
||||||
|
const inputValues = await askKeyValues(keysToPrompt)
|
||||||
|
const localEnv = Object.assign({}, baseEnv, inputValues)
|
||||||
|
|
||||||
|
fs.writeFileSync(path.resolve('./env_loc.gitomit.sfomit.json'), JSON.stringify(localEnv, null, 2), 'utf8')
|
||||||
|
|
||||||
|
console.log('\n::*** Configuring local enviroment:')
|
||||||
|
console.log(localEnv)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (require.main === module) {
|
||||||
|
main().catch((error) => {
|
||||||
|
console.error(error)
|
||||||
|
process.exit(1)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = baseEnv
|
||||||
|
|||||||
26
get_runmode.js
Normal file
26
get_runmode.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// 使用Node.js实现Shell脚本逻辑:获取公网IP并检查是否以.172结尾
|
||||||
|
const { execFileSync } = require('child_process')
|
||||||
|
|
||||||
|
//https.get('https://api.ipify.org', (res) => {
|
||||||
|
// `curl -s https://ifconfig.me` returns the IP address only, but open the url in browser or https.get() returns the HTML content
|
||||||
|
// `https://api.ipify.org` returns the IP address only with curl, browser or nodejs. But it seems it doesn't work in China.
|
||||||
|
|
||||||
|
// https.get 没有同步版本,使用 child_process.execFileSync 同步获取公网 IP
|
||||||
|
let ip
|
||||||
|
try {
|
||||||
|
// 使用 curl 同步请求获取 IP
|
||||||
|
ip = execFileSync('curl', ['-s', 'https://ifconfig.me'], { encoding: 'utf8' }).trim()
|
||||||
|
} catch (e) {
|
||||||
|
// 如果 curl 失败,降级为固定开发环境
|
||||||
|
ip = '0.0.0.0'
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = ip.endsWith('.172') ? 'production' : ip.endsWith('.60') ? 'development' : 'development'
|
||||||
|
|
||||||
|
// 直接导出结果字符串,require 时即可拿到 IP 对应的 env
|
||||||
|
module.exports = result
|
||||||
|
|
||||||
|
// 如果直接运行此文件,则打印结果
|
||||||
|
if (require.main === module) {
|
||||||
|
console.log(result)
|
||||||
|
}
|
||||||
41
gitignore_merge.js
Normal file
41
gitignore_merge.js
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
const https = require('https')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
console.log('\n::*** Merge remote and local gitignore files to .gitignore')
|
||||||
|
|
||||||
|
// 下载远程 .gitignore_global 内容,不保存中间文件
|
||||||
|
const remoteUrl = 'https://git.tic.cc/open/sysconfig/raw/branch/main/nixhome/.gitignore_global'
|
||||||
|
console.log('::--- fetching remote file:', remoteUrl)
|
||||||
|
https
|
||||||
|
.get(remoteUrl, (res) => {
|
||||||
|
if (res.statusCode !== 200) {
|
||||||
|
console.error(`::--- failed to download: status ${res.statusCode}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let globalContent = ''
|
||||||
|
res.setEncoding('utf8')
|
||||||
|
res.on('data', (chunk) => {
|
||||||
|
globalContent += chunk
|
||||||
|
})
|
||||||
|
res.on('end', () => {
|
||||||
|
const gitignoreLocalPath = path.resolve('./.gitignore.local.txt')
|
||||||
|
console.log('::--- merging with local file:', gitignoreLocalPath)
|
||||||
|
|
||||||
|
const gitignorePath = path.resolve('./.gitignore')
|
||||||
|
console.log('::--- into final result:', gitignorePath)
|
||||||
|
|
||||||
|
// 追加本地文件内容(如果存在)
|
||||||
|
let localContent = ''
|
||||||
|
if (fs.existsSync(gitignoreLocalPath)) {
|
||||||
|
localContent = fs.readFileSync(gitignoreLocalPath, 'utf8')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 合并写入 .gitignore
|
||||||
|
fs.writeFileSync(gitignorePath, globalContent + '\n' + localContent)
|
||||||
|
console.log('::--- Merged successfully!')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.on('error', (err) => {
|
||||||
|
console.error('::--- download error:', err.message)
|
||||||
|
})
|
||||||
9
gitignore_merge.sh
Executable file
9
gitignore_merge.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo ::*** Merge remote [.gitignore_global] and local [.gitignore.local.txt] to [.gitignore]
|
||||||
|
curl -sSL https://git.tic.cc/open/sysconfig/raw/branch/main/nixhome/.gitignore_global > .gitignore
|
||||||
|
if [ -f .gitignore.local.txt ]; then cat .gitignore.local.txt >> .gitignore; fi;
|
||||||
|
echo
|
||||||
|
|
||||||
|
# usage in package.json:
|
||||||
|
# "to_merge_gitignore.sh": "curl -sSL https://git.tic.cc/open/sysconfig/raw/branch/main/gitignore_merge.sh | bash",
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
// boot_link.js
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
@@ -46,10 +45,8 @@ libs.forEach((libName) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
script in package.json:
|
in package.json:
|
||||||
|
|
||||||
"boot_link.sh": "echo '::*** Copy local lib to node_modules'; for LIB in $(cd node_modules && ls -d wo_* wo-* tic-crypto 2>&1); do if [ -d ../../npm/$LIB ]; then echo $LIB; ln -f $(realpath ../../npm/$LIB)/*.js ./node_modules/$LIB/; fi; done;"
|
|
||||||
|
|
||||||
echo ::*** Copy local lib to node_modules; for LIB in $(cd node_modules && ls -d wo_* wo-* tic-crypto 2>&1); do if [ -d $(jq -r .openShare env_loc.gitomit.sfomit.json)/$LIB ]; then echo copying $LIB; ln -f $(realpath $(jq -r .openShare env_loc.gitomit.sfomit.json))/$LIB/*.js ./node_modules/$LIB/; fi; done;
|
|
||||||
|
|
||||||
|
"to_link_modules": "node node_modules/wo_scripts/link_modules.js",
|
||||||
|
"to_link_modules.sh": "echo ::*** Copy local lib to node_modules; for LIB in $(cd node_modules && ls -d wo_* wo-* tic-crypto 2>&1); do if [ -d $(jq -r .openShare env_loc.gitomit.sfomit.json)/$LIB ]; then echo Copying $LIB; ln -f $(realpath $(jq -r .openShare env_loc.gitomit.sfomit.json))/$LIB/*.js ./node_modules/$LIB/; fi; done;"
|
||||||
*/
|
*/
|
||||||
@@ -3,12 +3,9 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "app_versioning.js",
|
"main": "app_versioning.js",
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.faronear.org/npm/wo_scripts"
|
"url": "https://git.tic.cc/open/wo_scripts"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
@@ -17,5 +14,8 @@
|
|||||||
"readline-sync": "^1.4.10",
|
"readline-sync": "^1.4.10",
|
||||||
"shelljs": "^0.8.5",
|
"shelljs": "^0.8.5",
|
||||||
"shx": "^0.3.4"
|
"shx": "^0.3.4"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
84
seafile-ignore.txt
Normal file
84
seafile-ignore.txt
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
# https://help.seafile.com/syncing_client/excluding_files/
|
||||||
|
# 注释。通配符:* 匹配0到若干个字符,包括代表目录的/。? 匹配1个字符,包括/。
|
||||||
|
# seafile-ignore.txt 只能控制在客户端需要忽略哪些文件。你依然可以在 seahub 的 web 界面创建这些被客户端忽略的文件。
|
||||||
|
# 在这种情况下,
|
||||||
|
# 这些文件会被同步到客户端,但是用户在客户端对这些文件的后续修改会被忽略,不会被同步回服务器。
|
||||||
|
# 文件在服务器端的后续更改会被同步到客户端,如果客户端也同时修改了这些文件,系统会生成冲突文件。
|
||||||
|
# seafile-ignore.txt 只能忽略还没有被同步的文件。对于已经被同步的文件,如果后来把它添加到 seafile-ignore.txt 中,系统只会忽略后续更改,已经上传的版本不会受影响。
|
||||||
|
|
||||||
|
### seafile-ignore.global.txt ###
|
||||||
|
|
||||||
|
# 自定义的后缀名,凡有 sfignore 后缀的都不进行同步
|
||||||
|
*.sfignore
|
||||||
|
*.sfignore/
|
||||||
|
*.sfignore.*
|
||||||
|
*.sfignore.*/
|
||||||
|
*.sfomit
|
||||||
|
*.sfomit.*
|
||||||
|
*.sfomit/
|
||||||
|
*.sfomit.*/
|
||||||
|
*.nosf
|
||||||
|
*.nosf.*
|
||||||
|
*.nosf/
|
||||||
|
*.nosf.*/
|
||||||
|
|
||||||
|
## everything 'git pull or fetch' will update `.git/FETCH_HEAD`, even if the content doesn't change. To avoid too many useless updates of this file in Seafile history:
|
||||||
|
FETCH_HEAD
|
||||||
|
*/FETCH_HEAD
|
||||||
|
|
||||||
|
.Trash/
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
*/.DS_Store
|
||||||
|
|
||||||
|
.thumbnails
|
||||||
|
*/.thumbnails
|
||||||
|
|
||||||
|
Thumbs.db
|
||||||
|
*/Thumbs.db
|
||||||
|
thumbs.db
|
||||||
|
*/thumbs.db
|
||||||
|
|
||||||
|
_desktop.ini
|
||||||
|
*/_desktop.ini
|
||||||
|
|
||||||
|
._*
|
||||||
|
*/._*
|
||||||
|
|
||||||
|
.$*
|
||||||
|
*/.$*
|
||||||
|
|
||||||
|
~$*
|
||||||
|
*/~$*
|
||||||
|
|
||||||
|
node_modules/
|
||||||
|
*/node_modules/
|
||||||
|
package-lock.json
|
||||||
|
*/package-lock.json
|
||||||
|
|
||||||
|
pages4loader.json5
|
||||||
|
*/pages4loader.json5
|
||||||
|
|
||||||
|
.deploy_git/
|
||||||
|
*/.deploy_git/
|
||||||
|
|
||||||
|
# next.js 项目
|
||||||
|
.next/
|
||||||
|
*/.next/
|
||||||
|
|
||||||
|
# HBuilder 目录
|
||||||
|
unpackage/
|
||||||
|
*/unpackage/
|
||||||
|
|
||||||
|
Icon
|
||||||
|
OneDrive/Icon
|
||||||
|
|
||||||
|
# wrangler project
|
||||||
|
|
||||||
|
.dev.vars*
|
||||||
|
*/.dev.vars*
|
||||||
|
.wrangler/
|
||||||
|
*/.wrangler/
|
||||||
|
|
||||||
|
### seafile-ignore.local.txt ###
|
||||||
|
|
||||||
Reference in New Issue
Block a user