@valbuild/init 0.60.18 → 0.60.19
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/main/dist/valbuild-init-main.cjs.dev.js +214 -20
- package/main/dist/valbuild-init-main.cjs.prod.js +214 -20
- package/main/dist/valbuild-init-main.esm.js +214 -20
- package/package.json +1 -1
- package/src/init.ts +196 -6
- package/src/logger.ts +3 -3
- package/src/templates.ts +135 -0
|
@@ -418,6 +418,59 @@ function _slicedToArray(arr, i) {
|
|
|
418
418
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
+
function toPrimitive(t, r) {
|
|
422
|
+
if ("object" != typeof t || !t) return t;
|
|
423
|
+
var e = t[Symbol.toPrimitive];
|
|
424
|
+
if (void 0 !== e) {
|
|
425
|
+
var i = e.call(t, r || "default");
|
|
426
|
+
if ("object" != typeof i) return i;
|
|
427
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
428
|
+
}
|
|
429
|
+
return ("string" === r ? String : Number)(t);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function toPropertyKey(t) {
|
|
433
|
+
var i = toPrimitive(t, "string");
|
|
434
|
+
return "symbol" == typeof i ? i : String(i);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
function _defineProperty(obj, key, value) {
|
|
438
|
+
key = toPropertyKey(key);
|
|
439
|
+
if (key in obj) {
|
|
440
|
+
Object.defineProperty(obj, key, {
|
|
441
|
+
value: value,
|
|
442
|
+
enumerable: true,
|
|
443
|
+
configurable: true,
|
|
444
|
+
writable: true
|
|
445
|
+
});
|
|
446
|
+
} else {
|
|
447
|
+
obj[key] = value;
|
|
448
|
+
}
|
|
449
|
+
return obj;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
function ownKeys(e, r) {
|
|
453
|
+
var t = Object.keys(e);
|
|
454
|
+
if (Object.getOwnPropertySymbols) {
|
|
455
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
456
|
+
r && (o = o.filter(function (r) {
|
|
457
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
458
|
+
})), t.push.apply(t, o);
|
|
459
|
+
}
|
|
460
|
+
return t;
|
|
461
|
+
}
|
|
462
|
+
function _objectSpread2(e) {
|
|
463
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
464
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
465
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
466
|
+
_defineProperty(e, r, t[r]);
|
|
467
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
468
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
return e;
|
|
472
|
+
}
|
|
473
|
+
|
|
421
474
|
function transformNextAppRouterValProvider(fileInfo, api, options) {
|
|
422
475
|
if (!options.configImportPath) {
|
|
423
476
|
throw new Error("configImportPath is required");
|
|
@@ -463,7 +516,7 @@ function transformNextAppRouterValProvider(fileInfo, api, options) {
|
|
|
463
516
|
|
|
464
517
|
var packageJson = {
|
|
465
518
|
name: "@valbuild/init",
|
|
466
|
-
version: "0.60.
|
|
519
|
+
version: "0.60.19",
|
|
467
520
|
description: "Initialize a new val.build project",
|
|
468
521
|
exports: {
|
|
469
522
|
"./main": {
|
|
@@ -534,12 +587,15 @@ var VAL_API_ROUTER = function VAL_API_ROUTER(valServerPath) {
|
|
|
534
587
|
var VAL_APP_PAGE = function VAL_APP_PAGE(configImportPath) {
|
|
535
588
|
return "import { ValApp } from \"@valbuild/next\";\nimport { config } from \"".concat(configImportPath, "\";\n\nexport default function Val() {\n return <ValApp config={config} />;\n}\n");
|
|
536
589
|
};
|
|
590
|
+
var BASIC_EXAMPLE = function BASIC_EXAMPLE(moduleId, configImportPath, isJavaScript) {
|
|
591
|
+
return "".concat(isJavaScript ? "// @ts-check\n" : "", "/**\n * Val example file - generated by @valbuild/init\n **/\n\nimport {\n s /* s = schema */,\n c /* c = content */,").concat(isJavaScript ? "" : "\n type t /* t = type */,", "\n} from \"").concat(configImportPath, "\";\n\n/**\n * This is the schema for the content. It defines the structure of the content and the types of each field.\n *\n * @docs https://val.build/docs/api-reference\n */\nexport const testSchema = s.object({\n /**\n * Basic text field\n */\n text: s.string(),\n\n /**\n * Optional fields are marked with `.optional()`\n */\n optionals: s.string().optional(),\n\n arrays: s.array(s.string()),\n /**\n * Records are objects where entries can be added. Useful for array-like structures where you would use a key to uniquely identify each entry.\n */\n records: s.record(s.string()),\n\n /**\n * Rich text can be used for multiline text, but also for more complex text editing capabilities like links, images, lists, etc.\n *\n * @docs https://val.build/docs/api-reference/schema-types/richtext\n *\n * @see ValRichText will render rich text\n */\n richText: s.richtext({\n // All features enabled:\n bold: true,\n italic: true,\n lineThrough: true,\n headings: [\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"],\n a: true,\n img: true,\n ul: true,\n ol: true,\n }),\n\n /**\n * Images in Val are stored as files in the public folder.\n *\n * @docs https://val.build/docs/api-reference/schema-types/image\n *\n * When defining content use the following syntax:\n * @example c.file('/public/myimage.png') // path to the image file, use the VS Code plugin or the `@valbuild/cli validate --fix` command to add metadata\n *\n * @see ValImage component to see how to render this in your app\n */\n image: s.image().optional(),\n\n /**\n * String enums: presents as a dropdown in the UI\n */\n stringEnum: s.union(s.literal(\"lit-0\"), s.literal(\"lit-1\")),\n\n /**\n * Raw strings disables the stega (steganography) feature that automatically tags content when using the overlay.\n * It is useful for slugs and other data that might be processed in code (parsed or matching for equality...)\n */\n slug: s.string().raw(),\n\n /**\n * Object unions: presents as a dropdown in the UI and the different fields\n *\n * @docs https://val.build/docs/api-reference/schema-types/union\n */\n objectUnions: s.union(\n \"type\",\n s.object({\n type: s.literal(\"page-type-1\"),\n value: s.number(),\n }),\n s.object({\n type: s.literal(\"page-type-2\"),\n text: s.string(),\n })\n ),\n});\n").concat(isJavaScript ? "" : "\n/**\n * t.inferSchema returns the type of the content.\n * This pattern is useful to type props of components that use this content (partially or whole)\n */\nexport type TestContent = t.inferSchema<typeof testSchema>;\n", "\n\n/**\n * This is the content definition. Add your content below.\n *\n * NOTE: the first argument, module id, must match the path of the file.\n */\nexport default c.define(\"").concat(moduleId, "\", testSchema, {\n text: \"Basic text content\",\n optionals: null,\n arrays: [\"A string\"],\n records: {\n \"unique-key-1\": \"A string\",\n },\n richText: c.richtext`# Title 1\n\n${c.rt.link(\"Val docs\", { href: \"https://val.build/docs\" })}\n\n- List item 1\n- List item 2\n`,\n image: null,\n slug: \"test\",\n objectUnions: {\n type: \"page-type-2\",\n text: \"String value\",\n },\n stringEnum: \"lit-1\",\n});\n");
|
|
592
|
+
};
|
|
537
593
|
|
|
538
594
|
function error(message) {
|
|
539
|
-
console.error(chalk__default["default"].red("❌ ERROR: ") + message);
|
|
595
|
+
console.error(chalk__default["default"].red(" ❌ ERROR: ") + message);
|
|
540
596
|
}
|
|
541
597
|
function warn(message) {
|
|
542
|
-
console.error(chalk__default["default"].yellow("⚠️ WARN:"
|
|
598
|
+
console.error(chalk__default["default"].yellow(" ⚠️ WARN:" + message));
|
|
543
599
|
}
|
|
544
600
|
function info(message) {
|
|
545
601
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -548,7 +604,7 @@ function info(message) {
|
|
|
548
604
|
return;
|
|
549
605
|
}
|
|
550
606
|
if (opts.isGood) {
|
|
551
|
-
console.log(chalk__default["default"].
|
|
607
|
+
console.log(chalk__default["default"].hex("#37cd99")(" V") + message);
|
|
552
608
|
return;
|
|
553
609
|
}
|
|
554
610
|
console.log(message);
|
|
@@ -573,7 +629,7 @@ function _init() {
|
|
|
573
629
|
case 0:
|
|
574
630
|
root = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : process.cwd();
|
|
575
631
|
_ref = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {}, defaultAnswers = _ref.yes;
|
|
576
|
-
info(
|
|
632
|
+
info("Initializing " + chalk__default["default"].bgBlack.hex("#37cd99")("Val") + ' in "' + root + '"...\n');
|
|
577
633
|
process.stdout.write("Analyzing project...");
|
|
578
634
|
_context2.next = 6;
|
|
579
635
|
return analyze(path__default["default"].resolve(root), walk(path__default["default"].resolve(root)));
|
|
@@ -620,7 +676,7 @@ function walk(dir) {
|
|
|
620
676
|
}
|
|
621
677
|
var analyze = /*#__PURE__*/function () {
|
|
622
678
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(root, files) {
|
|
623
|
-
var analysis, packageJsonPath, packageJsonText, _packageJson, _semver$minVersion, minNextVersion, _semver$minVersion2, minValVersion, pagesRouterAppPath, appRouterLayoutPath, git, gitStatus, gitRemoteOrigin;
|
|
679
|
+
var analysis, packageJsonPath, packageJsonText, _packageJson, _semver$minVersion, minNextVersion, _semver$minVersion2, minValVersion, pagesRouterAppPath, appRouterLayoutPath, git, gitStatus, gitRemoteOrigin, parts, owner, repo, gitIgnorePath;
|
|
624
680
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
625
681
|
while (1) switch (_context.prev = _context.next) {
|
|
626
682
|
case 0:
|
|
@@ -732,18 +788,32 @@ var analyze = /*#__PURE__*/function () {
|
|
|
732
788
|
analysis.hasGit = true;
|
|
733
789
|
analysis.isGitHub = gitRemoteOrigin ? !!gitRemoteOrigin.includes("github.com") : false;
|
|
734
790
|
analysis.isGitClean = getGitStatusIsClean(gitStatus);
|
|
735
|
-
|
|
791
|
+
// get owner and repo from git remote:
|
|
792
|
+
if (gitRemoteOrigin) {
|
|
793
|
+
// Split the URL by colon
|
|
794
|
+
parts = gitRemoteOrigin.split(":"); // Extract owner and repo
|
|
795
|
+
owner = parts[0].split("@")[1];
|
|
796
|
+
repo = parts[1].replace(".git", ""); // Remove .git extension if present
|
|
797
|
+
analysis.gitRemote = {
|
|
798
|
+
owner: owner,
|
|
799
|
+
repo: repo
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
_context.next = 47;
|
|
736
803
|
break;
|
|
737
|
-
case
|
|
738
|
-
_context.prev =
|
|
804
|
+
case 45:
|
|
805
|
+
_context.prev = 45;
|
|
739
806
|
_context.t1 = _context["catch"](31);
|
|
740
|
-
case 46:
|
|
741
|
-
return _context.abrupt("return", analysis);
|
|
742
807
|
case 47:
|
|
808
|
+
gitIgnorePath = path__default["default"].join(root, ".gitignore");
|
|
809
|
+
analysis.gitIgnorePath = gitIgnorePath;
|
|
810
|
+
analysis.gitIgnoreFile = fs__default["default"].readFileSync(gitIgnorePath, "utf-8");
|
|
811
|
+
return _context.abrupt("return", analysis);
|
|
812
|
+
case 51:
|
|
743
813
|
case "end":
|
|
744
814
|
return _context.stop();
|
|
745
815
|
}
|
|
746
|
-
}, _callee, null, [[8, 17], [31,
|
|
816
|
+
}, _callee, null, [[8, 17], [31, 45]]);
|
|
747
817
|
}));
|
|
748
818
|
return function analyze(_x, _x2) {
|
|
749
819
|
return _ref2.apply(this, arguments);
|
|
@@ -780,6 +850,19 @@ function _plan() {
|
|
|
780
850
|
_answer7,
|
|
781
851
|
currentEslintRc,
|
|
782
852
|
parsedEslint,
|
|
853
|
+
_answer8,
|
|
854
|
+
_answer9,
|
|
855
|
+
vscodeDir,
|
|
856
|
+
settingsPath,
|
|
857
|
+
currentSettings,
|
|
858
|
+
currentSettingsFile,
|
|
859
|
+
currentRecommendations,
|
|
860
|
+
valBuildIntelliSense,
|
|
861
|
+
_answer10,
|
|
862
|
+
exampleDir,
|
|
863
|
+
examplePath,
|
|
864
|
+
exampleImport,
|
|
865
|
+
exampleModuleId,
|
|
783
866
|
_args3 = arguments;
|
|
784
867
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
785
868
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -816,7 +899,7 @@ function _plan() {
|
|
|
816
899
|
_context3.next = 15;
|
|
817
900
|
break;
|
|
818
901
|
}
|
|
819
|
-
info(" Source dir: " + analysis.
|
|
902
|
+
info(" Source dir: " + analysis.srcDir, {
|
|
820
903
|
isGood: true
|
|
821
904
|
});
|
|
822
905
|
_context3.next = 17;
|
|
@@ -1316,12 +1399,117 @@ function _plan() {
|
|
|
1316
1399
|
case 202:
|
|
1317
1400
|
warn("Cannot patch eslint: failed to find eslint config file");
|
|
1318
1401
|
case 203:
|
|
1402
|
+
if (!analysis.gitIgnorePath) {
|
|
1403
|
+
_context3.next = 210;
|
|
1404
|
+
break;
|
|
1405
|
+
}
|
|
1406
|
+
_context3.next = 206;
|
|
1407
|
+
return prompts.confirm({
|
|
1408
|
+
message: "Append .gitignore entry for Val cache? (recommended)",
|
|
1409
|
+
"default": true
|
|
1410
|
+
});
|
|
1411
|
+
case 206:
|
|
1412
|
+
_answer8 = _context3.sent;
|
|
1413
|
+
if (_answer8) {
|
|
1414
|
+
plan.updateGitIgnore = {
|
|
1415
|
+
path: analysis.gitIgnorePath,
|
|
1416
|
+
source: (analysis.gitIgnoreFile ? "".concat(analysis.gitIgnoreFile, "\n\n") : "") + "# Val local cache\n.val\n"
|
|
1417
|
+
};
|
|
1418
|
+
} else {
|
|
1419
|
+
plan.updateGitIgnore = false;
|
|
1420
|
+
}
|
|
1421
|
+
_context3.next = 211;
|
|
1422
|
+
break;
|
|
1423
|
+
case 210:
|
|
1424
|
+
plan.updateGitIgnore = false;
|
|
1425
|
+
case 211:
|
|
1426
|
+
_context3.next = 213;
|
|
1427
|
+
return prompts.confirm({
|
|
1428
|
+
message: "Add the Val Build IntelliSense to .vscode/extensions.json?",
|
|
1429
|
+
"default": true
|
|
1430
|
+
});
|
|
1431
|
+
case 213:
|
|
1432
|
+
_answer9 = _context3.sent;
|
|
1433
|
+
if (!_answer9) {
|
|
1434
|
+
_context3.next = 239;
|
|
1435
|
+
break;
|
|
1436
|
+
}
|
|
1437
|
+
vscodeDir = path__default["default"].join(analysis.root, ".vscode");
|
|
1438
|
+
settingsPath = path__default["default"].join(vscodeDir, "extensions.json");
|
|
1439
|
+
currentSettings = {};
|
|
1440
|
+
_context3.prev = 218;
|
|
1441
|
+
currentSettingsFile = fs__default["default"].readFileSync(settingsPath, "utf-8");
|
|
1442
|
+
if (!currentSettingsFile) {
|
|
1443
|
+
_context3.next = 229;
|
|
1444
|
+
break;
|
|
1445
|
+
}
|
|
1446
|
+
_context3.prev = 221;
|
|
1447
|
+
currentSettings = JSON.parse(currentSettingsFile);
|
|
1448
|
+
_context3.next = 229;
|
|
1449
|
+
break;
|
|
1450
|
+
case 225:
|
|
1451
|
+
_context3.prev = 225;
|
|
1452
|
+
_context3.t8 = _context3["catch"](221);
|
|
1453
|
+
warn("Failed to parse VS Code extensions.json found here: ".concat(settingsPath, ".").concat(_context3.t8 instanceof Error ? "Parse error: ".concat(_context3.t8.message) : ""));
|
|
1454
|
+
return _context3.abrupt("return", {
|
|
1455
|
+
abort: true
|
|
1456
|
+
});
|
|
1457
|
+
case 229:
|
|
1458
|
+
_context3.next = 233;
|
|
1459
|
+
break;
|
|
1460
|
+
case 231:
|
|
1461
|
+
_context3.prev = 231;
|
|
1462
|
+
_context3.t9 = _context3["catch"](218);
|
|
1463
|
+
case 233:
|
|
1464
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1465
|
+
currentRecommendations = currentSettings.recommendations;
|
|
1466
|
+
valBuildIntelliSense = "valbuild.vscode-val-build";
|
|
1467
|
+
if (!currentRecommendations.includes(valBuildIntelliSense)) {
|
|
1468
|
+
currentSettings = _objectSpread2(_objectSpread2({}, currentSettings), {}, {
|
|
1469
|
+
recommendations: (currentRecommendations || []).concat(valBuildIntelliSense)
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
plan.updateVSCodeSettings = {
|
|
1473
|
+
path: settingsPath,
|
|
1474
|
+
source: JSON.stringify(currentSettings, null, 2)
|
|
1475
|
+
};
|
|
1476
|
+
_context3.next = 240;
|
|
1477
|
+
break;
|
|
1478
|
+
case 239:
|
|
1479
|
+
plan.updateVSCodeSettings = false;
|
|
1480
|
+
case 240:
|
|
1481
|
+
_context3.next = 242;
|
|
1482
|
+
return prompts.confirm({
|
|
1483
|
+
message: "Include example Val files?",
|
|
1484
|
+
"default": true
|
|
1485
|
+
});
|
|
1486
|
+
case 242:
|
|
1487
|
+
_answer10 = _context3.sent;
|
|
1488
|
+
if (!_answer10) {
|
|
1489
|
+
_context3.next = 251;
|
|
1490
|
+
break;
|
|
1491
|
+
}
|
|
1492
|
+
exampleDir = path__default["default"].join(analysis.srcDir, "examples", "val");
|
|
1493
|
+
examplePath = path__default["default"].join(exampleDir, "example.val." + (analysis.isJavaScript ? "js" : "ts"));
|
|
1494
|
+
exampleImport = path__default["default"].relative(exampleDir, valConfigPath).replace(".js", "").replace(".ts", "");
|
|
1495
|
+
if (analysis.packageJsonDir) {
|
|
1496
|
+
_context3.next = 249;
|
|
1497
|
+
break;
|
|
1498
|
+
}
|
|
1499
|
+
throw Error("Could not detect package.json directory! This is a Val bug.");
|
|
1500
|
+
case 249:
|
|
1501
|
+
exampleModuleId = "/".concat(path__default["default"].relative(analysis.packageJsonDir, examplePath).replace(".val", "").replace(".js", "").replace(".ts", ""));
|
|
1502
|
+
plan.includeExample = {
|
|
1503
|
+
path: examplePath,
|
|
1504
|
+
source: BASIC_EXAMPLE(exampleModuleId, exampleImport, !!analysis.isJavaScript)
|
|
1505
|
+
};
|
|
1506
|
+
case 251:
|
|
1319
1507
|
return _context3.abrupt("return", plan);
|
|
1320
|
-
case
|
|
1508
|
+
case 252:
|
|
1321
1509
|
case "end":
|
|
1322
1510
|
return _context3.stop();
|
|
1323
1511
|
}
|
|
1324
|
-
}, _callee3);
|
|
1512
|
+
}, _callee3, null, [[218, 231], [221, 225]]);
|
|
1325
1513
|
}));
|
|
1326
1514
|
return _plan.apply(this, arguments);
|
|
1327
1515
|
}
|
|
@@ -1330,7 +1518,7 @@ function execute(_x4) {
|
|
|
1330
1518
|
}
|
|
1331
1519
|
function _execute() {
|
|
1332
1520
|
_execute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(plan) {
|
|
1333
|
-
var _i, _Object$entries, _Object$entries$_i, key,
|
|
1521
|
+
var _i, _Object$entries, _Object$entries$_i, key, maybeFileOp;
|
|
1334
1522
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1335
1523
|
while (1) switch (_context4.prev = _context4.next) {
|
|
1336
1524
|
case 0:
|
|
@@ -1348,10 +1536,13 @@ function _execute() {
|
|
|
1348
1536
|
case 4:
|
|
1349
1537
|
info("Executing...");
|
|
1350
1538
|
for (_i = 0, _Object$entries = Object.entries(plan); _i < _Object$entries.length; _i++) {
|
|
1351
|
-
_Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), key = _Object$entries$_i[0],
|
|
1352
|
-
|
|
1539
|
+
_Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), key = _Object$entries$_i[0], maybeFileOp = _Object$entries$_i[1];
|
|
1540
|
+
if (isFileOp(maybeFileOp)) {
|
|
1541
|
+
writeFile(maybeFileOp, plan.root, key.startsWith("update"));
|
|
1542
|
+
}
|
|
1353
1543
|
}
|
|
1354
|
-
|
|
1544
|
+
info("\n \nVal was successfully initialized!\n\n Start the application:\n\n $ ".concat(chalk__default["default"].gray("npm run dev"), "\n\n Open (assumes http://localhost:3000):\n\n ").concat(chalk__default["default"].bgBlack.hex("#37cd99").underline("http://localhost:3000/val"), "\n\n When you want to enable editor support, import the project by opening the following link:\n \n ").concat(chalk__default["default"].bgBlack.hex("#37cd99").underline("https://app.val.build/orgs/new".concat(plan.gitRemote ? "?org=".concat(encodeURIComponent(plan.gitRemote.owner), "&owner=").concat(encodeURIComponent(plan.gitRemote.owner), "&repo=").concat(encodeURIComponent(plan.gitRemote.repo)) : "")), "\n\n"));
|
|
1545
|
+
case 7:
|
|
1355
1546
|
case "end":
|
|
1356
1547
|
return _context4.stop();
|
|
1357
1548
|
}
|
|
@@ -1360,7 +1551,7 @@ function _execute() {
|
|
|
1360
1551
|
return _execute.apply(this, arguments);
|
|
1361
1552
|
}
|
|
1362
1553
|
function writeFile(fileOp, rootDir, isUpdate) {
|
|
1363
|
-
if (fileOp
|
|
1554
|
+
if (fileOp) {
|
|
1364
1555
|
fs__default["default"].mkdirSync(path__default["default"].dirname(fileOp.path), {
|
|
1365
1556
|
recursive: true
|
|
1366
1557
|
});
|
|
@@ -1390,6 +1581,9 @@ function getGitStatusIsClean(gitStatus) {
|
|
|
1390
1581
|
}
|
|
1391
1582
|
return false;
|
|
1392
1583
|
}
|
|
1584
|
+
function isFileOp(maybeFileOp) {
|
|
1585
|
+
return typeof maybeFileOp !== "boolean" && typeof maybeFileOp !== "string" && _typeof(maybeFileOp) === "object" && !!maybeFileOp && "path" in maybeFileOp && "source" in maybeFileOp && typeof maybeFileOp.path === "string" && typeof maybeFileOp.source === "string";
|
|
1586
|
+
}
|
|
1393
1587
|
|
|
1394
1588
|
function main() {
|
|
1395
1589
|
return _main.apply(this, arguments);
|