skuba 7.3.1 → 7.4.0-horrible-hacks-20240206024353

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.
Files changed (207) hide show
  1. package/README.md +3 -3
  2. package/jest/transform.test.ts +3 -1
  3. package/lib/api/jest/index.d.ts +1 -1
  4. package/lib/api/jest/index.js.map +2 -2
  5. package/lib/cli/adapter/prettier.d.ts +1 -1
  6. package/lib/cli/adapter/prettier.js +11 -10
  7. package/lib/cli/adapter/prettier.js.map +2 -2
  8. package/lib/cli/build/index.js +0 -2
  9. package/lib/cli/build/index.js.map +2 -2
  10. package/lib/cli/buildPackage.js +0 -2
  11. package/lib/cli/buildPackage.js.map +2 -2
  12. package/lib/cli/configure/analyseConfiguration.d.ts +2 -0
  13. package/lib/cli/configure/analyseConfiguration.js.map +2 -2
  14. package/lib/cli/configure/getEntryPoint.js +1 -1
  15. package/lib/cli/configure/getEntryPoint.js.map +2 -2
  16. package/lib/cli/configure/getProjectType.js +1 -1
  17. package/lib/cli/configure/getProjectType.js.map +2 -2
  18. package/lib/cli/configure/index.js +11 -8
  19. package/lib/cli/configure/index.js.map +2 -2
  20. package/lib/cli/configure/modules/index.js +0 -2
  21. package/lib/cli/configure/modules/index.js.map +2 -2
  22. package/lib/cli/configure/modules/package.d.ts +1 -1
  23. package/lib/cli/configure/modules/package.js +2 -1
  24. package/lib/cli/configure/modules/package.js.map +2 -2
  25. package/lib/cli/configure/patchRenovateConfig.d.ts +2 -1
  26. package/lib/cli/configure/patchRenovateConfig.js +23 -10
  27. package/lib/cli/configure/patchRenovateConfig.js.map +2 -2
  28. package/lib/cli/configure/types.d.ts +2 -0
  29. package/lib/cli/configure/types.js.map +1 -1
  30. package/lib/cli/configure/upgrade/index.d.ts +15 -0
  31. package/lib/cli/configure/upgrade/index.js +130 -0
  32. package/lib/cli/configure/upgrade/index.js.map +7 -0
  33. package/lib/cli/configure/{addEmptyExports.d.ts → upgrade/patches/7.3.1/addEmptyExports.d.ts} +2 -2
  34. package/lib/cli/configure/{addEmptyExports.js → upgrade/patches/7.3.1/addEmptyExports.js} +15 -11
  35. package/lib/cli/configure/upgrade/patches/7.3.1/addEmptyExports.js.map +7 -0
  36. package/lib/cli/configure/upgrade/patches/7.3.1/index.d.ts +2 -0
  37. package/lib/cli/configure/upgrade/patches/7.3.1/index.js +55 -0
  38. package/lib/cli/configure/upgrade/patches/7.3.1/index.js.map +7 -0
  39. package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.d.ts +2 -0
  40. package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.js +94 -0
  41. package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.js.map +7 -0
  42. package/lib/cli/configure/upgrade/patches/7.3.1/patchDockerfile.d.ts +2 -0
  43. package/lib/cli/configure/{patchDockerfile.js → upgrade/patches/7.3.1/patchDockerfile.js} +18 -12
  44. package/lib/cli/configure/upgrade/patches/7.3.1/patchDockerfile.js.map +7 -0
  45. package/lib/cli/configure/upgrade/patches/7.3.1/patchServerListener.d.ts +2 -0
  46. package/lib/cli/configure/{patchServerListener.js → upgrade/patches/7.3.1/patchServerListener.js} +18 -14
  47. package/lib/cli/configure/upgrade/patches/7.3.1/patchServerListener.js.map +7 -0
  48. package/lib/cli/format.js +7 -14
  49. package/lib/cli/format.js.map +2 -2
  50. package/lib/cli/init/getConfig.d.ts +4 -2
  51. package/lib/cli/init/getConfig.js +53 -26
  52. package/lib/cli/init/getConfig.js.map +2 -2
  53. package/lib/cli/init/git.d.ts +2 -1
  54. package/lib/cli/init/git.js +2 -9
  55. package/lib/cli/init/git.js.map +2 -2
  56. package/lib/cli/init/index.d.ts +1 -1
  57. package/lib/cli/init/index.js +19 -9
  58. package/lib/cli/init/index.js.map +2 -2
  59. package/lib/cli/init/prompts.d.ts +26 -3
  60. package/lib/cli/init/prompts.js +10 -2
  61. package/lib/cli/init/prompts.js.map +2 -2
  62. package/lib/cli/init/types.d.ts +21 -0
  63. package/lib/cli/init/types.js +5 -1
  64. package/lib/cli/init/types.js.map +2 -2
  65. package/lib/cli/init/writePackageJson.d.ts +6 -0
  66. package/lib/cli/init/writePackageJson.js.map +2 -2
  67. package/lib/cli/lint/annotate/buildkite/index.d.ts +2 -1
  68. package/lib/cli/lint/annotate/buildkite/index.js +5 -3
  69. package/lib/cli/lint/annotate/buildkite/index.js.map +2 -2
  70. package/lib/cli/lint/annotate/buildkite/internal.d.ts +2 -0
  71. package/lib/cli/lint/annotate/buildkite/internal.js +45 -0
  72. package/lib/cli/lint/annotate/buildkite/internal.js.map +7 -0
  73. package/lib/cli/lint/annotate/github/index.d.ts +2 -1
  74. package/lib/cli/lint/annotate/github/index.js +4 -2
  75. package/lib/cli/lint/annotate/github/index.js.map +2 -2
  76. package/lib/cli/lint/annotate/github/internal.d.ts +3 -0
  77. package/lib/cli/lint/annotate/github/internal.js +36 -0
  78. package/lib/cli/lint/annotate/github/internal.js.map +7 -0
  79. package/lib/cli/lint/annotate/index.d.ts +4 -3
  80. package/lib/cli/lint/annotate/index.js +9 -3
  81. package/lib/cli/lint/annotate/index.js.map +2 -2
  82. package/lib/cli/lint/autofix.d.ts +3 -1
  83. package/lib/cli/lint/autofix.js +36 -59
  84. package/lib/cli/lint/autofix.js.map +3 -3
  85. package/lib/cli/lint/external.d.ts +6 -1
  86. package/lib/cli/lint/external.js +6 -29
  87. package/lib/cli/lint/external.js.map +2 -2
  88. package/lib/cli/lint/index.d.ts +2 -1
  89. package/lib/cli/lint/index.js +46 -14
  90. package/lib/cli/lint/index.js.map +2 -2
  91. package/lib/cli/lint/internal.d.ts +12 -1
  92. package/lib/cli/lint/internal.js +55 -19
  93. package/lib/cli/lint/internal.js.map +3 -3
  94. package/lib/cli/lint/internalLints/deleteFiles.d.ts +3 -0
  95. package/lib/cli/lint/internalLints/deleteFiles.js +102 -0
  96. package/lib/cli/lint/internalLints/deleteFiles.js.map +7 -0
  97. package/lib/cli/lint/internalLints/noSkubaTemplateJs.d.ts +3 -0
  98. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +75 -0
  99. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +7 -0
  100. package/lib/cli/lint/internalLints/refreshConfigFiles.d.ts +11 -0
  101. package/lib/cli/lint/internalLints/refreshConfigFiles.js +147 -0
  102. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +7 -0
  103. package/lib/cli/test/index.js +0 -2
  104. package/lib/cli/test/index.js.map +2 -2
  105. package/lib/skuba.d.ts +1 -1
  106. package/lib/skuba.js.map +1 -1
  107. package/lib/utils/exec.d.ts +2 -1
  108. package/lib/utils/exec.js +1 -0
  109. package/lib/utils/exec.js.map +2 -2
  110. package/lib/utils/logging.d.ts +2 -0
  111. package/lib/utils/logging.js +1 -0
  112. package/lib/utils/logging.js.map +2 -2
  113. package/lib/utils/logo.js +6 -10
  114. package/lib/utils/logo.js.map +3 -3
  115. package/lib/utils/manifest.d.ts +1 -1
  116. package/lib/utils/manifest.js +1 -1
  117. package/lib/utils/manifest.js.map +2 -2
  118. package/lib/utils/npmrc.d.ts +1 -0
  119. package/lib/utils/npmrc.js +29 -0
  120. package/lib/utils/npmrc.js.map +7 -0
  121. package/lib/utils/packageManager.d.ts +24 -0
  122. package/lib/utils/packageManager.js +97 -0
  123. package/lib/utils/packageManager.js.map +7 -0
  124. package/lib/utils/template.d.ts +3 -0
  125. package/lib/utils/template.js +2 -0
  126. package/lib/utils/template.js.map +2 -2
  127. package/lib/utils/worker.d.ts +1 -0
  128. package/lib/wrapper/http.d.ts +1 -0
  129. package/package.json +39 -36
  130. package/template/base/_.dockerignore +0 -1
  131. package/template/base/_.eslintignore +1 -0
  132. package/template/base/_.gitignore +1 -1
  133. package/template/base/_.npmrc +8 -0
  134. package/template/express-rest-api/.buildkite/pipeline.yml +13 -10
  135. package/template/express-rest-api/.gantry/dev.yml +3 -0
  136. package/template/express-rest-api/Dockerfile +6 -12
  137. package/template/express-rest-api/Dockerfile.dev-deps +6 -5
  138. package/template/express-rest-api/README.md +6 -6
  139. package/template/express-rest-api/docker-compose.yml +0 -10
  140. package/template/express-rest-api/gantry.apply.yml +5 -0
  141. package/template/express-rest-api/gantry.build.yml +1 -2
  142. package/template/express-rest-api/package.json +2 -2
  143. package/template/express-rest-api/skuba.template.js +1 -0
  144. package/template/greeter/.buildkite/pipeline.yml +12 -9
  145. package/template/greeter/Dockerfile +6 -5
  146. package/template/greeter/README.md +6 -6
  147. package/template/greeter/docker-compose.yml +0 -10
  148. package/template/greeter/package.json +1 -1
  149. package/template/greeter/skuba.template.js +1 -0
  150. package/template/koa-rest-api/.buildkite/pipeline.yml +13 -10
  151. package/template/koa-rest-api/.gantry/dev.yml +3 -0
  152. package/template/koa-rest-api/.nvmrc +1 -1
  153. package/template/koa-rest-api/Dockerfile +6 -12
  154. package/template/koa-rest-api/Dockerfile.dev-deps +6 -5
  155. package/template/koa-rest-api/README.md +6 -6
  156. package/template/koa-rest-api/docker-compose.yml +0 -10
  157. package/template/koa-rest-api/gantry.apply.yml +5 -0
  158. package/template/koa-rest-api/gantry.build.yml +1 -2
  159. package/template/koa-rest-api/package.json +8 -6
  160. package/template/koa-rest-api/skuba.template.js +1 -0
  161. package/template/koa-rest-api/src/framework/validation.test.ts +48 -15
  162. package/template/koa-rest-api/src/framework/validation.ts +31 -8
  163. package/template/koa-rest-api/src/testing/types.ts +16 -4
  164. package/template/lambda-sqs-worker/.buildkite/pipeline.yml +21 -15
  165. package/template/lambda-sqs-worker/Dockerfile +6 -6
  166. package/template/lambda-sqs-worker/README.md +8 -8
  167. package/template/lambda-sqs-worker/_.npmrc +12 -0
  168. package/template/lambda-sqs-worker/docker-compose.yml +0 -15
  169. package/template/lambda-sqs-worker/package.json +3 -4
  170. package/template/lambda-sqs-worker/serverless.yml +4 -1
  171. package/template/lambda-sqs-worker/skuba.template.js +1 -0
  172. package/template/lambda-sqs-worker/src/hooks.ts +1 -2
  173. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +42 -18
  174. package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
  175. package/template/lambda-sqs-worker-cdk/Dockerfile +9 -7
  176. package/template/lambda-sqs-worker-cdk/cdk.json +12 -6
  177. package/template/lambda-sqs-worker-cdk/docker-compose.yml +0 -15
  178. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +1587 -225
  179. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +23 -3
  180. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +127 -14
  181. package/template/lambda-sqs-worker-cdk/package.json +5 -3
  182. package/template/lambda-sqs-worker-cdk/shared/context-types.ts +1 -0
  183. package/template/lambda-sqs-worker-cdk/skuba.template.js +1 -0
  184. package/template/lambda-sqs-worker-cdk/src/app.ts +14 -1
  185. package/template/lambda-sqs-worker-cdk/src/postHook.ts +154 -0
  186. package/template/lambda-sqs-worker-cdk/src/preHook.ts +95 -0
  187. package/template/oss-npm-package/.github/workflows/release.yml +10 -7
  188. package/template/oss-npm-package/.github/workflows/validate.yml +10 -7
  189. package/template/oss-npm-package/.releaserc +16 -0
  190. package/template/oss-npm-package/README.md +17 -17
  191. package/template/oss-npm-package/_package.json +3 -2
  192. package/template/oss-npm-package/skuba.template.js +1 -0
  193. package/template/private-npm-package/.releaserc +16 -0
  194. package/template/private-npm-package/README.md +16 -16
  195. package/template/private-npm-package/_package.json +3 -3
  196. package/template/private-npm-package/skuba.template.js +1 -0
  197. package/lib/cli/configure/addEmptyExports.js.map +0 -7
  198. package/lib/cli/configure/modules/tsconfig.d.ts +0 -2
  199. package/lib/cli/configure/modules/tsconfig.js +0 -87
  200. package/lib/cli/configure/modules/tsconfig.js.map +0 -7
  201. package/lib/cli/configure/patchDockerfile.d.ts +0 -1
  202. package/lib/cli/configure/patchDockerfile.js.map +0 -7
  203. package/lib/cli/configure/patchServerListener.d.ts +0 -3
  204. package/lib/cli/configure/patchServerListener.js.map +0 -7
  205. package/lib/cli/configure/refreshIgnoreFiles.d.ts +0 -3
  206. package/lib/cli/configure/refreshIgnoreFiles.js +0 -78
  207. package/lib/cli/configure/refreshIgnoreFiles.js.map +0 -7
