Skip to content

Commit 3344471

Browse files
authored
Tate/npm (#180)
* switch to npm from yarn * update examples on precommit
1 parent c571802 commit 3344471

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+64073
-7057
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
- uses: actions/setup-node@v2
1414
with:
1515
node-version: "16.x"
16-
cache: "yarn"
17-
- run: yarn
18-
- run: yarn lint
19-
- run: yarn package:build
20-
- run: yarn test:ci && yarn codecov --token=$CODECOV_TOKEN
16+
cache: "npm"
17+
- run: npm install
18+
- run: npm run lint
19+
- run: npm run package:build
20+
- run: npm run test:ci && npx codecov --token=$CODECOV_TOKEN
2121
env:
2222
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
- uses: actions/setup-node@v2
1111
with:
1212
node-version: "16.x"
13-
cache: "yarn"
13+
cache: "npm"
1414
registry-url: "https://registry.npmjs.org"
15-
- run: yarn package:build
15+
- run: npm run package:build
1616
- run: cd dist && npm publish
1717
env:
1818
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
**/dist/*
22
!**/dist/index.html
3-
package-lock.json
43
todo.txt
5-
node_modules
64
coverage
5+
node_modules
6+
tsconfig.tsbuildinfo

.husky/pre-commit

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
33

4-
yarn lint:fix --staged
4+
npm run package:build
5+
npm run examples:regen
6+
npm run lint:fix

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ throw new TwirpError({ code: "code", msg: "msg" });
5555

5656
## v0.0.56
5757

58-
Users will need to `yarn twirpscript` to regenerate their `.pb.ts` / `.pb.js` files when adopting this version.
58+
Users will need to `npx twirpscript` to regenerate their `.pb.ts` / `.pb.js` files when adopting this version.
5959

6060
- The generated message serializer/deserializer objects have been split into two separate objects: one for JSON and one for Protobuf. This enables smaller client bundles when using a bundler that supports tree shaking / dead code elimination. Many users will be unaffected by this change, but this is a breaking change for users that use message encode/decode methods directly in their source code.
6161

@@ -234,7 +234,7 @@ Changes:
234234

235235
## v0.0.44
236236

237-
This version has breaking changes between the generated code and the runtime. Run `yarn twrispcript` to update your generated `.pb.ts` when updating to this version.
237+
This version has breaking changes between the generated code and the runtime. Run `npx twrispcript` to update your generated `.pb.ts` when updating to this version.
238238

239239
TwirpScript now ships with JSON serializers and supports the `json_name` option described [here](https://developers.google.com/protocol-buffers/docs/proto3#json). This enables clients to specify custom JSON field names.
240240

@@ -256,7 +256,7 @@ Changes:
256256
## v0.0.41
257257

258258
- Breaking Change: field names are now camelCased by @tatethurston in https://github.com/tatethurston/TwirpScript/pull/97.
259-
`yarn twirpscript` will regenerate your `.pb.ts` files with the correct casing. If you run into significant issues with this change or prefer snake_case, please open an issue.
259+
`npx twirpscript` will regenerate your `.pb.ts` files with the correct casing. If you run into significant issues with this change or prefer snake_case, please open an issue.
260260

261261
## v0.0.40
262262

@@ -305,7 +305,7 @@ Changes:
305305

306306
This release includes breaking changes:
307307

308-
1. The generated `.pb.ts` files have been restructured. You'll need to run `yarn twirpscript` to regenerate your `.pb.ts` files after updating.
308+
1. The generated `.pb.ts` files have been restructured. You'll need to run `npx twirpscript` to regenerate your `.pb.ts` files after updating.
309309
2. `context`'s `service` and `method` properties now point to generated objects instead of simply being strings (eg previously these were "Haberdasher" and "MakeHat" and now these properties point to generated objects. This enables more powerful runtime reflection, eg:
310310

311311
```

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ To learn more about the motivation behind Twirp (and a comparison to REST APIs a
9292
Or install from a [precompiled binary](https://github.com/protocolbuffers/protobuf/releases).
9393

9494
1. Add this package to your project:
95-
`yarn add twirpscript` or `npm install twirpscript`
95+
`npm install twirpscript` or `yarn add twirpscript`
9696

9797
## Getting Started
9898

9999
### Overview 📖
100100

101101
1. Define your service in a `.proto` file.
102-
2. Run `yarn twirpscript` to generate JavaScript or TypeScript code from your `.proto` file. This will generate JSON and Protobuf clients, a service interface, and service utilities.
102+
2. Run `npx twirpscript` to generate JavaScript or TypeScript code from your `.proto` file. This will generate JSON and Protobuf clients, a service interface, and service utilities.
103103
3. If you only need a client, you're done! Use the generated client to make requests to your server.
104104
4. Implement the generated service interface.
105105
5. Add your implemented service to your application server's routes.
@@ -132,11 +132,11 @@ message Hat {
132132
}
133133
```
134134

135-
#### 2. Run `yarn twirpscript`
135+
#### 2. Run `npx twirpscript`
136136

137137
This will generate `haberdasher.pb.ts` (or `haberdasher.pb.js` for JavaScript users) in the same directory as as `haberdasher.proto`. Any comments will become [TSDoc](https://github.com/microsoft/tsdoc) comments and will show inline in supported editors.
138138

139-
`yarn twirpscript` will compile all`.proto` files in your project.
139+
`npx twirpscript` will compile all`.proto` files in your project.
140140

141141
#### 3. Use the client
142142

examples/authentication/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
### Running Locally
66

7-
1. `yarn install`
8-
2. `yarn start`
7+
1. `npm install`
8+
2. `npm start`

0 commit comments

Comments
 (0)