@yarn-tool/static-file 3.0.16 → 3.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/file/env +5 -0
- package/file/github/workflows/build-pnpm.yml +71 -0
- package/file/github/workflows/{build.yml → build-yarn.yml} +4 -4
- package/file/gitignore +7 -0
- package/file/lerna.json.tpl +1 -2
- package/file/pnpm-workspace.yaml +11 -11
- package/file/test/__root.js.map +1 -0
- package/file/test/temp.js.map +1 -0
- package/file/test/tsconfig.json.tpl +9 -2
- package/file/tsconfig.json.tpl +5 -1
- package/file/tsconfig.tsdx.json.tpl +5 -1
- package/file/tsdx/index.cjs.map +1 -0
- package/file/ws-root/__root_ws.js.map +1 -0
- package/lib/const.d.ts +3 -3
- package/lib/const.js +26 -23
- package/lib/const.js.map +1 -1
- package/package.json +7 -7
- package/file/changelog-option.js +0 -12
- package/file/jest.config.auto.js +0 -207
- package/file/jest.config.js +0 -205
- package/file/test/__root.ts +0 -47
- package/file/test/fixtures/.gitkeep +0 -0
- package/file/test/temp.ts +0 -2
- package/file/tsc-multi.json.tpl +0 -6
- package/file/tsconfig.esm.json.tpl +0 -10
- package/file/tsconfig.json +0 -5
- package/file/tsdx.config.js +0 -14
- package/file/ws-root/__root_ws.ts +0 -5
- package/file/ws-root/jest.config.js +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,42 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.0.17](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/static-file@3.0.16...@yarn-tool/static-file@3.0.17) (2026-09-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### 📦 Code Refactoring
|
|
11
|
+
|
|
12
|
+
* **@yarn-tool/static-file:** 優化模板檔案結構與配置管理 ([4dee77b](https://github.com/bluelovers/ws-yarn-workspaces/commit/4dee77bb027f49b987e689486d828e924492ed99))
|
|
13
|
+
* **@yarn-tool/static-file:** 移除舊版 jest 配置並修正 preset 路徑 ([92c97af](https://github.com/bluelovers/ws-yarn-workspaces/commit/92c97afcf90efacb50ccc81948c727716bd46ef5))
|
|
14
|
+
* **tools:** 優化各工具套件的實作細節與測試邏輯 ([f1f02f2](https://github.com/bluelovers/ws-yarn-workspaces/commit/f1f02f2319e9b5f7383e4001c7c67c60e8aae01a))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### 🛠 Build System
|
|
18
|
+
|
|
19
|
+
* update Static Files ([b2f5d72](https://github.com/bluelovers/ws-yarn-workspaces/commit/b2f5d7216773c53eb35f267ba34f8788543d46a1))
|
|
20
|
+
* **monorepo:** 優化靜態檔案範本與腳本指令 ([3ec7521](https://github.com/bluelovers/ws-yarn-workspaces/commit/3ec7521f4deb6625c4a567dc6885300e92c2a7ed))
|
|
21
|
+
* **static-file:** 在 tsconfig 範本中新增 jest 與 node 型別定義 ([774e55e](https://github.com/bluelovers/ws-yarn-workspaces/commit/774e55e092e07ec2bf72224797e1fe7b6b8a9ddc))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### ⚙️ Continuous Integration
|
|
25
|
+
|
|
26
|
+
* **workflow:** 新增 pnpm 工作流程並重構 GitHub Actions 配置 ([82e781d](https://github.com/bluelovers/ws-yarn-workspaces/commit/82e781dd53007bff5e3d693bb650a483a8b9c48c))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### ♻️ Chores
|
|
30
|
+
|
|
31
|
+
* **@yarn-tool/static-file:** 註解掉 pnpm-workspace 中的 publicHoistPattern 配置 ([49a2905](https://github.com/bluelovers/ws-yarn-workspaces/commit/49a290584df520d00fa55589a4518042b7748d32))
|
|
32
|
+
* **workspace:** 將所有套件的指令從 yarn 改為 pnpm 並更新依賴版本 ([0505892](https://github.com/bluelovers/ws-yarn-workspaces/commit/0505892e5e7c356f8cf59495fefda1aa681499c6))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### 🔖 Miscellaneous
|
|
36
|
+
|
|
37
|
+
* . ([b545589](https://github.com/bluelovers/ws-yarn-workspaces/commit/b54558925d67304019e2b4f9bb3c4671c429a96e))
|
|
38
|
+
* . ([50c995f](https://github.com/bluelovers/ws-yarn-workspaces/commit/50c995f7f5c8640fde49bc6c71e987a7bd01ece4))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
6
42
|
## [3.0.16](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/static-file@3.0.15...@yarn-tool/static-file@3.0.16) (2026-04-26)
|
|
7
43
|
|
|
8
44
|
|
package/file/env
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
name: build-pnpm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- master
|
|
8
|
+
- main
|
|
9
|
+
paths-ignore:
|
|
10
|
+
- 'test/**'
|
|
11
|
+
- '.run/**'
|
|
12
|
+
- '.github/**'
|
|
13
|
+
- '/*.*'
|
|
14
|
+
- '/.*'
|
|
15
|
+
# schedule:
|
|
16
|
+
## https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#scheduled-events-schedule
|
|
17
|
+
## ┌───────────── minute (0 - 59)
|
|
18
|
+
## │ ┌───────────── hour (0 - 23)
|
|
19
|
+
## │ │ ┌───────────── day of the month (1 - 31)
|
|
20
|
+
## │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
|
|
21
|
+
## │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
|
|
22
|
+
## │ │ │ │ │
|
|
23
|
+
## │ │ │ │ │
|
|
24
|
+
## │ │ │ │ │
|
|
25
|
+
## * * * * *
|
|
26
|
+
# - cron: '* * 1 * *'
|
|
27
|
+
# - cron: '* * 15 * *'
|
|
28
|
+
|
|
29
|
+
jobs:
|
|
30
|
+
build:
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
|
33
|
+
|
|
34
|
+
strategy:
|
|
35
|
+
matrix:
|
|
36
|
+
node-version: [ 26 ]
|
|
37
|
+
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@main
|
|
40
|
+
with:
|
|
41
|
+
fetch-depth: 2
|
|
42
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
43
|
+
- name: Set up Node.js ${{ matrix.node-version }} + pnpm
|
|
44
|
+
uses: pnpm/setup@v1
|
|
45
|
+
with:
|
|
46
|
+
version: next-12
|
|
47
|
+
runtime: node@${{ matrix.node-version }}
|
|
48
|
+
cache: true
|
|
49
|
+
- name: set cache id
|
|
50
|
+
id: id-cache
|
|
51
|
+
run: echo "::set-output name=id::${GITHUB_SHA}"
|
|
52
|
+
- name: echo var
|
|
53
|
+
run: |
|
|
54
|
+
echo ${{ steps.id-cache.outputs.id }}
|
|
55
|
+
echo ${GITHUB_SHA}
|
|
56
|
+
- name: setup git config
|
|
57
|
+
run: |
|
|
58
|
+
git config --local user.email "action@github.com"
|
|
59
|
+
git config --local user.name "GitHub Action"
|
|
60
|
+
- name: install deps
|
|
61
|
+
run: |
|
|
62
|
+
pnpm install --frozen-lockfile
|
|
63
|
+
pnpm run ci:install
|
|
64
|
+
- name: run script
|
|
65
|
+
if: success()
|
|
66
|
+
run: pnpm run ci:build
|
|
67
|
+
- name: Push changes
|
|
68
|
+
if: success()
|
|
69
|
+
uses: ad-m/github-push-action@master
|
|
70
|
+
with:
|
|
71
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
name: build
|
|
1
|
+
name: build-yarn
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
workflow_dispatch:
|
|
@@ -30,11 +30,11 @@ jobs:
|
|
|
30
30
|
build:
|
|
31
31
|
runs-on: ubuntu-latest
|
|
32
32
|
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
strategy:
|
|
35
35
|
matrix:
|
|
36
|
-
node-version: [
|
|
37
|
-
|
|
36
|
+
node-version: [ 26 ]
|
|
37
|
+
|
|
38
38
|
steps:
|
|
39
39
|
- uses: actions/checkout@main
|
|
40
40
|
with:
|
package/file/gitignore
CHANGED
package/file/lerna.json.tpl
CHANGED
package/file/pnpm-workspace.yaml
CHANGED
|
@@ -4,17 +4,17 @@ packages:
|
|
|
4
4
|
# exclude packages that are inside test/ directories
|
|
5
5
|
- '!**/test/**'
|
|
6
6
|
|
|
7
|
-
publicHoistPattern:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
# publicHoistPattern:
|
|
8
|
+
# - "ts-type"
|
|
9
|
+
# - "@bluelovers/tsconfig"
|
|
10
|
+
# - "@bluelovers/jest-config"
|
|
11
|
+
# - "@types/node"
|
|
12
|
+
# - "@types/jest"
|
|
13
|
+
# - "jest"
|
|
14
|
+
# - "ts-jest"
|
|
15
|
+
# - "ts-node"
|
|
16
|
+
# - "tsx"
|
|
17
|
+
# - "tslib"
|
|
18
18
|
|
|
19
19
|
linkWorkspacePackages: true
|
|
20
20
|
saveWorkspaceProtocol: false
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"__root.js","sourceRoot":"","sources":["__root.ts"],"names":[],"mappings":";;;;AAAA;;;;;;;;GAQG;AACH,8BAA8B;AAC9B,4DAA0B;AAC1B,aAAa;AACb,uDAA0D;AAKjD,uFALe,6BAAM,OAKf;AAEF,QAAA,KAAK,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AAElD;;;;GAIG;AACU,QAAA,WAAW,GAAG,gBAAI,CAAC,IAAI,CAAC,6BAAM,EAAE,MAAM,CAAC,CAAC;AAErD;;;;GAIG;AACU,QAAA,eAAe,GAAG,gBAAI,CAAC,IAAI,CAAC,mBAAW,EAAE,UAAU,CAAC,CAAC;AAElE;;;;;;;;;;GAUG;AACU,QAAA,WAAW,GAAG,gBAAI,CAAC,IAAI,CAAC,mBAAW,EAAE,MAAM,CAAC,CAAC","sourcesContent":["/**\n * 測試路徑架構 / Test Path Structure\n *\n * test/\n * ├── fixtures/ ← 測試資料夾(唯讀)\n * └── temp/ ← 臨時檔案(可寫,永遠建立子資料夾)\n * ├── fake-lib/\n * └── temp-pkg/\n */\n/// <reference types=\"node\" />\nimport path from 'upath2';\n// @ts-ignore\nimport { __ROOT_CORE as __ROOT } from './__root-core.cjs';\n\n/**\n * 專案根目錄\n */\nexport { __ROOT }\n\nexport const isWin = process.platform === \"win32\";\n\n/**\n * 測試資料夾\n *\n * @default test\n */\nexport const __TEST_ROOT = path.join(__ROOT, 'test');\n\n/**\n * 測試資料夾(唯讀)\n *\n * @default test/fixtures\n */\nexport const __TEST_FIXTURES = path.join(__TEST_ROOT, 'fixtures');\n\n/**\n * 臨時檔案(可寫,永遠建立子資料夾)\n *\n * test/\n * ├── fixtures/ ← 測試資料夾(唯讀)\n * └── temp/ ← 臨時檔案(可寫,永遠建立子資料夾)\n * ├── fake-lib/\n * └── temp-pkg/\n *\n * @default test/temp\n */\nexport const __TEST_TEMP = path.join(__TEST_ROOT, 'temp');\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temp.js","sourceRoot":"","sources":["temp.ts"],"names":[],"mappings":";AAAA,8BAA8B","sourcesContent":["/// <reference types=\"node\" />\n\n"]}
|
|
@@ -8,6 +8,13 @@
|
|
|
8
8
|
"noUnusedParameters": false,
|
|
9
9
|
"allowUnusedLabels": true,
|
|
10
10
|
"noUnusedLocals": false,
|
|
11
|
-
"noPropertyAccessFromIndexSignature": false
|
|
12
|
-
|
|
11
|
+
"noPropertyAccessFromIndexSignature": false,
|
|
12
|
+
"types": [
|
|
13
|
+
"jest",
|
|
14
|
+
"node"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"include": [
|
|
18
|
+
"test"
|
|
19
|
+
]
|
|
13
20
|
}
|
package/file/tsconfig.json.tpl
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["index.cts"],"names":[],"mappings":";;AAAA,4DAAwB;AAGxB,iBAAS,eAAC,CAAA","sourcesContent":["import _ from './index';\n\n// @ts-ignore\nexport = _\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"__root_ws.js","sourceRoot":"","sources":["__root_ws.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAEf,QAAA,SAAS,GAAG,IAAA,WAAI,EAAC,SAAS,CAAC,CAAC;AAE5B,QAAA,KAAK,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC","sourcesContent":["import { join } from \"path\";\n\nexport const __ROOT_WS = join(__dirname);\n\nexport const isWin = process.platform === \"win32\";\n"]}
|
package/lib/const.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { _Key, IStaticFilesMapArray } from './types';
|
|
|
20
20
|
* - staticFile: The source static file path (relative to static root) / 來源靜態檔案路徑(相對於靜態根目錄)
|
|
21
21
|
* - detectFile: Optional file to check for existence before copying / 可選的檢測檔案,複製前檢查是否存在
|
|
22
22
|
*/
|
|
23
|
-
declare const _defaultCopyStaticFiles: [[".npmignore", "file/npmignore"], [".gitignore", "file/gitignore"], [".eslintignore", "file/eslintignore"], ["tsconfig.json
|
|
23
|
+
declare const _defaultCopyStaticFiles: [[".npmignore", "file/npmignore"], [".gitignore", "file/gitignore"], [".eslintignore", "file/eslintignore"], ["tsconfig.json", "file/tsconfig.json.tpl"], ["tsconfig.json.tpl", "file/tsconfig.json.tpl"], ["test/tsconfig.json.tpl", "file/test/tsconfig.json.tpl", "test/tsconfig.json"], ["tsconfig.esm.json.tpl", "file/tsconfig.esm.json.tpl", "tsconfig.esm.json"], ["tsconfig.tsdx.json.tpl", "file/tsconfig.tsdx.json.tpl", "tsconfig.tsdx.json"], [".eslintrc.json.tpl", "file/eslintrc.json.tpl", ".eslintrc.json"], ["README.md", "file/README.md"], [".mocharc.yml.tpl", "file/mocharc.yml"], ["jest.config.js", "file/jest.config.auto.js"], [".nowignore", "file/nowignore"], ["now.json.tpl", "file/now.json.tpl", "now.json"], ["tsdx.config.js.tpl", "file/tsdx.config.js", "tsdx.config.js"], ...["test/temp.ts" | "test/__root.ts" | "test/__root-core.cjs" | "test/__root-core.mjs" | "test/__root-core.d.cts" | "test/__root-core.d.mts" | "test/__root-core.d.ts" | "test/fixtures/.gitkeep", "file/test/temp.ts" | "file/test/__root.ts" | "file/test/__root-core.cjs" | "file/test/__root-core.mjs" | "file/test/__root-core.d.cts" | "file/test/__root-core.d.mts" | "file/test/__root-core.d.ts" | "file/test/fixtures/.gitkeep"][]];
|
|
24
24
|
/**
|
|
25
25
|
* Default static files for root-level only copying / 僅根目錄層級複製的預設靜態檔案
|
|
26
26
|
*
|
|
@@ -30,14 +30,14 @@ declare const _defaultCopyStaticFiles: [[".npmignore", "file/npmignore"], [".git
|
|
|
30
30
|
* These files are typically shared across all packages in a monorepo.
|
|
31
31
|
* 這些檔案通常在 monorepo 中的所有套件之間共享。
|
|
32
32
|
*/
|
|
33
|
-
declare const _defaultCopyStaticFilesRootOnly: [["lerna.json.tpl", "file/lerna.json.tpl", "lerna.json"], ["pnpm-workspace.yaml.tpl", "file/pnpm-workspace.yaml"
|
|
33
|
+
declare const _defaultCopyStaticFilesRootOnly: [["lerna.json.tpl", "file/lerna.json.tpl", "lerna.json"], ["pnpm-workspace.yaml.tpl", "file/pnpm-workspace.yaml"], [".github/workflows/build-pnpm.yml", "file/github/workflows/build-pnpm.yml"], [".github/workflows/build-yarn.yml", "file/github/workflows/build-yarn.yml"], ...[".github/dependabot.yml" | ".github/commit-convention.md", "file/github/dependabot.yml" | "file/github/commit-convention.md"][], [".node-version.tpl", "file/nvmrc"], [".nvmrc.tpl", "file/nvmrc"], [".eslintrc.json", "file/eslintrc.json.tpl", ".eslintrc.json"], [".yarnrc.yml.tpl", "file/root/yarnrc.yml", ".yarnrc.yml"], [".npmrc.tpl", "file/npmrc", ".npmrc"], [".env.tpl", "file/env"], ["jest.config.auto.js.tpl", "file/jest.config.auto.js"], [".editorconfig.tpl", "file/tpl.editorconfig"], [".editorconfig", "file/tpl.editorconfig"], ["global.tsdx.d.ts", "file/root/global.tsdx.d.ts"], [".browserslistrc", "file/ws-root/browserslistrc"]];
|
|
34
34
|
/**
|
|
35
35
|
* Default static files for workspace root only / 僅工作區根目錄的預設靜態檔案
|
|
36
36
|
*
|
|
37
37
|
* Contains files specific to workspace root management.
|
|
38
38
|
* 包含特定於工作區根目錄管理的檔案。
|
|
39
39
|
*/
|
|
40
|
-
declare const _defaultCopyStaticFilesWsRootOnly: [["lerna.json.tpl", "file/lerna.json.tpl"], ["pnpm-workspace.yaml", "file/pnpm-workspace.yaml"], ["
|
|
40
|
+
declare const _defaultCopyStaticFilesWsRootOnly: [["lerna.json.tpl", "file/lerna.json.tpl"], ["pnpm-workspace.yaml", "file/pnpm-workspace.yaml"], ["__root_ws.ts", "file/ws-root/__root_ws.ts"], ["jest.config.js", "file/ws-root/jest.config.js"], ["jest-preset.js", "file/ws-root/jest-preset.js"], ["jest.config.js.tpl", "file/ws-root/jest.config.js"], [".run/lerna_publish_yes.run.xml", "file/ws-root/.run/lerna_publish_yes.run.xml"]];
|
|
41
41
|
/**
|
|
42
42
|
* Frozen default static files for package-level / 凍結的套件層級預設靜態檔案
|
|
43
43
|
*
|
package/lib/const.js
CHANGED
|
@@ -20,36 +20,34 @@ const _defaultCopyStaticFiles = [
|
|
|
20
20
|
['.gitignore', 'file/gitignore'],
|
|
21
21
|
['.eslintignore', 'file/eslintignore'],
|
|
22
22
|
// TypeScript configuration / TypeScript 配置
|
|
23
|
-
['tsconfig.json
|
|
23
|
+
['tsconfig.json', 'file/tsconfig.json.tpl'],
|
|
24
|
+
['tsconfig.json.tpl', 'file/tsconfig.json.tpl'],
|
|
24
25
|
['test/tsconfig.json.tpl', 'file/test/tsconfig.json.tpl', 'test/tsconfig.json'],
|
|
25
|
-
['test/tsconfig.json', 'file/test/tsconfig.json.tpl'],
|
|
26
26
|
['tsconfig.esm.json.tpl', 'file/tsconfig.esm.json.tpl', 'tsconfig.esm.json'],
|
|
27
27
|
['tsconfig.tsdx.json.tpl', 'file/tsconfig.tsdx.json.tpl', 'tsconfig.tsdx.json'],
|
|
28
|
-
['tsconfig.json', 'file/tsconfig.json.tpl'],
|
|
29
28
|
// ESLint configuration / ESLint 配置
|
|
30
29
|
['.eslintrc.json.tpl', 'file/eslintrc.json.tpl', '.eslintrc.json'],
|
|
31
30
|
// Documentation / 文檔
|
|
32
31
|
['README.md', 'file/README.md'],
|
|
33
32
|
// Test configuration / 測試配置
|
|
34
33
|
['.mocharc.yml.tpl', 'file/mocharc.yml'],
|
|
35
|
-
//['jest.config.js', 'file/jest.config.js'],
|
|
36
34
|
['jest.config.js', 'file/jest.config.auto.js'],
|
|
37
35
|
// Now/Zeit deployment / Now/Zeit 部署配置
|
|
38
36
|
['.nowignore', 'file/nowignore'],
|
|
39
37
|
['now.json.tpl', 'file/now.json.tpl', 'now.json'],
|
|
40
38
|
// TSDX configuration / TSDX 配置
|
|
41
39
|
['tsdx.config.js.tpl', 'file/tsdx.config.js', 'tsdx.config.js'],
|
|
42
|
-
//
|
|
43
|
-
['test/__root.ts', 'file/test/__root.ts'],
|
|
44
|
-
['test/fixtures/.gitkeep', 'file/test/fixtures/.gitkeep'],
|
|
45
|
-
// Temporary test files / 臨時測試檔案
|
|
40
|
+
// test / 測試
|
|
46
41
|
...([
|
|
47
42
|
'temp.ts',
|
|
43
|
+
'__root.ts',
|
|
48
44
|
'__root-core.cjs',
|
|
49
45
|
'__root-core.mjs',
|
|
50
46
|
'__root-core.d.cts',
|
|
51
47
|
'__root-core.d.mts',
|
|
52
48
|
'__root-core.d.ts',
|
|
49
|
+
// Test fixtures / 測試固定檔案
|
|
50
|
+
'fixtures/.gitkeep',
|
|
53
51
|
].map(file => [
|
|
54
52
|
`test/${file}`,
|
|
55
53
|
`file/test/${file}`
|
|
@@ -68,31 +66,35 @@ const _defaultCopyStaticFiles = [
|
|
|
68
66
|
const _defaultCopyStaticFilesRootOnly = [
|
|
69
67
|
// Monorepo configuration / Monorepo 配置
|
|
70
68
|
['lerna.json.tpl', 'file/lerna.json.tpl', 'lerna.json'],
|
|
71
|
-
['pnpm-workspace.yaml.tpl', 'file/pnpm-workspace.yaml'
|
|
69
|
+
['pnpm-workspace.yaml.tpl', 'file/pnpm-workspace.yaml'],
|
|
72
70
|
// GitHub Actions workflows / GitHub Actions 工作流程
|
|
73
|
-
['.github/workflows/
|
|
74
|
-
['.github/workflows/
|
|
75
|
-
['.github/workflows/build.yml', 'file/github/workflows/build.yml'],
|
|
76
|
-
['.github/workflows/yarn-lock-changes.yml', 'file/github/workflows/yarn-lock-changes.yml'],
|
|
77
|
-
['.github/commit-convention.md', 'file/github/commit-convention.md'],
|
|
71
|
+
['.github/workflows/build-pnpm.yml', 'file/github/workflows/build-pnpm.yml'],
|
|
72
|
+
['.github/workflows/build-yarn.yml', 'file/github/workflows/build-yarn.yml'],
|
|
78
73
|
// Additional GitHub configuration / 額外的 GitHub 配置
|
|
79
74
|
...([
|
|
80
75
|
'dependabot.yml',
|
|
81
|
-
'
|
|
82
|
-
|
|
76
|
+
'commit-convention.md',
|
|
77
|
+
// ---
|
|
78
|
+
// 'workflows/codeql-analysis.yml',
|
|
79
|
+
// 'workflows/cmd-rebase.yml',
|
|
80
|
+
// 'workflows/coverage.yml',
|
|
81
|
+
// 'workflows/action-yarnlock-dedupe.yml',
|
|
82
|
+
// 'workflows/yarn-lock-changes.yml',
|
|
83
|
+
// ---
|
|
83
84
|
].map(file => [`.github/${file}`, `file/github/${file}`])),
|
|
84
85
|
// Node version files / Node 版本檔案
|
|
85
|
-
['.node-version', 'file/nvmrc'],
|
|
86
|
-
['.nvmrc', 'file/nvmrc'],
|
|
86
|
+
['.node-version.tpl', 'file/nvmrc'],
|
|
87
|
+
['.nvmrc.tpl', 'file/nvmrc'],
|
|
87
88
|
// Root TypeScript configuration / 根目錄 TypeScript 配置
|
|
88
89
|
['.eslintrc.json', 'file/eslintrc.json.tpl', '.eslintrc.json'],
|
|
89
90
|
//['changelog-option.js', 'file/changelog-option.js', 'changelog-option.js.tpl'],
|
|
90
91
|
// Package manager configuration / 套件管理器配置
|
|
91
92
|
['.yarnrc.yml.tpl', 'file/root/yarnrc.yml', '.yarnrc.yml'],
|
|
92
93
|
['.npmrc.tpl', 'file/npmrc', '.npmrc'],
|
|
94
|
+
['.env.tpl', 'file/env'],
|
|
93
95
|
// Jest configuration / Jest 配置
|
|
94
|
-
['jest.config.js', 'file/jest.config.js'],
|
|
95
|
-
['jest.config.js.tpl', 'file/jest.config.js'],
|
|
96
|
+
// ['jest.config.js', 'file/jest.config.js'],
|
|
97
|
+
// ['jest.config.js.tpl', 'file/jest.config.js'],
|
|
96
98
|
['jest.config.auto.js.tpl', 'file/jest.config.auto.js'],
|
|
97
99
|
// Editor configuration / 編輯器配置
|
|
98
100
|
['.editorconfig.tpl', 'file/tpl.editorconfig'],
|
|
@@ -102,9 +104,9 @@ const _defaultCopyStaticFilesRootOnly = [
|
|
|
102
104
|
// Browserslist configuration / Browserslist 配置
|
|
103
105
|
['.browserslistrc', 'file/ws-root/browserslistrc'],
|
|
104
106
|
// TSC multi configuration / TSC 多配置
|
|
105
|
-
['tsc-multi.json.tpl', 'file/tsc-multi.json.tpl', 'tsc-multi.json'],
|
|
107
|
+
// ['tsc-multi.json.tpl', 'file/tsc-multi.json.tpl', 'tsc-multi.json'],
|
|
106
108
|
// NYC coverage configuration / NYC 覆蓋率配置
|
|
107
|
-
['.nycrc.tpl', 'file/nycrc'],
|
|
109
|
+
// ['.nycrc.tpl', 'file/nycrc', '.nycrc'],
|
|
108
110
|
];
|
|
109
111
|
/**
|
|
110
112
|
* Default static files for workspace root only / 僅工作區根目錄的預設靜態檔案
|
|
@@ -118,12 +120,13 @@ const _defaultCopyStaticFilesWsRootOnly = [
|
|
|
118
120
|
// pnpm workspace configuration / pnpm 工作區配置
|
|
119
121
|
['pnpm-workspace.yaml', 'file/pnpm-workspace.yaml'],
|
|
120
122
|
// TSC multi configuration / TSC 多配置
|
|
121
|
-
['tsc-multi.json.tpl', 'file/tsc-multi.json.tpl', 'tsc-multi.json'],
|
|
123
|
+
// ['tsc-multi.json.tpl', 'file/tsc-multi.json.tpl', 'tsc-multi.json'],
|
|
122
124
|
// Workspace root file / 工作區根目錄檔案
|
|
123
125
|
['__root_ws.ts', 'file/ws-root/__root_ws.ts'],
|
|
124
126
|
// Jest configuration / Jest 配置
|
|
125
127
|
['jest.config.js', 'file/ws-root/jest.config.js'],
|
|
126
128
|
['jest-preset.js', 'file/ws-root/jest-preset.js'],
|
|
129
|
+
['jest.config.js.tpl', 'file/ws-root/jest.config.js'],
|
|
127
130
|
// Run configurations / 執行配置
|
|
128
131
|
['.run/lerna_publish_yes.run.xml', 'file/ws-root/.run/lerna_publish_yes.run.xml'],
|
|
129
132
|
];
|
package/lib/const.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.js","sourceRoot":"","sources":["const.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Static file mapping constants / 靜態檔案映射常量\n *\n * This module defines the default static file mappings for different project scenarios.\n * 此模組定義了不同專案情境的預設靜態檔案映射。\n *\n * @module const\n */\nimport { _Key, IStaticFilesKey, IStaticFilesMapArray, IStaticFilesMapArrayEntry } from './types';\n\n/**\n * Default static files for package-level copying / 套件層級複製的預設靜態檔案\n *\n * Contains common configuration files that should be copied to each package.\n * 包含應複製到每個套件的常用配置檔案。\n *\n * Each entry follows the format: [targetFile, staticFile, detectFile?]\n * 每個條目遵循格式:[目標檔案, 靜態檔案, 檢測檔案?]\n *\n * - targetFile: The destination file path / 目標檔案路徑\n * - staticFile: The source static file path (relative to static root) / 來源靜態檔案路徑(相對於靜態根目錄)\n * - detectFile: Optional file to check for existence before copying / 可選的檢測檔案,複製前檢查是否存在\n */\nconst _defaultCopyStaticFiles = [\n\n\t// Ignore files / 忽略檔案\n\t['.npmignore', 'file/npmignore'],\n\t['.gitignore', 'file/gitignore'],\n\t['.eslintignore', 'file/eslintignore'],\n\n\t// TypeScript configuration / TypeScript 配置\n\t['tsconfig.json.tpl', 'file/tsconfig.json.tpl', 'tsconfig.json'],\n\n\t['test/tsconfig.json.tpl', 'file/test/tsconfig.json.tpl', 'test/tsconfig.json'],\n\t['test/tsconfig.json', 'file/test/tsconfig.json.tpl'],\n\n\t['tsconfig.esm.json.tpl', 'file/tsconfig.esm.json.tpl', 'tsconfig.esm.json'],\n\t['tsconfig.tsdx.json.tpl', 'file/tsconfig.tsdx.json.tpl', 'tsconfig.tsdx.json'],\n\n\t['tsconfig.json', 'file/tsconfig.json.tpl'],\n\n\t// ESLint configuration / ESLint 配置\n\t['.eslintrc.json.tpl', 'file/eslintrc.json.tpl', '.eslintrc.json'],\n\n\t// Documentation / 文檔\n\t['README.md', 'file/README.md'],\n\n\t// Test configuration / 測試配置\n\t['.mocharc.yml.tpl', 'file/mocharc.yml'],\n\t//['jest.config.js', 'file/jest.config.js'],\n\t['jest.config.js', 'file/jest.config.auto.js'],\n\n\t// Now/Zeit deployment / Now/Zeit 部署配置\n\t['.nowignore', 'file/nowignore'],\n\t['now.json.tpl', 'file/now.json.tpl', 'now.json'],\n\n\t// TSDX configuration / TSDX 配置\n\t['tsdx.config.js.tpl', 'file/tsdx.config.js', 'tsdx.config.js'],\n\n\t// Test fixtures / 測試固定檔案\n\t['test/__root.ts', 'file/test/__root.ts'],\n\t['test/fixtures/.gitkeep', 'file/test/fixtures/.gitkeep'],\n\n\t// Temporary test files / 臨時測試檔案\n\t...(([\n\t\t'temp.ts',\n\n\t\t'__root-core.cjs',\n\t\t'__root-core.mjs',\n\n\t\t'__root-core.d.cts',\n\t\t'__root-core.d.mts',\n\n\t\t'__root-core.d.ts',\n\n\t] as const).map(file => [\n\t\t`test/${file}`,\n\t\t`file/test/${file}`\n\t] as const satisfies IStaticFilesMapArrayEntry<string>)),\n\n\t//['changelog-option.js.tpl', 'file/changelog-option.js', 'changelog-option.js'],\n\n] as const satisfies IStaticFilesMapArray<string>;\n\n/**\n * Default static files for root-level only copying / 僅根目錄層級複製的預設靜態檔案\n *\n * Contains configuration files that should only be copied to the workspace root.\n * 包含僅應複製到工作區根目錄的配置檔案。\n *\n * These files are typically shared across all packages in a monorepo.\n * 這些檔案通常在 monorepo 中的所有套件之間共享。\n */\nconst _defaultCopyStaticFilesRootOnly = [\n\n\t// Monorepo configuration / Monorepo 配置\n\t['lerna.json.tpl', 'file/lerna.json.tpl', 'lerna.json'],\n\t['pnpm-workspace.yaml.tpl', 'file/pnpm-workspace.yaml', 'pnpm-workspace.yaml'],\n\n\t// GitHub Actions workflows / GitHub Actions 工作流程\n\t['.github/workflows/coverage.yml', 'file/github/workflows/coverage.yml'],\n\t['.github/workflows/action-yarnlock-dedupe.yml', 'file/github/workflows/action-yarnlock-dedupe.yml'],\n\t['.github/workflows/build.yml', 'file/github/workflows/build.yml'],\n\t['.github/workflows/yarn-lock-changes.yml', 'file/github/workflows/yarn-lock-changes.yml'],\n\t['.github/commit-convention.md', 'file/github/commit-convention.md'],\n\n\t// Additional GitHub configuration / 額外的 GitHub 配置\n\t...(([\n\t\t'dependabot.yml',\n\t\t'workflows/codeql-analysis.yml',\n\t\t'workflows/cmd-rebase.yml',\n\t] as const).map(file => [`.github/${file}`, `file/github/${file}`] as const satisfies IStaticFilesMapArrayEntry<string>)),\n\n\t// Node version files / Node 版本檔案\n\t['.node-version', 'file/nvmrc'],\n\t['.nvmrc', 'file/nvmrc'],\n\n\t// Root TypeScript configuration / 根目錄 TypeScript 配置\n\t['.eslintrc.json', 'file/eslintrc.json.tpl', '.eslintrc.json'],\n\n\t//['changelog-option.js', 'file/changelog-option.js', 'changelog-option.js.tpl'],\n\n\t// Package manager configuration / 套件管理器配置\n\t['.yarnrc.yml.tpl', 'file/root/yarnrc.yml', '.yarnrc.yml'],\n\t['.npmrc.tpl', 'file/npmrc', '.npmrc'],\n\n\t// Jest configuration / Jest 配置\n\t['jest.config.js', 'file/jest.config.js'],\n\t['jest.config.js.tpl', 'file/jest.config.js'],\n\t['jest.config.auto.js.tpl', 'file/jest.config.auto.js'],\n\n\t// Editor configuration / 編輯器配置\n\t['.editorconfig.tpl', 'file/tpl.editorconfig'],\n\t['.editorconfig', 'file/tpl.editorconfig'],\n\n\t// Global type declarations / 全局類型聲明\n\t['global.tsdx.d.ts', 'file/root/global.tsdx.d.ts'],\n\n\t// Browserslist configuration / Browserslist 配置\n\t['.browserslistrc', 'file/ws-root/browserslistrc'],\n\n\t// TSC multi configuration / TSC 多配置\n\t['tsc-multi.json.tpl', 'file/tsc-multi.json.tpl', 'tsc-multi.json'],\n\n\t// NYC coverage configuration / NYC 覆蓋率配置\n\t['.nycrc.tpl', 'file/nycrc'],\n\n] as const satisfies IStaticFilesMapArray<string>;\n\n/**\n * Default static files for workspace root only / 僅工作區根目錄的預設靜態檔案\n *\n * Contains files specific to workspace root management.\n * 包含特定於工作區根目錄管理的檔案。\n */\nconst _defaultCopyStaticFilesWsRootOnly = [\n\n\t// Lerna configuration / Lerna 配置\n\t['lerna.json.tpl', 'file/lerna.json.tpl'],\n\n\t// pnpm workspace configuration / pnpm 工作區配置\n\t['pnpm-workspace.yaml', 'file/pnpm-workspace.yaml'],\n\n\t// TSC multi configuration / TSC 多配置\n\t['tsc-multi.json.tpl', 'file/tsc-multi.json.tpl', 'tsc-multi.json'],\n\n\t// Workspace root file / 工作區根目錄檔案\n\t['__root_ws.ts', 'file/ws-root/__root_ws.ts'],\n\n\t// Jest configuration / Jest 配置\n\t['jest.config.js', 'file/ws-root/jest.config.js'],\n\t['jest-preset.js', 'file/ws-root/jest-preset.js'],\n\n\t// Run configurations / 執行配置\n\t['.run/lerna_publish_yes.run.xml', 'file/ws-root/.run/lerna_publish_yes.run.xml'],\n\n] as const satisfies IStaticFilesMapArray<string>;\n\n/**\n * Frozen default static files for package-level / 凍結的套件層級預設靜態檔案\n *\n * Use this for copying static files to individual packages.\n * 用於將靜態檔案複製到各個套件。\n */\nexport const defaultCopyStaticFiles = Object.freeze(_defaultCopyStaticFiles) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFiles>>;\n\n/**\n * Frozen default static files for root-level only / 凍結的僅根目錄層級預設靜態檔案\n *\n * Use this for copying static files to the workspace root only.\n * 用於將靜態檔案僅複製到工作區根目錄。\n */\nexport const defaultCopyStaticFilesRootOnly = Object.freeze(_defaultCopyStaticFilesRootOnly) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFilesRootOnly>>;\n\n/**\n * Frozen default static files for workspace root / 凍結的工作區根目錄預設靜態檔案\n *\n * Use this for workspace root specific file management.\n * 用於工作區根目錄特定的檔案管理。\n */\nexport const defaultCopyStaticFilesWsRootOnly = Object.freeze(_defaultCopyStaticFilesWsRootOnly) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFilesWsRootOnly>>;\n"]}
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["const.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Static file mapping constants / 靜態檔案映射常量\n *\n * This module defines the default static file mappings for different project scenarios.\n * 此模組定義了不同專案情境的預設靜態檔案映射。\n *\n * @module const\n */\nimport { _Key, IStaticFilesKey, IStaticFilesMapArray, IStaticFilesMapArrayEntry } from './types';\n\n/**\n * Default static files for package-level copying / 套件層級複製的預設靜態檔案\n *\n * Contains common configuration files that should be copied to each package.\n * 包含應複製到每個套件的常用配置檔案。\n *\n * Each entry follows the format: [targetFile, staticFile, detectFile?]\n * 每個條目遵循格式:[目標檔案, 靜態檔案, 檢測檔案?]\n *\n * - targetFile: The destination file path / 目標檔案路徑\n * - staticFile: The source static file path (relative to static root) / 來源靜態檔案路徑(相對於靜態根目錄)\n * - detectFile: Optional file to check for existence before copying / 可選的檢測檔案,複製前檢查是否存在\n */\nconst _defaultCopyStaticFiles = [\n\n\t// Ignore files / 忽略檔案\n\t['.npmignore', 'file/npmignore'],\n\t['.gitignore', 'file/gitignore'],\n\t['.eslintignore', 'file/eslintignore'],\n\n\t// TypeScript configuration / TypeScript 配置\n\t['tsconfig.json', 'file/tsconfig.json.tpl'],\n\t['tsconfig.json.tpl', 'file/tsconfig.json.tpl'],\n\n\t['test/tsconfig.json.tpl', 'file/test/tsconfig.json.tpl', 'test/tsconfig.json'],\n\n\t['tsconfig.esm.json.tpl', 'file/tsconfig.esm.json.tpl', 'tsconfig.esm.json'],\n\t['tsconfig.tsdx.json.tpl', 'file/tsconfig.tsdx.json.tpl', 'tsconfig.tsdx.json'],\n\n\t// ESLint configuration / ESLint 配置\n\t['.eslintrc.json.tpl', 'file/eslintrc.json.tpl', '.eslintrc.json'],\n\n\t// Documentation / 文檔\n\t['README.md', 'file/README.md'],\n\n\t// Test configuration / 測試配置\n\t['.mocharc.yml.tpl', 'file/mocharc.yml'],\n\n\t['jest.config.js', 'file/jest.config.auto.js'],\n\n\t// Now/Zeit deployment / Now/Zeit 部署配置\n\t['.nowignore', 'file/nowignore'],\n\t['now.json.tpl', 'file/now.json.tpl', 'now.json'],\n\n\t// TSDX configuration / TSDX 配置\n\t['tsdx.config.js.tpl', 'file/tsdx.config.js', 'tsdx.config.js'],\n\n\t// test / 測試\n\t...(([\n\t\t'temp.ts',\n\n\t\t'__root.ts',\n\n\t\t'__root-core.cjs',\n\t\t'__root-core.mjs',\n\n\t\t'__root-core.d.cts',\n\t\t'__root-core.d.mts',\n\n\t\t'__root-core.d.ts',\n\n\t\t// Test fixtures / 測試固定檔案\n\t\t'fixtures/.gitkeep',\n\n\t] as const).map(file => [\n\t\t`test/${file}`,\n\t\t`file/test/${file}`\n\t] as const satisfies IStaticFilesMapArrayEntry<string>)),\n\n\t//['changelog-option.js.tpl', 'file/changelog-option.js', 'changelog-option.js'],\n\n] as const satisfies IStaticFilesMapArray<string>;\n\n/**\n * Default static files for root-level only copying / 僅根目錄層級複製的預設靜態檔案\n *\n * Contains configuration files that should only be copied to the workspace root.\n * 包含僅應複製到工作區根目錄的配置檔案。\n *\n * These files are typically shared across all packages in a monorepo.\n * 這些檔案通常在 monorepo 中的所有套件之間共享。\n */\nconst _defaultCopyStaticFilesRootOnly = [\n\n\t// Monorepo configuration / Monorepo 配置\n\t['lerna.json.tpl', 'file/lerna.json.tpl', 'lerna.json'],\n\t['pnpm-workspace.yaml.tpl', 'file/pnpm-workspace.yaml'],\n\n\t// GitHub Actions workflows / GitHub Actions 工作流程\n\t['.github/workflows/build-pnpm.yml', 'file/github/workflows/build-pnpm.yml'],\n\t['.github/workflows/build-yarn.yml', 'file/github/workflows/build-yarn.yml'],\n\n\t// Additional GitHub configuration / 額外的 GitHub 配置\n\t...(([\n\t\t'dependabot.yml',\n\t\t'commit-convention.md',\n\n\t\t// ---\n\n\t\t// 'workflows/codeql-analysis.yml',\n\t\t// 'workflows/cmd-rebase.yml',\n\n\t\t// 'workflows/coverage.yml',\n\t\t// 'workflows/action-yarnlock-dedupe.yml',\n\t\t// 'workflows/yarn-lock-changes.yml',\n\n\t\t// ---\n\n\t] as const).map(file => [`.github/${file}`, `file/github/${file}`] as const satisfies IStaticFilesMapArrayEntry<string>)),\n\n\t// Node version files / Node 版本檔案\n\t['.node-version.tpl', 'file/nvmrc'],\n\t['.nvmrc.tpl', 'file/nvmrc'],\n\n\t// Root TypeScript configuration / 根目錄 TypeScript 配置\n\t['.eslintrc.json', 'file/eslintrc.json.tpl', '.eslintrc.json'],\n\n\t//['changelog-option.js', 'file/changelog-option.js', 'changelog-option.js.tpl'],\n\n\t// Package manager configuration / 套件管理器配置\n\t['.yarnrc.yml.tpl', 'file/root/yarnrc.yml', '.yarnrc.yml'],\n\t['.npmrc.tpl', 'file/npmrc', '.npmrc'],\n\n\t['.env.tpl', 'file/env'],\n\n\t// Jest configuration / Jest 配置\n\t// ['jest.config.js', 'file/jest.config.js'],\n\t// ['jest.config.js.tpl', 'file/jest.config.js'],\n\t['jest.config.auto.js.tpl', 'file/jest.config.auto.js'],\n\n\t// Editor configuration / 編輯器配置\n\t['.editorconfig.tpl', 'file/tpl.editorconfig'],\n\t['.editorconfig', 'file/tpl.editorconfig'],\n\n\t// Global type declarations / 全局類型聲明\n\t['global.tsdx.d.ts', 'file/root/global.tsdx.d.ts'],\n\n\t// Browserslist configuration / Browserslist 配置\n\t['.browserslistrc', 'file/ws-root/browserslistrc'],\n\n\t// TSC multi configuration / TSC 多配置\n\t// ['tsc-multi.json.tpl', 'file/tsc-multi.json.tpl', 'tsc-multi.json'],\n\n\t// NYC coverage configuration / NYC 覆蓋率配置\n\t// ['.nycrc.tpl', 'file/nycrc', '.nycrc'],\n\n] as const satisfies IStaticFilesMapArray<string>;\n\n/**\n * Default static files for workspace root only / 僅工作區根目錄的預設靜態檔案\n *\n * Contains files specific to workspace root management.\n * 包含特定於工作區根目錄管理的檔案。\n */\nconst _defaultCopyStaticFilesWsRootOnly = [\n\n\t// Lerna configuration / Lerna 配置\n\t['lerna.json.tpl', 'file/lerna.json.tpl'],\n\n\t// pnpm workspace configuration / pnpm 工作區配置\n\t['pnpm-workspace.yaml', 'file/pnpm-workspace.yaml'],\n\n\t// TSC multi configuration / TSC 多配置\n\t// ['tsc-multi.json.tpl', 'file/tsc-multi.json.tpl', 'tsc-multi.json'],\n\n\t// Workspace root file / 工作區根目錄檔案\n\t['__root_ws.ts', 'file/ws-root/__root_ws.ts'],\n\n\t// Jest configuration / Jest 配置\n\t['jest.config.js', 'file/ws-root/jest.config.js'],\n\t['jest-preset.js', 'file/ws-root/jest-preset.js'],\n\n\t['jest.config.js.tpl', 'file/ws-root/jest.config.js'],\n\n\t// Run configurations / 執行配置\n\t['.run/lerna_publish_yes.run.xml', 'file/ws-root/.run/lerna_publish_yes.run.xml'],\n\n] as const satisfies IStaticFilesMapArray<string>;\n\n/**\n * Frozen default static files for package-level / 凍結的套件層級預設靜態檔案\n *\n * Use this for copying static files to individual packages.\n * 用於將靜態檔案複製到各個套件。\n */\nexport const defaultCopyStaticFiles = Object.freeze(_defaultCopyStaticFiles) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFiles>>;\n\n/**\n * Frozen default static files for root-level only / 凍結的僅根目錄層級預設靜態檔案\n *\n * Use this for copying static files to the workspace root only.\n * 用於將靜態檔案僅複製到工作區根目錄。\n */\nexport const defaultCopyStaticFilesRootOnly = Object.freeze(_defaultCopyStaticFilesRootOnly) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFilesRootOnly>>;\n\n/**\n * Frozen default static files for workspace root / 凍結的工作區根目錄預設靜態檔案\n *\n * Use this for workspace root specific file management.\n * 用於工作區根目錄特定的檔案管理。\n */\nexport const defaultCopyStaticFilesWsRootOnly = Object.freeze(_defaultCopyStaticFilesWsRootOnly) as any as IStaticFilesMapArray<_Key<typeof _defaultCopyStaticFilesWsRootOnly>>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarn-tool/static-file",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.17",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://github.com/bluelovers/ws-yarn-workspaces/tree/master/packages/@yarn-tool/static-file#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"lint": "npx eslint **/*.ts",
|
|
20
20
|
"test": "node --run test:jest --",
|
|
21
21
|
"test:jest": "jest --passWithNoTests",
|
|
22
|
-
"test:jest:coverage": "
|
|
23
|
-
"test:jest:snapshot": "
|
|
24
|
-
"test:snapshot": "
|
|
22
|
+
"test:jest:coverage": "pnpm run test:jest -- --coverage",
|
|
23
|
+
"test:jest:snapshot": "pnpm run test:jest -- -u",
|
|
24
|
+
"test:snapshot": "pnpm run test -u",
|
|
25
25
|
"test:tsd": "ynpx tsd",
|
|
26
26
|
"npm:publish": "npm publish",
|
|
27
|
-
"preversion": "
|
|
27
|
+
"preversion": "pnpm run test",
|
|
28
28
|
"prepublishOnly": "echo prepublishOnly",
|
|
29
29
|
"postpublish_": "git commit -m \"chore(release): publish\" .",
|
|
30
30
|
"ncu": "npx yarn-tool ncu -u",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"tsc:showConfig": "ynpx get-current-tsconfig -p"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"fs-extra": "^11.
|
|
35
|
+
"fs-extra": "^11.4.0",
|
|
36
36
|
"tslib": ">=2.8.1"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "008888d233d299e89673cbc45a2712ba9bf825c1"
|
|
42
42
|
}
|
package/file/changelog-option.js
DELETED
package/file/jest.config.auto.js
DELETED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Jest 自動配置模組
|
|
5
|
-
* Jest Auto Configuration Module
|
|
6
|
-
*
|
|
7
|
-
* 此模組自動偵測並配置 Jest 測試環境,支援多層級配置解析
|
|
8
|
-
* This module automatically detects and configures Jest test environment with multi-level configuration resolution
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const { basename, extname, dirname } = require('path');
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Jest 配置物件
|
|
15
|
-
* Jest configuration object
|
|
16
|
-
*
|
|
17
|
-
* @type { import('ts-jest').JestConfigWithTsJest }
|
|
18
|
-
*/
|
|
19
|
-
let jestConfig = {}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* 嘗試使用 `@yarn-tool/require-resolve` 載入模組的工具函數
|
|
23
|
-
* Utility function for lazy loading modules
|
|
24
|
-
*
|
|
25
|
-
* @param {string} name - 模組名稱 Module name
|
|
26
|
-
* @param {string[]} [paths] - 搜尋路徑 Search paths
|
|
27
|
-
* @private
|
|
28
|
-
*/
|
|
29
|
-
function _lazyRequire(name, paths)
|
|
30
|
-
{
|
|
31
|
-
let m;
|
|
32
|
-
try
|
|
33
|
-
{
|
|
34
|
-
/**
|
|
35
|
-
* 嘗試使用 require-resolve 工具載入模組
|
|
36
|
-
* Try to load module using require-resolve tool
|
|
37
|
-
*/
|
|
38
|
-
m = require('@yarn-tool/require-resolve').requireExtra(name, {
|
|
39
|
-
includeCurrentDirectory: true,
|
|
40
|
-
includeGlobal: true,
|
|
41
|
-
paths,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
catch (e)
|
|
45
|
-
{}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* 如果失敗則使用標準 require
|
|
49
|
-
* If failed, use standard require
|
|
50
|
-
*/
|
|
51
|
-
return typeof m === 'undefined' ? require(name) : m;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* 嘗試使用 `@yarn-tool/require-resolve` 解析模組路徑的工具函數
|
|
56
|
-
* Utility function for resolving module paths
|
|
57
|
-
*
|
|
58
|
-
* @param {string} name - 模組名稱 Module name
|
|
59
|
-
* @returns {string} - 解析後的路徑 Resolved path
|
|
60
|
-
* @private
|
|
61
|
-
*/
|
|
62
|
-
function _requireResolve(name)
|
|
63
|
-
{
|
|
64
|
-
let result;
|
|
65
|
-
|
|
66
|
-
try
|
|
67
|
-
{
|
|
68
|
-
/** @type {import('@yarn-tool/require-resolve')} */
|
|
69
|
-
const { requireResolveExtra, requireResolveCore } = _lazyRequire('@yarn-tool/require-resolve');
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* 嘗試從多個路徑解析 TSDX 相關模組
|
|
73
|
-
* Try to resolve TSDX related modules from multiple paths
|
|
74
|
-
*/
|
|
75
|
-
const paths = [
|
|
76
|
-
requireResolveExtra('@bluelovers/tsdx').result,
|
|
77
|
-
requireResolveExtra('tsdx').result,
|
|
78
|
-
].filter(Boolean);
|
|
79
|
-
|
|
80
|
-
result = requireResolveCore(name, {
|
|
81
|
-
includeGlobal: true,
|
|
82
|
-
includeCurrentDirectory: true,
|
|
83
|
-
paths,
|
|
84
|
-
})
|
|
85
|
-
}
|
|
86
|
-
catch (e)
|
|
87
|
-
{
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* 如果都失敗,使用標準 resolve
|
|
93
|
-
* If all failed, use standard resolve
|
|
94
|
-
*/
|
|
95
|
-
result = result || require.resolve(name);
|
|
96
|
-
|
|
97
|
-
console.info('[require.resolve]', name, '=>', result)
|
|
98
|
-
|
|
99
|
-
return result
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* 配置解析狀態標誌
|
|
104
|
-
* Configuration resolution status flag
|
|
105
|
-
*/
|
|
106
|
-
let _isNeedConfig = true;
|
|
107
|
-
|
|
108
|
-
try
|
|
109
|
-
{
|
|
110
|
-
/**
|
|
111
|
-
* 第一層:搜尋工作區中的配置檔案
|
|
112
|
-
* First level: Search for configuration files in workspace
|
|
113
|
-
*/
|
|
114
|
-
if (!jestConfig.preset)
|
|
115
|
-
{
|
|
116
|
-
/** @type {import('@yarn-tool/ws-find-up-paths')} */
|
|
117
|
-
const { findUpPathsWorkspaces } = _lazyRequire('@yarn-tool/ws-find-up-paths');
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* 向上搜尋 jest-preset.js 和 jest.config.js
|
|
121
|
-
* Search upwards for jest-preset.js and jest.config.js
|
|
122
|
-
*/
|
|
123
|
-
let result = findUpPathsWorkspaces([
|
|
124
|
-
'jest-preset.js',
|
|
125
|
-
'jest.config.js',
|
|
126
|
-
], {
|
|
127
|
-
/** 忽略當前套件 / Ignore current package */
|
|
128
|
-
ignoreCurrentPackage: true,
|
|
129
|
-
/** 只搜尋檔案 / Only search for files */
|
|
130
|
-
onlyFiles: true,
|
|
131
|
-
}).result;
|
|
132
|
-
|
|
133
|
-
if (result)
|
|
134
|
-
{
|
|
135
|
-
let name = basename(result, extname(result))
|
|
136
|
-
|
|
137
|
-
switch (name)
|
|
138
|
-
{
|
|
139
|
-
/**
|
|
140
|
-
* 如果是 jest-preset.js,使用其目錄作為 preset
|
|
141
|
-
* If it's jest-preset.js, use its directory as preset
|
|
142
|
-
*/
|
|
143
|
-
case 'jest-preset':
|
|
144
|
-
// @ts-ignore
|
|
145
|
-
jestConfig.preset = dirname(result);
|
|
146
|
-
break;
|
|
147
|
-
/**
|
|
148
|
-
* 其他情況,載入配置檔案內容
|
|
149
|
-
* Otherwise, load the configuration file content
|
|
150
|
-
*/
|
|
151
|
-
default:
|
|
152
|
-
jestConfig = {
|
|
153
|
-
...require(result),
|
|
154
|
-
jestConfig,
|
|
155
|
-
};
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
_isNeedConfig = false;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
catch (e)
|
|
164
|
-
{
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
try
|
|
169
|
-
{
|
|
170
|
-
/**
|
|
171
|
-
* 第二層:嘗試解析 @bluelovers/jest-config
|
|
172
|
-
* Second level: Try to resolve @bluelovers/jest-config
|
|
173
|
-
*/
|
|
174
|
-
if (_isNeedConfig && !jestConfig.preset)
|
|
175
|
-
{
|
|
176
|
-
let result = _requireResolve('@bluelovers/jest-config/package.json');
|
|
177
|
-
if (result)
|
|
178
|
-
{
|
|
179
|
-
// @ts-ignore
|
|
180
|
-
jestConfig.preset = dirname(result);
|
|
181
|
-
_isNeedConfig = false;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
catch (e)
|
|
186
|
-
{
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (_isNeedConfig && !jestConfig.preset)
|
|
191
|
-
{
|
|
192
|
-
/**
|
|
193
|
-
* 第三層:使用預設的 @bluelovers/jest-config
|
|
194
|
-
* Third level: Use default @bluelovers/jest-config
|
|
195
|
-
*/
|
|
196
|
-
// @ts-ignore
|
|
197
|
-
jestConfig.preset = '@bluelovers/jest-config';
|
|
198
|
-
_isNeedConfig = false;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* 輸出最終的 preset 設定
|
|
203
|
-
* Output the final preset configuration
|
|
204
|
-
*/
|
|
205
|
-
console.info(`jest.config.preset: ${jestConfig.preset}`);
|
|
206
|
-
|
|
207
|
-
module.exports = jestConfig
|
package/file/jest.config.js
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
// @deprecated replace by jest.config.auto.js
|
|
3
|
-
|
|
4
|
-
const { join, dirname } = require('path');
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
const { tryRealpath } = require('jest-util');
|
|
7
|
-
const { tmpdir } = require('os');
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @param {string} name
|
|
11
|
-
* @returns {string}
|
|
12
|
-
* @private
|
|
13
|
-
*/
|
|
14
|
-
function _requireResolve(name)
|
|
15
|
-
{
|
|
16
|
-
let result;
|
|
17
|
-
|
|
18
|
-
try
|
|
19
|
-
{
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
const { requireResolveExtra, requireResolveCore } = require('@yarn-tool/require-resolve');
|
|
22
|
-
|
|
23
|
-
const paths = [
|
|
24
|
-
requireResolveExtra('@bluelovers/tsdx').result,
|
|
25
|
-
requireResolveExtra('tsdx').result,
|
|
26
|
-
].filter(Boolean);
|
|
27
|
-
|
|
28
|
-
result = requireResolveCore(name, {
|
|
29
|
-
includeGlobal: true,
|
|
30
|
-
includeCurrentDirectory: true,
|
|
31
|
-
paths,
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
catch (e)
|
|
35
|
-
{
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
result = result || require.resolve(name);
|
|
40
|
-
|
|
41
|
-
console.info('[require.resolve]', name, '=>', result)
|
|
42
|
-
|
|
43
|
-
return result
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @returns {string}
|
|
48
|
-
* @see https://github.com/facebook/jest/blob/main/packages/jest-config/src/getCacheDirectory.ts
|
|
49
|
-
*/
|
|
50
|
-
function getCacheDirectory()
|
|
51
|
-
{
|
|
52
|
-
const { getuid } = process;
|
|
53
|
-
const tmpdirPath = process.env['JEST_CACHE_DIRECTORY'] || join(tryRealpath(tmpdir()), 'jest');
|
|
54
|
-
if (getuid == null)
|
|
55
|
-
{
|
|
56
|
-
return tmpdirPath;
|
|
57
|
-
}
|
|
58
|
-
else
|
|
59
|
-
{
|
|
60
|
-
// On some platforms tmpdir() is `/tmp`, causing conflicts between different
|
|
61
|
-
// users and permission issues. Adding an additional subdivision by UID can
|
|
62
|
-
// help.
|
|
63
|
-
return `${tmpdirPath}_${getuid.call(process).toString(36)}`;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const testExt = [
|
|
68
|
-
'ts',
|
|
69
|
-
'tsx',
|
|
70
|
-
'mts',
|
|
71
|
-
'cts',
|
|
72
|
-
//'js',
|
|
73
|
-
//'jsx',
|
|
74
|
-
// 'mjs',
|
|
75
|
-
// 'cjs',
|
|
76
|
-
].join('|');
|
|
77
|
-
|
|
78
|
-
const cacheDirectory = getCacheDirectory();
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* @_type { import('@jest/types').Config.InitialOptions }
|
|
82
|
-
* @type { import('ts-jest').InitialOptionsTsJest }
|
|
83
|
-
*/
|
|
84
|
-
const jestConfig = {
|
|
85
|
-
globals: {
|
|
86
|
-
'ts-jest': {
|
|
87
|
-
//tsconfig: 'tsconfig.spec.json',
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
cacheDirectory,
|
|
91
|
-
maxWorkers: 1,
|
|
92
|
-
clearMocks: true,
|
|
93
|
-
passWithNoTests: true,
|
|
94
|
-
moduleFileExtensions: [
|
|
95
|
-
'ts',
|
|
96
|
-
'tsx',
|
|
97
|
-
'mts',
|
|
98
|
-
'cts',
|
|
99
|
-
'js',
|
|
100
|
-
'jsx',
|
|
101
|
-
'mjs',
|
|
102
|
-
'cjs',
|
|
103
|
-
'json',
|
|
104
|
-
'node',
|
|
105
|
-
],
|
|
106
|
-
testEnvironment: 'node',
|
|
107
|
-
//testMatch: ['**/*.test.ts', '**/*.spec.ts'],
|
|
108
|
-
testMatch: void 0,
|
|
109
|
-
testRegex: [
|
|
110
|
-
`\\.(tests?|spec)\\.(${testExt})$`,
|
|
111
|
-
`__tests__\/\.*\\.(${testExt})$`,
|
|
112
|
-
],
|
|
113
|
-
testPathIgnorePatterns: [
|
|
114
|
-
'/node_modules/',
|
|
115
|
-
'/__fixtures__/',
|
|
116
|
-
'/fixtures/',
|
|
117
|
-
'/__tests__/helpers/',
|
|
118
|
-
'/__tests__/utils/',
|
|
119
|
-
'__mocks__',
|
|
120
|
-
'/dist/',
|
|
121
|
-
],
|
|
122
|
-
//testRunner: 'jest-circus/runner',
|
|
123
|
-
setupFilesAfterEnv: [
|
|
124
|
-
//"jest-chain",
|
|
125
|
-
//"jest-extended/all",
|
|
126
|
-
//"jest-extended-extra",
|
|
127
|
-
//"jest-num-close-with",
|
|
128
|
-
/**
|
|
129
|
-
* https://medium.com/doctolib/how-to-run-the-same-jest-test-suite-across-several-platforms-jest-os-detection-plugin-included-f8113832482b
|
|
130
|
-
* https://github.com/doctolib/jest-os-detection
|
|
131
|
-
*/
|
|
132
|
-
//'jest-os-detection',
|
|
133
|
-
],
|
|
134
|
-
transform: {
|
|
135
|
-
'.(ts|tsx|mts|cts)$': _requireResolve('ts-jest'),
|
|
136
|
-
},
|
|
137
|
-
verbose: true,
|
|
138
|
-
/**
|
|
139
|
-
* if didn't set `coverageProvider` to `v8`
|
|
140
|
-
* with `collectCoverage` `true`, nodejs debug point maybe will fail
|
|
141
|
-
*/
|
|
142
|
-
coverageProvider: 'v8',
|
|
143
|
-
collectCoverage: false,
|
|
144
|
-
coveragePathIgnorePatterns: [
|
|
145
|
-
'/node_modules/',
|
|
146
|
-
'/__snapshots__/',
|
|
147
|
-
'/__tests__/',
|
|
148
|
-
'/__test__/',
|
|
149
|
-
//'**/node_modules/',
|
|
150
|
-
//'**/__snapshots__/',
|
|
151
|
-
//'**/__tests__/',
|
|
152
|
-
'/dist/',
|
|
153
|
-
'/test/',
|
|
154
|
-
'/fixture/',
|
|
155
|
-
],
|
|
156
|
-
/**
|
|
157
|
-
* https://github.com/facebook/jest/issues/9771#issuecomment-872764344
|
|
158
|
-
*/
|
|
159
|
-
//resolver: 'jest-node-exports-resolver',
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/*
|
|
163
|
-
try
|
|
164
|
-
{
|
|
165
|
-
if (!jestConfig.preset)
|
|
166
|
-
{
|
|
167
|
-
let result = require('@yarn-tool/ws-find-up-paths').findUpPathsWorkspaces('jest.config.js', {
|
|
168
|
-
ignoreCurrentPackage: true,
|
|
169
|
-
onlyFiles: true,
|
|
170
|
-
}).result;
|
|
171
|
-
if (result)
|
|
172
|
-
{
|
|
173
|
-
jestConfig.preset = result;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
catch (e)
|
|
178
|
-
{
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
*/
|
|
182
|
-
|
|
183
|
-
try
|
|
184
|
-
{
|
|
185
|
-
if (!jestConfig.preset)
|
|
186
|
-
{
|
|
187
|
-
let result = _requireResolve('@bluelovers/jest-config/package.json');
|
|
188
|
-
if (result)
|
|
189
|
-
{
|
|
190
|
-
jestConfig.preset = dirname(result);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
catch (e)
|
|
195
|
-
{
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
console.info(`jest.config`);
|
|
200
|
-
console.info(`- file: ${__filename}`);
|
|
201
|
-
console.info(`- cwd: ${process.cwd()}`);
|
|
202
|
-
console.info(`- cacheDirectory: ${cacheDirectory}`);
|
|
203
|
-
console.info(`- preset: ${jestConfig.preset}`);
|
|
204
|
-
|
|
205
|
-
module.exports = jestConfig
|
package/file/test/__root.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 測試路徑架構 / Test Path Structure
|
|
3
|
-
*
|
|
4
|
-
* test/
|
|
5
|
-
* ├── fixtures/ ← 測試資料夾(唯讀)
|
|
6
|
-
* └── temp/ ← 臨時檔案(可寫,永遠建立子資料夾)
|
|
7
|
-
* ├── fake-lib/
|
|
8
|
-
* └── temp-pkg/
|
|
9
|
-
*/
|
|
10
|
-
/// <reference types="node" />
|
|
11
|
-
import path from 'upath2';
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
import { __ROOT_CORE as __ROOT } from './__root-core.cjs';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 專案根目錄
|
|
17
|
-
*/
|
|
18
|
-
export { __ROOT }
|
|
19
|
-
|
|
20
|
-
export const isWin = process.platform === "win32";
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* 測試資料夾
|
|
24
|
-
*
|
|
25
|
-
* @default test
|
|
26
|
-
*/
|
|
27
|
-
export const __TEST_ROOT = path.join(__ROOT, 'test');
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* 測試資料夾(唯讀)
|
|
31
|
-
*
|
|
32
|
-
* @default test/fixtures
|
|
33
|
-
*/
|
|
34
|
-
export const __TEST_FIXTURES = path.join(__TEST_ROOT, 'fixtures');
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* 臨時檔案(可寫,永遠建立子資料夾)
|
|
38
|
-
*
|
|
39
|
-
* test/
|
|
40
|
-
* ├── fixtures/ ← 測試資料夾(唯讀)
|
|
41
|
-
* └── temp/ ← 臨時檔案(可寫,永遠建立子資料夾)
|
|
42
|
-
* ├── fake-lib/
|
|
43
|
-
* └── temp-pkg/
|
|
44
|
-
*
|
|
45
|
-
* @default test/temp
|
|
46
|
-
*/
|
|
47
|
-
export const __TEST_TEMP = path.join(__TEST_ROOT, 'temp');
|
|
File without changes
|
package/file/test/temp.ts
DELETED
package/file/tsc-multi.json.tpl
DELETED
package/file/tsconfig.json
DELETED
package/file/tsdx.config.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Not transpiled with TypeScript or Babel, so use plain Es6/Node.js!
|
|
2
|
-
module.exports = {
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This function will run for each entry/format/env combination
|
|
6
|
-
*/
|
|
7
|
-
rollup(config, options) {
|
|
8
|
-
|
|
9
|
-
config.output.preferConst = true;
|
|
10
|
-
|
|
11
|
-
return config;
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// DO NOT EDIT THIS FILE
|
|
2
|
-
const { resolve } = require('path');
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @_type { import('@jest/types').Config.InitialOptions }
|
|
6
|
-
* @_type { import('ts-jest').InitialOptionsTsJest }
|
|
7
|
-
* @type { import('ts-jest').JestConfigWithTsJest }
|
|
8
|
-
*/
|
|
9
|
-
const jestConfig = {
|
|
10
|
-
preset: __dirname,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
module.exports = jestConfig
|