Skip to content

Commit ef9d012

Browse files
authored
Fix generation of icons package and add task "clean" (#2470)
1 parent f12a215 commit ef9d012

File tree

12 files changed

+39
-15
lines changed

12 files changed

+39
-15
lines changed

.changeset/forty-trains-pull.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gitbook/icons': patch
3+
---
4+
5+
Fix first run of the package in development mode

bun.lockb

0 Bytes
Binary file not shown.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@
1616
"e2e": "turbo run e2e",
1717
"changeset": "changeset",
1818
"release": "turbo run release && changeset publish",
19-
"download:env": "op read op://gitbook-x-dev/gitbook-open/.env.local >> .env.local"
19+
"download:env": "op read op://gitbook-x-dev/gitbook-open/.env.local >> .env.local",
20+
"clean": "turbo run clean"
2021
},
2122
"workspaces": [
2223
"packages/*"
2324
],
2425
"devDependencies": {
2526
"@changesets/cli": "^2.27.7",
2627
"prettier": "^3.0.3",
27-
"turbo": "^2.0.9"
28+
"turbo": "^2.1.2"
2829
},
2930
"patchedDependencies": {
3031
"@vercel/next@4.3.6": "patches/@vercel%2Fnext@4.3.6.patch"

packages/emoji-codepoints/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"emoji-assets": "^8.0.0"
1010
},
1111
"scripts": {
12-
"generate": "bun ./build.ts"
12+
"generate": "bun ./build.ts",
13+
"clean": "rm -rf ./dist"
1314
}
1415
}

packages/gitbook/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"e2e": "playwright test",
1313
"unit": "bun test {src,packages}",
1414
"generate": "gitbook-icons ./public/~gitbook/static/icons custom-icons && gitbook-math ./public/~gitbook/static/math",
15-
"copy:icons": "gitbook-icons ./public/~gitbook/static/icons"
15+
"copy:icons": "gitbook-icons ./public/~gitbook/static/icons",
16+
"clean": "rm -rf ./.next && rm -rf ./public/~gitbook/static"
1617
},
1718
"dependencies": {
1819
"@gitbook/api": "0.60.0",

packages/icons/bin/gen-list.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,19 @@ async function main() {
6060

6161
async function writeDataFile(name, content) {
6262
const dirname = path.dirname(url.fileURLToPath(import.meta.url));
63+
64+
const srcData = path.resolve(dirname, '../src/data');
65+
const distData = path.resolve(dirname, '../dist/data');
66+
67+
// Ensure the directories exists
68+
await Promise.all([
69+
fs.mkdir(srcData, { recursive: true }),
70+
fs.mkdir(distData, { recursive: true }),
71+
]);
72+
6373
await Promise.all([
64-
fs.writeFile(path.resolve(dirname, `../src/data/${name}.json`), content),
65-
// Write to dist folder if it exists
66-
existsSync(path.resolve(dirname, '../dist/'))
67-
? fs.writeFile(path.resolve(dirname, `../dist/data/${name}.json`), content)
68-
: null,
74+
fs.writeFile(path.resolve(srcData, `${name}.json`), content),
75+
fs.writeFile(path.resolve(distData, `${name}.json`), content),
6976
]);
7077
}
7178

packages/icons/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"generate": "node ./bin/gen-list.js",
3535
"build": "tsc",
3636
"typecheck": "tsc --noEmit",
37-
"dev": "tsc -w"
37+
"dev": "tsc -w",
38+
"clean": "rm -rf ./dist && rm -rf ./src/data"
3839
},
3940
"bin": {
4041
"gitbook-icons": "./bin/gitbook-icons.js"

packages/icons/src/data/.gitkeep

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/react-contentkit/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"scripts": {
2323
"build": "tsc",
2424
"typecheck": "tsc --noEmit",
25-
"dev": "tsc -w"
25+
"dev": "tsc -w",
26+
"clean": "rm -rf ./dist"
2627
},
2728
"files": [
2829
"dist",

packages/react-math/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"scripts": {
2323
"build": "tsc",
2424
"typecheck": "tsc --noEmit",
25-
"dev": "tsc -w"
25+
"dev": "tsc -w",
26+
"clean": "rm -rf ./dist"
2627
},
2728
"bin": {
2829
"gitbook-math": "./bin/gitbook-math.js"

0 commit comments

Comments
 (0)