diff --git a/.gitignore b/.gitignore deleted file mode 100755 index ea2b251..0000000 --- a/.gitignore +++ /dev/null @@ -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 diff --git a/git-ignore-merge.js b/git-ignore-merge.js new file mode 100644 index 0000000..22738eb --- /dev/null +++ b/git-ignore-merge.js @@ -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/npm/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) + }) diff --git a/git-ignore-merge.sh b/git-ignore-merge.sh new file mode 100755 index 0000000..2562c36 --- /dev/null +++ b/git-ignore-merge.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +echo ::*** Merge remote [.gitignore_global] and local [.gitignore.local.txt] to [.gitignore] +curl -sSL https://git.tic.cc/npm/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/npm/sysconfig/raw/branch/main/git-ignore-merge.sh | bash", \ No newline at end of file diff --git a/link_modules.js b/link_modules.js index fa8b6ae..c087060 100644 --- a/link_modules.js +++ b/link_modules.js @@ -45,10 +45,8 @@ libs.forEach((libName) => { }) /* -script in package.json: - -"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 ../../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; +in package.json: +"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;" */