From 32ede0aa4f8e10cf94c4aef4d54b555b92bdf671 Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Sun, 15 Oct 2023 16:21:39 -0400 Subject: [PATCH 01/10] Update Test.yml --- .github/workflows/Test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index f2a8f53..14a3eaf 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -12,12 +12,19 @@ jobs: strategy: matrix: type: [game, place, model, plugin, package] + git: [true, false] + eslint: [true, false] + prettier: [true, false] + vscode: [true, false] + packageManager: [npm, yarn, pnpm] steps: - name: Checkout create-roblox-ts repo uses: actions/checkout@v4 with: path: create-roblox-ts + - uses: pnpm/action-setup@v2 + - name: Setup create-roblox-ts repo run: | cd create-roblox-ts From a28b23b642d9289f1c6631c64216f7d1cd2b275f Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Sun, 15 Oct 2023 16:22:41 -0400 Subject: [PATCH 02/10] Update Test.yml --- .github/workflows/Test.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index 14a3eaf..3b4069a 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -32,4 +32,11 @@ jobs: npm run build - name: Create template project - run: node ./create-roblox-ts/out/index.js ${{ matrix.type }} -y --dir project + run: | + node ./create-roblox-ts/out/index.js ${{ matrix.type }} \ + --dir project \ + --git=${{ matrix.git }} \ + --eslint=${{ matrix.eslint }} \ + --prettier=${{ matrix.prettier }} \ + --vscode=${{ matrix.vscode }} \ + --packageManager=${{ matrix.packageManager }} From 452447b4abb7ff61089b7f072ca5445b48e36c55 Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Sun, 15 Oct 2023 16:27:51 -0400 Subject: [PATCH 03/10] Remove pnpm --- .github/workflows/Test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index 3b4069a..2987934 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -16,15 +16,13 @@ jobs: eslint: [true, false] prettier: [true, false] vscode: [true, false] - packageManager: [npm, yarn, pnpm] + packageManager: [npm, yarn] steps: - name: Checkout create-roblox-ts repo uses: actions/checkout@v4 with: path: create-roblox-ts - - uses: pnpm/action-setup@v2 - - name: Setup create-roblox-ts repo run: | cd create-roblox-ts From 752cbf9ceeee6fd2f22210b150cf80ed592d0fa6 Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Sun, 15 Oct 2023 16:37:52 -0400 Subject: [PATCH 04/10] Revert Test.yml --- .github/workflows/Test.yml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index 2987934..f2a8f53 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -12,11 +12,6 @@ jobs: strategy: matrix: type: [game, place, model, plugin, package] - git: [true, false] - eslint: [true, false] - prettier: [true, false] - vscode: [true, false] - packageManager: [npm, yarn] steps: - name: Checkout create-roblox-ts repo uses: actions/checkout@v4 @@ -30,11 +25,4 @@ jobs: npm run build - name: Create template project - run: | - node ./create-roblox-ts/out/index.js ${{ matrix.type }} \ - --dir project \ - --git=${{ matrix.git }} \ - --eslint=${{ matrix.eslint }} \ - --prettier=${{ matrix.prettier }} \ - --vscode=${{ matrix.vscode }} \ - --packageManager=${{ matrix.packageManager }} + run: node ./create-roblox-ts/out/index.js ${{ matrix.type }} -y --dir project From a9dc09324c7a31ba50d11f9669a77e5b0f77e2a4 Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Sun, 15 Oct 2023 16:38:08 -0400 Subject: [PATCH 05/10] Simulate breaking plugin tsconfig.json --- templates/plugin/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/plugin/tsconfig.json b/templates/plugin/tsconfig.json index c8b0db2..2bd16fc 100644 --- a/templates/plugin/tsconfig.json +++ b/templates/plugin/tsconfig.json @@ -18,7 +18,7 @@ "typeRoots": ["node_modules/@rbxts"], // configurable - "types": ["types/plugin"], + "types": ["@rbxts/types/plugin"], "rootDir": "src", "outDir": "out", "baseUrl": "src", From 626e71ee16acd4b838fb3b06a86ebe47f31fafd6 Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Sun, 15 Oct 2023 16:42:43 -0400 Subject: [PATCH 06/10] Better error handling --- src/commands/init.ts | 8 ++++---- src/index.ts | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/commands/init.ts b/src/commands/init.ts index 6f9532b..14b6e99 100644 --- a/src/commands/init.ts +++ b/src/commands/init.ts @@ -64,14 +64,14 @@ const packageManagerCommands: { function cmd(cmdStr: string, cwd: string) { return new Promise((resolve, reject) => { - exec(cmdStr, { cwd }, (error, stdout) => { + exec(cmdStr, { cwd }, (error, stdout, stderr) => { if (error) { - reject(error); + reject({ error, stderr }); } resolve(stdout); }); - }).catch((error: ExecException) => { - throw new InitError(`Command "${error.cmd}" exited with code ${error.code}\n\n${error.message}`); + }).catch(({ error, stderr }: { error: ExecException; stderr: string }) => { + throw new InitError(`Command "${error.cmd}" exited with code ${error.code}\n\n${error.message}\n\n${stderr}`); }); } diff --git a/src/index.ts b/src/index.ts index 53c654b..f400db7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -35,6 +35,7 @@ yargs }) .parseAsync() .catch(e => { + process.exitCode = 1; if (e instanceof LoggableError) { e.log(); } else { From 64200e13e2ecaf9d7c14fb69d2c64af3059a8b5f Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Sun, 15 Oct 2023 16:50:35 -0400 Subject: [PATCH 07/10] stdout? --- src/commands/init.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/commands/init.ts b/src/commands/init.ts index 14b6e99..18504b6 100644 --- a/src/commands/init.ts +++ b/src/commands/init.ts @@ -70,8 +70,10 @@ function cmd(cmdStr: string, cwd: string) { } resolve(stdout); }); - }).catch(({ error, stderr }: { error: ExecException; stderr: string }) => { - throw new InitError(`Command "${error.cmd}" exited with code ${error.code}\n\n${error.message}\n\n${stderr}`); + }).catch(({ error, stdout, stderr }: { error: ExecException; stdout: string; stderr: string }) => { + throw new InitError( + [`Command "${error.cmd}" exited with code ${error.code}`, error.message, stdout, stderr].join("\n\n"), + ); }); } From e52e5fcef74b7ba94685d8971b14f874f0b1b02a Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Sun, 15 Oct 2023 16:52:28 -0400 Subject: [PATCH 08/10] wip --- src/commands/init.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/commands/init.ts b/src/commands/init.ts index 18504b6..b25aa78 100644 --- a/src/commands/init.ts +++ b/src/commands/init.ts @@ -71,6 +71,7 @@ function cmd(cmdStr: string, cwd: string) { resolve(stdout); }); }).catch(({ error, stdout, stderr }: { error: ExecException; stdout: string; stderr: string }) => { + console.log({ error, stdout, stderr }); throw new InitError( [`Command "${error.cmd}" exited with code ${error.code}`, error.message, stdout, stderr].join("\n\n"), ); From d934f97125ed3751f917f8635eaf78bd7118b938 Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Sun, 15 Oct 2023 17:12:03 -0400 Subject: [PATCH 09/10] Improved cmd function --- src/commands/init.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/commands/init.ts b/src/commands/init.ts index b25aa78..655df27 100644 --- a/src/commands/init.ts +++ b/src/commands/init.ts @@ -1,4 +1,4 @@ -import { exec, ExecException } from "child_process"; +import { spawn } from "child_process"; import fs from "fs-extra"; import kleur from "kleur"; import { lookpath } from "lookpath"; @@ -64,17 +64,17 @@ const packageManagerCommands: { function cmd(cmdStr: string, cwd: string) { return new Promise((resolve, reject) => { - exec(cmdStr, { cwd }, (error, stdout, stderr) => { - if (error) { - reject({ error, stderr }); - } - resolve(stdout); - }); - }).catch(({ error, stdout, stderr }: { error: ExecException; stdout: string; stderr: string }) => { - console.log({ error, stdout, stderr }); - throw new InitError( - [`Command "${error.cmd}" exited with code ${error.code}`, error.message, stdout, stderr].join("\n\n"), + const [command, ...args] = cmdStr.split(" "); + const childProcess = spawn(command, args, { cwd }); + let output = ""; + childProcess.stdout.on("data", data => (output += data)); + childProcess.stderr.on("data", data => (output += data)); + childProcess.on("close", code => + code === 0 + ? resolve(output) + : reject(new InitError(`Command "${cmdStr}" exited with code ${code}\n\n${output}`)), ); + childProcess.on("error", reject); }); } From 7496ebf9b51608e5e13311be4f45a08f84b00dcc Mon Sep 17 00:00:00 2001 From: osyrisrblx Date: Sun, 15 Oct 2023 17:14:47 -0400 Subject: [PATCH 10/10] Revert plugin/tsconfig.json change --- templates/plugin/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/plugin/tsconfig.json b/templates/plugin/tsconfig.json index 2bd16fc..c8b0db2 100644 --- a/templates/plugin/tsconfig.json +++ b/templates/plugin/tsconfig.json @@ -18,7 +18,7 @@ "typeRoots": ["node_modules/@rbxts"], // configurable - "types": ["@rbxts/types/plugin"], + "types": ["types/plugin"], "rootDir": "src", "outDir": "out", "baseUrl": "src",