@pdfbutler/migration-cli 0.0.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/README.md +145 -0
- package/lib/commands/butler/pb/export.d.ts +23 -0
- package/lib/commands/butler/pb/export.js +108 -0
- package/lib/commands/butler/pb/export.js.map +1 -0
- package/lib/commands/butler/pb/import.d.ts +20 -0
- package/lib/commands/butler/pb/import.js +131 -0
- package/lib/commands/butler/pb/import.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -0
- package/messages/butler.pb.export.md +51 -0
- package/messages/butler.pb.import.md +40 -0
- package/oclif.manifest.json +166 -0
- package/package.json +212 -0
package/README.md
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# pdfbutler-migration-cli
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/pdfbutler-migration-cli) [](https://npmjs.org/package/pdfbutler-migration-cli) [](https://raw.githubusercontent.com/salesforcecli/pdfbutler-migration-cli/main/LICENSE.txt)
|
|
4
|
+
|
|
5
|
+
## Using the template
|
|
6
|
+
|
|
7
|
+
This repository provides a template for creating a plugin for the Salesforce CLI. To convert this template to a working plugin:
|
|
8
|
+
|
|
9
|
+
1. Please get in touch with the Platform CLI team. We want to help you develop your plugin.
|
|
10
|
+
2. Generate your plugin:
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
sf plugins install dev
|
|
14
|
+
sf dev generate plugin
|
|
15
|
+
|
|
16
|
+
git init -b main
|
|
17
|
+
git add . && git commit -m "chore: initial commit"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
3. Create your plugin's repo in the salesforcecli github org
|
|
21
|
+
4. When you're ready, replace the contents of this README with the information you want.
|
|
22
|
+
|
|
23
|
+
## Learn about `sf` plugins
|
|
24
|
+
|
|
25
|
+
Salesforce CLI plugins are based on the [oclif plugin framework](<(https://oclif.io/docs/introduction.html)>). Read the [plugin developer guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_plugins.meta/sfdx_cli_plugins/cli_plugins_architecture_sf_cli.htm) to learn about Salesforce CLI plugin development.
|
|
26
|
+
|
|
27
|
+
This repository contains a lot of additional scripts and tools to help with general Salesforce node development and enforce coding standards. You should familiarize yourself with some of the [node developer packages](#tooling) used by Salesforce.
|
|
28
|
+
|
|
29
|
+
Additionally, there are some additional tests that the Salesforce CLI will enforce if this plugin is ever bundled with the CLI. These test are included by default under the `posttest` script and it is required to keep these tests active in your plugin if you plan to have it bundled.
|
|
30
|
+
|
|
31
|
+
### Tooling
|
|
32
|
+
|
|
33
|
+
- [@salesforce/core](https://github.com/forcedotcom/sfdx-core)
|
|
34
|
+
- [@salesforce/kit](https://github.com/forcedotcom/kit)
|
|
35
|
+
- [@salesforce/sf-plugins-core](https://github.com/salesforcecli/sf-plugins-core)
|
|
36
|
+
- [@salesforce/ts-types](https://github.com/forcedotcom/ts-types)
|
|
37
|
+
- [@salesforce/ts-sinon](https://github.com/forcedotcom/ts-sinon)
|
|
38
|
+
- [@salesforce/dev-config](https://github.com/forcedotcom/dev-config)
|
|
39
|
+
- [@salesforce/dev-scripts](https://github.com/forcedotcom/dev-scripts)
|
|
40
|
+
|
|
41
|
+
### Hooks
|
|
42
|
+
|
|
43
|
+
For cross clouds commands, e.g. `sf env list`, we utilize [oclif hooks](https://oclif.io/docs/hooks) to get the relevant information from installed plugins.
|
|
44
|
+
|
|
45
|
+
This plugin includes sample hooks in the [src/hooks directory](src/hooks). You'll just need to add the appropriate logic. You can also delete any of the hooks if they aren't required for your plugin.
|
|
46
|
+
|
|
47
|
+
# Everything past here is only a suggestion as to what should be in your specific plugin's description
|
|
48
|
+
|
|
49
|
+
This plugin is bundled with the [Salesforce CLI](https://developer.salesforce.com/tools/sfdxcli). For more information on the CLI, read the [getting started guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_intro.htm).
|
|
50
|
+
|
|
51
|
+
We always recommend using the latest version of these commands bundled with the CLI, however, you can install a specific version or tag if needed.
|
|
52
|
+
|
|
53
|
+
## Install
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
sf plugins install pdfbutler-migration-cli@x.y.z
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Issues
|
|
60
|
+
|
|
61
|
+
Please report any issues at https://github.com/forcedotcom/cli/issues
|
|
62
|
+
|
|
63
|
+
## Contributing
|
|
64
|
+
|
|
65
|
+
1. Please read our [Code of Conduct](CODE_OF_CONDUCT.md)
|
|
66
|
+
2. Create a new issue before starting your project so that we can keep track of
|
|
67
|
+
what you are trying to add/fix. That way, we can also offer suggestions or
|
|
68
|
+
let you know if there is already an effort in progress.
|
|
69
|
+
3. Fork this repository.
|
|
70
|
+
4. [Build the plugin locally](#build)
|
|
71
|
+
5. Create a _topic_ branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.
|
|
72
|
+
6. Edit the code in your fork.
|
|
73
|
+
7. Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.
|
|
74
|
+
8. Sign CLA (see [CLA](#cla) below).
|
|
75
|
+
9. Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.
|
|
76
|
+
|
|
77
|
+
### CLA
|
|
78
|
+
|
|
79
|
+
External contributors will be required to sign a Contributor's License
|
|
80
|
+
Agreement. You can do so by going to https://cla.salesforce.com/sign-cla.
|
|
81
|
+
|
|
82
|
+
### Build
|
|
83
|
+
|
|
84
|
+
To build the plugin locally, make sure to have yarn installed and run the following commands:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Clone the repository
|
|
88
|
+
git clone git@github.com:salesforcecli/pdfbutler-migration-cli
|
|
89
|
+
|
|
90
|
+
# Install the dependencies and compile
|
|
91
|
+
yarn && yarn build
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
To use your plugin, run using the local `./bin/dev` or `./bin/dev.cmd` file.
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Run using local run file.
|
|
98
|
+
./bin/dev hello world
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Link your plugin to the sf cli
|
|
105
|
+
sf plugins link .
|
|
106
|
+
# To verify
|
|
107
|
+
sf plugins
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Commands
|
|
111
|
+
|
|
112
|
+
<!-- commands -->
|
|
113
|
+
|
|
114
|
+
- [`sf hello world`](#sf-hello-world)
|
|
115
|
+
|
|
116
|
+
## `sf hello world`
|
|
117
|
+
|
|
118
|
+
Say hello either to the world or someone you know.
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
USAGE
|
|
122
|
+
$ sf hello world [--json] [-n <value>]
|
|
123
|
+
|
|
124
|
+
FLAGS
|
|
125
|
+
-n, --name=<value> [default: World] The name of the person you'd like to say hello to.
|
|
126
|
+
|
|
127
|
+
GLOBAL FLAGS
|
|
128
|
+
--json Format output as json.
|
|
129
|
+
|
|
130
|
+
DESCRIPTION
|
|
131
|
+
Say hello either to the world or someone you know.
|
|
132
|
+
|
|
133
|
+
Say hello either to the world or someone you know.
|
|
134
|
+
|
|
135
|
+
EXAMPLES
|
|
136
|
+
Say hello to the world:
|
|
137
|
+
|
|
138
|
+
$ sf hello world
|
|
139
|
+
|
|
140
|
+
Say hello to someone you know:
|
|
141
|
+
|
|
142
|
+
$ sf hello world --name Astro
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
<!-- commandsstop -->
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
4
|
+
export type ButlerPbExportResult = {
|
|
5
|
+
path: string;
|
|
6
|
+
};
|
|
7
|
+
export default class ButlerPbExport extends SfCommand<Buffer> {
|
|
8
|
+
static readonly summary: string;
|
|
9
|
+
static readonly description: string;
|
|
10
|
+
static readonly examples: string[];
|
|
11
|
+
static readonly flags: {
|
|
12
|
+
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
13
|
+
target: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
14
|
+
id: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
15
|
+
out: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
16
|
+
backend: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
'auth-env-var': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
18
|
+
endpoint: import("@oclif/core/lib/interfaces").OptionFlag<import("url").URL | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
19
|
+
stage: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
20
|
+
unzip: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
21
|
+
};
|
|
22
|
+
run(): Promise<Buffer>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fs_1 = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
6
|
+
const core_1 = require("@salesforce/core");
|
|
7
|
+
const AdmZip = require("adm-zip");
|
|
8
|
+
const got_1 = require("got");
|
|
9
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
10
|
+
// const messages = Messages.loadMessages('pdfbutler-migration-cli', 'butler.pb.export');
|
|
11
|
+
const messages = core_1.Messages.loadMessages('@pdfbutler/migration-cli', 'butler.pb.export');
|
|
12
|
+
class ButlerPbExport extends sf_plugins_core_1.SfCommand {
|
|
13
|
+
async run() {
|
|
14
|
+
const { flags } = await this.parse(ButlerPbExport);
|
|
15
|
+
const outFile = flags.out;
|
|
16
|
+
const outDir = path.dirname(outFile);
|
|
17
|
+
const authInfo = await core_1.AuthInfo.create({ username: flags.target });
|
|
18
|
+
const connection = await core_1.Connection.create({ authInfo });
|
|
19
|
+
this.log(`Connected to ${flags.target} (${authInfo.getFields().orgId}) with API version ${connection.version}`);
|
|
20
|
+
const docConfigResponse = await connection.apex.get(`/cadmus_core/DocConfig/Export2/${flags.id}`);
|
|
21
|
+
let zip;
|
|
22
|
+
let result = Buffer.from('');
|
|
23
|
+
if (flags.backend) {
|
|
24
|
+
const auth = flags['auth-env-var'];
|
|
25
|
+
let base64Auth = auth;
|
|
26
|
+
if (auth?.indexOf(':')) {
|
|
27
|
+
base64Auth = Buffer.from(auth).toString('base64');
|
|
28
|
+
}
|
|
29
|
+
const finalUrl = `${flags.endpoint?.toString()}config/export-config/${flags.stage}/${flags.id}`;
|
|
30
|
+
result = await (0, got_1.default)(finalUrl, {
|
|
31
|
+
headers: {
|
|
32
|
+
Authorization: `Basic ${base64Auth}`,
|
|
33
|
+
},
|
|
34
|
+
}).buffer();
|
|
35
|
+
zip = new AdmZip(result);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
zip = new AdmZip();
|
|
39
|
+
}
|
|
40
|
+
await fs_1.promises.mkdir(`./sfdc/${outDir}`, { recursive: true });
|
|
41
|
+
if (flags.unzip) {
|
|
42
|
+
zip.extractAllTo(`./sfdc/${outFile}`, false);
|
|
43
|
+
await fs_1.promises.writeFile(`./sfdc/${outDir}/docconfig.json`, JSON.stringify(docConfigResponse));
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
let zipToExport = new AdmZip();
|
|
47
|
+
if (result) {
|
|
48
|
+
zipToExport = new AdmZip();
|
|
49
|
+
}
|
|
50
|
+
for (const entry of zip.getEntries()) {
|
|
51
|
+
zipToExport.addFile(entry.entryName, zip.readFile(entry));
|
|
52
|
+
}
|
|
53
|
+
zipToExport.addFile('sfdc/docconfig.json', docConfigResponse);
|
|
54
|
+
await fs_1.promises.writeFile(`./sfdc/${outFile}.zip`, zipToExport.toBuffer());
|
|
55
|
+
await fs_1.promises.writeFile(`./sfdc/${outDir}/docconfig.json`, JSON.stringify(docConfigResponse));
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
ButlerPbExport.summary = messages.getMessage('summary');
|
|
61
|
+
ButlerPbExport.description = messages.getMessage('description');
|
|
62
|
+
ButlerPbExport.examples = messages.getMessages('examples');
|
|
63
|
+
ButlerPbExport.flags = {
|
|
64
|
+
name: sf_plugins_core_1.Flags.string({
|
|
65
|
+
summary: messages.getMessage('flags.name.summary'),
|
|
66
|
+
description: messages.getMessage('flags.name.description'),
|
|
67
|
+
char: 'n',
|
|
68
|
+
required: false,
|
|
69
|
+
}),
|
|
70
|
+
target: sf_plugins_core_1.Flags.string({
|
|
71
|
+
summary: messages.getMessage('flags.target.summary'),
|
|
72
|
+
char: 't',
|
|
73
|
+
required: true,
|
|
74
|
+
}),
|
|
75
|
+
id: sf_plugins_core_1.Flags.string({
|
|
76
|
+
summary: messages.getMessage('flags.id.summary'),
|
|
77
|
+
char: 'i',
|
|
78
|
+
required: true,
|
|
79
|
+
}),
|
|
80
|
+
out: sf_plugins_core_1.Flags.string({
|
|
81
|
+
summary: messages.getMessage('flags.out.summary'),
|
|
82
|
+
char: 'o',
|
|
83
|
+
required: true,
|
|
84
|
+
}),
|
|
85
|
+
backend: sf_plugins_core_1.Flags.boolean({
|
|
86
|
+
summary: messages.getMessage('flags.backend.summary'),
|
|
87
|
+
char: 'b',
|
|
88
|
+
}),
|
|
89
|
+
'auth-env-var': sf_plugins_core_1.Flags.string({
|
|
90
|
+
summary: messages.getMessage('flags.auth-env-var.summary'),
|
|
91
|
+
char: 'a',
|
|
92
|
+
}),
|
|
93
|
+
endpoint: sf_plugins_core_1.Flags.url({
|
|
94
|
+
summary: messages.getMessage('flags.endpoint.summary'),
|
|
95
|
+
char: 'e',
|
|
96
|
+
}),
|
|
97
|
+
stage: sf_plugins_core_1.Flags.string({
|
|
98
|
+
summary: messages.getMessage('flags.stage.summary'),
|
|
99
|
+
char: 's',
|
|
100
|
+
required: true,
|
|
101
|
+
}),
|
|
102
|
+
unzip: sf_plugins_core_1.Flags.boolean({
|
|
103
|
+
summary: messages.getMessage('flags.unzip.summary'),
|
|
104
|
+
char: 'u',
|
|
105
|
+
}),
|
|
106
|
+
};
|
|
107
|
+
exports.default = ButlerPbExport;
|
|
108
|
+
//# sourceMappingURL=export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../../../src/commands/butler/pb/export.ts"],"names":[],"mappings":";;AAAA,2BAAoC;AACpC,6BAA8B;AAC9B,iEAA+D;AAC/D,2CAAkE;AAClE,kCAAmC;AACnC,6BAAsB;AAEtB,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,yFAAyF;AACzF,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,kBAAkB,CAAC,CAAC;AAMvF,MAAqB,cAAe,SAAQ,2BAAiB;IAkDpD,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAEnD,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAErC,MAAM,QAAQ,GAAG,MAAM,eAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,EA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;KACV,CAAC;CACH,CAAC;kBAhDiB,cAAc"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
export type ButlerPbImportResult = {
|
|
4
|
+
success: boolean;
|
|
5
|
+
};
|
|
6
|
+
export default class ButlerPbImport extends SfCommand<ButlerPbImportResult> {
|
|
7
|
+
static readonly summary: string;
|
|
8
|
+
static readonly description: string;
|
|
9
|
+
static readonly examples: string[];
|
|
10
|
+
static readonly flags: {
|
|
11
|
+
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
12
|
+
target: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
13
|
+
'auth-env-var': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
14
|
+
endpoint: import("@oclif/core/lib/interfaces").OptionFlag<import("url").URL | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
15
|
+
stage: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
16
|
+
config: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
17
|
+
};
|
|
18
|
+
private static getTargetPath;
|
|
19
|
+
run(): Promise<ButlerPbImportResult>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const fs = require("graceful-fs");
|
|
5
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
6
|
+
const core_1 = require("@salesforce/core");
|
|
7
|
+
const FormData = require("form-data");
|
|
8
|
+
const AdmZip = require("adm-zip");
|
|
9
|
+
const got_1 = require("got");
|
|
10
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
11
|
+
const messages = core_1.Messages.loadMessages('@pdfbutler/migration-cli', 'butler.pb.import');
|
|
12
|
+
class ButlerPbImport extends sf_plugins_core_1.SfCommand {
|
|
13
|
+
static getTargetPath(recordType) {
|
|
14
|
+
switch (recordType) {
|
|
15
|
+
case 'EXCEL':
|
|
16
|
+
return 'config/xls/import-config';
|
|
17
|
+
case 'WORD':
|
|
18
|
+
return 'config/import-config';
|
|
19
|
+
case 'PPTX':
|
|
20
|
+
return 'config/pptx/import-config';
|
|
21
|
+
case 'PDF':
|
|
22
|
+
return 'config/pdf/import-config';
|
|
23
|
+
case 'EMAIL':
|
|
24
|
+
return 'config/import-config';
|
|
25
|
+
case 'CSV':
|
|
26
|
+
return 'config/csv/import-config';
|
|
27
|
+
}
|
|
28
|
+
throw new Error('Unsupported record type');
|
|
29
|
+
}
|
|
30
|
+
async run() {
|
|
31
|
+
const { flags } = await this.parse(ButlerPbImport);
|
|
32
|
+
const statInfo = await new Promise((resolve) => {
|
|
33
|
+
fs.stat(flags.config, (_, stat) => {
|
|
34
|
+
resolve(stat);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
let zip = null;
|
|
38
|
+
if (statInfo?.isDirectory()) {
|
|
39
|
+
zip = new AdmZip();
|
|
40
|
+
zip.addLocalFolder(flags.config);
|
|
41
|
+
}
|
|
42
|
+
if (statInfo?.isFile()) {
|
|
43
|
+
zip = new AdmZip(flags.config);
|
|
44
|
+
}
|
|
45
|
+
if (zip == null && flags.endpoint) {
|
|
46
|
+
return { success: false };
|
|
47
|
+
}
|
|
48
|
+
const targetDir = path.dirname(flags.config);
|
|
49
|
+
const authInfo = await core_1.AuthInfo.create({ username: flags.target });
|
|
50
|
+
const connection = await core_1.Connection.create({ authInfo });
|
|
51
|
+
this.log(`Connected to ${flags.target} (${authInfo.getFields().orgId}) with API version ${connection.version}`);
|
|
52
|
+
const sfdcConfig = JSON.parse(fs.readFileSync(`${targetDir}/docconfig.json`)?.toString());
|
|
53
|
+
const sfdcConfigObject = new Object();
|
|
54
|
+
Object.assign(sfdcConfigObject, sfdcConfig);
|
|
55
|
+
await connection.apex.post('/cadmus_core/DocConfig/Import', sfdcConfigObject, { header: { 'content-type': 'application/json' } });
|
|
56
|
+
if (flags.endpoint) {
|
|
57
|
+
if (zip == null) {
|
|
58
|
+
return { success: false };
|
|
59
|
+
}
|
|
60
|
+
const zipToSend = new AdmZip();
|
|
61
|
+
for (const entry of zip.getEntries()) {
|
|
62
|
+
if (entry != null) {
|
|
63
|
+
zipToSend.addFile(entry.entryName, zip.readFile(entry));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (!flags['auth-env-var']) {
|
|
67
|
+
this.error('auth-env-var parameter is required when endpoint is provided');
|
|
68
|
+
return { success: false };
|
|
69
|
+
}
|
|
70
|
+
const auth = flags['auth-env-var'];
|
|
71
|
+
let base64Auth = auth;
|
|
72
|
+
if (auth?.indexOf(':')) {
|
|
73
|
+
base64Auth = Buffer.from(auth).toString('base64');
|
|
74
|
+
}
|
|
75
|
+
const baseUrl = `${flags.endpoint.toString()}`;
|
|
76
|
+
const txt = zip.readAsText('doc-config.json');
|
|
77
|
+
const recordType = JSON.parse(txt).recordType;
|
|
78
|
+
const targetPath = ButlerPbImport.getTargetPath(recordType);
|
|
79
|
+
const finalUrl = `${baseUrl}${targetPath}`;
|
|
80
|
+
const fd = new FormData();
|
|
81
|
+
fd.append('zip', zipToSend.toBuffer(), { filename: 'zip' });
|
|
82
|
+
fd.append('metadata', JSON.stringify({
|
|
83
|
+
stage: flags.stage,
|
|
84
|
+
version: 'v10.0',
|
|
85
|
+
}), { contentType: 'application/json' });
|
|
86
|
+
const resp = await got_1.default.post(finalUrl, {
|
|
87
|
+
body: fd.getBuffer(),
|
|
88
|
+
headers: fd.getHeaders({
|
|
89
|
+
Authorization: `Basic ${base64Auth}`
|
|
90
|
+
}),
|
|
91
|
+
});
|
|
92
|
+
return { success: resp.statusCode === 200 };
|
|
93
|
+
}
|
|
94
|
+
return { success: true };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
ButlerPbImport.summary = messages.getMessage('summary');
|
|
98
|
+
ButlerPbImport.description = messages.getMessage('description');
|
|
99
|
+
ButlerPbImport.examples = messages.getMessages('examples');
|
|
100
|
+
ButlerPbImport.flags = {
|
|
101
|
+
name: sf_plugins_core_1.Flags.string({
|
|
102
|
+
summary: messages.getMessage('flags.name.summary'),
|
|
103
|
+
description: messages.getMessage('flags.name.description'),
|
|
104
|
+
char: 'n',
|
|
105
|
+
required: false,
|
|
106
|
+
}),
|
|
107
|
+
target: sf_plugins_core_1.Flags.string({
|
|
108
|
+
summary: messages.getMessage('flags.target.summary'),
|
|
109
|
+
char: 't',
|
|
110
|
+
required: true,
|
|
111
|
+
}),
|
|
112
|
+
'auth-env-var': sf_plugins_core_1.Flags.string({
|
|
113
|
+
summary: messages.getMessage('flags.auth-env-var.summary'),
|
|
114
|
+
char: 'a',
|
|
115
|
+
}),
|
|
116
|
+
endpoint: sf_plugins_core_1.Flags.url({
|
|
117
|
+
summary: messages.getMessage('flags.endpoint.summary'),
|
|
118
|
+
char: 'e',
|
|
119
|
+
}),
|
|
120
|
+
stage: sf_plugins_core_1.Flags.string({
|
|
121
|
+
summary: messages.getMessage('flags.stage.summary'),
|
|
122
|
+
char: 's',
|
|
123
|
+
}),
|
|
124
|
+
config: sf_plugins_core_1.Flags.string({
|
|
125
|
+
summary: messages.getMessage('flags.config.summary'),
|
|
126
|
+
char: 'f',
|
|
127
|
+
required: true,
|
|
128
|
+
}),
|
|
129
|
+
};
|
|
130
|
+
exports.default = ButlerPbImport;
|
|
131
|
+
//# sourceMappingURL=import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import.js","sourceRoot":"","sources":["../../../../src/commands/butler/pb/import.ts"],"names":[],"mappings":";;AAAA,6BAA8B;AAC9B,kC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C,wBAAwB,CAAC;QACtD,IAAI,EAAE,GAAG;KACV,CAAC;IACF,KAAK,EAAE,uBAAK,CAAC,MAAM,CAAC;QAClB,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,qBAAqB,CAAC;QACnD,IAAI,EAAE,GAAG;KACV,CAAC;IACF,MAAM,EAAE,uBAAK,CAAC,MAAM,CAAC;QACnB,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,sBAAsB,CAAC;QACpD,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,IAAI;KACf,CAAC;CACH,CAAC;kBAlCiB,cAAc"}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,iBAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Summary of a command.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
More information about a command. Don't repeat the summary.
|
|
8
|
+
|
|
9
|
+
# flags.name.summary
|
|
10
|
+
|
|
11
|
+
Description of a flag.
|
|
12
|
+
|
|
13
|
+
# flags.name.description
|
|
14
|
+
|
|
15
|
+
More information about a flag. Don't repeat the summary.
|
|
16
|
+
|
|
17
|
+
# examples
|
|
18
|
+
|
|
19
|
+
- <%= config.bin %> <%= command.id %>
|
|
20
|
+
|
|
21
|
+
# flags.target.summary
|
|
22
|
+
|
|
23
|
+
Summary for target.
|
|
24
|
+
|
|
25
|
+
# flags.id.summary
|
|
26
|
+
|
|
27
|
+
Summary for id.
|
|
28
|
+
|
|
29
|
+
# flags.out.summary
|
|
30
|
+
|
|
31
|
+
Summary for out.
|
|
32
|
+
|
|
33
|
+
# flags.backend.summary
|
|
34
|
+
|
|
35
|
+
Summary for backend.
|
|
36
|
+
|
|
37
|
+
# flags.auth-env-var.summary
|
|
38
|
+
|
|
39
|
+
Summary for auth-env-var.
|
|
40
|
+
|
|
41
|
+
# flags.endpoint.summary
|
|
42
|
+
|
|
43
|
+
Summary for endpoint.
|
|
44
|
+
|
|
45
|
+
# flags.stage.summary
|
|
46
|
+
|
|
47
|
+
Summary for stage.
|
|
48
|
+
|
|
49
|
+
# flags.unzip.summary
|
|
50
|
+
|
|
51
|
+
Summary for unzip.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Summary of a command.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
More information about a command. Don't repeat the summary.
|
|
8
|
+
|
|
9
|
+
# flags.name.summary
|
|
10
|
+
|
|
11
|
+
Description of a flag.
|
|
12
|
+
|
|
13
|
+
# flags.name.description
|
|
14
|
+
|
|
15
|
+
More information about a flag. Don't repeat the summary.
|
|
16
|
+
|
|
17
|
+
# examples
|
|
18
|
+
|
|
19
|
+
- <%= config.bin %> <%= command.id %>
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# flags.target.summary
|
|
23
|
+
|
|
24
|
+
Summary for target.
|
|
25
|
+
|
|
26
|
+
# flags.auth-env-var.summary
|
|
27
|
+
|
|
28
|
+
Summary for auth-env-var.
|
|
29
|
+
|
|
30
|
+
# flags.endpoint.summary
|
|
31
|
+
|
|
32
|
+
Summary for endpoint.
|
|
33
|
+
|
|
34
|
+
# flags.stage.summary
|
|
35
|
+
|
|
36
|
+
Summary for stage.
|
|
37
|
+
|
|
38
|
+
# flags.config.summary
|
|
39
|
+
|
|
40
|
+
Summary for config.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.0.1",
|
|
3
|
+
"commands": {
|
|
4
|
+
"butler:pb:export": {
|
|
5
|
+
"id": "butler:pb:export",
|
|
6
|
+
"summary": "Summary of a command.",
|
|
7
|
+
"description": "More information about a command. Don't repeat the summary.",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"pluginName": "@pdfbutler/migration-cli",
|
|
10
|
+
"pluginAlias": "@pdfbutler/migration-cli",
|
|
11
|
+
"pluginType": "core",
|
|
12
|
+
"aliases": [],
|
|
13
|
+
"examples": [
|
|
14
|
+
"<%= config.bin %> <%= command.id %>"
|
|
15
|
+
],
|
|
16
|
+
"flags": {
|
|
17
|
+
"json": {
|
|
18
|
+
"name": "json",
|
|
19
|
+
"type": "boolean",
|
|
20
|
+
"description": "Format output as json.",
|
|
21
|
+
"helpGroup": "GLOBAL",
|
|
22
|
+
"allowNo": false
|
|
23
|
+
},
|
|
24
|
+
"name": {
|
|
25
|
+
"name": "name",
|
|
26
|
+
"type": "option",
|
|
27
|
+
"char": "n",
|
|
28
|
+
"summary": "Description of a flag.",
|
|
29
|
+
"description": "More information about a flag. Don't repeat the summary.",
|
|
30
|
+
"required": false,
|
|
31
|
+
"multiple": false
|
|
32
|
+
},
|
|
33
|
+
"target": {
|
|
34
|
+
"name": "target",
|
|
35
|
+
"type": "option",
|
|
36
|
+
"char": "t",
|
|
37
|
+
"summary": "Summary for target.",
|
|
38
|
+
"required": true,
|
|
39
|
+
"multiple": false
|
|
40
|
+
},
|
|
41
|
+
"id": {
|
|
42
|
+
"name": "id",
|
|
43
|
+
"type": "option",
|
|
44
|
+
"char": "i",
|
|
45
|
+
"summary": "Summary for id.",
|
|
46
|
+
"required": true,
|
|
47
|
+
"multiple": false
|
|
48
|
+
},
|
|
49
|
+
"out": {
|
|
50
|
+
"name": "out",
|
|
51
|
+
"type": "option",
|
|
52
|
+
"char": "o",
|
|
53
|
+
"summary": "Summary for out.",
|
|
54
|
+
"required": true,
|
|
55
|
+
"multiple": false
|
|
56
|
+
},
|
|
57
|
+
"backend": {
|
|
58
|
+
"name": "backend",
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"char": "b",
|
|
61
|
+
"summary": "Summary for backend.",
|
|
62
|
+
"allowNo": false
|
|
63
|
+
},
|
|
64
|
+
"auth-env-var": {
|
|
65
|
+
"name": "auth-env-var",
|
|
66
|
+
"type": "option",
|
|
67
|
+
"char": "a",
|
|
68
|
+
"summary": "Summary for auth-env-var.",
|
|
69
|
+
"multiple": false
|
|
70
|
+
},
|
|
71
|
+
"endpoint": {
|
|
72
|
+
"name": "endpoint",
|
|
73
|
+
"type": "option",
|
|
74
|
+
"char": "e",
|
|
75
|
+
"summary": "Summary for endpoint.",
|
|
76
|
+
"multiple": false
|
|
77
|
+
},
|
|
78
|
+
"stage": {
|
|
79
|
+
"name": "stage",
|
|
80
|
+
"type": "option",
|
|
81
|
+
"char": "s",
|
|
82
|
+
"summary": "Summary for stage.",
|
|
83
|
+
"required": true,
|
|
84
|
+
"multiple": false
|
|
85
|
+
},
|
|
86
|
+
"unzip": {
|
|
87
|
+
"name": "unzip",
|
|
88
|
+
"type": "boolean",
|
|
89
|
+
"char": "u",
|
|
90
|
+
"summary": "Summary for unzip.",
|
|
91
|
+
"allowNo": false
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"args": {}
|
|
95
|
+
},
|
|
96
|
+
"butler:pb:import": {
|
|
97
|
+
"id": "butler:pb:import",
|
|
98
|
+
"summary": "Summary of a command.",
|
|
99
|
+
"description": "More information about a command. Don't repeat the summary.",
|
|
100
|
+
"strict": true,
|
|
101
|
+
"pluginName": "@pdfbutler/migration-cli",
|
|
102
|
+
"pluginAlias": "@pdfbutler/migration-cli",
|
|
103
|
+
"pluginType": "core",
|
|
104
|
+
"aliases": [],
|
|
105
|
+
"examples": [
|
|
106
|
+
"<%= config.bin %> <%= command.id %>"
|
|
107
|
+
],
|
|
108
|
+
"flags": {
|
|
109
|
+
"json": {
|
|
110
|
+
"name": "json",
|
|
111
|
+
"type": "boolean",
|
|
112
|
+
"description": "Format output as json.",
|
|
113
|
+
"helpGroup": "GLOBAL",
|
|
114
|
+
"allowNo": false
|
|
115
|
+
},
|
|
116
|
+
"name": {
|
|
117
|
+
"name": "name",
|
|
118
|
+
"type": "option",
|
|
119
|
+
"char": "n",
|
|
120
|
+
"summary": "Description of a flag.",
|
|
121
|
+
"description": "More information about a flag. Don't repeat the summary.",
|
|
122
|
+
"required": false,
|
|
123
|
+
"multiple": false
|
|
124
|
+
},
|
|
125
|
+
"target": {
|
|
126
|
+
"name": "target",
|
|
127
|
+
"type": "option",
|
|
128
|
+
"char": "t",
|
|
129
|
+
"summary": "Summary for target.",
|
|
130
|
+
"required": true,
|
|
131
|
+
"multiple": false
|
|
132
|
+
},
|
|
133
|
+
"auth-env-var": {
|
|
134
|
+
"name": "auth-env-var",
|
|
135
|
+
"type": "option",
|
|
136
|
+
"char": "a",
|
|
137
|
+
"summary": "Summary for auth-env-var.",
|
|
138
|
+
"multiple": false
|
|
139
|
+
},
|
|
140
|
+
"endpoint": {
|
|
141
|
+
"name": "endpoint",
|
|
142
|
+
"type": "option",
|
|
143
|
+
"char": "e",
|
|
144
|
+
"summary": "Summary for endpoint.",
|
|
145
|
+
"multiple": false
|
|
146
|
+
},
|
|
147
|
+
"stage": {
|
|
148
|
+
"name": "stage",
|
|
149
|
+
"type": "option",
|
|
150
|
+
"char": "s",
|
|
151
|
+
"summary": "Summary for stage.",
|
|
152
|
+
"multiple": false
|
|
153
|
+
},
|
|
154
|
+
"config": {
|
|
155
|
+
"name": "config",
|
|
156
|
+
"type": "option",
|
|
157
|
+
"char": "f",
|
|
158
|
+
"summary": "Summary for config.",
|
|
159
|
+
"required": true,
|
|
160
|
+
"multiple": false
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"args": {}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pdfbutler/migration-cli",
|
|
3
|
+
"description": "[](https://www.npmjs.com/package/pdfbutler-migration-cli) [](https://npmjs.org/package/pdfbutler-migration-cli) [](https://raw.githubusercontent.com/salesforcecli/pdfbutler-migration-cli/main/LICENSE.txt)",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@oclif/core": "^2.11.8",
|
|
7
|
+
"@salesforce/core": "^5.2.0",
|
|
8
|
+
"@salesforce/kit": "^3.0.8",
|
|
9
|
+
"@salesforce/sf-plugins-core": "^3.1.14",
|
|
10
|
+
"adm-zip": "^0.5.10",
|
|
11
|
+
"got": "^11",
|
|
12
|
+
"graceful-fs": "^4.2.4",
|
|
13
|
+
"tslib": "^2"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@salesforce/cli-plugins-testkit": "^4.3.0",
|
|
17
|
+
"@salesforce/dev-config": "^4.0.1",
|
|
18
|
+
"@salesforce/dev-scripts": "^5.7.0",
|
|
19
|
+
"@salesforce/prettier-config": "^0.0.3",
|
|
20
|
+
"@salesforce/ts-sinon": "^1.4.14",
|
|
21
|
+
"@swc/core": "^1.3.19",
|
|
22
|
+
"@types/adm-zip": "^0.5.1",
|
|
23
|
+
"@types/graceful-fs": "^4.1.6",
|
|
24
|
+
"@types/inquirer": "^9.0.3",
|
|
25
|
+
"@typescript-eslint/eslint-plugin": "^5.59.8",
|
|
26
|
+
"@typescript-eslint/parser": "^5.62.0",
|
|
27
|
+
"chai": "^4.3.6",
|
|
28
|
+
"eslint": "^8.47.0",
|
|
29
|
+
"eslint-config-prettier": "^8.5.0",
|
|
30
|
+
"eslint-config-salesforce": "^2.0.1",
|
|
31
|
+
"eslint-config-salesforce-typescript": "^1.1.2",
|
|
32
|
+
"eslint-plugin-import": "2.27.5",
|
|
33
|
+
"eslint-plugin-jsdoc": "^46.4.6",
|
|
34
|
+
"eslint-plugin-sf-plugin": "^1.16.2",
|
|
35
|
+
"husky": "^7.0.4",
|
|
36
|
+
"mocha": "^9.2.2",
|
|
37
|
+
"nyc": "^15.1.0",
|
|
38
|
+
"oclif": "^3.9.1",
|
|
39
|
+
"prettier": "^2.8.8",
|
|
40
|
+
"pretty-quick": "^3.1.3",
|
|
41
|
+
"shx": "0.3.4",
|
|
42
|
+
"sinon": "10.0.0",
|
|
43
|
+
"ts-node": "^10.9.1",
|
|
44
|
+
"typescript": "^5.1.6",
|
|
45
|
+
"wireit": "^0.10.0"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=16.0.0"
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"/lib",
|
|
52
|
+
"/messages",
|
|
53
|
+
"/oclif.manifest.json"
|
|
54
|
+
],
|
|
55
|
+
"keywords": [
|
|
56
|
+
"force",
|
|
57
|
+
"salesforce",
|
|
58
|
+
"sfdx",
|
|
59
|
+
"salesforcedx",
|
|
60
|
+
"sfdx-plugin",
|
|
61
|
+
"sf-plugin",
|
|
62
|
+
"sf"
|
|
63
|
+
],
|
|
64
|
+
"license": "BSD-3-Clause",
|
|
65
|
+
"main": "lib/index.js",
|
|
66
|
+
"oclif": {
|
|
67
|
+
"commands": "./lib/commands",
|
|
68
|
+
"bin": "sf",
|
|
69
|
+
"topicSeparator": " ",
|
|
70
|
+
"devPlugins": [
|
|
71
|
+
"@oclif/plugin-help"
|
|
72
|
+
],
|
|
73
|
+
"topics": {
|
|
74
|
+
"butler": {
|
|
75
|
+
"description": "description for butler",
|
|
76
|
+
"subtopics": {
|
|
77
|
+
"pb": {
|
|
78
|
+
"description": "description for butler.pb"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"scripts": {
|
|
85
|
+
"build": "wireit",
|
|
86
|
+
"clean": "sf-clean",
|
|
87
|
+
"clean-all": "sf-clean all",
|
|
88
|
+
"clean:lib": "shx rm -rf lib && shx rm -rf coverage && shx rm -rf .nyc_output && shx rm -f oclif.manifest.json",
|
|
89
|
+
"compile": "wireit",
|
|
90
|
+
"docs": "sf-docs",
|
|
91
|
+
"format": "wireit",
|
|
92
|
+
"lint": "wireit",
|
|
93
|
+
"postinstall": "yarn husky install",
|
|
94
|
+
"postpack": "shx rm -f oclif.manifest.json",
|
|
95
|
+
"prepack": "sf-prepack",
|
|
96
|
+
"test": "wireit",
|
|
97
|
+
"test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel",
|
|
98
|
+
"test:only": "wireit",
|
|
99
|
+
"version": "oclif readme"
|
|
100
|
+
},
|
|
101
|
+
"publishConfig": {
|
|
102
|
+
"access": "public"
|
|
103
|
+
},
|
|
104
|
+
"wireit": {
|
|
105
|
+
"build": {
|
|
106
|
+
"dependencies": [
|
|
107
|
+
"compile",
|
|
108
|
+
"lint"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
"compile": {
|
|
112
|
+
"command": "tsc -p . --pretty --incremental",
|
|
113
|
+
"files": [
|
|
114
|
+
"src/**/*.ts",
|
|
115
|
+
"**/tsconfig.json",
|
|
116
|
+
"messages/**"
|
|
117
|
+
],
|
|
118
|
+
"output": [
|
|
119
|
+
"lib/**",
|
|
120
|
+
"*.tsbuildinfo"
|
|
121
|
+
],
|
|
122
|
+
"clean": "if-file-deleted"
|
|
123
|
+
},
|
|
124
|
+
"format": {
|
|
125
|
+
"command": "prettier --write \"+(src|test|schemas)/**/*.+(ts|js|json)|command-snapshot.json\"",
|
|
126
|
+
"files": [
|
|
127
|
+
"src/**/*.ts",
|
|
128
|
+
"test/**/*.ts",
|
|
129
|
+
"schemas/**/*.json",
|
|
130
|
+
"command-snapshot.json",
|
|
131
|
+
".prettier*"
|
|
132
|
+
],
|
|
133
|
+
"output": []
|
|
134
|
+
},
|
|
135
|
+
"lint": {
|
|
136
|
+
"command": "eslint src test --color --cache --cache-location .eslintcache",
|
|
137
|
+
"files": [
|
|
138
|
+
"src/**/*.ts",
|
|
139
|
+
"test/**/*.ts",
|
|
140
|
+
"messages/**",
|
|
141
|
+
"**/.eslint*",
|
|
142
|
+
"**/tsconfig.json"
|
|
143
|
+
],
|
|
144
|
+
"output": []
|
|
145
|
+
},
|
|
146
|
+
"test:compile": {
|
|
147
|
+
"command": "tsc -p \"./test\" --pretty",
|
|
148
|
+
"files": [
|
|
149
|
+
"test/**/*.ts",
|
|
150
|
+
"**/tsconfig.json"
|
|
151
|
+
],
|
|
152
|
+
"output": []
|
|
153
|
+
},
|
|
154
|
+
"test": {
|
|
155
|
+
"dependencies": [
|
|
156
|
+
"test:compile",
|
|
157
|
+
"test:only",
|
|
158
|
+
"lint"
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
"test:only": {
|
|
162
|
+
"command": "nyc mocha \"test/**/*.test.ts\"",
|
|
163
|
+
"env": {
|
|
164
|
+
"FORCE_COLOR": "2"
|
|
165
|
+
},
|
|
166
|
+
"files": [
|
|
167
|
+
"test/**/*.ts",
|
|
168
|
+
"src/**/*.ts",
|
|
169
|
+
"**/tsconfig.json",
|
|
170
|
+
".mocha*",
|
|
171
|
+
"!*.nut.ts",
|
|
172
|
+
".nycrc"
|
|
173
|
+
],
|
|
174
|
+
"output": []
|
|
175
|
+
},
|
|
176
|
+
"test:command-reference": {
|
|
177
|
+
"command": "\"./bin/dev\" commandreference:generate --erroronwarnings",
|
|
178
|
+
"files": [
|
|
179
|
+
"src/**/*.ts",
|
|
180
|
+
"messages/**",
|
|
181
|
+
"package.json"
|
|
182
|
+
],
|
|
183
|
+
"output": [
|
|
184
|
+
"tmp/root"
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
"test:deprecation-policy": {
|
|
188
|
+
"command": "\"./bin/dev\" snapshot:compare",
|
|
189
|
+
"files": [
|
|
190
|
+
"src/**/*.ts"
|
|
191
|
+
],
|
|
192
|
+
"output": [],
|
|
193
|
+
"dependencies": [
|
|
194
|
+
"compile"
|
|
195
|
+
]
|
|
196
|
+
},
|
|
197
|
+
"test:json-schema": {
|
|
198
|
+
"command": "\"./bin/dev\" schema:compare",
|
|
199
|
+
"files": [
|
|
200
|
+
"src/**/*.ts",
|
|
201
|
+
"schemas"
|
|
202
|
+
],
|
|
203
|
+
"output": []
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"author": "pdfbutler",
|
|
207
|
+
"types": "./lib/index.d.ts",
|
|
208
|
+
"directories": {
|
|
209
|
+
"lib": "lib",
|
|
210
|
+
"test": "test"
|
|
211
|
+
}
|
|
212
|
+
}
|