Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
Merge pull request #22 from cm-dyoshikawa/rename-nise-line
Browse files Browse the repository at this point in the history
rename linely->niseline
  • Loading branch information
cm-dyoshikawa authored Jan 17, 2022
2 parents f0efa4c + 59ed6f2 commit bee2279
Showing 42 changed files with 93 additions and 70 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ jobs:

- run: npm ci

- run: npm run build -w client-sdk
- run: npm run build -w niseliff-sdk

- run: npm run check

@@ -35,6 +35,6 @@ jobs:
with:
context: .
push: false
tags: dyoshikawa/linely:${{ github.sha }}
tags: dyoshikawa/niseline:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ jobs:

- run: npm ci

- run: npm run build -w client-sdk
- run: npm run build -w niseliff-sdk

- run: npm run check

@@ -35,6 +35,6 @@ jobs:
with:
context: .
push: true
tags: dyoshikawa/linely:latest,dyoshikawa/linely:${{ github.sha }}
tags: dyoshikawa/niseline:latest,dyoshikawa/niseline:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Linely
# NiseLine

Linely is inspired by [LocalStack](https://github.com/localstack/localstack). Goal of this tool is to create a mock service for [LINE](https://line.me/ja/).
NiseLine is inspired by [LocalStack](https://github.com/localstack/localstack). Goal of this tool is to create a mock service for [LINE](https://line.me/ja/).

## Setup

### Docker

```bash
docker run -d -p 3000:3000 dyoshikawa/linely:latest
curl http://localhost:3000/linely/ping
docker run -d -p 3000:3000 dyoshikawa/niseline:latest
curl http://localhost:3000/niseline/ping
# => {"ping":"pong"}
```

@@ -18,23 +18,23 @@ curl http://localhost:3000/linely/ping
# docker-compose.yml
version: '3'
services:
linely:
image: dyoshikawa/linely:latest
niseline:
image: dyoshikawa/niseline:latest
ports:
- 3000:3000
```
```bash
docker compose up -d
curl http://localhost:3000/linely/ping
curl http://localhost:3000/niseline/ping
# => {"ping":"pong"}
```

## Usage

```bash
curl --request POST \
--url http://localhost:3000/linely/users \
--url http://localhost:3000/niseline/users \
--header 'content-type: application/json' \
--data '{"id": "FOO_ID","name": "Foo","picture": "http://example.com/foo.jpg","email": "foo@example.com"}'
# => null
10 changes: 5 additions & 5 deletions api.http
Original file line number Diff line number Diff line change
@@ -2,11 +2,11 @@

###

GET {{ BASE_URL }}/linely/ping
GET {{ BASE_URL }}/niseline/ping

###

POST {{ BASE_URL }}/linely/users
POST {{ BASE_URL }}/niseline/users
Content-Type: application/json

{
@@ -18,7 +18,7 @@ Content-Type: application/json

###

GET {{ BASE_URL }}/linely/users/me/_accessToken
GET {{ BASE_URL }}/niseline/users/me/_accessToken
Content-Type: application/json
Authorization: Bearer DEFAULT_USER_ACCESS_TOKEN

@@ -53,7 +53,7 @@ Authorization: Bearer DEFAULT_CHANNEL_ACCESS_TOKEN
"replyToken": "DEFAULT_USER",
"messages": [{
"type": "text",
"text": "Hello Linely!"
"text": "Hello NiseLine!"
}]
}

@@ -67,6 +67,6 @@ Authorization: Bearer DEFAULT_CHANNEL_ACCESS_TOKEN
"to": "DEFAULT_USER",
"messages": [{
"type": "text",
"text": "Hello Linely!"
"text": "Hello NiseLine!"
}]
}
9 changes: 7 additions & 2 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
{
"words": [
"fastify",
"linely",
"niseline",
"dyoshikawa",
"typec",
"esbuild",
"inversify",
"liff",
"outfile",
"formbody",
"camelcase"
"camelcase",
"niseline",
"niseliff",
"vite",
"vitejs",
"devcert"
]
}
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'

services:
linely:
image: dyoshikawa/linely:latest
niseline:
image: dyoshikawa/niseline:latest
ports:
- 3000:3000
60 changes: 38 additions & 22 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"name": "linely",
"name": "niseline",
"private": true,
"version": "0.0.0",
"description": "",
"main": "index.js",
"author": "dyoshikawa",
"license": "MIT",
"scripts": {
"build": "docker build -t dyoshikawa/linely:latest .",
"publish": "docker push dyoshikawa/linely:latest",
"build": "docker build -t dyoshikawa/niseline:latest .",
"publish": "docker push dyoshikawa/niseline:latest",
"format": "prettier --write .",
"format:check": "prettier -c .",
"lint:secret": "secretlint '**/*'",
"prepare": "husky install",
"postinstall": "npm run prepare",
"check": "npm run lint:secret && npm run format:check && npm run lint:js --workspaces && npm run typec --workspaces",
"start:client": "npm run build -w client-sdk && npm run start -w sample-client-app",
"start:client": "npm run build -w niseliff-sdk && npm run start -w sample-client-app",
"start:server": "npm run start -w server"
},
"devDependencies": {
2 changes: 1 addition & 1 deletion packages/e2e/src/messaging-api/send-push-message.test.ts
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ test('Send push message', async () => {
messages: [
{
type: 'text',
text: 'Hello Linely!',
text: 'Hello NiseLine!',
},
],
}),
2 changes: 1 addition & 1 deletion packages/e2e/src/messaging-api/send-reply-message.test.ts
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ test('Send reply message', async () => {
messages: [
{
type: 'text',
text: 'Hello Linely!',
text: 'Hello NiseLine!',
},
],
}),
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "client-sdk",
"name": "niseliff-sdk",
"version": "0.0.0",
"private": false,
"main": "dist/index.js",
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -24,15 +24,17 @@ export const buildInit =
logger.info('Exists tokens')

const fetchMeResult = await fetch(
new URL('/linely/users/me/_accessToken', authEndpoint).toString(),
new URL('/niseline/users/me/_accessToken', authEndpoint).toString(),
{
headers: {
Authorization: `Bearer ${accessToken}`,
},
}
)
if (!fetchMeResult.ok) {
logger.error('Invalid response from GET /linely/users/me/_accessToken')
logger.error(
'Invalid response from GET /niseline/users/me/_accessToken'
)
return
}

@@ -58,7 +60,7 @@ export const buildInit =

logger.info('Valid state value')
const result = await fetch(
new URL('/linely/token', authEndpoint).toString(),
new URL('/niseline/token', authEndpoint).toString(),
{
method: 'POST',
headers: {
@@ -72,7 +74,7 @@ export const buildInit =
}
)
if (!result.ok) {
logger.error('Invalid response from POST /linely/token')
logger.error('Invalid response from POST /niseline/token')
return
}

@@ -89,7 +91,7 @@ export const buildInit =
*/
const newState = uuidV4()
localStorage.setItem('STATE', newState)
const url = new URL('/linely/authorize', authEndpoint)
const url = new URL('/niseline/authorize', authEndpoint)
url.search = new URLSearchParams({
response_type: 'code',
client_id: config.liffId,
Loading

0 comments on commit bee2279

Please sign in to comment.