@intuned/runtime-dev 0.1.0-test.12 → 0.1.0-test.14

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.
@@ -9,6 +9,7 @@ import json from "@rollup/plugin-json";
9
9
  import * as fs from "fs-extra";
10
10
  import * as path from "path";
11
11
  import { moveWebTemplateFiles } from "./common/utils/webTemplate.js";
12
+ import { fileURLToPath } from "url";
12
13
  function isThirdPartyWarning(warning) {
13
14
  if (warning.id && /node_modules/.test(warning.id))
14
15
  return true;
@@ -28,7 +29,7 @@ program
28
29
  .allowUnknownOption()
29
30
  .action(async (mode, outfile) => {
30
31
  await moveWebTemplateFiles();
31
- const currentTemplateTsConfig = path.resolve(__dirname, "..", "..", "template.tsconfig.json");
32
+ const currentTemplateTsConfig = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "template.tsconfig.json");
32
33
  await fs.copy(currentTemplateTsConfig, "./intuned/WebTemplate/tsconfig.json");
33
34
  await build(outfile, mode);
34
35
  });
@@ -93,7 +94,7 @@ async function build(outfile, mode) {
93
94
  console.log(`📦 Building ${outfile}`);
94
95
  const outfileFolder = path.dirname(outfile);
95
96
  // copy assets to outfile folder
96
- const assetsDir = path.resolve(__dirname, "..", "common", "assets");
97
+ const assetsDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "common", "assets");
97
98
  await fs.copy(assetsDir, `${outfileFolder}/assets`);
98
99
  await bundle.write({
99
100
  format: "cjs",
@@ -9,6 +9,7 @@ import json from "@rollup/plugin-json";
9
9
  import * as fs from "fs-extra";
10
10
  import * as path from "path";
11
11
  import { moveWebTemplateFiles } from "./common/utils/webTemplate.js";
12
+ import { fileURLToPath } from "url";
12
13
  function isThirdPartyWarning(warning) {
13
14
  if (warning.id && /node_modules/.test(warning.id)) return true;
14
15
  if (warning.ids && warning.ids.every(id => /node_modules/.test(id))) return true;
@@ -18,7 +19,7 @@ import dotenv from "dotenv";
18
19
  dotenv.config();
19
20
  program.description("build the intuned server").addArgument(new Argument("<mode>", "mode of execution").choices(["vanilla", "playwright"]).default("playwright").argOptional()).argument("[outfile]", "output bundle", "./output/bundle_v2.js").allowUnknownOption().action(async (mode, outfile) => {
20
21
  await moveWebTemplateFiles();
21
- const currentTemplateTsConfig = path.resolve(__dirname, "..", "..", "template.tsconfig.json");
22
+ const currentTemplateTsConfig = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "template.tsconfig.json");
22
23
  await fs.copy(currentTemplateTsConfig, "./intuned/WebTemplate/tsconfig.json");
23
24
  await build(outfile, mode);
24
25
  });
@@ -58,7 +59,7 @@ async function build(outfile, mode) {
58
59
  });
59
60
  console.log(`📦 Building ${outfile}`);
60
61
  const outfileFolder = path.dirname(outfile);
61
- const assetsDir = path.resolve(__dirname, "..", "common", "assets");
62
+ const assetsDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "common", "assets");
62
63
  await fs.copy(assetsDir, `${outfileFolder}/assets`);
