Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move to bun and structure output #364

Merged
merged 17 commits into from
Jan 12, 2025
Merged

feat: move to bun and structure output #364

merged 17 commits into from
Jan 12, 2025

Conversation

mattzcarey
Copy link
Owner

No description provided.

src/common/model/AIModel.ts Fixed Show fixed Hide fixed
src/common/model/AIModel.ts Fixed Show fixed Hide fixed
src/common/model/AIModel.ts Fixed Show fixed Hide fixed
Copy link
Contributor

github-actions bot commented Jan 12, 2025

Risk Level 2 - /home/runner/work/code-review-gpt/code-review-gpt/scripts/build.js

The code is generally well-structured, but the repeated fs.copyFileSync calls can be simplified by using an array of template names and iterating over it. This improves readability and maintainability.

Suggested changes:

const { build } = require('esbuild');
const { dependencies } = require('../package.json');
const { Generator } = require('npm-dts');
const fs = require('fs');
const path = require('path');

new Generator({
  entry: 'src/index.ts',
  output: 'dist/index.d.ts',
}).generate();

const sharedConfig = {
  entryPoints: ['src/index.ts'],
  bundle: true,
  minify: true,
  external: Object.keys(dependencies),
  platform: 'node',
  outfile: 'dist/index.js',
};

build(sharedConfig).then(() => {
  // Copy the CI template files to the dist folder after the build is complete
  const templates = ['github-pr.yml', 'gitlab-pr.yml', 'azdev-pr.yml'];
  templates.forEach(template => {
    fs.copyFileSync(
      path.join(__dirname, '../templates', template),
      path.join(__dirname, '../dist', template)
    );
  });
});
View Original Code
+const { build } = require('esbuild');
+const { dependencies } = require('../package.json');
+const { Generator } = require('npm-dts');
+const fs = require('fs');
+const path = require('path');
+
+new Generator({
+  entry: 'src/index.ts',
+  output: 'dist/index.d.ts',
+}).generate();
+
+const sharedConfig = {
+  entryPoints: ['src/index.ts'],
+  bundle: true,
+  minify: true,
+  external: Object.keys(dependencies),
+  platform: 'node',
+  outfile: 'dist/index.js',
+};
+
+build(sharedConfig).then(() => {
+  // Copy the ci template files to the dist folder after the build is complete
+  fs.copyFileSync(
+    path.join(__dirname, '../templates', 'github-pr.yml'),
+    path.join(__dirname, '../dist', 'github-pr.yml')
+  );
+  fs.copyFileSync(
+    path.join(__dirname, '../templates', 'gitlab-pr.yml'),
+    path.join(__dirname, '../dist', 'gitlab-pr.yml')
+  );
+  fs.copyFileSync(
+    path.join(__dirname, '../templates', 'azdev-pr.yml'),
+    path.join(__dirname, '../dist', 'azdev-pr.yml')
+  );
+});

Powered by Code Review GPT

Copy link
Contributor

github-actions bot commented Jan 12, 2025

Test results summary:

❌ [FAIL] - Test case: Unawaited Promise
❌ [FAIL] - Test case: Exposed secret
❌ [FAIL] - Test case: Too many nested loops
❌ [FAIL] - Test case: Bad variable name

SUMMARY: ✅ PASS: 0 - ⚠️ WARN: 0 - ❌ FAIL: 4


Tests Powered by Code Review GPT

@mattzcarey mattzcarey merged commit c042495 into main Jan 12, 2025
4 checks passed
@mattzcarey mattzcarey deleted the feat/move-to-bun branch January 12, 2025 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant