File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change 1- import { writeFile } from 'node:fs/promises'
21import cac from 'cac'
32import { resolveConfig } from '@/config.ts'
4- import { loaderToken } from '@/token.ts'
3+ import { loaderToken , setToken } from '@/token.ts'
54import { printWarning } from '@/utils.ts'
65import { name , version } from '../package.json'
76
@@ -27,7 +26,7 @@ cli.command('set <token>', 'Set the local release Token')
2726 . action ( async ( token : string = '' ) => {
2827 try {
2928 const config = await resolveConfig ( )
30- await writeFile ( config . tokenFile , `export default " ${ token } "` )
29+ await setToken ( config , token )
3130 }
3231 catch ( error : any ) {
3332 printWarning ( error . message )
Original file line number Diff line number Diff line change @@ -2,12 +2,12 @@ import type { IConfig } from '@/types'
22import { writeFile } from 'node:fs/promises'
33import { resolve } from 'node:path'
44import { createJiti } from 'jiti'
5- import { CACHE_FOLDER_NAME , CACHE_TOKEN_FILE_PATH } from '@/constant.ts'
5+ import { CACHE_FOLDER_NAME } from '@/constant.ts'
66import { createDir } from '@/utils.ts'
77
88export const setToken = async ( config : IConfig , token : string ) : Promise < void > => {
99 createDir ( resolve ( config . cwd , CACHE_FOLDER_NAME ) )
10- await writeFile ( resolve ( config . cwd , CACHE_TOKEN_FILE_PATH ) , `export default "${ token } "` )
10+ await writeFile ( config . tokenFile , `export default "${ token } "` )
1111}
1212
1313export const loaderToken = async ( config : IConfig ) : Promise < string > => {
You can’t perform that action at this time.
0 commit comments