63
64
  await bundle.write({
64
65
  format: "cjs",
@@ -2,8 +2,9 @@ import { expect, describe, it, beforeAll, afterAll } from "vitest";
2
2
  import getFirstLineNumber from "./getFirstLineNumber.js";
3
3
  import * as fs from "fs";
4
4
  import * as path from "path";
5
+ import { fileURLToPath } from "url";
5
6
  describe("getFirstLineNumber", () => {
6
- const testFilesDir = path.join(__dirname, "testFiles");
7
+ const testFilesDir = path.join(path.dirname(fileURLToPath(import.meta.url)), "testFiles");
7
8
  const createTestFile = (fileName, content) => {
8
9
  const filePath = path.join(testFilesDir, fileName);
9
10
  fs.writeFileSync(filePath, content);
@@ -1,10 +1,11 @@
1
1
  import * as fs from "fs-extra";
2
2
  import * as path from "path";
3
3
  import { getFullPathInProject, listProjectFilesAndFolders, } from "./fileUtils.js";
4
+ import { fileURLToPath } from "url";
4
5
  export const moveWebTemplateFiles = async () => {
5
6
  await fs.remove("./intuned");
6
7
  await fs.ensureDir("./intuned");
7
- const currentFileLocation = path.resolve(__dirname, "..", "..", "..", "..", "WebTemplate");
8
+ const currentFileLocation = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "..", "..", "WebTemplate");
8
9
  // copy WebTemplate to ./intuned
9
10
  await fs.copy(`${currentFileLocation}`, "./intuned/WebTemplate", {
10
11
  filter: (src, dest) => {
@@ -1,10 +1,11 @@
1
1
  import * as fs from "fs-extra";
2
2
  import * as path from "path";
3
3
  import { getFullPathInProject, listProjectFilesAndFolders } from "./fileUtils.js";
4
+ import { fileURLToPath } from "url";
4
5
  export const moveWebTemplateFiles = async () => {
5
6
  await fs.remove("./intuned");
6
7
  await fs.ensureDir("./intuned");
7
- const currentFileLocation = path.resolve(__dirname, "..", "..", "..", "..", "WebTemplate");
8
+ const currentFileLocation = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "..", "..", "WebTemplate");
8
9
  await fs.copy(`${currentFileLocation}`, "./intuned/WebTemplate", {
9
10
  filter: (src, dest) => {
10
11
  if (src.includes(".d.ts")) {
@@ -4,12 +4,13 @@ import { program } from "commander";
4
4
  import * as fs from "fs-extra";
5
5
  import * as path from "path";
6
6
  import { moveWebTemplateFiles } from "./common/utils/webTemplate.js";
7
+ import { fileURLToPath } from "url";
7
8
  program
8
9
  .description("Check TypeScript types in the project")
9
10
  .allowUnknownOption()
10
11
  .action(async () => {
11
12
  await moveWebTemplateFiles();
12
- const templateTsConfig = path.resolve(__dirname, "..", "..", "template.tsconfig.json");
13
+ const templateTsConfig = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "template.tsconfig.json");
13
14
  await fs.copy(templateTsConfig, "./intuned/WebTemplate/tsconfig.json");
14
15
  checkTypes();
15
16
  });
@@ -4,9 +4,10 @@ import { program } from "commander";
4
4
  import * as fs from "fs-extra";
5
5
  import * as path from "path";
6
6
  import { moveWebTemplateFiles } from "./common/utils/webTemplate.js";
7
+ import { fileURLToPath } from "url";
7
8
  program.description("Check TypeScript types in the project").allowUnknownOption().action(async () => {
8
9
  await moveWebTemplateFiles();
9
- const templateTsConfig = path.resolve(__dirname, "..", "..", "template.tsconfig.json");
10
+ const templateTsConfig = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "template.tsconfig.json");
10
11
  await fs.copy(templateTsConfig, "./intuned/WebTemplate/tsconfig.json");
11
12
  checkTypes();
12
13
  });
@@ -7,6 +7,7 @@ import * as fs from "fs-extra";
7
7
  import { getFullPathInProject } from "../commands/common/utils/fileUtils";
8
8
  import waitOn from "wait-on";
9
9
  import { getDownloadDirectoryPath } from "../runtime";
10
+ import { fileURLToPath } from "url";
10
11
  async function createUserDirWithPreferences() {
11
12
  const playwrightTempDir = await mkdtemp("/tmp/pw-");
12
13
  const userDir = join(playwrightTempDir, "userdir");
@@ -65,7 +66,7 @@ export async function getProductionPlaywrightConstructs({ proxy, headless = true
65
66
  if (storageState) {
66
67
  await loadSessionToContext({ context, session: storageState });
67
68
  }
68
- const assetsFile = path.join(__dirname, "./assets/browser_scripts.js");
69
+ const assetsFile = path.join(path.dirname(fileURLToPath(import.meta.url)), "./assets/browser_scripts.js");
69
70
  await context.addInitScript({
70
71
  path: assetsFile,
71
72
  });
@@ -122,7 +123,7 @@ export async function getPlaywrightConstructsForMode(mode, cdpAddress, authSessi
122
123
  if (!context) {
123
124
  throw new Error("no context found");
124
125
  }
125
- const assetsFile = path.join(__dirname, "./assets/browser_scripts.js");
126
+ const assetsFile = path.join(path.dirname(fileURLToPath(import.meta.url)), "./assets/browser_scripts.js");
126
127
  await context.addInitScript({
127
128
  path: assetsFile,
128
129
  });
@@ -7,6 +7,7 @@ import * as fs from "fs-extra";
7
7
  import { getFullPathInProject } from "../commands/common/utils/fileUtils";
8
8
  import waitOn from "wait-on";
9
9
  import { getDownloadDirectoryPath } from "../runtime";
10
+ import { fileURLToPath } from "url";
10
11
  async function createUserDirWithPreferences() {
11
12
  const playwrightTempDir = await mkdtemp("/tmp/pw-");
12
13
  const userDir = join(playwrightTempDir, "userdir");
@@ -64,7 +65,7 @@ export async function getProductionPlaywrightConstructs({
64
65
  session: storageState
65
66
  });
66
67
  }
67
- const assetsFile = path.join(__dirname, "./assets/browser_scripts.js");
68
+ const assetsFile = path.join(path.dirname(fileURLToPath(import.meta.url)), "./assets/browser_scripts.js");
68
69
  await context.addInitScript({
69
70
  path: assetsFile
70
71
  });
@@ -92,7 +93,7 @@ export async function getPlaywrightConstructsForMode(mode, cdpAddress, authSessi
92
93
  if (!context) {
93
94
  throw new Error("no context found");
94
95
  }
95
- const assetsFile = path.join(__dirname, "./assets/browser_scripts.js");
96
+ const assetsFile = path.join(path.dirname(fileURLToPath(import.meta.url)), "./assets/browser_scripts.js");
96
97
  await context.addInitScript({
97
98
  path: assetsFile
98
99
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
3
  "type": "module",
4
- "version": "0.1.0-test.12",
4
+ "version": "0.1.0-test.14",
5
5
  "description": "Intuned runtime",
6
6
  "exports": {
7
7
  ".": "./dist/index.js",