drop2run 0.4.0 → 0.4.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/dist/index.js
CHANGED
|
@@ -926,8 +926,11 @@ async function publish(credentials, source, site, onProgress, subdomain) {
|
|
|
926
926
|
});
|
|
927
927
|
return { url, siteId: target.siteId, subdomain: target.subdomain, files, unchanged };
|
|
928
928
|
}
|
|
929
|
-
function publishDirectory(credentials, directory, site, onProgress, subdomain) {
|
|
930
|
-
|
|
929
|
+
async function publishDirectory(credentials, directory, site, onProgress, subdomain) {
|
|
930
|
+
const found = await stat(directory).catch(() => null);
|
|
931
|
+
if (found === null) throw new Error(`There is no folder at ${directory}.`);
|
|
932
|
+
if (!found.isDirectory()) throw new Error(`${directory} is a file, not a folder to publish.`);
|
|
933
|
+
return await publish(credentials, directorySource(directory), site, onProgress, subdomain);
|
|
931
934
|
}
|
|
932
935
|
const silentProgress = Object.assign(() => {
|
|
933
936
|
}, { done: () => {
|
|
@@ -1352,6 +1355,21 @@ function flagValue(args, flag) {
|
|
|
1352
1355
|
const value = args[at + 1];
|
|
1353
1356
|
return value === void 0 || value.startsWith("-") ? void 0 : value;
|
|
1354
1357
|
}
|
|
1358
|
+
const VALUE_FLAGS = ["--site", "--subdomain"];
|
|
1359
|
+
function positionals(argv) {
|
|
1360
|
+
const found = [];
|
|
1361
|
+
for (let at = 0; at < argv.length; at++) {
|
|
1362
|
+
const argument = argv[at];
|
|
1363
|
+
if (argument === void 0) continue;
|
|
1364
|
+
if (VALUE_FLAGS.includes(argument)) {
|
|
1365
|
+
const value = argv[at + 1];
|
|
1366
|
+
if (value !== void 0 && !value.startsWith("-")) at++;
|
|
1367
|
+
continue;
|
|
1368
|
+
}
|
|
1369
|
+
if (!argument.startsWith("-")) found.push(argument);
|
|
1370
|
+
}
|
|
1371
|
+
return found;
|
|
1372
|
+
}
|
|
1355
1373
|
function subdomainFlagProblem(argv, command, site, subdomain) {
|
|
1356
1374
|
if (!argv.includes("--subdomain")) return void 0;
|
|
1357
1375
|
if (subdomain === void 0) {
|
|
@@ -1367,10 +1385,10 @@ function subdomainFlagProblem(argv, command, site, subdomain) {
|
|
|
1367
1385
|
}
|
|
1368
1386
|
async function run(argv) {
|
|
1369
1387
|
const json = argv.includes("--json");
|
|
1370
|
-
const positional = argv
|
|
1388
|
+
const positional = positionals(argv);
|
|
1371
1389
|
const [command, ...rest] = positional;
|
|
1372
1390
|
if (argv.includes("--version")) {
|
|
1373
|
-
const { version } = await import("./package-
|
|
1391
|
+
const { version } = await import("./package-sLisZctX.js").then(
|
|
1374
1392
|
(module) => module.default
|
|
1375
1393
|
);
|
|
1376
1394
|
return { text: version, json: { version }, code: 0 };
|