From 1bfb46a2663e4e9da5cc9d367e83c0e0a89d18ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Lenon?= Date: Thu, 12 May 2022 14:12:17 -0300 Subject: [PATCH] fix(cli): set node executable and dirname --- package.json | 5 +---- src/index.js | 8 +++++++- 2 files changed, 8 insertions(+), 5 deletions(-) mode change 100644 => 100755 src/index.js diff --git a/package.json b/package.json index 108eeb4..563804e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/cli", - "version": "1.0.6", + "version": "1.0.7", "description": "Athenna CLI to create new projects and install components.", "license": "MIT", "author": "João Lenon ", @@ -34,9 +34,6 @@ "type": "module", "main": "./src/index.js", "types": "./src/index.d.ts", - "exports": { - ".": "./src/index.js" - }, "imports": { "#src/*": "./src/*.js", "#tests/*": "./tests/*.js" diff --git a/src/index.js b/src/index.js old mode 100644 new mode 100755 index 8ff3dc5..a6dc6ed --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,5 @@ +#!/usr/bin/env node + /** * @athenna/cli * @@ -11,11 +13,14 @@ import figlet from 'figlet' import chalkRainbow from 'chalk-rainbow' import { Command } from 'commander' -import { resolve } from 'node:path' +import { fileURLToPath } from 'node:url' +import { resolve, dirname } from 'node:path' import { Config, File, Path } from '@secjs/utils' import { New } from '#src/Commands/New' +const __dirname = dirname(fileURLToPath(import.meta.url)) + export class Cli { /** * The path where the cli were called. @@ -61,6 +66,7 @@ export class Cli { * @return {Promise} */ async main() { + console.log('hello') await new Config().safeLoad(Path.config('logging.js')) const newCommand = new New(this.#callPath)