create-flowbite
Advanced tools
+33
-15
| #! /usr/bin/env node | ||
| const fs = require("fs"); | ||
| const readline = require('readline').createInterface({ | ||
| input: process.stdin, | ||
| output: process.stdout | ||
| }); | ||
| // Check if the file tailwind.config.js exists | ||
@@ -7,14 +11,8 @@ if (!fs.existsSync("tailwind.config.js")) { | ||
| // Ask if the user wants to create the file | ||
| const readline = require('readline').createInterface({ | ||
| input: process.stdin, | ||
| output: process.stdout | ||
| }); | ||
| readline.question('Do you want to create the file? (y/n) ', async answer => { | ||
| if (answer == "y") { | ||
| await createTailwindConfig(); | ||
| console.log("tailwind.config.js created"); | ||
| updateTailwindConfig(); | ||
| } else { | ||
| console.log("tailwind.config.js not created"); | ||
| console.log("tailwind.config.js not created\nExiting..."); | ||
| process.exit(1); | ||
@@ -26,3 +24,3 @@ } | ||
| }else{ | ||
| } else { | ||
| updateTailwindConfig(); | ||
@@ -32,3 +30,14 @@ } | ||
| function createTailwindConfig() { | ||
| fs.writeFileSync("tailwind.config.js", "module.exports = {\n purge: {\n content: [\n './src/**/*.html',\n './src/**/*.js',\n ],\n options: {\n safelist: [],\n },\n },\n darkMode: false, // or 'media' or 'class'\n theme: {\n extend: {},\n },\n variants: {\n extend: {},\n },\n plugins: [],\n}", "utf8"); | ||
| const data = ` | ||
| /** @type {import('tailwindcss').Config} */ | ||
| module.exports = { | ||
| content: ["./src/**/*.{html,js}"], | ||
| theme: { | ||
| extend: {}, | ||
| }, | ||
| plugins: [], | ||
| } | ||
| `; | ||
| // Write the file | ||
| fs.writeFileSync("tailwind.config.js", data, "utf8"); | ||
| console.log("tailwind.config.js created"); | ||
@@ -48,3 +57,3 @@ } | ||
| if (!fs.existsSync("node_modules/flowbite")) { | ||
| console.log("Flowbite is not installed"); | ||
| console.log("Dependencies not installed"); | ||
| // Check if package.json exists | ||
@@ -55,9 +64,18 @@ if (!fs.existsSync("package.json")) { | ||
| } | ||
| console.log("Installing flowbite..."); | ||
| // Install flowbite | ||
| require("./run")("npm install flowbite"); | ||
| readline.question('Do you want to install the dependencies? (y/n) ', async answer => { | ||
| if (answer == "y") { | ||
| await require("./run")("npm install -D tailwindcss postcss autoprefixer flowbite"); | ||
| console.log("Dependencies installed"); | ||
| updateTailwindConfig(); | ||
| } else { | ||
| console.log("Flowbite not installed"); | ||
| process.exit(1); | ||
| } | ||
| readline.close(); | ||
| }); | ||
| } | ||
| var result = data.replace("plugins: [", "plugins: [\n require('flowbite'),"); | ||
| var result = result.replace("content: [", "content: [\n './node_modules/flowbite/**/*.js',"); | ||
| var result = data.replace("plugins: [", "plugins: [\n require('flowbite'),\n"); | ||
| var result = result.replace("content: [", "content: [\n './node_modules/flowbite/**/*.js',\n"); | ||
| fs.writeFileSync("tailwind.config.js", result, "utf8"); | ||
@@ -64,0 +82,0 @@ console.log("Flowbite plugin added to tailwind.config.js"); |
+1
-1
| { | ||
| "name": "create-flowbite", | ||
| "version": "0.0.1", | ||
| "version": "0.0.2", | ||
| "description": "Test to make a auto-install for flowbite", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
| # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | ||
| # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | ||
| name: Node.js Package | ||
| on: | ||
| push | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 16 | ||
| - run: npm ci | ||
| publish-npm: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 16 | ||
| registry-url: https://registry.npmjs.org/ | ||
| - run: npm ci | ||
| - run: npm publish | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{secrets.npm_token}} |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
81
26.56%3677
-14.92%3
-25%