@@ -39,33 +39,33 @@ log();
39
39
  ### Prerequisites
40
40
 
41
41
  - Node.js LTS
42
- - Yarn 1.x
42
+ - pnpm
43
43
 
44
44
  ```shell
45
- yarn install
45
+ pnpm install
46
46
  ```
47
47
 
48
48
  ### Test
49
49
 
50
50
  ```shell
51
- yarn test
51
+ pnpm run test
52
52
  ```
53
53
 
54
54
  ### Lint
55
55
 
56
56
  ```shell
57
57
  # Fix issues
58
- yarn format
58
+ pnpm run format
59
59
 
60
60
  # Check for issues
61
- yarn lint
61
+ pnpm run lint
62
62
  ```
63
63
 
64
64
  ### Package
65
65
 
66
66
  ```shell
67
67
  # Compile source
68
- yarn build
68
+ pnpm run build
69
69
 
70
70
  # Review bundle
71
71
  npm pack
@@ -82,8 +82,8 @@ on:
82
82
  push:
83
83
  branches:
84
84
  # add others as necessary
85
+ - $default-branch
85
86
  - beta
86
- - master
87
87
  # - alpha
88
88
  ```
89
89
 
@@ -94,13 +94,13 @@ To set up this repo for publishing, follow the instructions in our [OSS npm pack
94
94
  ### Commit messages
95
95
 
96
96
  This package is published with **[semantic-release]**, which requires a particular commit format to manage semantic versioning.
97
- You can run the interactive `yarn commit` command in place of `git commit` to generate a compliant commit title and message.
97
+ You can run the interactive `pnpm run commit` command in place of `git commit` to generate a compliant commit title and message.
98
98
  If you use the `Squash and merge` option on pull requests, take extra care to format the squashed commit in the GitHub UI before merging.
99
99
 
100
100
  ### Releasing latest
101
101
 
102
- Commits to the `master` branch will be released with the `latest` tag,
103
- which is the default used when running `npm install` or `yarn install`.
102
+ Commits to the `<%- defaultBranch %>` branch will be released with the `latest` tag,
103
+ which is the default used when running `npm install` or `pnpm install`.
104
104
 
105
105
  ### Releasing other dist-tags
106
106
 
@@ -110,13 +110,13 @@ You can push to other branches to manage betas, maintenance updates to prior maj
110
110
 
111
111
  Here are some branches that **semantic-release** supports by default:
112
112
 
113
- | Git branch | npm dist-tag |
114
- | :--------- | :----------- |
115
- | master | latest |
116
- | alpha | alpha |
117
- | beta | beta |
118
- | next | next |
119
- | 1.x | release-1.x |
113
+ | Git branch | npm dist-tag |
114
+ | :------------------- | :----------- |
115
+ | <%- defaultBranch %> | latest |
116
+ | alpha | alpha |
117
+ | beta | beta |
118
+ | next | next |
119
+ | 1.x | release-1.x |
120
120
 
121
121
  For more information, see the **semantic-release** docs on [triggering a release].
122
122
 
@@ -22,7 +22,7 @@
22
22
  "commit": "cz",
23
23
  "format": "skuba format",
24
24
  "lint": "skuba lint",
25
- "release": "yarn build && skuba release",
25
+ "release": "pnpm run --silent build && skuba release",
26
26
  "test": "skuba test",
27
27
  "test:ci": "skuba test --coverage",
28
28
  "test:watch": "skuba test --watch"
@@ -34,10 +34,11 @@
34
34
  },
