fixed npm global install
This commit is contained in:
parent
894228d189
commit
7e58b4e703
3 changed files with 11 additions and 8 deletions
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env node
|
||||
import fs from 'fs'
|
||||
import { Encoder } from "../lib/encoder.js"
|
||||
import { UI } from "../lib/ui.js"
|
||||
|
@ -6,8 +7,10 @@ import { SettingsManager } from "../lib/settingsManager.js"
|
|||
import path from "path"
|
||||
//get settings
|
||||
let settings = new SettingsManager()
|
||||
await settings.start()
|
||||
|
||||
getSettings()
|
||||
async function getSettings() {
|
||||
await settings.start()
|
||||
}
|
||||
let term = termkit.terminal
|
||||
const ui = new UI(settings.settings, settings.currentSetting)
|
||||
|
||||
|
@ -26,7 +29,6 @@ if (!inputList[0]) {
|
|||
let filePaths = [], fileNames = [], fileTypes = []
|
||||
let presetIndexArg = undefined
|
||||
//if preset argument go through list from 2 and add argument
|
||||
console.log(inputList)
|
||||
if (inputList[0] == "-preset") {
|
||||
presetIndexArg = inputList[1]
|
||||
|
||||
|
|
|
@ -18,14 +18,15 @@ export class SettingsManager {
|
|||
settings = await this.#getSettings().catch(async (err) => {
|
||||
settings = undefined
|
||||
})
|
||||
//console.log(settings)
|
||||
if (!settings) settings = await this.#makeNewSettingsFile()
|
||||
this.settings = JSON.parse(settings.toString())
|
||||
this.currentSetting = this.settings.presets[this.settings.currentSetting]
|
||||
}
|
||||
async #getSettings() {
|
||||
const dir = __dirname
|
||||
console.log(dir)
|
||||
return new Promise((resolve, reject) => {
|
||||
const getSettings = fs.readFile(path.resolve(__dirname, "settings.json"), (err, data) => {
|
||||
const getSettings = fs.readFile(path.resolve(dir, "settings.json"), (err, data) => {
|
||||
if (err) reject(err)
|
||||
resolve(data)
|
||||
})
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
"description": "helps free discord users to send any media(image, video, audio) and not get limited by discords 8mb file limit",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
"DMC": "node bin/index.js"
|
||||
"DMC": "bin/index.js"
|
||||
},
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "node bin/index.js",
|
||||
"build": "pkg .",
|
||||
"build": "pkg . --output dist --debug",
|
||||
"test": "node fieldTest.cjs"
|
||||
},
|
||||
"keywords": [
|
||||
|
@ -28,7 +28,7 @@
|
|||
"terminal-kit": "^2.4.0"
|
||||
},
|
||||
"pkg": {
|
||||
"scripts": "index.js",
|
||||
"scripts": "bin/index.js",
|
||||
"targets": [
|
||||
"latest-win-x64"
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue