codeflash-internal/js/VSC-Extension/esbuild.js
HeshamHM28 b1584a5d12
[Feat] Organization (#1888)
## Organization Feature

This PR introduces a new **Organization** feature that allows users to:
- Create organizations and add members  
- Manage repositories within organizations  
- Allow organization members to access and view shared repository data  

---

##  How to Test

### 1. Setup
- Apply the latest **database migrations**.  
- Build the **common** package, then **pack** and **install** it in
both:
  - `cf-webapp`
  - `cf-api`

### 2. Create an Organization
- You can create an organization **manually** in the database, **or**
- Use the **GitHub webhook** to add it automatically.

### 3. Test Scenarios
Prepare the following:
- **Two users:**
  - **User A** – has access to the organization and its repositories.
  - **User B** – a regular user.
- **Two repositories:**
  - One under the **organization**.
  - One under **User A’s personal account**.

### 4. Verification Steps
1. Log in to **cf-webapp** as **User A**.  
2. Confirm both the **personal account** and **organization** appear.  
3. Try optimizing code and ensure **statistics** display correctly.  
4. Switch between **personal** and **organization** accounts to verify
data accuracy.
5. From the **personal account**:
   - Open a specific repository.  
   - Add a new member by **GitHub username**.  
   - Log in as that member (**User B**) and verify access.  
6. From the **organization**:
   - Add members to the organization by **GitHub username**.  
- Log in as the added member and confirm they have access to
organization repositories.
- Update the member’s **role** and ensure changes are applied correctly.

---

---------

Co-authored-by: ali <mohammed18200118@gmail.com>
Co-authored-by: Sarthak Agarwal <sarthak.saga@gmail.com>
2025-10-29 13:05:40 -07:00

57 lines
1.3 KiB
JavaScript

const esbuild = require("esbuild");
const production = process.argv.includes("--production");
const watch = process.argv.includes("--watch");
/**
* @type {import('esbuild').Plugin}
*/
const esbuildProblemMatcherPlugin = {
name: "esbuild-problem-matcher",
setup(build) {
build.onStart(() => {
console.log("[watch] build started");
});
build.onEnd((result) => {
result.errors.forEach(({ text, location }) => {
console.error(`✘ [ERROR] ${text}`);
console.error(
` ${location.file}:${location.line}:${location.column}:`,
);
});
console.log("[watch] build finished");
});
},
};
async function main() {
const ctx = await esbuild.context({
entryPoints: ["src/extension.ts"],
bundle: true,
format: "cjs",
minify: production,
sourcemap: !production ? "inline" : false,
sourcesContent: true,
platform: "node",
outfile: "dist/extension.js",
external: ["vscode"],
logLevel: "silent",
plugins: [
/* add to the end of plugins array */
esbuildProblemMatcherPlugin,
],
keepNames: !production,
});
if (watch) {
await ctx.watch();
} else {
await ctx.rebuild();
await ctx.dispose();
}
}
main().catch((e) => {
console.error(e);
process.exit(1);
});