修复不存在农历的年份, 渲染异常的bug

master
yutent 2024-12-10 17:44:50 +08:00
parent bc55309c1a
commit 9df56f60c8
5 changed files with 19 additions and 11 deletions

View File

@ -1,5 +1,7 @@
const esbuild = require('esbuild')
const { version } = require('./package.json')
import esbuild from 'esbuild'
import pkg from './package.json' assert { type: 'json' }
const { version } = pkg
esbuild.build({
entryPoints: ['src/index.js'],

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
{
"name": "bash-calendar",
"description": "终端版万年历",
"version": "1.2.6",
"version": "1.2.7",
"author": "yutent <yutent.io@gmail.com>",
"bin": {
"calendar": "index.js",

View File

@ -220,8 +220,11 @@ function drawTbody(year, month) {
: tmp.weekend
? chalk.redBright(tmp.lunar)
: chalk.grey(tmp.lunar)
//
tr += ' '.repeat(pad + 2) + tmp.lunar + ' '.repeat(pad + 2) + VLINE
} else {
tr += ' '.repeat(pad * 2) + VLINE
}
tr += ' '.repeat(pad + 2) + tmp.lunar + ' '.repeat(pad + 2) + VLINE
}
break
}

View File

@ -11,10 +11,10 @@ import chalk from 'chalk'
import { CACHE_FILE } from './lunar/config.js'
import { getThisYearMonth, drawCalendar } from './calendar.js'
var version = process.env.APP_VERSION
var argvs = process.argv.slice(2)
var action = argvs.shift()
var [year, month] = getThisYearMonth()
const version = process.env.APP_VERSION
const argvs = process.argv.slice(2)
let action = argvs.shift()
let [year, month] = getThisYearMonth()
function drawOneYear(y) {
for (let i = 0; i < 12; i++) {