From 3abc8451c3d40ce7cb985feb0f7e1fa3f95e646f Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 10 Sep 2024 15:19:08 +0200 Subject: [PATCH] fix spawn server --- .../src/githttpbackend/package.json | 6 ++++- .../src/githttpbackend/{ => src}/server.ts | 0 .../src/githttpbackend/tsconfig.json | 25 +++++++++++++++++++ .../src/githttpbackend/yarn.lock | 17 +++++++++++++ .../src/tests/dgit_local.test.ts | 2 +- 5 files changed, 48 insertions(+), 2 deletions(-) rename apps/remix-ide-e2e/src/githttpbackend/{ => src}/server.ts (100%) create mode 100644 apps/remix-ide-e2e/src/githttpbackend/tsconfig.json diff --git a/apps/remix-ide-e2e/src/githttpbackend/package.json b/apps/remix-ide-e2e/src/githttpbackend/package.json index 3e44990386..23c5fdb3fd 100644 --- a/apps/remix-ide-e2e/src/githttpbackend/package.json +++ b/apps/remix-ide-e2e/src/githttpbackend/package.json @@ -1,6 +1,6 @@ { "scripts": { - "start:server": "npx ts-node server.ts" + "start:server": "tsc && node ./dist/server.js" }, "dependencies": { "body-parser": "^1.20.2", @@ -9,5 +9,9 @@ "git-http-backend": "^1.1.2", "path": "^0.12.7", "zlib": "^1.0.5" + }, + "devDependencies": { + "@types/node": "^22.5.4", + "typescript": "^5.6.2" } } diff --git a/apps/remix-ide-e2e/src/githttpbackend/server.ts b/apps/remix-ide-e2e/src/githttpbackend/src/server.ts similarity index 100% rename from apps/remix-ide-e2e/src/githttpbackend/server.ts rename to apps/remix-ide-e2e/src/githttpbackend/src/server.ts diff --git a/apps/remix-ide-e2e/src/githttpbackend/tsconfig.json b/apps/remix-ide-e2e/src/githttpbackend/tsconfig.json new file mode 100644 index 0000000000..7b867a47ae --- /dev/null +++ b/apps/remix-ide-e2e/src/githttpbackend/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "target": "ES6", // Set the ECMAScript target version + "module": "commonjs", // Specify module code generation + "strict": true, + "noImplicitAny": false, // Enable all strict type-checking options + "esModuleInterop": true, // Emit additional code to make commonJS and ES modules work together + "skipLibCheck": true, // Skip type checking of all declaration files (.d.ts) + "forceConsistentCasingInFileNames": true, // Ensure file names are treated with case sensitivity + "outDir": "./dist", // Redirect output structure to the 'dist' directory + "rootDir": "./src", // Specify the root directory of input files + "sourceMap": true, // Create source map files + "types": [ + "node" + ], // Add node types + "moduleResolution": "node", // Ensure TypeScript resolves modules like Node.js + }, + "include": [ + "src/**/*" // Include all TypeScript files in the src directory + ], + "exclude": [ + "node_modules", // Exclude the node_modules folder + "**/*.test.ts" // Exclude test files + ] +} \ No newline at end of file diff --git a/apps/remix-ide-e2e/src/githttpbackend/yarn.lock b/apps/remix-ide-e2e/src/githttpbackend/yarn.lock index 8548a19555..b426315cd1 100644 --- a/apps/remix-ide-e2e/src/githttpbackend/yarn.lock +++ b/apps/remix-ide-e2e/src/githttpbackend/yarn.lock @@ -2,6 +2,13 @@ # yarn lockfile v1 +"@types/node@^22.5.4": + version "22.5.4" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.5.4.tgz#83f7d1f65bc2ed223bdbf57c7884f1d5a4fa84e8" + integrity sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg== + dependencies: + undici-types "~6.19.2" + accepts@~1.3.8: version "1.3.8" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" @@ -483,6 +490,16 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" +typescript@^5.6.2: + version "5.6.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.2.tgz#d1de67b6bef77c41823f822df8f0b3bcff60a5a0" + integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw== + +undici-types@~6.19.2: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== + unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" diff --git a/apps/remix-ide-e2e/src/tests/dgit_local.test.ts b/apps/remix-ide-e2e/src/tests/dgit_local.test.ts index 659b20767a..a298f15d96 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_local.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_local.test.ts @@ -606,7 +606,7 @@ async function createCommitOnLocalServer(path: string, message: string) { async function spawnGitServer(path: string): Promise { console.log(process.cwd()) try { - const server = spawn('yarn && sh setup.sh && npx ts-node server.ts', [`${path}`], { cwd: process.cwd() + '/apps/remix-ide-e2e/src/githttpbackend/', shell: true, detached: true }) + const server = spawn('yarn && sh setup.sh && yarn start:server', [`${path}`], { cwd: process.cwd() + '/apps/remix-ide-e2e/src/githttpbackend/', shell: true, detached: true }) console.log('spawned', server.stdout.closed, server.stderr.closed) return new Promise((resolve, reject) => { server.stdout.on('data', function (data) {