Skip to content

Commit

Permalink
chore: pnpm format
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentfrochot committed Dec 9, 2024
1 parent 367a906 commit 6e5edb6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand All @@ -121,22 +124,30 @@ pnpm run format
```

### Watch chessground changes from another project:

In other project:

- declare the link towards chessground (from project's `package.json`)

```json
"dependencies": {
...
"chessground": "link:/path/to/chessground",
...
}
```

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
```
```
28 changes: 15 additions & 13 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
}
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`);
}

0 comments on commit 6e5edb6

Please sign in to comment.