@datacamp/learn-vm-scripts 0.0.4 → 0.0.5
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.cjs +12 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3327,7 +3327,7 @@ var require_node = __commonJS({
|
|
|
3327
3327
|
var tty2 = require("tty");
|
|
3328
3328
|
var util2 = require("util");
|
|
3329
3329
|
exports2.init = init;
|
|
3330
|
-
exports2.log =
|
|
3330
|
+
exports2.log = log2;
|
|
3331
3331
|
exports2.formatArgs = formatArgs;
|
|
3332
3332
|
exports2.save = save;
|
|
3333
3333
|
exports2.load = load;
|
|
@@ -3462,7 +3462,7 @@ var require_node = __commonJS({
|
|
|
3462
3462
|
}
|
|
3463
3463
|
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
3464
3464
|
}
|
|
3465
|
-
function
|
|
3465
|
+
function log2(...args) {
|
|
3466
3466
|
return process.stderr.write(util2.formatWithOptions(exports2.inspectOpts, ...args) + "\n");
|
|
3467
3467
|
}
|
|
3468
3468
|
function save(namespaces) {
|
|
@@ -95717,6 +95717,9 @@ var Input = objectType({
|
|
|
95717
95717
|
url: stringType(),
|
|
95718
95718
|
username: stringType()
|
|
95719
95719
|
});
|
|
95720
|
+
var log = (message) => {
|
|
95721
|
+
console.log(`[${(/* @__PURE__ */ new Date()).toISOString()}] ${message}`);
|
|
95722
|
+
};
|
|
95720
95723
|
var handleInput = async ({
|
|
95721
95724
|
line,
|
|
95722
95725
|
userDataDir,
|
|
@@ -95783,28 +95786,31 @@ var startInputWatcher = async ({
|
|
|
95783
95786
|
const lines = fileContent.split(/\r?\n/);
|
|
95784
95787
|
const newInput = lines[0]?.trim();
|
|
95785
95788
|
if (newInput == null || newInput === "") {
|
|
95786
|
-
|
|
95789
|
+
log("No input");
|
|
95787
95790
|
return;
|
|
95788
95791
|
}
|
|
95789
95792
|
if (lastInput != null && newInput === lastInput) {
|
|
95790
|
-
|
|
95793
|
+
log("Input already processed");
|
|
95791
95794
|
await outputFileHandle.appendFile(`Done: ${newInput}`);
|
|
95792
95795
|
return;
|
|
95793
95796
|
}
|
|
95794
95797
|
if (lastInput != null) {
|
|
95795
|
-
|
|
95798
|
+
log("Resetting Chrome");
|
|
95796
95799
|
await resetChrome({ userDataDir });
|
|
95797
95800
|
}
|
|
95801
|
+
log("New input, processing");
|
|
95798
95802
|
await handleInput({ line: newInput, userDataDir, executablePath: executablePath2 });
|
|
95799
95803
|
await outputFileHandle.appendFile(`Done: ${newInput}`);
|
|
95804
|
+
log("Done processing input");
|
|
95800
95805
|
lastInput = newInput;
|
|
95801
95806
|
};
|
|
95802
95807
|
await checkInputFile();
|
|
95803
|
-
|
|
95808
|
+
log("Waiting for input");
|
|
95804
95809
|
for await (const event of fs6.watch(inputFilePath)) {
|
|
95805
95810
|
if (event.eventType !== "change") {
|
|
95806
95811
|
continue;
|
|
95807
95812
|
}
|
|
95813
|
+
log("Input file changed");
|
|
95808
95814
|
await checkInputFile();
|
|
95809
95815
|
}
|
|
95810
95816
|
};
|
package/package.json
CHANGED