Skip to content

Commit

Permalink
fix: Binary path
Browse files Browse the repository at this point in the history
  • Loading branch information
unlight committed Jul 29, 2022
1 parent f3f1e21 commit 8b2bd48
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Taskfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ build_pkgroll() {
# https://esbuild.github.io/api/#target
npx pkgroll --target=es2020
cp -f README.md dist
cp src/bin.cjs ./dist
rm dist/cli.mjs
cat package.json | jq '.main = "./index.cjs"' |
jq '.module = "./index.mjs"' |
jq '.types = "./index.d.ts"' |
jq '.bin = "./cli.mjs"' |
jq '.bin = "./bin.cjs"' |
jq '.exports.".".import = "./index.mjs"' |
jq '.exports.".".require = "./index.cjs"' \
>dist/package.json
rm dist/cli.cjs
set +x
}

Expand Down
9 changes: 9 additions & 0 deletions packages/wireit-package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ npm install --save-dev wireit-package
npx wireit-package update --command "npm run build" --name "build"
```

Result:

```json
"wireit": {
"build": {
Expand All @@ -25,6 +27,13 @@ npx wireit-package update --command "npm run build" --name "build"
}
```

## Development

```sh
npm run -w wireit-package test:w
npm run -w wireit-package build
```

## License

MIT License, Copyright (c) 2022
4 changes: 2 additions & 2 deletions packages/wireit-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"wireit",
"workspace"
],
"bin": "./dist/cli.mjs",
"bin": "./dist/cli.cjs",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
Expand All @@ -20,7 +20,7 @@
"scripts": {
"test": "npm run eslint && npm run tscheck && npm run test:cov",
"test:r": "npm run mocha -- src/**/*.spec.ts",
"test:cov": "c8 --reporter text --exclude \"**/*.spec.ts\" --exclude \"**/testing/**\" npm run test:r -- --no-timeouts",
"test:cov": "c8 --reporter text --exclude \"**/*.spec.ts\" --exclude \"**/testing/**\" npm run test:r -- --no-timeouts",
"test:w": "npm run test:r -- --watch-files src --watch",
"lint": "npm run eslint && npm run tscheck",
"eslint": "eslint \"src/**/*.{ts,tsx}\"",
Expand Down
2 changes: 2 additions & 0 deletions packages/wireit-package/src/bin.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env node
require('./cli.cjs');
1 change: 1 addition & 0 deletions packages/wireit-package/src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,6 @@ describe('update command', () => {
const { wireit } = JSON.parse(b);

expect(wireit.build.command).toBe('npm run build');
expect(wireit.build.dependencies).toEqual(['../a:build']);
});
});

0 comments on commit 8b2bd48

Please sign in to comment.