35
35
  "dependencies": {},
36
36
  "devDependencies": {
37
- "@types/node": "^16.18.3",
37
+ "@types/node": "^18.19.8",
38
38
  "commitizen": "^4.2.4",
39
39
  "skuba": "*"
40
40
  },
41
+ "packageManager": "pnpm@8.9.0",
41
42
  "engines": {
42
43
  "node": ">=18.12"
43
44
  },
@@ -18,5 +18,6 @@ module.exports = {
18
18
  ],
19
19
  // `moduleName` is required for a valid `package.json`
20
20
  noSkip: true,
21
+ packageManager: 'pnpm',
21
22
  type: 'package',
22
23
  };
@@ -0,0 +1,16 @@
1
+ {
2
+ "branches": [
3
+ "+([0-9])?(.{+([0-9]),x}).x",
4
+ "<%- defaultBranch %>",
5
+ "next",
6
+ "next-major",
7
+ {
8
+ "name": "beta",
9
+ "prerelease": true
10
+ },
11
+ {
12
+ "name": "alpha",
13
+ "prerelease": true
14
+ }
15
+ ]
16
+ }
@@ -35,33 +35,33 @@ log();
35
35
  ### Prerequisites
36
36
 
37
37
  - Node.js LTS
38
- - Yarn 1.x
38
+ - pnpm
39
39
 
