mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-23 19:06:31 +00:00
Fix generation of icons package and add task "clean" (#2470)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@gitbook/icons': patch
|
||||
---
|
||||
|
||||
Fix first run of the package in development mode
|
||||
+3
-2
@@ -16,7 +16,8 @@
|
||||
"e2e": "turbo run e2e",
|
||||
"changeset": "changeset",
|
||||
"release": "turbo run release && changeset publish",
|
||||
"download:env": "op read op://gitbook-x-dev/gitbook-open/.env.local >> .env.local"
|
||||
"download:env": "op read op://gitbook-x-dev/gitbook-open/.env.local >> .env.local",
|
||||
"clean": "turbo run clean"
|
||||
},
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
@@ -24,7 +25,7 @@
|
||||
"devDependencies": {
|
||||
"@changesets/cli": "^2.27.7",
|
||||
"prettier": "^3.0.3",
|
||||
"turbo": "^2.0.9"
|
||||
"turbo": "^2.1.2"
|
||||
},
|
||||
"patchedDependencies": {
|
||||
"@vercel/next@4.3.6": "patches/@vercel%2Fnext@4.3.6.patch"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"emoji-assets": "^8.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"generate": "bun ./build.ts"
|
||||
"generate": "bun ./build.ts",
|
||||
"clean": "rm -rf ./dist"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
"e2e": "playwright test",
|
||||
"unit": "bun test {src,packages}",
|
||||
"generate": "gitbook-icons ./public/~gitbook/static/icons custom-icons && gitbook-math ./public/~gitbook/static/math",
|
||||
"copy:icons": "gitbook-icons ./public/~gitbook/static/icons"
|
||||
"copy:icons": "gitbook-icons ./public/~gitbook/static/icons",
|
||||
"clean": "rm -rf ./.next && rm -rf ./public/~gitbook/static"
|
||||
},
|
||||
"dependencies": {
|
||||
"@gitbook/api": "0.60.0",
|
||||
|
||||
@@ -60,12 +60,19 @@ async function main() {
|
||||
|
||||
async function writeDataFile(name, content) {
|
||||
const dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
||||
|
||||
const srcData = path.resolve(dirname, '../src/data');
|
||||
const distData = path.resolve(dirname, '../dist/data');
|
||||
|
||||
// Ensure the directories exists
|
||||
await Promise.all([
|
||||
fs.writeFile(path.resolve(dirname, `../src/data/${name}.json`), content),
|
||||
// Write to dist folder if it exists
|
||||
existsSync(path.resolve(dirname, '../dist/'))
|
||||
? fs.writeFile(path.resolve(dirname, `../dist/data/${name}.json`), content)
|
||||
: null,
|
||||
fs.mkdir(srcData, { recursive: true }),
|
||||
fs.mkdir(distData, { recursive: true }),
|
||||
]);
|
||||
|
||||
await Promise.all([
|
||||
fs.writeFile(path.resolve(srcData, `${name}.json`), content),
|
||||
fs.writeFile(path.resolve(distData, `${name}.json`), content),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
"generate": "node ./bin/gen-list.js",
|
||||
"build": "tsc",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"dev": "tsc -w"
|
||||
"dev": "tsc -w",
|
||||
"clean": "rm -rf ./dist && rm -rf ./src/data"
|
||||
},
|
||||
"bin": {
|
||||
"gitbook-icons": "./bin/gitbook-icons.js"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Files in this folder are generated in postinstall script.
|
||||
@@ -22,7 +22,8 @@
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"dev": "tsc -w"
|
||||
"dev": "tsc -w",
|
||||
"clean": "rm -rf ./dist"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"dev": "tsc -w"
|
||||
"dev": "tsc -w",
|
||||
"clean": "rm -rf ./dist"
|
||||
},
|
||||
"bin": {
|
||||
"gitbook-math": "./bin/gitbook-math.js"
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
"build": "tsc",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"unit": "bun test",
|
||||
"dev": "tsc -w"
|
||||
"dev": "tsc -w",
|
||||
"clean": "rm -rf ./dist"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
|
||||
+7
-1
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"$schema": "https://turbo.build/schema.json",
|
||||
"ui": "tui",
|
||||
"globalEnv": ["NODE_ENV", "CI", "ARGOS_*", "GITHUB_*"],
|
||||
"tasks": {
|
||||
// Prepare the package for all other tasks
|
||||
@@ -40,11 +41,16 @@
|
||||
// Start the package in development mode
|
||||
"dev": {
|
||||
"persistent": true,
|
||||
"cache": false
|
||||
"cache": false,
|
||||
"dependsOn": ["generate"]
|
||||
},
|
||||
// Script run when the package is deployed
|
||||
"release": {
|
||||
"dependsOn": ["^release", "build"]
|
||||
},
|
||||
// Clean up the package
|
||||
"clean": {
|
||||
"cache": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user