Skip to main content

Quick Start

Initialization

Switch mirror, can be ignored if already be OK
npm config set registry https://registry.npmmirror.com
Use yarn in the project
npm install yarn@1.19.1 -g
yarn install
Create a new project with the template
npm create alemonjs
cd alemonb
Development mode start
npx alemonjs dev --login "kook" --token "xxxx"

--login selects the KOOK platform.

--token is the token needed for KOOK login.

--input defaults to ./src/index.ts

Configuration

lemon.config.yaml
kook:
token: 'xxxx'
master_id:
- '123456'
- '654321'

Compile

npx alemonjs build

Output directory:lib

PM2

Installation

yarn add pm2 -D
alemon.config.yaml
pm2:
name: 'kook'
# Production mode, the entry can choose only to the bundled production file
script: 'alemonjs start --input ./lib/index.js --login kook'

Configuration

pm2.config.cjs

pm2.config.cjs
const fs = require('fs')
const yaml = require('yaml')
const data = fs.readFileSync('./alemon.config.yaml', 'utf8')
const config = yaml.parse(data)
const app = config?.pm2 ?? {}
/**
* @type {{ apps: import("pm2").StartOptions[] }}
*/
module.exports = {
apps: [
{
...app,
env: {
// Ensure it's in production environment
NODE_ENV: 'production',
...(app?.env ?? {})
}
}
]
}

Start

# start
npx pm2 startOrRestart pm2.config.cjs
# stop
npx pm2 stop pm2.config.cjs
# delete
npx pm2 delete pm2.config.cjs
# kill
npx pm2 kill
# logs
npx pm2 logs