@depup/oclif 4.22.92-depup.1
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/LICENSE +21 -0
- package/README.md +44 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +7 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +7 -0
- package/changes.json +62 -0
- package/lib/aws.d.ts +22 -0
- package/lib/aws.js +146 -0
- package/lib/commands/generate/command.d.ts +12 -0
- package/lib/commands/generate/command.js +44 -0
- package/lib/commands/generate/hook.d.ts +12 -0
- package/lib/commands/generate/hook.js +87 -0
- package/lib/commands/generate.d.ts +67 -0
- package/lib/commands/generate.js +269 -0
- package/lib/commands/init.d.ts +39 -0
- package/lib/commands/init.js +165 -0
- package/lib/commands/lock.d.ts +4 -0
- package/lib/commands/lock.js +70 -0
- package/lib/commands/manifest.d.ts +13 -0
- package/lib/commands/manifest.js +156 -0
- package/lib/commands/pack/deb.d.ts +13 -0
- package/lib/commands/pack/deb.js +194 -0
- package/lib/commands/pack/macos.d.ts +14 -0
- package/lib/commands/pack/macos.js +273 -0
- package/lib/commands/pack/tarballs.d.ts +15 -0
- package/lib/commands/pack/tarballs.js +77 -0
- package/lib/commands/pack/win.d.ts +16 -0
- package/lib/commands/pack/win.js +398 -0
- package/lib/commands/promote.d.ts +20 -0
- package/lib/commands/promote.js +305 -0
- package/lib/commands/readme.d.ts +19 -0
- package/lib/commands/readme.js +143 -0
- package/lib/commands/upload/deb.d.ts +10 -0
- package/lib/commands/upload/deb.js +113 -0
- package/lib/commands/upload/macos.d.ts +11 -0
- package/lib/commands/upload/macos.js +92 -0
- package/lib/commands/upload/tarballs.d.ts +12 -0
- package/lib/commands/upload/tarballs.js +135 -0
- package/lib/commands/upload/win.d.ts +11 -0
- package/lib/commands/upload/win.js +97 -0
- package/lib/generator.d.ts +57 -0
- package/lib/generator.js +184 -0
- package/lib/help-compatibility.d.ts +11 -0
- package/lib/help-compatibility.js +22 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -0
- package/lib/log.d.ts +2 -0
- package/lib/log.js +13 -0
- package/lib/readme-generator.d.ts +38 -0
- package/lib/readme-generator.js +305 -0
- package/lib/tarballs/bin.d.ts +7 -0
- package/lib/tarballs/bin.js +126 -0
- package/lib/tarballs/build.d.ts +10 -0
- package/lib/tarballs/build.js +250 -0
- package/lib/tarballs/config.d.ts +45 -0
- package/lib/tarballs/config.js +132 -0
- package/lib/tarballs/index.d.ts +4 -0
- package/lib/tarballs/index.js +20 -0
- package/lib/tarballs/node.d.ts +10 -0
- package/lib/tarballs/node.js +78 -0
- package/lib/upload-util.d.ts +17 -0
- package/lib/upload-util.js +56 -0
- package/lib/util.d.ts +18 -0
- package/lib/util.js +160 -0
- package/lib/version-indexes.d.ts +9 -0
- package/lib/version-indexes.js +119 -0
- package/oclif.manifest.json +1199 -0
- package/package.json +217 -0
- package/templates/cli/commonjs/.mocharc.json.ejs +11 -0
- package/templates/cli/commonjs/.vscode/launch.json.ejs +20 -0
- package/templates/cli/commonjs/bin/dev.cmd.ejs +3 -0
- package/templates/cli/commonjs/bin/dev.js.ejs +7 -0
- package/templates/cli/commonjs/bin/run.cmd.ejs +3 -0
- package/templates/cli/commonjs/bin/run.js.ejs +7 -0
- package/templates/cli/commonjs/eslint.config.mjs.ejs +19 -0
- package/templates/cli/commonjs/tsconfig.json.ejs +11 -0
- package/templates/cli/esm/.mocharc.json.ejs +15 -0
- package/templates/cli/esm/.vscode/launch.json.ejs +22 -0
- package/templates/cli/esm/bin/dev.cmd.ejs +3 -0
- package/templates/cli/esm/bin/dev.js.ejs +5 -0
- package/templates/cli/esm/bin/run.cmd.ejs +3 -0
- package/templates/cli/esm/bin/run.js.ejs +5 -0
- package/templates/cli/esm/eslint.config.mjs.ejs +9 -0
- package/templates/cli/esm/tsconfig.json.ejs +15 -0
- package/templates/cli/shared/.github/workflows/onPushToMain.yml.ejs +56 -0
- package/templates/cli/shared/.github/workflows/onRelease.yml.ejs +21 -0
- package/templates/cli/shared/.github/workflows/test.yml.ejs +23 -0
- package/templates/cli/shared/.gitignore.ejs +27 -0
- package/templates/cli/shared/.prettierrc.json.ejs +1 -0
- package/templates/cli/shared/README.md.ejs +396 -0
- package/templates/cli/shared/package.json.ejs +73 -0
- package/templates/cli/shared/src/commands/hello/index.ts.ejs +22 -0
- package/templates/cli/shared/src/commands/hello/world.ts.ejs +16 -0
- package/templates/cli/shared/src/index.ts.ejs +1 -0
- package/templates/cli/shared/test/commands/hello/index.test.ts.ejs +9 -0
- package/templates/cli/shared/test/commands/hello/world.test.ts.ejs +9 -0
- package/templates/cli/shared/test/tsconfig.json.ejs +9 -0
- package/templates/src/command.ts.ejs +27 -0
- package/templates/src/hook.ts.ejs +7 -0
- package/templates/src/init/dev.cmd.ejs +12 -0
- package/templates/src/init/dev.js.ejs +17 -0
- package/templates/src/init/run.cmd.ejs +3 -0
- package/templates/src/init/run.js.ejs +17 -0
- package/templates/test/command.test.ts.ejs +14 -0
- package/templates/test/hook.test.ts.ejs +9 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Salesforce.com
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @depup/oclif
|
|
2
|
+
|
|
3
|
+
> Dependency-bumped version of [oclif](https://www.npmjs.com/package/oclif)
|
|
4
|
+
|
|
5
|
+
Generated by [DepUp](https://github.com/depup/npm) -- all production
|
|
6
|
+
dependencies bumped to latest versions.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @depup/oclif
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
| Field | Value |
|
|
15
|
+
|-------|-------|
|
|
16
|
+
| Original | [oclif](https://www.npmjs.com/package/oclif) @ 4.22.92 |
|
|
17
|
+
| Processed | 2026-03-17 |
|
|
18
|
+
| Smoke test | passed |
|
|
19
|
+
| Deps updated | 14 |
|
|
20
|
+
|
|
21
|
+
## Dependency Changes
|
|
22
|
+
|
|
23
|
+
| Dependency | From | To |
|
|
24
|
+
|------------|------|-----|
|
|
25
|
+
| @aws-sdk/client-cloudfront | 3.1009.0 | ^3.1011.0 |
|
|
26
|
+
| @aws-sdk/client-s3 | 3.1009.0 | ^3.1011.0 |
|
|
27
|
+
| @inquirer/confirm | ^3.1.22 | ^6.0.10 |
|
|
28
|
+
| @inquirer/input | ^2.2.4 | ^5.0.10 |
|
|
29
|
+
| @inquirer/select | ^2.5.0 | ^5.1.2 |
|
|
30
|
+
| ansis | ^3.16.0 | ^4.2.0 |
|
|
31
|
+
| change-case | ^4 | ^5.4.4 |
|
|
32
|
+
| debug | ^4.4.0 | ^4.4.3 |
|
|
33
|
+
| ejs | ^3.1.10 | ^5.0.1 |
|
|
34
|
+
| fs-extra | ^8.1 | ^11.3.4 |
|
|
35
|
+
| got | ^13 | ^14.6.6 |
|
|
36
|
+
| normalize-package-data | ^6 | ^8.0.0 |
|
|
37
|
+
| sort-package-json | ^2.15.1 | ^3.6.1 |
|
|
38
|
+
| validate-npm-package-name | ^5.0.1 | ^7.0.2 |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/oclif
|
|
43
|
+
|
|
44
|
+
License inherited from the original package.
|
package/bin/dev.cmd
ADDED
package/bin/dev.js
ADDED
package/bin/run.cmd
ADDED
package/bin/run.js
ADDED
package/changes.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bumped": {
|
|
3
|
+
"@aws-sdk/client-cloudfront": {
|
|
4
|
+
"from": "3.1009.0",
|
|
5
|
+
"to": "^3.1011.0"
|
|
6
|
+
},
|
|
7
|
+
"@aws-sdk/client-s3": {
|
|
8
|
+
"from": "3.1009.0",
|
|
9
|
+
"to": "^3.1011.0"
|
|
10
|
+
},
|
|
11
|
+
"@inquirer/confirm": {
|
|
12
|
+
"from": "^3.1.22",
|
|
13
|
+
"to": "^6.0.10"
|
|
14
|
+
},
|
|
15
|
+
"@inquirer/input": {
|
|
16
|
+
"from": "^2.2.4",
|
|
17
|
+
"to": "^5.0.10"
|
|
18
|
+
},
|
|
19
|
+
"@inquirer/select": {
|
|
20
|
+
"from": "^2.5.0",
|
|
21
|
+
"to": "^5.1.2"
|
|
22
|
+
},
|
|
23
|
+
"ansis": {
|
|
24
|
+
"from": "^3.16.0",
|
|
25
|
+
"to": "^4.2.0"
|
|
26
|
+
},
|
|
27
|
+
"change-case": {
|
|
28
|
+
"from": "^4",
|
|
29
|
+
"to": "^5.4.4"
|
|
30
|
+
},
|
|
31
|
+
"debug": {
|
|
32
|
+
"from": "^4.4.0",
|
|
33
|
+
"to": "^4.4.3"
|
|
34
|
+
},
|
|
35
|
+
"ejs": {
|
|
36
|
+
"from": "^3.1.10",
|
|
37
|
+
"to": "^5.0.1"
|
|
38
|
+
},
|
|
39
|
+
"fs-extra": {
|
|
40
|
+
"from": "^8.1",
|
|
41
|
+
"to": "^11.3.4"
|
|
42
|
+
},
|
|
43
|
+
"got": {
|
|
44
|
+
"from": "^13",
|
|
45
|
+
"to": "^14.6.6"
|
|
46
|
+
},
|
|
47
|
+
"normalize-package-data": {
|
|
48
|
+
"from": "^6",
|
|
49
|
+
"to": "^8.0.0"
|
|
50
|
+
},
|
|
51
|
+
"sort-package-json": {
|
|
52
|
+
"from": "^2.15.1",
|
|
53
|
+
"to": "^3.6.1"
|
|
54
|
+
},
|
|
55
|
+
"validate-npm-package-name": {
|
|
56
|
+
"from": "^5.0.1",
|
|
57
|
+
"to": "^7.0.2"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"timestamp": "2026-03-17T21:28:52.632Z",
|
|
61
|
+
"totalUpdated": 14
|
|
62
|
+
}
|
package/lib/aws.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CreateInvalidationCommandOutput, CreateInvalidationRequest } from '@aws-sdk/client-cloudfront';
|
|
2
|
+
import { CopyObjectOutput, CopyObjectRequest, DeleteObjectsOutput, DeleteObjectsRequest, GetObjectOutput, GetObjectRequest, HeadObjectOutput, HeadObjectRequest, ListObjectsV2Output, ListObjectsV2Request, PutObjectOutput, PutObjectRequest } from '@aws-sdk/client-s3';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
readonly cloudfront: {
|
|
5
|
+
createCloudfrontInvalidation: (options: CreateInvalidationRequest) => Promise<CreateInvalidationCommandOutput>;
|
|
6
|
+
};
|
|
7
|
+
readonly s3: {
|
|
8
|
+
copyObject: (options: CopyObjectRequest, { dryRun, ignoreMissing, namespace }: {
|
|
9
|
+
dryRun?: boolean;
|
|
10
|
+
ignoreMissing?: boolean;
|
|
11
|
+
namespace?: string;
|
|
12
|
+
}) => Promise<CopyObjectOutput>;
|
|
13
|
+
deleteObjects: (options: DeleteObjectsRequest) => Promise<DeleteObjectsOutput>;
|
|
14
|
+
getObject: (options: GetObjectRequest) => Promise<GetObjectOutput>;
|
|
15
|
+
headObject: (options: HeadObjectRequest) => Promise<HeadObjectOutput>;
|
|
16
|
+
listObjects: (options: ListObjectsV2Request) => Promise<ListObjectsV2Output>;
|
|
17
|
+
uploadFile: (local: string, options: PutObjectRequest, { dryRun }?: {
|
|
18
|
+
dryRun?: boolean;
|
|
19
|
+
}) => Promise<PutObjectOutput>;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export default _default;
|
package/lib/aws.js
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const client_cloudfront_1 = require("@aws-sdk/client-cloudfront");
|
|
4
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
5
|
+
const errors_1 = require("@oclif/core/errors");
|
|
6
|
+
const ux_1 = require("@oclif/core/ux");
|
|
7
|
+
const fs_extra_1 = require("fs-extra");
|
|
8
|
+
const log_1 = require("./log");
|
|
9
|
+
const util_1 = require("./util");
|
|
10
|
+
const debug = log_1.debug.new('aws');
|
|
11
|
+
const cache = {};
|
|
12
|
+
const aws = {
|
|
13
|
+
get cloudfront() {
|
|
14
|
+
cache.cloudfront =
|
|
15
|
+
cache.cloudfront || new (require('@aws-sdk/client-cloudfront').CloudFrontClient)({ credentials: this.creds });
|
|
16
|
+
return cache.cloudfront;
|
|
17
|
+
},
|
|
18
|
+
get creds() {
|
|
19
|
+
const creds = {
|
|
20
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
|
21
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
22
|
+
sessionToken: process.env.AWS_SESSION_TOKEN,
|
|
23
|
+
};
|
|
24
|
+
if (!creds.accessKeyId)
|
|
25
|
+
throw new Error('AWS_ACCESS_KEY_ID not set');
|
|
26
|
+
if (!creds.secretAccessKey)
|
|
27
|
+
throw new Error('AWS_SECRET_ACCESS_KEY not set');
|
|
28
|
+
return creds;
|
|
29
|
+
},
|
|
30
|
+
get s3() {
|
|
31
|
+
try {
|
|
32
|
+
const endpoint = process.env.AWS_S3_ENDPOINT;
|
|
33
|
+
const checksumConfig = (0, util_1.getS3ChecksumConfig)(endpoint, process.env.AWS_REQUEST_CHECKSUM_CALCULATION);
|
|
34
|
+
cache.s3 =
|
|
35
|
+
cache.s3 ??
|
|
36
|
+
new (require('@aws-sdk/client-s3').S3Client)({
|
|
37
|
+
credentials: this.creds,
|
|
38
|
+
endpoint,
|
|
39
|
+
forcePathStyle: Boolean(process.env.AWS_S3_FORCE_PATH_STYLE),
|
|
40
|
+
region: process.env.AWS_REGION ?? 'us-east-1',
|
|
41
|
+
// Support disabling checksums for S3-compatible storage
|
|
42
|
+
...(checksumConfig && {
|
|
43
|
+
requestChecksumCalculation: checksumConfig,
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
return cache.s3;
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
const { code, message } = error;
|
|
50
|
+
if (code === 'MODULE_NOT_FOUND')
|
|
51
|
+
throw new Error(`${message}\n@aws-sdk/client-s3 is needed to run this command.\nInstall @aws-sdk/client-s3 as a devDependency in your CLI. \`yarn add -D @aws-sdk/client-s3\``);
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
exports.default = {
|
|
57
|
+
get cloudfront() {
|
|
58
|
+
return {
|
|
59
|
+
createCloudfrontInvalidation: (options) => new Promise((resolve, reject) => {
|
|
60
|
+
(0, log_1.log)('createCloudfrontInvalidation', options.DistributionId, options.InvalidationBatch?.Paths?.Items);
|
|
61
|
+
aws.cloudfront
|
|
62
|
+
?.send(new client_cloudfront_1.CreateInvalidationCommand(options))
|
|
63
|
+
.then((data) => resolve(data))
|
|
64
|
+
.catch((error) => reject(error));
|
|
65
|
+
}),
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
get s3() {
|
|
69
|
+
return {
|
|
70
|
+
copyObject: (options, { dryRun, ignoreMissing, namespace }) => new Promise((resolve, reject) => {
|
|
71
|
+
const logNamespace = namespace ? `> ${namespace}` : `> s3://${options.CopySource}`;
|
|
72
|
+
ux_1.ux.stdout(logNamespace);
|
|
73
|
+
ux_1.ux.stdout(' action: copy');
|
|
74
|
+
ux_1.ux.stdout(` source: s3://${options.CopySource}`);
|
|
75
|
+
ux_1.ux.stdout(` target: s3://${options.Bucket}/${options.Key}`);
|
|
76
|
+
ux_1.ux.stdout();
|
|
77
|
+
if (dryRun)
|
|
78
|
+
return;
|
|
79
|
+
aws.s3
|
|
80
|
+
?.send(new client_s3_1.CopyObjectCommand(options))
|
|
81
|
+
.then((data) => resolve(data))
|
|
82
|
+
.catch((error) => {
|
|
83
|
+
if (error.Code === 'NoSuchKey') {
|
|
84
|
+
if (ignoreMissing) {
|
|
85
|
+
ux_1.ux.stdout(logNamespace);
|
|
86
|
+
ux_1.ux.stdout(` warning: s3://${options.CopySource} does not exist - skipping because of --ignore-missing`);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
ux_1.ux.stdout(logNamespace);
|
|
90
|
+
ux_1.ux.stdout(` error: s3://${options.CopySource} does not exist`);
|
|
91
|
+
reject(new errors_1.CLIError(`Failed to copy source object s3://${options.CopySource} to s3://${options.Bucket}/${options.Key} because the source object does not exist`, {
|
|
92
|
+
suggestions: [
|
|
93
|
+
'Use the "oclif upload" to upload the object first',
|
|
94
|
+
'Use the "--targets" flag to specify existing targets',
|
|
95
|
+
'Use the "--ignore-missing" flag to skip this error',
|
|
96
|
+
],
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
reject(error);
|
|
100
|
+
});
|
|
101
|
+
}),
|
|
102
|
+
deleteObjects: (options) => new Promise((resolve, reject) => {
|
|
103
|
+
debug('deleteObjects', `s3://${options.Bucket}`);
|
|
104
|
+
aws.s3
|
|
105
|
+
?.send(new client_s3_1.DeleteObjectsCommand(options))
|
|
106
|
+
.then((data) => resolve(data))
|
|
107
|
+
.catch((error) => reject(error));
|
|
108
|
+
}),
|
|
109
|
+
getObject: (options) => new Promise((resolve, reject) => {
|
|
110
|
+
debug('getObject', `s3://${options.Bucket}/${options.Key}`);
|
|
111
|
+
aws.s3
|
|
112
|
+
?.send(new client_s3_1.GetObjectCommand(options))
|
|
113
|
+
.then((data) => resolve(data))
|
|
114
|
+
.catch((error) => reject(error));
|
|
115
|
+
}),
|
|
116
|
+
headObject: (options) => new Promise((resolve, reject) => {
|
|
117
|
+
debug('s3:headObject', `s3://${options.Bucket}/${options.Key}`);
|
|
118
|
+
aws.s3
|
|
119
|
+
?.send(new client_s3_1.HeadObjectCommand(options))
|
|
120
|
+
.then((data) => resolve(data))
|
|
121
|
+
.catch((error) => reject(error));
|
|
122
|
+
}),
|
|
123
|
+
listObjects: (options) => new Promise((resolve, reject) => {
|
|
124
|
+
debug('listObjects', `s3://${options.Bucket}/${options.Prefix}`);
|
|
125
|
+
aws.s3
|
|
126
|
+
?.send(new client_s3_1.ListObjectsV2Command(options))
|
|
127
|
+
.then((data) => resolve(data))
|
|
128
|
+
.catch((error) => reject(error));
|
|
129
|
+
}),
|
|
130
|
+
uploadFile: (local, options, { dryRun } = {}) => new Promise((resolve, reject) => {
|
|
131
|
+
ux_1.ux.stdout(`> ${local}`);
|
|
132
|
+
ux_1.ux.stdout(' action: upload');
|
|
133
|
+
ux_1.ux.stdout(` source: ${(0, util_1.prettifyPaths)(local)}`);
|
|
134
|
+
ux_1.ux.stdout(` target: s3://${options.Bucket}/${options.Key}`);
|
|
135
|
+
ux_1.ux.stdout();
|
|
136
|
+
if (dryRun)
|
|
137
|
+
return;
|
|
138
|
+
options.Body = (0, fs_extra_1.createReadStream)(local);
|
|
139
|
+
aws.s3
|
|
140
|
+
?.send(new client_s3_1.PutObjectCommand(options))
|
|
141
|
+
.then((data) => resolve(data))
|
|
142
|
+
.catch((error) => reject(error));
|
|
143
|
+
}),
|
|
144
|
+
};
|
|
145
|
+
},
|
|
146
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { GeneratorCommand } from '../../generator';
|
|
2
|
+
export default class GenerateCommand extends GeneratorCommand<typeof GenerateCommand> {
|
|
3
|
+
static args: {
|
|
4
|
+
name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static flags: {
|
|
8
|
+
'commands-dir': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const ansis_1 = require("ansis");
|
|
5
|
+
const change_case_1 = require("change-case");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
const generator_1 = require("../../generator");
|
|
8
|
+
class GenerateCommand extends generator_1.GeneratorCommand {
|
|
9
|
+
static args = {
|
|
10
|
+
name: core_1.Args.string({ description: 'name of command', required: true }),
|
|
11
|
+
};
|
|
12
|
+
static description = 'Add a command to an existing CLI or plugin.';
|
|
13
|
+
static flags = {
|
|
14
|
+
'commands-dir': core_1.Flags.string({ default: 'src/commands', description: 'The directory to create the command in.' }),
|
|
15
|
+
force: core_1.Flags.boolean({ description: 'Overwrite existing files.' }),
|
|
16
|
+
};
|
|
17
|
+
async run() {
|
|
18
|
+
const packageJSON = await (0, generator_1.readPJSON)(process.cwd());
|
|
19
|
+
if (!packageJSON)
|
|
20
|
+
throw new core_1.Errors.CLIError('not in a project directory');
|
|
21
|
+
const topicSeparator = packageJSON.oclif?.topicSeparator ?? ':';
|
|
22
|
+
this.log(`Adding ${(0, ansis_1.dim)(this.args.name.replaceAll(':', topicSeparator))} to ${packageJSON.name}!`);
|
|
23
|
+
const cmdPath = this.args.name.split(':').join('/');
|
|
24
|
+
const destination = (0, node_path_1.join)(process.cwd(), this.flags['commands-dir'], `${cmdPath}.ts`);
|
|
25
|
+
let bin = packageJSON.oclif?.bin ?? packageJSON.oclif?.dirname ?? packageJSON.name;
|
|
26
|
+
if (bin.includes('/'))
|
|
27
|
+
bin = bin.split('/').at(-1);
|
|
28
|
+
const opts = {
|
|
29
|
+
bin,
|
|
30
|
+
className: (0, change_case_1.pascalCase)(this.args.name),
|
|
31
|
+
cmd: `${bin} ${this.args.name}`,
|
|
32
|
+
name: this.args.name,
|
|
33
|
+
path: destination,
|
|
34
|
+
type: 'command',
|
|
35
|
+
};
|
|
36
|
+
await this.template((0, node_path_1.join)(this.templatesDir, 'src', 'command.ts.ejs'), destination, opts);
|
|
37
|
+
if (packageJSON.devDependencies?.mocha) {
|
|
38
|
+
const testTemplatePath = (0, node_path_1.join)(this.templatesDir, 'test', 'command.test.ts.ejs');
|
|
39
|
+
const testDestination = (0, node_path_1.join)(process.cwd(), 'test', 'commands', `${cmdPath}.test.ts`);
|
|
40
|
+
await this.template(testTemplatePath, testDestination, opts);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.default = GenerateCommand;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { GeneratorCommand } from '../../generator';
|
|
2
|
+
export default class GenerateHook extends GeneratorCommand<typeof GenerateHook> {
|
|
3
|
+
static args: {
|
|
4
|
+
name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static flags: {
|
|
8
|
+
event: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const core_1 = require("@oclif/core");
|
|
37
|
+
const ansis_1 = require("ansis");
|
|
38
|
+
const fs = __importStar(require("fs-extra"));
|
|
39
|
+
const promises_1 = require("node:fs/promises");
|
|
40
|
+
const node_path_1 = require("node:path");
|
|
41
|
+
const generator_1 = require("../../generator");
|
|
42
|
+
const util_1 = require("../../util");
|
|
43
|
+
class GenerateHook extends generator_1.GeneratorCommand {
|
|
44
|
+
static args = {
|
|
45
|
+
name: core_1.Args.string({ description: 'Name of hook (snake_case).', required: true }),
|
|
46
|
+
};
|
|
47
|
+
static description = 'Add a hook to an existing CLI or plugin.';
|
|
48
|
+
static flags = {
|
|
49
|
+
event: core_1.Flags.string({
|
|
50
|
+
default: 'init',
|
|
51
|
+
description: 'Event to run hook on.',
|
|
52
|
+
}),
|
|
53
|
+
force: core_1.Flags.boolean({
|
|
54
|
+
description: 'Overwrite existing files.',
|
|
55
|
+
}),
|
|
56
|
+
};
|
|
57
|
+
async run() {
|
|
58
|
+
const packageJSON = await (0, generator_1.readPJSON)(process.cwd());
|
|
59
|
+
if (!packageJSON)
|
|
60
|
+
throw new core_1.Errors.CLIError('not in a project directory');
|
|
61
|
+
this.log(`Adding a ${(0, ansis_1.dim)(this.flags.event)} hook to ${packageJSON.name}!`);
|
|
62
|
+
const source = (0, node_path_1.join)(this.templatesDir, 'src', 'hook.ts.ejs');
|
|
63
|
+
const dest = (0, node_path_1.join)(process.cwd(), 'src', 'hooks', this.flags.event, `${this.args.name}.ts`);
|
|
64
|
+
await this.template(source, dest, { event: this.flags.event });
|
|
65
|
+
if (packageJSON.devDependencies?.mocha) {
|
|
66
|
+
const testSource = (0, node_path_1.join)(this.templatesDir, 'test', 'hook.test.ts.ejs');
|
|
67
|
+
const testDest = (0, node_path_1.join)(process.cwd(), 'test', 'hooks', this.flags.event, `${this.args.name}.test.ts`);
|
|
68
|
+
await this.template(testSource, testDest);
|
|
69
|
+
}
|
|
70
|
+
const tsConfigPath = (0, node_path_1.resolve)(process.cwd(), 'tsconfig.json');
|
|
71
|
+
const tsConfig = await fs.readJSON(tsConfigPath).catch(() => ({}));
|
|
72
|
+
const outDir = tsConfig.compilerOptions?.outDir ?? 'dist';
|
|
73
|
+
const hooks = packageJSON.oclif?.hooks ?? {};
|
|
74
|
+
hooks[this.flags.event] = hooks[this.flags.event]
|
|
75
|
+
? (0, util_1.uniq)([...(0, util_1.castArray)(hooks[this.flags.event]), `./${outDir}/hooks/${this.flags.event}/${this.args.name}`]).sort()
|
|
76
|
+
: `./${outDir}/hooks/${this.flags.event}/${this.args.name}`;
|
|
77
|
+
const updatedPackageJSON = {
|
|
78
|
+
...packageJSON,
|
|
79
|
+
oclif: {
|
|
80
|
+
...packageJSON.oclif,
|
|
81
|
+
hooks,
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
await (0, promises_1.writeFile)((0, node_path_1.resolve)(process.cwd(), 'package.json'), JSON.stringify(updatedPackageJSON, null, 2));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.default = GenerateHook;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { GeneratorCommand } from '../generator';
|
|
2
|
+
export default class Generate extends GeneratorCommand<typeof Generate> {
|
|
3
|
+
static args: {
|
|
4
|
+
name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: {
|
|
8
|
+
command: string;
|
|
9
|
+
description: string;
|
|
10
|
+
}[];
|
|
11
|
+
static flaggablePrompts: {
|
|
12
|
+
author: {
|
|
13
|
+
message: string;
|
|
14
|
+
validate: (d: string) => true | "Author cannot be empty";
|
|
15
|
+
};
|
|
16
|
+
bin: {
|
|
17
|
+
message: string;
|
|
18
|
+
validate: (d: string) => true | "Invalid bin name";
|
|
19
|
+
};
|
|
20
|
+
description: {
|
|
21
|
+
message: string;
|
|
22
|
+
validate: (d: string) => true | "Description cannot be empty";
|
|
23
|
+
};
|
|
24
|
+
license: {
|
|
25
|
+
message: string;
|
|
26
|
+
validate: (d: string) => true | "License cannot be empty";
|
|
27
|
+
};
|
|
28
|
+
'module-type': {
|
|
29
|
+
message: string;
|
|
30
|
+
options: string[];
|
|
31
|
+
validate: (d: string) => true | "Invalid module type";
|
|
32
|
+
};
|
|
33
|
+
name: {
|
|
34
|
+
message: string;
|
|
35
|
+
validate: (d: string) => true | "Invalid package name";
|
|
36
|
+
};
|
|
37
|
+
owner: {
|
|
38
|
+
message: string;
|
|
39
|
+
validate: (d: string) => true | "Owner cannot be empty";
|
|
40
|
+
};
|
|
41
|
+
'package-manager': {
|
|
42
|
+
message: string;
|
|
43
|
+
options: string[];
|
|
44
|
+
validate: (d: string) => true | "Invalid package manager";
|
|
45
|
+
};
|
|
46
|
+
repository: {
|
|
47
|
+
message: string;
|
|
48
|
+
validate: (d: string) => true | "Repo cannot be empty";
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
static flags: {
|
|
52
|
+
'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
53
|
+
'output-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
54
|
+
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
55
|
+
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
56
|
+
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
57
|
+
repository: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
58
|
+
bin: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
59
|
+
author: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
60
|
+
license: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
61
|
+
"module-type": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
62
|
+
owner: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
63
|
+
"package-manager": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
64
|
+
};
|
|
65
|
+
static summary: string;
|
|
66
|
+
run(): Promise<void>;
|
|
67
|
+
}
|