refactor json parser to json5

This commit is contained in:
bossgeekgo
2024-02-11 23:51:47 +08:00
parent 36bc5a9cdd
commit 9eb6d4c3f2
2 changed files with 5 additions and 3 deletions
@@ -9,10 +9,11 @@ import {
import fs from 'node:fs' import fs from 'node:fs'
import { get__dirname } from '@bossgeekgo/utils/legacy-path.mjs'; import { get__dirname } from '@bossgeekgo/utils/legacy-path.mjs';
import path from 'node:path'; import path from 'node:path';
import JSON5 from 'json5'
puppeteer.use(StealthPlugin()) puppeteer.use(StealthPlugin())
const { cookies: bossCookies } = JSON.parse( const { cookies: bossCookies } = JSON5.parse(
fs.readFileSync( fs.readFileSync(
path.join( path.join(
get__dirname(), get__dirname(),
@@ -21,7 +22,7 @@ const { cookies: bossCookies } = JSON.parse(
) )
) )
const targetCompanyList = JSON.parse( const targetCompanyList = JSON5.parse(
fs.readFileSync( fs.readFileSync(
path.join( path.join(
get__dirname(), get__dirname(),
@@ -7,8 +7,9 @@ import {
import fs from 'node:fs' import fs from 'node:fs'
import path from 'node:path' import path from 'node:path'
import { get__dirname } from '@bossgeekgo/utils/legacy-path.mjs'; import { get__dirname } from '@bossgeekgo/utils/legacy-path.mjs';
import JSON5 from 'json5'
const { groupRobotAccessToken: dingTalkAccessToken } = JSON.parse( const { groupRobotAccessToken: dingTalkAccessToken } = JSON5.parse(
fs.readFileSync( fs.readFileSync(
path.join( path.join(
get__dirname(), get__dirname(),