40
40
  ```shell
41
- yarn install
41
+ pnpm install
42
42
  ```
43
43
 
44
44
  ### Test
45
45
 
46
46
  ```shell
47
- yarn test
47
+ pnpm run test
48
48
  ```
49
49
 
50
50
  ### Lint
51
51
 
52
52
  ```shell
53
53
  # Fix issues
54
- yarn format
54
+ pnpm run format
55
55
 
56
56
  # Check for issues
57
- yarn lint
57
+ pnpm run lint
58
58
  ```
59
59
 
60
60
  ### Package
61
61
 
62
62
  ```shell
63
63
  # Compile source
64
- yarn build
64
+ pnpm run build
65
65
 
66
66
  # Review bundle
67
67
  npm pack
@@ -76,13 +76,13 @@ It depends on this repo being hosted on [SEEK-Jobs] with appropriate access.
76
76
  ### Commit messages
77
77
 
78
78
  This package is published with **[semantic-release]**, which requires a particular commit format to manage semantic versioning.
79
- You can run the interactive `yarn commit` command in place of `git commit` to generate a compliant commit title and message.
79
+ You can run the interactive `pnpm run commit` command in place of `git commit` to generate a compliant commit title and message.
80
80
  If you use the `Squash and merge` option on pull requests, take extra care to format the squashed commit in the GitHub UI before merging.
81
81
 
82
82
  ### Releasing latest
83
83
 
84
- Commits to the `master` branch will be released with the `latest` tag,
85
- which is the default used when running `npm install` or `yarn install`.
84
+ Commits to the `<%- defaultBranch %>` branch will be released with the `latest` tag,
85
+ which is the default used when running `npm install` or `pnpm install`.
86
86
 
87
87
  ### Releasing other dist-tags
88
88
 
@@ -92,13 +92,13 @@ You can push to other branches to manage betas, maintenance updates to prior maj
92
92
 
93
93
  Here are some branches that **semantic-release** supports by default:
94
94
 
95
- | Git branch | npm dist-tag |
96
- | :--------- | :----------- |
97
- | master | latest |
98
- | alpha | alpha |
99
- | beta | beta |
100
- | next | next |
101
- | 1.x | release-1.x |
95
+ | Git branch | npm dist-tag |
96
+ | :------------------- | :----------- |
97
+ | <%- defaultBranch %> | latest |
98
+ | alpha | alpha |
99
+ | beta | beta |
100
+ | next | next |
101
+ | 1.x | release-1.x |
102
102
 
103
103
  For more information, see the **semantic-release** docs on [triggering a release].
104
104
 
@@ -22,9 +22,9 @@
22
22
  "commit": "cz",
23
23
  "format": "skuba format",
24
24
  "lint": "skuba lint",
25
- "release": "yarn build && skuba release",
25
+ "release": "pnpm run --silent build && skuba release",
26
26
  "test": "skuba test --coverage",
27
- "test:ci": "yarn -s test",
27
+ "test:ci": "pnpm run --silent test",
28
28
  "test:watch": "skuba test --watch"
29
29
  },
30
30
  "config": {
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "dependencies": {},
36
36
  "devDependencies": {
37
- "@types/node": "^16.18.3",
37
+ "@types/node": "^18.19.8",
38
38
  "commitizen": "^4.2.4",
39
39
  "skuba": "*"
40
40
  },
@@ -20,5 +20,6 @@ module.exports = {
20
20
  ],
21
21
  // `moduleName` is required for a valid `package.json`
22
22
  noSkip: true,
23
+ packageManager: 'pnpm',
23
24
  type: 'package',
24
25
  };
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/cli/configure/addEmptyExports.ts"],
4
- "sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { log } from '../../utils/logging';\n\nimport { getDestinationManifest } from './analysis/package';\nimport { createDestinationFileReader } from './analysis/project';\nimport { formatPrettier } from './processing/prettier';\n\n// TODO: glob `**/jest.*setup*.ts`?\nexport const JEST_SETUP_FILES = ['jest.setup.ts', 'jest.setup.int.ts'];\n\nconst addEmptyExports = async () => {\n const manifest = await getDestinationManifest();\n\n const destinationRoot = path.dirname(manifest.path);\n\n const readDestinationFile = createDestinationFileReader(destinationRoot);\n\n const addEmptyExport = async (filename: string) => {\n const inputFile = await readDestinationFile(filename);\n\n if (\n !inputFile ||\n // The file appears to have an import or export so it should be compatible\n // with isolated modules. This is a very naive check that we don't want to\n // overcomplicate because it is invoked before many skuba commands.\n inputFile.includes('import ') ||\n inputFile.includes('export ')\n ) {\n return;\n }\n\n const data = await formatPrettier([inputFile, 'export {}'].join('\\n\\n'), {\n parser: 'typescript',\n });\n\n const filepath = path.join(destinationRoot, filename);\n\n await fs.promises.writeFile(filepath, data);\n };\n\n await Promise.all(JEST_SETUP_FILES.map(addEmptyExport));\n};\n\n/**\n * Tries to add an empty `export {}` statement to the bottom of Jest setup files\n * for compliance with TypeScript isolated modules.\n */\nexport const tryAddEmptyExports = async () => {\n try {\n await addEmptyExports();\n } catch (err) {\n log.warn('Failed to convert Jest setup files to isolated modules.');\n log.subtle(inspect(err));\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAwB;AAExB,sBAAe;AAEf,qBAAoB;AAEpB,qBAAuC;AACvC,qBAA4C;AAC5C,sBAA+B;AAGxB,MAAM,mBAAmB,CAAC,iBAAiB,mBAAmB;AAErE,MAAM,kBAAkB,YAAY;AAClC,QAAM,WAAW,UAAM,uCAAuB;AAE9C,QAAM,kBAAkB,YAAAA,QAAK,QAAQ,SAAS,IAAI;AAElD,QAAM,0BAAsB,4CAA4B,eAAe;AAEvE,QAAM,iBAAiB,OAAO,aAAqB;AACjD,UAAM,YAAY,MAAM,oBAAoB,QAAQ;AAEpD,QACE,CAAC;AAAA;AAAA;AAAA,IAID,UAAU,SAAS,SAAS,KAC5B,UAAU,SAAS,SAAS,GAC5B;AACA;AAAA,IACF;AAEA,UAAM,OAAO,UAAM,gCAAe,CAAC,WAAW,WAAW,EAAE,KAAK,MAAM,GAAG;AAAA,MACvE,QAAQ;AAAA,IACV,CAAC;AAED,UAAM,WAAW,YAAAA,QAAK,KAAK,iBAAiB,QAAQ;AAEpD,UAAM,gBAAAC,QAAG,SAAS,UAAU,UAAU,IAAI;AAAA,EAC5C;AAEA,QAAM,QAAQ,IAAI,iBAAiB,IAAI,cAAc,CAAC;AACxD;AAMO,MAAM,qBAAqB,YAAY;AAC5C,MAAI;AACF,UAAM,gBAAgB;AAAA,EACxB,SAAS,KAAK;AACZ,uBAAI,KAAK,yDAAyD;AAClE,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AAAA,EACzB;AACF;",
6
- "names": ["path", "fs"]
7
- }
@@ -1,2 +0,0 @@
1
- import type { Module, Options } from '../types';
2
- export declare const tsconfigModule: ({ firstRun, type, }: Options) => Promise<Module>;
@@ -1,87 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var tsconfig_exports = {};
20
- __export(tsconfig_exports, {
21
- tsconfigModule: () => tsconfigModule
22
- });
23
- module.exports = __toCommonJS(tsconfig_exports);
24
- var import_template = require("../../../utils/template");
25
- var import_validation = require("../../../utils/validation");
26
- var import_json = require("../processing/json");
27
- var import_loadFiles = require("../processing/loadFiles");
28
- var import_record = require("../processing/record");
29
- const tsconfigModule = async ({
30
- firstRun,
31
- type
32
- }) => {
33
- const [buildFile, baseFile] = await Promise.all([
34
- (0, import_template.readBaseTemplateFile)("tsconfig.build.json"),
35
- (0, import_template.readBaseTemplateFile)("tsconfig.json")
36
- ]);
37
- const baseData = (0, import_json.parseObject)(baseFile);
38
- if (type === "package" && (0, import_validation.hasProp)(baseData, "compilerOptions") && (0, import_validation.isObject)(baseData.compilerOptions)) {
39
- delete baseData.compilerOptions.baseUrl;
40
- delete baseData.compilerOptions.paths;
41
- }
42
- return {
43
- ...(0, import_loadFiles.loadFiles)("Dockerfile"),
44
- "tsconfig.build.json": (inputFile) => inputFile ?? buildFile,
45
- "tsconfig.json": (inputFile, files, initialFiles) => {
46
- const inputData = (0, import_json.parseObject)(inputFile);
47
- let outDir;
48
- if ((0, import_validation.hasProp)(inputData, "compilerOptions") && (0, import_validation.hasStringProp)(inputData.compilerOptions, "outDir")) {
49
- outDir = inputData.compilerOptions.outDir.replace(/\/$/, "");
50
- }
51
- if (outDir !== void 0 && outDir !== "lib") {
52
- files.Dockerfile = files.Dockerfile?.replace(
53
- new RegExp(`([^\\w])${outDir}([^\\w])`, "g"),
54
- "$1lib$2"
55
- );
56
- }
57
- if ((0, import_validation.hasProp)(baseData, "compilerOptions")) {
58
- if ((0, import_validation.hasProp)(baseData.compilerOptions, "lib") && (0, import_validation.hasProp)(inputData?.compilerOptions, "lib")) {
59
- delete baseData.compilerOptions.lib;
60
- }
61
- if ((0, import_validation.hasProp)(baseData.compilerOptions, "target") && (0, import_validation.hasProp)(inputData?.compilerOptions, "target")) {
62
- delete baseData.compilerOptions.target;
63
- }
64
- }
65
- const outputData = (0, import_record.merge)(inputData ?? {}, baseData);
66
- if ((0, import_validation.hasProp)(outputData, "exclude") && Array.isArray(outputData.exclude)) {
67
- const { exclude } = outputData;
68
- const hasLibStar = exclude.includes("lib*/**/*");
69
- outputData.exclude = exclude.filter(
70
- (pattern) => !(hasLibStar && (/* @__PURE__ */ new Set(["lib", "lib/**/*"])).has(pattern))
71
- );
72
- }
73
- if ((0, import_validation.hasProp)(outputData, "include") && !initialFiles["tsconfig.json"]?.includes("skuba/config/tsconfig.json")) {
74
- delete outputData.include;
75
- }
76
- if (firstRun && type === "package" && (0, import_validation.hasProp)(outputData, "compilerOptions") && (0, import_validation.isObject)(outputData.compilerOptions) && !outputData.compilerOptions.removeComments) {
77
- outputData.compilerOptions.removeComments = false;
78
- }
79
- return (0, import_json.formatObject)(outputData);
80
- }
81
- };
82
- };
83
- // Annotate the CommonJS export names for ESM import in node:
84
- 0 && (module.exports = {
85
- tsconfigModule
86
- });
87
- //# sourceMappingURL=tsconfig.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/cli/configure/modules/tsconfig.ts"],
4
- "sourcesContent": ["import { readBaseTemplateFile } from '../../../utils/template';\nimport { hasProp, hasStringProp, isObject } from '../../../utils/validation';\nimport { formatObject, parseObject } from '../processing/json';\nimport { loadFiles } from '../processing/loadFiles';\nimport { merge } from '../processing/record';\nimport type { Module, Options } from '../types';\n\nexport const tsconfigModule = async ({\n firstRun,\n type,\n}: Options): Promise<Module> => {\n const [buildFile, baseFile] = await Promise.all([\n readBaseTemplateFile('tsconfig.build.json'),\n readBaseTemplateFile('tsconfig.json'),\n ]);\n\n const baseData = parseObject(baseFile);\n\n // packages should not use module aliases\n if (\n type === 'package' &&\n hasProp(baseData, 'compilerOptions') &&\n isObject(baseData.compilerOptions)\n ) {\n delete baseData.compilerOptions.baseUrl;\n delete baseData.compilerOptions.paths;\n }\n\n return {\n ...loadFiles('Dockerfile'),\n\n 'tsconfig.build.json': (inputFile) => inputFile ?? buildFile,\n\n 'tsconfig.json': (inputFile, files, initialFiles) => {\n const inputData = parseObject(inputFile);\n\n let outDir: string | undefined;\n\n if (\n hasProp(inputData, 'compilerOptions') &&\n hasStringProp(inputData.compilerOptions, 'outDir')\n ) {\n outDir = inputData.compilerOptions.outDir.replace(/\\/$/, '');\n }\n\n // optimistically rewire Dockerfile for new output directory\n if (outDir !== undefined && outDir !== 'lib') {\n files.Dockerfile = files.Dockerfile?.replace(\n new RegExp(`([^\\\\w])${outDir}([^\\\\w])`, 'g'),\n '$1lib$2',\n );\n }\n\n // existing project may target earlier Node.js versions than skuba\n if (hasProp(baseData, 'compilerOptions')) {\n if (\n hasProp(baseData.compilerOptions, 'lib') &&\n hasProp(inputData?.compilerOptions, 'lib')\n ) {\n delete baseData.compilerOptions.lib;\n }\n\n if (\n hasProp(baseData.compilerOptions, 'target') &&\n hasProp(inputData?.compilerOptions, 'target')\n ) {\n delete baseData.compilerOptions.target;\n }\n }\n\n const outputData = merge(inputData ?? {}, baseData);\n\n // Remove `lib/**/*` and `lib`, which duplicate `lib*/**/*`\n if (hasProp(outputData, 'exclude') && Array.isArray(outputData.exclude)) {\n const { exclude } = outputData;\n\n const hasLibStar = exclude.includes('lib*/**/*');\n\n outputData.exclude = exclude.filter(\n (pattern: unknown) =>\n !(hasLibStar && new Set<unknown>(['lib', 'lib/**/*']).has(pattern)),\n );\n }\n\n // for optimal ESLinting, base config should compile all files and leave\n // exclusions to .eslintignore and tsconfig.build.json\n if (\n hasProp(outputData, 'include') &&\n !initialFiles['tsconfig.json']?.includes('skuba/config/tsconfig.json')\n ) {\n delete outputData.include;\n }\n\n // Retain comments for package documentation\n if (\n firstRun &&\n type === 'package' &&\n hasProp(outputData, 'compilerOptions') &&\n isObject(outputData.compilerOptions) &&\n !outputData.compilerOptions.removeComments\n ) {\n outputData.compilerOptions.removeComments = false;\n }\n\n return formatObject(outputData);\n },\n };\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAqC;AACrC,wBAAiD;AACjD,kBAA0C;AAC1C,uBAA0B;AAC1B,oBAAsB;AAGf,MAAM,iBAAiB,OAAO;AAAA,EACnC;AAAA,EACA;AACF,MAAgC;AAC9B,QAAM,CAAC,WAAW,QAAQ,IAAI,MAAM,QAAQ,IAAI;AAAA,QAC9C,sCAAqB,qBAAqB;AAAA,QAC1C,sCAAqB,eAAe;AAAA,EACtC,CAAC;AAED,QAAM,eAAW,yBAAY,QAAQ;AAGrC,MACE,SAAS,iBACT,2BAAQ,UAAU,iBAAiB,SACnC,4BAAS,SAAS,eAAe,GACjC;AACA,WAAO,SAAS,gBAAgB;AAChC,WAAO,SAAS,gBAAgB;AAAA,EAClC;AAEA,SAAO;AAAA,IACL,OAAG,4BAAU,YAAY;AAAA,IAEzB,uBAAuB,CAAC,cAAc,aAAa;AAAA,IAEnD,iBAAiB,CAAC,WAAW,OAAO,iBAAiB;AACnD,YAAM,gBAAY,yBAAY,SAAS;AAEvC,UAAI;AAEJ,cACE,2BAAQ,WAAW,iBAAiB,SACpC,iCAAc,UAAU,iBAAiB,QAAQ,GACjD;AACA,iBAAS,UAAU,gBAAgB,OAAO,QAAQ,OAAO,EAAE;AAAA,MAC7D;AAGA,UAAI,WAAW,UAAa,WAAW,OAAO;AAC5C,cAAM,aAAa,MAAM,YAAY;AAAA,UACnC,IAAI,OAAO,WAAW,MAAM,YAAY,GAAG;AAAA,UAC3C;AAAA,QACF;AAAA,MACF;AAGA,cAAI,2BAAQ,UAAU,iBAAiB,GAAG;AACxC,gBACE,2BAAQ,SAAS,iBAAiB,KAAK,SACvC,2BAAQ,WAAW,iBAAiB,KAAK,GACzC;AACA,iBAAO,SAAS,gBAAgB;AAAA,QAClC;AAEA,gBACE,2BAAQ,SAAS,iBAAiB,QAAQ,SAC1C,2BAAQ,WAAW,iBAAiB,QAAQ,GAC5C;AACA,iBAAO,SAAS,gBAAgB;AAAA,QAClC;AAAA,MACF;AAEA,YAAM,iBAAa,qBAAM,aAAa,CAAC,GAAG,QAAQ;AAGlD,cAAI,2BAAQ,YAAY,SAAS,KAAK,MAAM,QAAQ,WAAW,OAAO,GAAG;AACvE,cAAM,EAAE,QAAQ,IAAI;AAEpB,cAAM,aAAa,QAAQ,SAAS,WAAW;AAE/C,mBAAW,UAAU,QAAQ;AAAA,UAC3B,CAAC,YACC,EAAE,eAAc,oBAAI,IAAa,CAAC,OAAO,UAAU,CAAC,GAAE,IAAI,OAAO;AAAA,QACrE;AAAA,MACF;AAIA,cACE,2BAAQ,YAAY,SAAS,KAC7B,CAAC,aAAa,eAAe,GAAG,SAAS,4BAA4B,GACrE;AACA,eAAO,WAAW;AAAA,MACpB;AAGA,UACE,YACA,SAAS,iBACT,2BAAQ,YAAY,iBAAiB,SACrC,4BAAS,WAAW,eAAe,KACnC,CAAC,WAAW,gBAAgB,gBAC5B;AACA,mBAAW,gBAAgB,iBAAiB;AAAA,MAC9C;AAEA,iBAAO,0BAAa,UAAU;AAAA,IAChC;AAAA,EACF;AACF;",
6
- "names": []
7
- }
@@ -1 +0,0 @@
1
- export declare const tryPatchDockerfile: (dir?: string) => Promise<void>;
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/cli/configure/patchDockerfile.ts"],
4
- "sourcesContent": ["import { inspect } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { log } from '../../utils/logging';\n\nimport { createDestinationFileReader } from './analysis/project';\n\nconst DOCKERFILE_FILENAME = 'Dockerfile';\n\nconst VERSION_REGEX = /gcr.io\\/distroless\\/nodejs:(16|18|20)/g;\nconst VERSION_DEBIAN_REPLACE = 'gcr.io/distroless/nodejs$1-debian11';\n\nconst patchDockerfile = async (dir: string) => {\n const readFile = createDestinationFileReader(dir);\n\n const maybeDockerfile = await readFile(DOCKERFILE_FILENAME);\n\n if (!maybeDockerfile) {\n return;\n }\n\n const patched = maybeDockerfile.replaceAll(\n VERSION_REGEX,\n VERSION_DEBIAN_REPLACE,\n );\n\n await fs.promises.writeFile(DOCKERFILE_FILENAME, patched);\n};\n\nexport const tryPatchDockerfile = async (dir = process.cwd()) => {\n try {\n await patchDockerfile(dir);\n } catch (err) {\n log.warn('Failed to patch Dockerfile.');\n log.subtle(inspect(err));\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,sBAAe;AAEf,qBAAoB;AAEpB,qBAA4C;AAE5C,MAAM,sBAAsB;AAE5B,MAAM,gBAAgB;AACtB,MAAM,yBAAyB;AAE/B,MAAM,kBAAkB,OAAO,QAAgB;AAC7C,QAAM,eAAW,4CAA4B,GAAG;AAEhD,QAAM,kBAAkB,MAAM,SAAS,mBAAmB;AAE1D,MAAI,CAAC,iBAAiB;AACpB;AAAA,EACF;AAEA,QAAM,UAAU,gBAAgB;AAAA,IAC9B;AAAA,IACA;AAAA,EACF;AAEA,QAAM,gBAAAA,QAAG,SAAS,UAAU,qBAAqB,OAAO;AAC1D;AAEO,MAAM,qBAAqB,OAAO,MAAM,QAAQ,IAAI,MAAM;AAC/D,MAAI;AACF,UAAM,gBAAgB,GAAG;AAAA,EAC3B,SAAS,KAAK;AACZ,uBAAI,KAAK,6BAA6B;AACtC,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AAAA,EACzB;AACF;",
6
- "names": ["fs"]
7
- }
@@ -1,3 +0,0 @@
1
- export declare const KEEP_ALIVE_CODE = "\n// Gantry ALB default idle timeout is 30 seconds\n// https://nodejs.org/docs/latest-v18.x/api/http.html#serverkeepalivetimeout\n// Node default is 5 seconds\n// https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html#connection-idle-timeout\n// AWS recommends setting an application timeout larger than the load balancer\nlistener.keepAliveTimeout = 31000;\n";
2
- export declare const SERVER_LISTENER_FILENAME = "src/listen.ts";
3
- export declare const tryPatchServerListener: (dir?: string) => Promise<void>;
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/cli/configure/patchServerListener.ts"],
4
- "sourcesContent": ["import { inspect } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { log } from '../../utils/logging';\n\nimport { createDestinationFileReader } from './analysis/project';\nimport { formatPrettier } from './processing/prettier';\n\nexport const KEEP_ALIVE_CODE = `\n// Gantry ALB default idle timeout is 30 seconds\n// https://nodejs.org/docs/latest-v18.x/api/http.html#serverkeepalivetimeout\n// Node default is 5 seconds\n// https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html#connection-idle-timeout\n// AWS recommends setting an application timeout larger than the load balancer\nlistener.keepAliveTimeout = 31000;\n`;\n\nexport const SERVER_LISTENER_FILENAME = 'src/listen.ts';\n\nconst patchServerListener = async (dir: string) => {\n const readFile = createDestinationFileReader(dir);\n\n let listener = await readFile(SERVER_LISTENER_FILENAME);\n\n if (!listener || listener.includes('keepAliveTimeout')) {\n return;\n }\n\n if (listener.includes('\\napp.listen(')) {\n listener = listener.replace(\n '\\napp.listen(',\n '\\nconst listener = app.listen(',\n );\n }\n\n if (!listener.includes('\\nconst listener = app.listen(')) {\n return;\n }\n\n listener = `${listener}${KEEP_ALIVE_CODE}`;\n\n await fs.promises.writeFile(\n SERVER_LISTENER_FILENAME,\n await formatPrettier(listener, {\n parser: 'typescript',\n }),\n );\n};\n\nexport const tryPatchServerListener = async (dir = process.cwd()) => {\n try {\n await patchServerListener(dir);\n } catch (err) {\n log.warn('Failed to patch server listener.');\n log.subtle(inspect(err));\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,sBAAe;AAEf,qBAAoB;AAEpB,qBAA4C;AAC5C,sBAA+B;AAExB,MAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASxB,MAAM,2BAA2B;AAExC,MAAM,sBAAsB,OAAO,QAAgB;AACjD,QAAM,eAAW,4CAA4B,GAAG;AAEhD,MAAI,WAAW,MAAM,SAAS,wBAAwB;AAEtD,MAAI,CAAC,YAAY,SAAS,SAAS,kBAAkB,GAAG;AACtD;AAAA,EACF;AAEA,MAAI,SAAS,SAAS,eAAe,GAAG;AACtC,eAAW,SAAS;AAAA,MAClB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,SAAS,SAAS,gCAAgC,GAAG;AACxD;AAAA,EACF;AAEA,aAAW,GAAG,QAAQ,GAAG,eAAe;AAExC,QAAM,gBAAAA,QAAG,SAAS;AAAA,IAChB;AAAA,IACA,UAAM,gCAAe,UAAU;AAAA,MAC7B,QAAQ;AAAA,IACV,CAAC;AAAA,EACH;AACF;AAEO,MAAM,yBAAyB,OAAO,MAAM,QAAQ,IAAI,MAAM;AACnE,MAAI;AACF,UAAM,oBAAoB,GAAG;AAAA,EAC/B,SAAS,KAAK;AACZ,uBAAI,KAAK,kCAAkC;AAC3C,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AAAA,EACzB;AACF;",
6
- "names": ["fs"]
7
- }
@@ -1,3 +0,0 @@
1
- export declare const REFRESHABLE_IGNORE_FILES: string[];
2
- export declare const refreshIgnoreFiles: () => Promise<void>;
3
- export declare const tryRefreshIgnoreFiles: () => Promise<void>;
@@ -1,78 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var refreshIgnoreFiles_exports = {};
30
- __export(refreshIgnoreFiles_exports, {
31
- REFRESHABLE_IGNORE_FILES: () => REFRESHABLE_IGNORE_FILES,
32
- refreshIgnoreFiles: () => refreshIgnoreFiles,
33
- tryRefreshIgnoreFiles: () => tryRefreshIgnoreFiles
34
- });
35
- module.exports = __toCommonJS(refreshIgnoreFiles_exports);
36
- var import_path = __toESM(require("path"));
37
- var import_util = require("util");
38
- var import_fs_extra = __toESM(require("fs-extra"));
39
- var import_logging = require("../../utils/logging");
40
- var import_template = require("../../utils/template");
41
- var import_package = require("./analysis/package");
42
- var import_project = require("./analysis/project");
43
- var import_ignoreFile = require("./processing/ignoreFile");
44
- const REFRESHABLE_IGNORE_FILES = [
45
- ".eslintignore",
46
- ".gitignore",
47
- ".prettierignore"
48
- ];
49
- const refreshIgnoreFiles = async () => {
50
- const manifest = await (0, import_package.getDestinationManifest)();
51
- const destinationRoot = import_path.default.dirname(manifest.path);
52
- const readDestinationFile = (0, import_project.createDestinationFileReader)(destinationRoot);
53
- const refreshIgnoreFile = async (filename) => {
54
- const [inputFile, templateFile] = await Promise.all([
55
- readDestinationFile(filename),
56
- (0, import_template.readBaseTemplateFile)(`_${filename}`)
57
- ]);
58
- const data = inputFile ? (0, import_ignoreFile.mergeWithIgnoreFile)(templateFile)(inputFile) : templateFile;
59
- const filepath = import_path.default.join(destinationRoot, filename);
60
- await import_fs_extra.default.promises.writeFile(filepath, data);
61
- };
62
- await Promise.all(REFRESHABLE_IGNORE_FILES.map(refreshIgnoreFile));
63
- };
64
- const tryRefreshIgnoreFiles = async () => {
65
- try {
66
- await refreshIgnoreFiles();
67
- } catch (err) {
68
- import_logging.log.warn("Failed to refresh ignore files.");
69
- import_logging.log.subtle((0, import_util.inspect)(err));
70
- }
71
- };
72
- // Annotate the CommonJS export names for ESM import in node:
73
- 0 && (module.exports = {
74
- REFRESHABLE_IGNORE_FILES,
75
- refreshIgnoreFiles,
76
- tryRefreshIgnoreFiles
77
- });
78
- //# sourceMappingURL=refreshIgnoreFiles.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/cli/configure/refreshIgnoreFiles.ts"],
4
- "sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { log } from '../../utils/logging';\nimport { readBaseTemplateFile } from '../../utils/template';\n\nimport { getDestinationManifest } from './analysis/package';\nimport { createDestinationFileReader } from './analysis/project';\nimport { mergeWithIgnoreFile } from './processing/ignoreFile';\n\nexport const REFRESHABLE_IGNORE_FILES = [\n '.eslintignore',\n '.gitignore',\n '.prettierignore',\n];\n\nexport const refreshIgnoreFiles = async () => {\n const manifest = await getDestinationManifest();\n\n const destinationRoot = path.dirname(manifest.path);\n\n const readDestinationFile = createDestinationFileReader(destinationRoot);\n\n const refreshIgnoreFile = async (filename: string) => {\n const [inputFile, templateFile] = await Promise.all([\n readDestinationFile(filename),\n readBaseTemplateFile(`_${filename}`),\n ]);\n\n const data = inputFile\n ? mergeWithIgnoreFile(templateFile)(inputFile)\n : templateFile;\n\n const filepath = path.join(destinationRoot, filename);\n\n await fs.promises.writeFile(filepath, data);\n };\n\n await Promise.all(REFRESHABLE_IGNORE_FILES.map(refreshIgnoreFile));\n};\n\nexport const tryRefreshIgnoreFiles = async () => {\n try {\n await refreshIgnoreFiles();\n } catch (err) {\n log.warn('Failed to refresh ignore files.');\n log.subtle(inspect(err));\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAwB;AAExB,sBAAe;AAEf,qBAAoB;AACpB,sBAAqC;AAErC,qBAAuC;AACvC,qBAA4C;AAC5C,wBAAoC;AAE7B,MAAM,2BAA2B;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,qBAAqB,YAAY;AAC5C,QAAM,WAAW,UAAM,uCAAuB;AAE9C,QAAM,kBAAkB,YAAAA,QAAK,QAAQ,SAAS,IAAI;AAElD,QAAM,0BAAsB,4CAA4B,eAAe;AAEvE,QAAM,oBAAoB,OAAO,aAAqB;AACpD,UAAM,CAAC,WAAW,YAAY,IAAI,MAAM,QAAQ,IAAI;AAAA,MAClD,oBAAoB,QAAQ;AAAA,UAC5B,sCAAqB,IAAI,QAAQ,EAAE;AAAA,IACrC,CAAC;AAED,UAAM,OAAO,gBACT,uCAAoB,YAAY,EAAE,SAAS,IAC3C;AAEJ,UAAM,WAAW,YAAAA,QAAK,KAAK,iBAAiB,QAAQ;AAEpD,UAAM,gBAAAC,QAAG,SAAS,UAAU,UAAU,IAAI;AAAA,EAC5C;AAEA,QAAM,QAAQ,IAAI,yBAAyB,IAAI,iBAAiB,CAAC;AACnE;AAEO,MAAM,wBAAwB,YAAY;AAC/C,MAAI;AACF,UAAM,mBAAmB;AAAA,EAC3B,SAAS,KAAK;AACZ,uBAAI,KAAK,iCAAiC;AAC1C,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AAAA,EACzB;AACF;",
6
- "names": ["path", "fs"]
7
- }