修复不存在农历的年份, 渲染异常的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') import esbuild from 'esbuild'
const { version } = require('./package.json') import pkg from './package.json' assert { type: 'json' }
const { version } = pkg
esbuild.build({ esbuild.build({
entryPoints: ['src/index.js'], entryPoints: ['src/index.js'],

File diff suppressed because one or more lines are too long

View File

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

View File

@ -220,8 +220,11 @@ function drawTbody(year, month) {
: tmp.weekend : tmp.weekend
? chalk.redBright(tmp.lunar) ? chalk.redBright(tmp.lunar)
: chalk.grey(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 break
} }

View File

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