@datacamp/learn-vm-scripts 0.0.6 → 0.0.8-rc.0

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.
Files changed (3) hide show
  1. package/dist/index.cjs +21 -16
  2. package/dist/local.cjs +351 -3251
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -92641,12 +92641,18 @@ var {
92641
92641
  var puppeteer_core_default = puppeteer;
92642
92642
 
92643
92643
  // src/setup.ts
92644
- async function setupBrowser({
92644
+ async function setupPuppeteerPage({
92645
92645
  executablePath: executablePath2,
92646
92646
  userDataDir
92647
92647
  }) {
92648
92648
  const browser = await puppeteer_core_default.launch({
92649
- args: ["--start-maximized", "--enable-save-password-bubble"],
92649
+ args: [
92650
+ "--start-maximized",
92651
+ "--kiosk",
92652
+ "--kiosk-mode-single-window",
92653
+ "--kiosk-mode-no-prompts",
92654
+ "--kiosk-mode-no-dialogs"
92655
+ ],
92650
92656
  executablePath: executablePath2,
92651
92657
  headless: false,
92652
92658
  defaultViewport: null,
@@ -92655,10 +92661,9 @@ async function setupBrowser({
92655
92661
  });
92656
92662
  const pages = await browser.pages();
92657
92663
  if (pages[0] !== void 0) {
92658
- return { browser, page: pages[0] };
92664
+ return pages[0];
92659
92665
  }
92660
- const page = await browser.newPage();
92661
- return { browser, page };
92666
+ return browser.newPage();
92662
92667
  }
92663
92668
 
92664
92669
  // src/utils.ts
@@ -92730,7 +92735,7 @@ async function loginToAzure({
92730
92735
  log("Password entered successfully");
92731
92736
  log("Ensuring user stays signed in ...");
92732
92737
  await page.waitForSelector('[type="submit"]');
92733
- await Promise.all([page.waitForNavigation(), page.click('[type="submit"]')]);
92738
+ await page.click('[type="submit"]');
92734
92739
  log("Logged in to Azure successfully");
92735
92740
  }
92736
92741
 
@@ -92811,19 +92816,11 @@ var Input = objectType({
92811
92816
  url: stringType(),
92812
92817
  username: stringType()
92813
92818
  });
92814
- var handleInput = async ({
92815
- line,
92816
- userDataDir,
92817
- executablePath: executablePath2
92818
- }) => {
92819
+ var handleInput = async ({ line, page }) => {
92819
92820
  try {
92820
92821
  const { cloudProvider, url, password, username } = Input.parse(
92821
92822
  JSON.parse(line)
92822
92823
  );
92823
- const { browser, page } = await setupBrowser({
92824
- executablePath: executablePath2,
92825
- userDataDir
92826
- });
92827
92824
  switch (cloudProvider) {
92828
92825
  case "azure":
92829
92826
  await loginToAzure({ url, username, page, password });
@@ -92872,6 +92869,10 @@ var startInputWatcher = async ({
92872
92869
  const outputFileHandle = await fs6.open(outputFilePath, "a");
92873
92870
  let lastInput = void 0;
92874
92871
  await createFileIfNotExists(inputFilePath);
92872
+ let page = await setupPuppeteerPage({
92873
+ executablePath: executablePath2,
92874
+ userDataDir
92875
+ });
92875
92876
  const checkInputFile = async () => {
92876
92877
  const fileContent = await fs6.readFile(inputFilePath, { encoding: "utf-8" });
92877
92878
  const lines = fileContent.split(/\r?\n/);
@@ -92888,9 +92889,13 @@ var startInputWatcher = async ({
92888
92889
  if (lastInput != null) {
92889
92890
  log("Resetting Chrome");
92890
92891
  await resetChrome({ userDataDir });
92892
+ page = await setupPuppeteerPage({
92893
+ executablePath: executablePath2,
92894
+ userDataDir
92895
+ });
92891
92896
  }
92892
92897
  log("New input, processing");
92893
- await handleInput({ line: newInput, userDataDir, executablePath: executablePath2 });
92898
+ await handleInput({ line: newInput, page });
92894
92899
  await outputFileHandle.appendFile(`Done: ${newInput}`);
92895
92900
  log("Done processing input");
92896
92901
  lastInput = newInput;