Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 2 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,8 @@ jobs:
- name: Generate code
run: |
python3 generate-code.py
- name: Test Project
run: export NODE_OPTIONS=--max-old-space-size=6144; npm test
- name: Test building apidocs
run: export NODE_OPTIONS=--openssl-legacy-provider; npm run apidocs
- name: Test building docs
run: export NODE_OPTIONS=--openssl-legacy-provider; npm run docs:build
- name: Test building examples (CJS)
run: |
cd examples/echo-bot-ts-cjs
npm run build-sdk
npm install
npm run build
cd -
- name: Test building examples (ESM)
run: |
cd examples/echo-bot-ts-esm
npm run build-sdk
npm install
npm run build
cd -
- name: publint
run: npm run check:publint
- name: validate package
run: npm run check:attw
- name: Run all checks
run: npm run checkAll

pinact:
runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ Especially for bug fixes, please follow this flow for testing and development:

### Run your code in your local

You can use the example projects to test your changes locally before submitting a pull request.
You can use the example projects under `examples/` to test your changes locally before submitting a pull request.
See each example's README for instructions.

### Run CI tasks in your local

Expand All @@ -57,6 +58,7 @@ The following npm scripts are available for development:
* `npm run test`: Run test suites using Vitest.
* `npm run format`: Format source code with [Prettier](https://github.com/prettier/prettier).
* `npm run build`: Build TypeScript code into JavaScript. The built files will be placed in `dist/`.
* `npm run checkAll`: Run the full set of checks executed in CI.

We test, lint and build on CI, but it is always nice to check them before uploading a pull request.
For details on the commands executed in the CI, please refer to `.github/workflows/test.yml`.
Expand Down
13 changes: 12 additions & 1 deletion examples/echo-bot-esm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ An example LINE bot just to echo messages written in ES modules.
### Install deps

``` shell
$ npm build-sdk
$ npm install
```

Expand All @@ -30,3 +29,15 @@ $ node .
```
https://your.base.url/callback
```

## Using a local build of `@line/bot-sdk`

When developing the SDK in this repository, run `npm run build-sdk` after `npm install` to test the example
against your unreleased local SDK changes instead of the published package from npm:

``` shell
$ npm install
$ npm run build-sdk
```

Without `build-sdk`, the published package from npm is used.
65 changes: 30 additions & 35 deletions examples/echo-bot-esm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/echo-bot-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"description": "An example LINE bot just to echo messages written in ES modules",
"main": "index.js",
"scripts": {
"build-sdk": "cd ../../ && npm install && npm run build",
"build-sdk": "npm --prefix ../.. run build && npm install --no-save --package-lock=false @line/bot-sdk@file:../..",
"start": "node ."
},
"dependencies": {
"@line/bot-sdk": "../../",
"@line/bot-sdk": "^11.0.1",
"express": "^4.17.3"
},
"type": "module"
Expand Down
12 changes: 11 additions & 1 deletion examples/echo-bot-ts-cjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ cd line-bot-sdk-nodejs/examples/echo-bot-ts-cjs
- Install all dependencies.

```bash
npm run build-sdk
npm install
```

Expand Down Expand Up @@ -57,3 +56,14 @@ npm run build
npm start
```

## Using a local build of `@line/bot-sdk`

When developing the SDK in this repository, run `npm run build-sdk` after `npm install` to test the example
against your unreleased local SDK changes instead of the published package from npm:

```bash
npm install
npm run build-sdk
```

Without `build-sdk`, the published package from npm is used.
91 changes: 43 additions & 48 deletions examples/echo-bot-ts-cjs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/echo-bot-ts-cjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"scripts": {
"clean": "rimraf ./dist",
"build": "npm run clean && tsc",
"build-sdk": "cd ../../ && npm install && npm run build",
"build-sdk": "npm --prefix ../.. run build && npm install --no-save --package-lock=false @line/bot-sdk@file:../..",
"start": "node dist/index.js"
},
"dependencies": {
"@line/bot-sdk": "../../",
"@line/bot-sdk": "^11.0.1",
"express": "^4.18.2"
},
"devDependencies": {
Expand Down
Loading