From a79c78a7091409bd2b436f968942a22ffcd6cd52 Mon Sep 17 00:00:00 2001 From: khoilen Date: Wed, 18 Dec 2024 14:37:28 +0700 Subject: [PATCH] feat: add hashbang to bin script --- apps/nt-stylesheet/bin/init-tailwind.js | 41 +++++++++++-------------- apps/nt-stylesheet/package.json | 2 +- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/apps/nt-stylesheet/bin/init-tailwind.js b/apps/nt-stylesheet/bin/init-tailwind.js index 77480bc..fb51e9e 100644 --- a/apps/nt-stylesheet/bin/init-tailwind.js +++ b/apps/nt-stylesheet/bin/init-tailwind.js @@ -1,9 +1,8 @@ +#!/usr/bin/env node + import fs from 'fs' import readline from 'readline' -// Check if running in an interactive environment -const isInteractive = process.stdout.isTTY - const createTailwindConfig = () => { const tailwindConfigContent = `/** @type {import('tailwindcss').Config} */ const ntTheme = require('nt-stylesheet/dist/theme.cjs'); @@ -60,24 +59,20 @@ const createPostCSSConfig = () => { ) } -if (isInteractive) { - const rl = readline.createInterface({ - input: process.stdin, - output: process.stdout, - }) +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, +}) - rl.question( - 'Do you want to initialize Tailwind CSS? (y/n) ', - (answer) => { - if (answer.toLowerCase() === 'y') { - createTailwindConfig() - createPostCSSConfig() - } else { - console.log('Tailwind CSS initialization skipped.') - } - rl.close() - }, - ) -} else { - console.log('Non-interactive mode detected.') -} +rl.question( + 'Do you want to initialize Tailwind CSS? (y/n) ', + (answer) => { + if (answer.toLowerCase() === 'y') { + createTailwindConfig() + createPostCSSConfig() + } else { + console.log('Tailwind CSS initialization skipped.') + } + rl.close() + }, +) diff --git a/apps/nt-stylesheet/package.json b/apps/nt-stylesheet/package.json index 9f0dcac..c1d60b5 100644 --- a/apps/nt-stylesheet/package.json +++ b/apps/nt-stylesheet/package.json @@ -1,6 +1,6 @@ { "name": "nt-stylesheet", - "version": "1.1.6", + "version": "1.1.7", "description": "", "packageManager": "pnpm@9.0.5", "scripts": {