Skip to content

Commit bf8ee15

Browse files
committed
feat: add extension to package, with icon removed
1 parent 1e38eb1 commit bf8ee15

4 files changed

Lines changed: 32 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
"module": "dist/index.js",
3535
"scripts": {
36-
"build": "tsc",
36+
"build": "tsc && node ./scripts/copy-ext-no-icon.js",
3737
"prepare": "pnpm build"
3838
},
3939
"dependencies": {

scripts/copy-ext-no-icon.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import fs from "fs";
2+
3+
const src = "./extension";
4+
const dest = "./dist/extension";
5+
6+
// Remove the destination directory if it exists
7+
if (fs.existsSync(dest)) {
8+
fs.rmSync(dest, { recursive: true, force: true });
9+
}
10+
11+
// Copy the source directory to the destination
12+
fs.cpSync(src, dest, { recursive: true });
13+
14+
// Remove the icon files from the copied extension
15+
fs.rmSync(`${dest}/icons`, { recursive: true, force: true });
16+
17+
const manifestPath = `${dest}/manifest.json`;
18+
let manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
19+
delete manifest.icons;
20+
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));

src/extensionPath.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { fileURLToPath } from "url";
2+
import path from "path";
3+
4+
const __filename = fileURLToPath(import.meta.url);
5+
const __dirname = path.dirname(__filename);
6+
7+
export const CHROME_INSPECTOR_SYNC_EXTENSION_PATH = path.join(
8+
__dirname,
9+
"extension",
10+
);

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export * from "./Inspector.js";
22
export * from "./constants.js";
33
export * from "./types.js";
44
export * from "./InspectorDOM.js";
5+
export * from "./extensionPath.js";

0 commit comments

Comments
 (0)