Skip to content

Commit 09c61db

Browse files
authored
Support CJS again (line#797)
We will also support CJS to make it a dual package. It seems that for Typescript, it needs to be version 5.3 or higher. Additionally, I have introduced two validators for the dual package. 1. publint https://publint.dev/ 2. arethetypeswrong https://arethetypeswrong.github.io/
1 parent c99f1d9 commit 09c61db

File tree

12 files changed

+2210
-4676
lines changed

12 files changed

+2210
-4676
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
run: export NODE_OPTIONS=--openssl-legacy-provider; npm run docs:build
4949
- name: Test building examples (CJS)
5050
run: |
51-
cd examples/echo-bot-ts
51+
cd examples/echo-bot-ts-cjs
5252
npm run build-sdk
5353
npm install
5454
npm run build
@@ -60,3 +60,7 @@ jobs:
6060
npm install
6161
npm run build
6262
cd -
63+
- name: publint
64+
run: npx publint
65+
- name: validate package
66+
run: npx @arethetypeswrong/cli $(npm pack)

examples/echo-bot-ts/README.md renamed to examples/echo-bot-ts-cjs/README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
# LINE Echo Bot with TypeScript
1+
# Echo Bot for LINE using TypeScript and CJS
22

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

57
## Prerequisite
68

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

1113
## Installation
1214

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

2123
```bash
22-
cd line-bot-sdk-nodejs/examples/echo-bot-ts
24+
cd line-bot-sdk-nodejs/examples/echo-bot-ts-cjs
2325
```
2426

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

46-
- Compile the TypeScript files.
48+
- Build the application.
4749

4850
```bash
4951
npm run build
File renamed without changes.

examples/echo-bot-ts/index.ts renamed to examples/echo-bot-ts-cjs/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const clientConfig: ClientConfig = {
1616
};
1717

1818
const middlewareConfig: MiddlewareConfig = {
19-
channelAccessToken: process.env.CHANNEL_ACCESS_TOKEN,
2019
channelSecret: process.env.CHANNEL_SECRET || '',
2120
};
2221

0 commit comments

Comments
 (0)