skuba 7.3.1 → 7.4.0-horrible-hacks-20240206023615
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/README.md +3 -3
- package/jest/transform.test.ts +3 -1
- package/lib/api/jest/index.d.ts +1 -1
- package/lib/api/jest/index.js.map +2 -2
- package/lib/cli/adapter/prettier.d.ts +1 -1
- package/lib/cli/adapter/prettier.js +11 -10
- package/lib/cli/adapter/prettier.js.map +2 -2
- package/lib/cli/build/index.js +0 -2
- package/lib/cli/build/index.js.map +2 -2
- package/lib/cli/buildPackage.js +0 -2
- package/lib/cli/buildPackage.js.map +2 -2
- package/lib/cli/configure/analyseConfiguration.d.ts +2 -0
- package/lib/cli/configure/analyseConfiguration.js.map +2 -2
- package/lib/cli/configure/getEntryPoint.js +1 -1
- package/lib/cli/configure/getEntryPoint.js.map +2 -2
- package/lib/cli/configure/getProjectType.js +1 -1
- package/lib/cli/configure/getProjectType.js.map +2 -2
- package/lib/cli/configure/index.js +11 -8
- package/lib/cli/configure/index.js.map +2 -2
- package/lib/cli/configure/modules/index.js +0 -2
- package/lib/cli/configure/modules/index.js.map +2 -2
- package/lib/cli/configure/modules/package.d.ts +1 -1
- package/lib/cli/configure/modules/package.js +2 -1
- package/lib/cli/configure/modules/package.js.map +2 -2
- package/lib/cli/configure/patchRenovateConfig.d.ts +2 -1
- package/lib/cli/configure/patchRenovateConfig.js +23 -10
- package/lib/cli/configure/patchRenovateConfig.js.map +2 -2
- package/lib/cli/configure/types.d.ts +2 -0
- package/lib/cli/configure/types.js.map +1 -1
- package/lib/cli/configure/upgrade/index.d.ts +15 -0
- package/lib/cli/configure/upgrade/index.js +130 -0
- package/lib/cli/configure/upgrade/index.js.map +7 -0
- package/lib/cli/configure/{addEmptyExports.d.ts → upgrade/patches/7.3.1/addEmptyExports.d.ts} +2 -2
- package/lib/cli/configure/{addEmptyExports.js → upgrade/patches/7.3.1/addEmptyExports.js} +15 -11
- package/lib/cli/configure/upgrade/patches/7.3.1/addEmptyExports.js.map +7 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/index.d.ts +2 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/index.js +55 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/index.js.map +7 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.d.ts +2 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.js +94 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/moveNpmrcOutOfGitignoreManagedSection.js.map +7 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/patchDockerfile.d.ts +2 -0
- package/lib/cli/configure/{patchDockerfile.js → upgrade/patches/7.3.1/patchDockerfile.js} +18 -12
- package/lib/cli/configure/upgrade/patches/7.3.1/patchDockerfile.js.map +7 -0
- package/lib/cli/configure/upgrade/patches/7.3.1/patchServerListener.d.ts +2 -0
- package/lib/cli/configure/{patchServerListener.js → upgrade/patches/7.3.1/patchServerListener.js} +18 -14
- package/lib/cli/configure/upgrade/patches/7.3.1/patchServerListener.js.map +7 -0
- package/lib/cli/format.js +7 -14
- package/lib/cli/format.js.map +2 -2
- package/lib/cli/init/getConfig.d.ts +4 -2
- package/lib/cli/init/getConfig.js +53 -26
- package/lib/cli/init/getConfig.js.map +2 -2
- package/lib/cli/init/git.d.ts +2 -1
- package/lib/cli/init/git.js +2 -9
- package/lib/cli/init/git.js.map +2 -2
- package/lib/cli/init/index.d.ts +1 -1
- package/lib/cli/init/index.js +19 -9
- package/lib/cli/init/index.js.map +2 -2
- package/lib/cli/init/prompts.d.ts +26 -3
- package/lib/cli/init/prompts.js +10 -2
- package/lib/cli/init/prompts.js.map +2 -2
- package/lib/cli/init/types.d.ts +21 -0
- package/lib/cli/init/types.js +5 -1
- package/lib/cli/init/types.js.map +2 -2
- package/lib/cli/init/writePackageJson.d.ts +6 -0
- package/lib/cli/init/writePackageJson.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/index.d.ts +2 -1
- package/lib/cli/lint/annotate/buildkite/index.js +5 -3
- package/lib/cli/lint/annotate/buildkite/index.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/internal.d.ts +2 -0
- package/lib/cli/lint/annotate/buildkite/internal.js +45 -0
- package/lib/cli/lint/annotate/buildkite/internal.js.map +7 -0
- package/lib/cli/lint/annotate/github/index.d.ts +2 -1
- package/lib/cli/lint/annotate/github/index.js +4 -2
- package/lib/cli/lint/annotate/github/index.js.map +2 -2
- package/lib/cli/lint/annotate/github/internal.d.ts +3 -0
- package/lib/cli/lint/annotate/github/internal.js +36 -0
- package/lib/cli/lint/annotate/github/internal.js.map +7 -0
- package/lib/cli/lint/annotate/index.d.ts +4 -3
- package/lib/cli/lint/annotate/index.js +9 -3
- package/lib/cli/lint/annotate/index.js.map +2 -2
- package/lib/cli/lint/autofix.d.ts +3 -1
- package/lib/cli/lint/autofix.js +36 -59
- package/lib/cli/lint/autofix.js.map +3 -3
- package/lib/cli/lint/external.d.ts +6 -1
- package/lib/cli/lint/external.js +6 -29
- package/lib/cli/lint/external.js.map +2 -2
- package/lib/cli/lint/index.d.ts +2 -1
- package/lib/cli/lint/index.js +46 -14
- package/lib/cli/lint/index.js.map +2 -2
- package/lib/cli/lint/internal.d.ts +12 -1
- package/lib/cli/lint/internal.js +55 -19
- package/lib/cli/lint/internal.js.map +3 -3
- package/lib/cli/lint/internalLints/deleteFiles.d.ts +3 -0
- package/lib/cli/lint/internalLints/deleteFiles.js +102 -0
- package/lib/cli/lint/internalLints/deleteFiles.js.map +7 -0
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.d.ts +3 -0
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +75 -0
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +7 -0
- package/lib/cli/lint/internalLints/refreshConfigFiles.d.ts +11 -0
- package/lib/cli/lint/internalLints/refreshConfigFiles.js +147 -0
- package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +7 -0
- package/lib/cli/test/index.js +0 -2
- package/lib/cli/test/index.js.map +2 -2
- package/lib/skuba.d.ts +1 -1
- package/lib/skuba.js.map +1 -1
- package/lib/utils/exec.d.ts +2 -1
- package/lib/utils/exec.js +1 -0
- package/lib/utils/exec.js.map +2 -2
- package/lib/utils/logging.d.ts +2 -0
- package/lib/utils/logging.js +1 -0
- package/lib/utils/logging.js.map +2 -2
- package/lib/utils/logo.js +6 -10
- package/lib/utils/logo.js.map +3 -3
- package/lib/utils/manifest.d.ts +1 -1
- package/lib/utils/manifest.js +1 -1
- package/lib/utils/manifest.js.map +2 -2
- package/lib/utils/npmrc.d.ts +1 -0
- package/lib/utils/npmrc.js +29 -0
- package/lib/utils/npmrc.js.map +7 -0
- package/lib/utils/packageManager.d.ts +24 -0
- package/lib/utils/packageManager.js +97 -0
- package/lib/utils/packageManager.js.map +7 -0
- package/lib/utils/template.d.ts +3 -0
- package/lib/utils/template.js +2 -0
- package/lib/utils/template.js.map +2 -2
- package/lib/utils/worker.d.ts +1 -0
- package/lib/wrapper/http.d.ts +1 -0
- package/package.json +39 -36
- package/template/base/_.dockerignore +0 -1
- package/template/base/_.eslintignore +1 -0
- package/template/base/_.gitignore +1 -1
- package/template/base/_.npmrc +8 -0
- package/template/express-rest-api/.buildkite/pipeline.yml +13 -10
- package/template/express-rest-api/.gantry/dev.yml +3 -0
- package/template/express-rest-api/Dockerfile +6 -12
- package/template/express-rest-api/Dockerfile.dev-deps +6 -5
- package/template/express-rest-api/README.md +6 -6
- package/template/express-rest-api/docker-compose.yml +0 -10
- package/template/express-rest-api/gantry.apply.yml +5 -0
- package/template/express-rest-api/gantry.build.yml +1 -2
- package/template/express-rest-api/package.json +2 -2
- package/template/express-rest-api/skuba.template.js +1 -0
- package/template/greeter/.buildkite/pipeline.yml +12 -9
- package/template/greeter/Dockerfile +6 -5
- package/template/greeter/README.md +6 -6
- package/template/greeter/docker-compose.yml +0 -10
- package/template/greeter/package.json +1 -1
- package/template/greeter/skuba.template.js +1 -0
- package/template/koa-rest-api/.buildkite/pipeline.yml +13 -10
- package/template/koa-rest-api/.gantry/dev.yml +3 -0
- package/template/koa-rest-api/.nvmrc +1 -1
- package/template/koa-rest-api/Dockerfile +6 -12
- package/template/koa-rest-api/Dockerfile.dev-deps +6 -5
- package/template/koa-rest-api/README.md +6 -6
- package/template/koa-rest-api/docker-compose.yml +0 -10
- package/template/koa-rest-api/gantry.apply.yml +5 -0
- package/template/koa-rest-api/gantry.build.yml +1 -2
- package/template/koa-rest-api/package.json +8 -6
- package/template/koa-rest-api/skuba.template.js +1 -0
- package/template/koa-rest-api/src/framework/validation.test.ts +48 -15
- package/template/koa-rest-api/src/framework/validation.ts +31 -8
- package/template/koa-rest-api/src/testing/types.ts +16 -4
- package/template/lambda-sqs-worker/.buildkite/pipeline.yml +21 -15
- package/template/lambda-sqs-worker/Dockerfile +6 -6
- package/template/lambda-sqs-worker/README.md +8 -8
- package/template/lambda-sqs-worker/_.npmrc +12 -0
- package/template/lambda-sqs-worker/docker-compose.yml +0 -15
- package/template/lambda-sqs-worker/package.json +3 -4
- package/template/lambda-sqs-worker/serverless.yml +4 -1
- package/template/lambda-sqs-worker/skuba.template.js +1 -0
- package/template/lambda-sqs-worker/src/hooks.ts +1 -2
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +42 -18
- package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
- package/template/lambda-sqs-worker-cdk/Dockerfile +9 -7
- package/template/lambda-sqs-worker-cdk/cdk.json +12 -6
- package/template/lambda-sqs-worker-cdk/docker-compose.yml +0 -15
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +1587 -225
- package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +23 -3
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +127 -14
- package/template/lambda-sqs-worker-cdk/package.json +5 -3
- package/template/lambda-sqs-worker-cdk/shared/context-types.ts +1 -0
- package/template/lambda-sqs-worker-cdk/skuba.template.js +1 -0
- package/template/lambda-sqs-worker-cdk/src/app.ts +14 -1
- package/template/lambda-sqs-worker-cdk/src/postHook.ts +154 -0
- package/template/lambda-sqs-worker-cdk/src/preHook.ts +95 -0
- package/template/oss-npm-package/.github/workflows/release.yml +10 -7
- package/template/oss-npm-package/.github/workflows/validate.yml +10 -7
- package/template/oss-npm-package/.releaserc +16 -0
- package/template/oss-npm-package/README.md +17 -17
- package/template/oss-npm-package/_package.json +3 -2
- package/template/oss-npm-package/skuba.template.js +1 -0
- package/template/private-npm-package/.releaserc +16 -0
- package/template/private-npm-package/README.md +16 -16
- package/template/private-npm-package/_package.json +3 -3
- package/template/private-npm-package/skuba.template.js +1 -0
- package/lib/cli/configure/addEmptyExports.js.map +0 -7
- package/lib/cli/configure/modules/tsconfig.d.ts +0 -2
- package/lib/cli/configure/modules/tsconfig.js +0 -87
- package/lib/cli/configure/modules/tsconfig.js.map +0 -7
- package/lib/cli/configure/patchDockerfile.d.ts +0 -1
- package/lib/cli/configure/patchDockerfile.js.map +0 -7
- package/lib/cli/configure/patchServerListener.d.ts +0 -3
- package/lib/cli/configure/patchServerListener.js.map +0 -7
- package/lib/cli/configure/refreshIgnoreFiles.d.ts +0 -3
- package/lib/cli/configure/refreshIgnoreFiles.js +0 -78
- 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
|
-
-
|
|
42
|
+
- pnpm
|
|
43
43
|
|
|
44
44
|
```shell
|
|
45
|
-
|
|
45
|
+
pnpm install
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
### Test
|
|
49
49
|
|
|
50
50
|
```shell
|
|
51
|
-
|
|
51
|
+
pnpm run test
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
### Lint
|
|
55
55
|
|
|
56
56
|
```shell
|
|
57
57
|
# Fix issues
|
|
58
|
-
|
|
58
|
+
pnpm run format
|
|
59
59
|
|
|
60
60
|
# Check for issues
|
|
61
|
-
|
|
61
|
+
pnpm run lint
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
### Package
|
|
65
65
|
|
|
66
66
|
```shell
|
|
67
67
|
# Compile source
|
|
68
|
-
|
|
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 `
|
|
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
|
|
103
|
-
which is the default used when running `npm install` or `
|
|
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
|
|
114
|
-
|
|
|
115
|
-
|
|
|
116
|
-
| alpha
|
|
117
|
-
| beta
|
|
118
|
-
| next
|
|
119
|
-
| 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": "
|
|
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": "^
|
|
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
|
},
|
|
@@ -35,33 +35,33 @@ log();
|
|
|
35
35
|
### Prerequisites
|
|
36
36
|
|
|
37
37
|
- Node.js LTS
|
|
38
|
-
-
|
|
38
|
+
- pnpm
|
|
39
39
|
|
|
40
40
|
```shell
|
|
41
|
-
|
|
41
|
+
pnpm install
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
### Test
|
|
45
45
|
|
|
46
46
|
```shell
|
|
47
|
-
|
|
47
|
+
pnpm run test
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
### Lint
|
|
51
51
|
|
|
52
52
|
```shell
|
|
53
53
|
# Fix issues
|
|
54
|
-
|
|
54
|
+
pnpm run format
|
|
55
55
|
|
|
56
56
|
# Check for issues
|
|
57
|
-
|
|
57
|
+
pnpm run lint
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
### Package
|
|
61
61
|
|
|
62
62
|
```shell
|
|
63
63
|
# Compile source
|
|
64
|
-
|
|
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 `
|
|
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
|
|
85
|
-
which is the default used when running `npm install` or `
|
|
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
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
-
| alpha
|
|
99
|
-
| beta
|
|
100
|
-
| next
|
|
101
|
-
| 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": "
|
|
25
|
+
"release": "pnpm run --silent build && skuba release",
|
|
26
26
|
"test": "skuba test --coverage",
|
|
27
|
-
"test:ci": "
|
|
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": "^
|
|
37
|
+
"@types/node": "^18.19.8",
|
|
38
38
|
"commitizen": "^4.2.4",
|
|
39
39
|
"skuba": "*"
|
|
40
40
|
},
|
|
@@ -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,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,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
|
-
}
|