Skip to content

Commit

Permalink
Add local testing and linking guide, fix esbuild module resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
fritx committed Jan 15, 2024
1 parent 3cf395b commit b8f0c5e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
38 changes: 35 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,38 @@ Please try to use the original style in the codebase. Do not introduce new rules
Nue is not using Prettier or ESLint because they will increase the project size to 40MB. The `.prettierrc.yaml` file on the root directory does the job well enough.





### Testing

```sh
# if using bun
bun install
bun install --no-save esbuild
bun test

# if using node
npm install
npm install --no-save jest jest-extended esbuild
node --experimental-vm-modules node_modules/jest/bin/jest --runInBand
```


### Linking

```sh
# if using bun
bun install
cd packages/nuekit
bun link
cd my/nue/project
nue
nue build --production

# if using node
npm install
cd packages/nuekit
npm link
cd my/nue/project
npm install --save-dev esbuild
node $(which nue)
node $(which nue) build --production
```
1 change: 1 addition & 0 deletions packages/nuekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"dependencies": {
"diff-dom": "^5.0.6",
"import-meta-resolve": "^4.0.0",
"js-yaml": "^4.1.0",
"nuejs-core": "^0.3.0",
"nuemark": "^0.1.0"
Expand Down
3 changes: 2 additions & 1 deletion packages/nuekit/src/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
/* Builders for CSS, JS, and TS */

import { join, extname } from 'node:path'
import { resolve } from 'import-meta-resolve'

export async function getBuilder(is_esbuild) {
try {
return is_esbuild ? await import('esbuild') : Bun
return is_esbuild ? await import(await resolve('esbuild', `file://${process.cwd()}/`)) : Bun
} catch {
throw 'Bundler not found. Please use Bun or install esbuild'
}
Expand Down

0 comments on commit b8f0c5e

Please sign in to comment.