From 6e5edb61e80b2fe57bb28cb6c2ccd7df0c0f1550 Mon Sep 17 00:00:00 2001 From: Vincent FROCHOT Date: Tue, 10 Dec 2024 00:43:23 +0100 Subject: [PATCH] chore: pnpm format --- README.md | 15 +++++++++++++-- build.js | 28 +++++++++++++++------------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index c99fe38..b0a3f4d 100644 --- a/README.md +++ b/README.md @@ -92,16 +92,19 @@ Commands are listed in package.json. In case you want to see the possibilities from the console, run `pnpm run` ### Install build dependencies:s + ```sh pnpm install ``` ### Update deps: + ```sh rm -rf node_modules pnpm-lock.yaml && pnpm store prune && pnpm install ``` ### Build the node module: + ```sh pnpm prepare --watch ``` @@ -121,8 +124,11 @@ pnpm run format ``` ### Watch chessground changes from another project: + In other project: + - declare the link towards chessground (from project's `package.json`) + ```json "dependencies": { ... @@ -130,13 +136,18 @@ In other project: ... } ``` + In chessground: -- create `.env.local` file based on .env.local.default + +- create `.env.local` file based on .env.local.default - link back: + ```sh pnpm run link ``` + - trigger compilation and generate minified file: + ```sh pnpm run local-dist -``` \ No newline at end of file +``` diff --git a/build.js b/build.js index cd97e10..05b1c8f 100644 --- a/build.js +++ b/build.js @@ -7,23 +7,25 @@ const cyan = '\x1b[36m%s\x1b[0m'; const linkedProject = process.env.LINKED_PROJECT_PATH; if (!linkedProject) { - console.error(red, 'LINKED_PROJECT not set'); - process.exit(1); + console.error(red, 'LINKED_PROJECT not set'); + process.exit(1); } const args = process.argv.slice(2); - -if(args.length === 0) { - console.error(red, 'No arguments provided'); - process.exit(1); +if (args.length === 0) { + console.error(red, 'No arguments provided'); + process.exit(1); } -if(args.includes('--link')) { - cps.execSync(`pnpm link --dir ${linkedProject}`, { stdio: 'inherit' }); - console.log(cyan, `ready to be linked from ${linkedProject}.`); +if (args.includes('--link')) { + cps.execSync(`pnpm link --dir ${linkedProject}`, { stdio: 'inherit' }); + console.log(cyan, `ready to be linked from ${linkedProject}.`); } -if(args.includes('--bundle')) { - cps.execSync(`esbuild src/chessground.ts --bundle --format=esm --outfile=${linkedProject}/node_modules/chessground/dist/chessground.min.js`, { stdio: 'inherit' }); - console.log(green, `compiled and built ${linkedProject}/node_modules/chessground/dist/chessground.min.js`); -} \ No newline at end of file +if (args.includes('--bundle')) { + cps.execSync( + `esbuild src/chessground.ts --bundle --format=esm --outfile=${linkedProject}/node_modules/chessground/dist/chessground.min.js`, + { stdio: 'inherit' }, + ); + console.log(green, `compiled and built ${linkedProject}/node_modules/chessground/dist/chessground.min.js`); +}