Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CJS again #797

Merged
merged 11 commits into from
Apr 2, 2024
Merged
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
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
run: export NODE_OPTIONS=--openssl-legacy-provider; npm run docs:build
- name: Test building examples (CJS)
run: |
cd examples/echo-bot-ts
cd examples/echo-bot-ts-cjs
npm run build-sdk
npm install
npm run build
Expand All @@ -60,3 +60,7 @@ jobs:
npm install
npm run build
cd -
- name: publint
run: npx publint
- name: validate package
run: npx @arethetypeswrong/cli $(npm pack)
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# LINE Echo Bot with TypeScript
# Echo Bot for LINE using TypeScript and CJS

An example LINE bot to echo message with TypeScript. The bot is coded according to TypeScript's best practices.
Welcome to this simple guide on how to create an Echo Bot for the LINE messaging platform using TypeScript and CommonJS (CJS).
An Echo Bot is a basic bot that replies to a user's message with the same content.
This tutorial will help you set up a LINE Echo Bot from scratch.

## Prerequisite

- Git
- Node.js version 10 and up
- LINE Developers Account for the bot
- Node.js version 18 or higher
- You've created a channel in the LINE Developers Console, and got your channel access token and channel secret.
- Read https://developers.line.biz/en/docs/messaging-api/getting-started/#using-console if you haven't done this yet.

## Installation

Expand All @@ -19,7 +21,7 @@ git clone https://github.com/line/line-bot-sdk-nodejs.git
- Change directory to the example.

```bash
cd line-bot-sdk-nodejs/examples/echo-bot-ts
cd line-bot-sdk-nodejs/examples/echo-bot-ts-cjs
```

- Install all dependencies.
Expand All @@ -43,7 +45,7 @@ export PORT=<YOUR_PORT>
https://example.com/callback
```

- Compile the TypeScript files.
- Build the application.

```bash
npm run build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const clientConfig: ClientConfig = {
};

const middlewareConfig: MiddlewareConfig = {
channelAccessToken: process.env.CHANNEL_ACCESS_TOKEN,
channelSecret: process.env.CHANNEL_SECRET || '',
};

Expand Down
Loading