sfmc-dataloader 2.0.0 → 2.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/lib/cli.mjs +15 -0
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
1
2
|
import { parseArgs } from 'node:util';
|
|
2
3
|
import process from 'node:process';
|
|
3
4
|
import path from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
4
6
|
import SDK from 'sfmc-sdk';
|
|
5
7
|
import {
|
|
6
8
|
loadMcdevProject,
|
|
@@ -18,6 +20,13 @@ import { confirmClearBeforeImport } from './confirm-clear.mjs';
|
|
|
18
20
|
import { multiBuExport } from './multi-bu-export.mjs';
|
|
19
21
|
import { crossBuImport } from './cross-bu-import.mjs';
|
|
20
22
|
|
|
23
|
+
/** @returns {string} semver from this package's package.json */
|
|
24
|
+
function readCliPackageVersion() {
|
|
25
|
+
const pkgPath = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'package.json');
|
|
26
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
27
|
+
return typeof pkg.version === 'string' ? pkg.version : '';
|
|
28
|
+
}
|
|
29
|
+
|
|
21
30
|
function printHelp() {
|
|
22
31
|
console.log(`mcdata — SFMC Data Extension export/import (mcdev project)
|
|
23
32
|
|
|
@@ -29,6 +38,7 @@ Usage:
|
|
|
29
38
|
mcdata import --to <cred>/<bu> [--to <cred>/<bu> ...] --file <path> [--file <path> ...] [options]
|
|
30
39
|
|
|
31
40
|
Options:
|
|
41
|
+
--version Print version and exit
|
|
32
42
|
-p, --project <dir> mcdev project root (default: cwd)
|
|
33
43
|
--format <csv|tsv|json> File format (default: csv)
|
|
34
44
|
--json-pretty Pretty-print JSON on export
|
|
@@ -82,6 +92,7 @@ export async function main(argv) {
|
|
|
82
92
|
'i-accept-clear-data-risk': { type: 'boolean', default: false },
|
|
83
93
|
'json-pretty': { type: 'boolean', default: false },
|
|
84
94
|
help: { type: 'boolean', short: 'h', default: false },
|
|
95
|
+
version: { type: 'boolean', default: false },
|
|
85
96
|
},
|
|
86
97
|
});
|
|
87
98
|
values = parsed.values;
|
|
@@ -96,6 +107,10 @@ export async function main(argv) {
|
|
|
96
107
|
printHelp();
|
|
97
108
|
return 0;
|
|
98
109
|
}
|
|
110
|
+
if (values.version) {
|
|
111
|
+
console.log(readCliPackageVersion());
|
|
112
|
+
return 0;
|
|
113
|
+
}
|
|
99
114
|
if (positionals.length === 0) {
|
|
100
115
|
printHelp();
|
|
101
116
|
return 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sfmc-dataloader",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "SFMC Data Loader CLI (mcdata) to export and import Marketing Cloud Data Extension rows using mcdev project config and sfmc-sdk",
|
|
5
5
|
"author": "Jörn Berkefeld <joern.berkefeld@gmail.com>",
|
|
6
6
|
"license": "MIT",
|