Skip to content

Commit

Permalink
Fix: Get Args
Browse files Browse the repository at this point in the history
  • Loading branch information
edelciomolina committed Dec 6, 2023
1 parent 350df01 commit 799d292
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,17 @@ const minify = require('./lib/minify.js')
const clean = require('./lib/clean.js')

const args = process.argv.slice(2)
const workingDirectoryIndex = args.indexOf('--working-directory')
const bundleConfigFolderIndex = args.indexOf('--bundle-config-folder')
const createBundleConfigIndex = args.indexOf('--create-bundle-config')
const searchExtensionsIndex = args.indexOf('--search-extensions')
const deleteInputFilesIndex = args.indexOf('--delete-input-files')

core.info(`✅ Input Parameters`)
core.info(` - bundle_config_folder: ${bundleConfigFolderIndex}`)
core.info(` - create_bundle_config: ${createBundleConfigIndex}`)
core.info(` - search_extensions: ${searchExtensionsIndex}`)
core.info(` - delete_input_files: ${deleteInputFilesIndex}`)

const working_directory = workingDirectoryIndex || './'
const bundle_config_folder = bundleConfigFolderIndex || './test'
const search_extensions = ('.' + (searchExtensionsIndex || 'js|css|html').split('|').join(',.')).split(',')
const delete_input_files = (deleteInputFilesIndex || 'true') === 'true'
const create_bundle_config = (createBundleConfigIndex || 'true') === 'true'
const workingDirectory = args[args.indexOf('--working-directory') + 1]
const bundleConfigFolder = args[args.indexOf('--bundle-config-folder') + 1]
const createBundleConfig = args[args.indexOf('--create-bundle-config') + 1]
const searchExtensions = args[args.indexOf('--search-extensions') + 1]
const deleteInputFiles = args[args.indexOf('--delete-input-files') + 1]

const working_directory = workingDirectory || './'
const bundle_config_folder = bundleConfigFolder || './test'
const search_extensions = ('.' + (searchExtensions || 'js|css|html').split('|').join(',.')).split(',')
const delete_input_files = (deleteInputFiles || 'true') === 'true'
const create_bundle_config = (createBundleConfig || 'true') === 'true'

try {
core.info(`✅ You are here "${process.cwd()}"`)
Expand Down

0 comments on commit 799d292

Please sign in to comment.