draftify-cli 1.0.73 → 1.0.76
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 +6 -0
- package/dist/repl.js +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,6 +6,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const commander_1 = require("commander");
|
|
8
8
|
const https_1 = __importDefault(require("https"));
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
9
11
|
const login_1 = require("./commands/login");
|
|
10
12
|
const refactor_1 = require("./commands/refactor");
|
|
11
13
|
const repl_1 = require("./repl");
|
|
@@ -36,6 +38,10 @@ program.on('command:*', function () {
|
|
|
36
38
|
process.exit(1);
|
|
37
39
|
});
|
|
38
40
|
async function checkVersion() {
|
|
41
|
+
const isDev = fs_1.default.existsSync(path_1.default.join(__dirname, "../src/index.ts"));
|
|
42
|
+
if (isDev) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
39
45
|
return new Promise((resolve) => {
|
|
40
46
|
// Set a short timeout so the CLI doesn't hang if the registry is slow or offline
|
|
41
47
|
const req = https_1.default.get("https://registry.npmjs.org/draftify-cli/latest", { timeout: 2000 }, (res) => {
|
package/dist/repl.js
CHANGED
|
@@ -600,7 +600,7 @@ async function startRepl(initialUsername) {
|
|
|
600
600
|
const relative = path_1.default.relative(process.cwd(), targetPath);
|
|
601
601
|
return !relative.startsWith('..') && !path_1.default.isAbsolute(relative);
|
|
602
602
|
};
|
|
603
|
-
const deleteRegex = /<FILE_DELETE\s+path="([^"]+)"\s
|
|
603
|
+
const deleteRegex = /<FILE_DELETE\s+path="([^"]+)"\s*(?:\/>|>[\s\S]*?<\/FILE_DELETE>)/gi;
|
|
604
604
|
let match;
|
|
605
605
|
while ((match = deleteRegex.exec(result)) !== null) {
|
|
606
606
|
const filePath = match[1];
|
|
@@ -824,13 +824,13 @@ async function startRepl(initialUsername) {
|
|
|
824
824
|
displayResult = displayResult.replace(match[0], '');
|
|
825
825
|
}
|
|
826
826
|
const filesToReadAuto = [];
|
|
827
|
-
const readRegex = /<READ_FILE\s+path="([^"]+)"\s
|
|
827
|
+
const readRegex = /<READ_FILE\s+path="([^"]+)"\s*(?:\/>|>[\s\S]*?<\/READ_FILE>)/gi;
|
|
828
828
|
while ((match = readRegex.exec(result)) !== null) {
|
|
829
829
|
filesToReadAuto.push(match[1]);
|
|
830
830
|
displayResult = displayResult.replace(match[0], '');
|
|
831
831
|
}
|
|
832
832
|
const dirsToListAuto = [];
|
|
833
|
-
const listRegex = /<LIST_DIR\s+path="([^"]+)"\s
|
|
833
|
+
const listRegex = /<LIST_DIR\s+path="([^"]+)"\s*(?:\/>|>[\s\S]*?<\/LIST_DIR>)/gi;
|
|
834
834
|
while ((match = listRegex.exec(result)) !== null) {
|
|
835
835
|
dirsToListAuto.push(match[1]);
|
|
836
836
|
displayResult = displayResult.replace(match[0], '');
|