From dc0622848b648ba27e7110b9b900673bb668ab4c Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 9 Aug 2023 19:21:57 -0700 Subject: fix: :bug: make typegen.js windows compatible --- extension/scripts/typegen.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'extension/scripts') diff --git a/extension/scripts/typegen.js b/extension/scripts/typegen.js index 0bbff19e..ada39d47 100644 --- a/extension/scripts/typegen.js +++ b/extension/scripts/typegen.js @@ -46,8 +46,15 @@ function deleteAllInDir(dir) { }); } -OUTPUT_DIR = "schema"; -INPUT_DIR = "../schema/json"; +const OUTPUT_DIR = path.join("schema"); +const INPUT_DIR = path.join("..", "schema", "json"); +if (!fs.existsSync(INPUT_DIR)) { + throw new Error(`Input directory does not exist: ${INPUT_DIR}`); +} + +if (!fs.existsSync(OUTPUT_DIR)) { + throw new Error(`Output directory does not exist: ${OUTPUT_DIR}`); +} deleteAllInDir(OUTPUT_DIR); generateAllSchemas(INPUT_DIR, OUTPUT_DIR); -- cgit v1.2.3-70-g09d2 From f38c8fb8b33a705ed4eb4d2e0974060ebb88afd3 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 9 Aug 2023 19:35:26 -0700 Subject: fix: :bug: another windows fix in typegen.js --- extension/scripts/typegen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extension/scripts') diff --git a/extension/scripts/typegen.js b/extension/scripts/typegen.js index ada39d47..8fec3888 100644 --- a/extension/scripts/typegen.js +++ b/extension/scripts/typegen.js @@ -4,7 +4,7 @@ const { compile } = require("json-schema-to-typescript"); function generateTypesForFile(inputPath, outputPath) { let schema = JSON.parse(fs.readFileSync(inputPath, "utf8")); - let name = (inputPath.split("/").pop() || inputPath).split(".")[0]; + let name = path.parse(path.basename(inputPath)).name; // This is to solve the issue of json-schema-to-typescript not supporting $ref at the top-level, which is what Pydantic generates for recursive types if ("$ref" in schema) { let temp = schema["$ref"]; -- cgit v1.2.3-70-g09d2 From 4636c9590154d6b5995948003da212eb25003750 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 9 Aug 2023 20:56:11 -0700 Subject: fix: :bug: write out npm run package as package.js --- extension/package.json | 2 +- extension/scripts/package.js | 40 +++++++++++++++++++++++ extension/src/test-suite/environmentSetup.test.ts | 2 +- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 extension/scripts/package.js (limited to 'extension/scripts') diff --git a/extension/package.json b/extension/package.json index ea4d8c16..7cf2bc7d 100644 --- a/extension/package.json +++ b/extension/package.json @@ -195,7 +195,7 @@ "lint": "eslint src --ext ts", "build-test": "tsc && node esbuild.test.mjs", "test": "npm run build-test && node ./out/test-runner/runTestOnVSCodeHost.js", - "package": "npm install && npm run typegen && npm run clientgen && cd react-app && npm install && npm run build && cd .. && mkdir build && vsce package --out ./build" + "package": "node scripts/package.js" }, "devDependencies": { "@nestjs/common": "^8.4.7", diff --git a/extension/scripts/package.js b/extension/scripts/package.js new file mode 100644 index 00000000..4703ebc2 --- /dev/null +++ b/extension/scripts/package.js @@ -0,0 +1,40 @@ +const { exec } = require("child_process"); +const fs = require("fs"); + +exec("npm install", (error) => { + if (error) throw error; + console.log("npm install completed"); + + exec("npm run typegen", (error) => { + if (error) throw error; + console.log("npm run typegen completed"); + + exec("npm run clientgen", (error) => { + if (error) throw error; + console.log("npm run clientgen completed"); + + process.chdir("react-app"); + + exec("npm install", (error) => { + if (error) throw error; + console.log("npm install in react-app completed"); + + exec("npm run build", (error) => { + if (error) throw error; + console.log("npm run build in react-app completed"); + + process.chdir(".."); + + if (!fs.existsSync("build")) { + fs.mkdirSync("build"); + } + + exec("vsce package --out ./build", (error) => { + if (error) throw error; + console.log("vsce package completed"); + }); + }); + }); + }); + }); +}); diff --git a/extension/src/test-suite/environmentSetup.test.ts b/extension/src/test-suite/environmentSetup.test.ts index a6aa3433..a0d6cbaa 100644 --- a/extension/src/test-suite/environmentSetup.test.ts +++ b/extension/src/test-suite/environmentSetup.test.ts @@ -9,7 +9,7 @@ import fkill from "fkill"; describe("Can start python server", () => { test("Can start python server in under 10 seconds", async function () { fkill(65432, { force: true, silent: true }); - const allowedTime = 10_000; + const allowedTime = 15_000; this.timeout(allowedTime + 1000); // If successful, the server is started by the extension while we wait -- cgit v1.2.3-70-g09d2 From 19acf3bb36c1e44274297c806b89b589ca02f5ba Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 10 Aug 2023 10:47:09 -0700 Subject: fix: :green_heart: testing for failure to package dist in vsix --- .github/workflows/main.yaml | 108 ++++++++++++---------- continuedev/src/continuedev/plugins/steps/help.py | 3 +- extension/react-app/src/components/ComboBox.tsx | 3 +- extension/scripts/package.js | 6 ++ 4 files changed, 68 insertions(+), 52 deletions(-) (limited to 'extension/scripts') diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 99b30201..03855b64 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -180,55 +180,63 @@ jobs: cd extension npm ci - - name: Publish - run: | - cd extension - npx vsce publish patch -p ${{ secrets.VSCE_TOKEN }} - - name: Commit changes - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git commit -am "ci: 💚 Update package.json version [skip ci]" - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} - - # Download binaries and upload to S3 - - - name: Download Linux build - uses: actions/download-artifact@v2 - with: - name: Linux Build - path: exe/linux - - - name: Download macOS build - uses: actions/download-artifact@v2 - with: - name: macOS Build - path: exe/mac - - - name: Download Windows build - uses: actions/download-artifact@v2 - with: - name: Windows Build - path: exe/windows - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 + - name: Upload .vsix a second time + uses: actions/upload-artifact@v2 with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-west-1 + name: vsix-artifact + path: extension/build - - name: Upload binaries to S3 - uses: jakejarvis/s3-sync-action@master - with: - args: --acl public-read --follow-symlinks --delete - env: - AWS_S3_BUCKET: continue-server-binaries - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_REGION: "us-west-1" - SOURCE_DIR: "exe" + # - name: Publish + # run: | + # cd extension + # npx vsce publish patch -p ${{ secrets.VSCE_TOKEN }} + + # - name: Commit changes + # run: | + # git config --local user.email "action@github.com" + # git config --local user.name "GitHub Action" + # git commit -am "ci: 💚 Update package.json version [skip ci]" + + # - name: Push changes + # uses: ad-m/github-push-action@master + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # branch: ${{ github.ref }} + + # # Download binaries and upload to S3 + + # - name: Download Linux build + # uses: actions/download-artifact@v2 + # with: + # name: Linux Build + # path: exe/linux + + # - name: Download macOS build + # uses: actions/download-artifact@v2 + # with: + # name: macOS Build + # path: exe/mac + + # - name: Download Windows build + # uses: actions/download-artifact@v2 + # with: + # name: Windows Build + # path: exe/windows + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v1 + # with: + # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + # aws-region: us-west-1 + + # - name: Upload binaries to S3 + # uses: jakejarvis/s3-sync-action@master + # with: + # args: --acl public-read --follow-symlinks --delete + # env: + # AWS_S3_BUCKET: continue-server-binaries + # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + # AWS_REGION: "us-west-1" + # SOURCE_DIR: "exe" diff --git a/continuedev/src/continuedev/plugins/steps/help.py b/continuedev/src/continuedev/plugins/steps/help.py index ec670999..82f885d6 100644 --- a/continuedev/src/continuedev/plugins/steps/help.py +++ b/continuedev/src/continuedev/plugins/steps/help.py @@ -39,6 +39,7 @@ class HelpStep(Step): if question.strip() == "": self.description = help else: + self.description = "The following output is generated by a language model, which may hallucinate. Type just '/help'to see a fixed answer. You can also learn more by reading [the docs](https://continue.dev/docs).\n\n" prompt = dedent(f""" Information: @@ -48,7 +49,7 @@ class HelpStep(Step): Please us the information below to provide a succinct answer to the following question: {question} - Do not cite any slash commands other than those you've been told about, which are: /edit and /feedback.""") + Do not cite any slash commands other than those you've been told about, which are: /edit and /feedback. Never refer or link to any URL.""") self.chat_context.append(ChatMessage( role="user", diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx index 472e1b14..bf32fc5a 100644 --- a/extension/react-app/src/components/ComboBox.tsx +++ b/extension/react-app/src/components/ComboBox.tsx @@ -479,7 +479,8 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { selected={downshiftProps.selectedItem === item} > - {item.name}:{" "} + {item.name} + {" "} {item.description} diff --git a/extension/scripts/package.js b/extension/scripts/package.js index ae9a4d94..e36df029 100644 --- a/extension/scripts/package.js +++ b/extension/scripts/package.js @@ -17,6 +17,12 @@ exec("npm install", (error) => { exec("npm run build", (error) => { if (error) throw error; + if (!fs.existsSync(path.join("dist", "assets", "index.js"))) { + throw new Error("react-app build did not produce index.js"); + } + if (!fs.existsSync(path.join("dist", "assets", "index.css"))) { + throw new Error("react-app build did not produce index.css"); + } console.log("npm run build in react-app completed"); process.chdir(".."); -- cgit v1.2.3-70-g09d2 From 5bfe68ea7f7e90e3cb1c3101360cf959b336a857 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 10 Aug 2023 10:52:16 -0700 Subject: fix: :bug: fix missing path import --- extension/scripts/package.js | 1 + 1 file changed, 1 insertion(+) (limited to 'extension/scripts') diff --git a/extension/scripts/package.js b/extension/scripts/package.js index e36df029..8b2816c5 100644 --- a/extension/scripts/package.js +++ b/extension/scripts/package.js @@ -1,5 +1,6 @@ const { exec } = require("child_process"); const fs = require("fs"); +const path = require("path"); exec("npm install", (error) => { if (error) throw error; -- cgit v1.2.3-70-g09d2 From 34f32ed5f71055ea11d4332f18e77ceba5849631 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 10 Aug 2023 23:39:19 -0700 Subject: fix: :green_heart: package patch --- extension/scripts/package.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extension/scripts') diff --git a/extension/scripts/package.js b/extension/scripts/package.js index 8b2816c5..59da9181 100644 --- a/extension/scripts/package.js +++ b/extension/scripts/package.js @@ -32,7 +32,7 @@ exec("npm install", (error) => { fs.mkdirSync("build"); } - exec("vsce package --out ./build", (error) => { + exec("vsce package --out ./build patch", (error) => { if (error) throw error; console.log("vsce package completed"); }); -- cgit v1.2.3-70-g09d2