Skip to content

Commit

Permalink
Merge pull request #1855 from SUI-Components/allow-custom-base
Browse files Browse the repository at this point in the history
feat(packages/sui-svg): allow setting custom base path for svg icons build (vite)
  • Loading branch information
kikoruiz authored Oct 23, 2024
2 parents df7d92e + b00b1f7 commit baa0ed1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/sui-svg/bin/sui-svg-dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,33 @@
import {resolve} from 'path'

import {build} from 'vite'
import program from 'commander'

const {pathname: root} = new URL('../src', import.meta.url)

const outDir = resolve(process.cwd(), './public')
const icons = resolve(process.cwd(), 'lib', '_demo.js')

const DEFAULT_BASE = '/'

console.log('[sui-svg] Preparing build with icons...')

program
.option('-b, --base [path]', 'Base public path')
.on('--help', () => {
console.log(' Examples:')
console.log('')
console.log(' $ sui-svg dist')
console.log(' $ sui-svg dist --base /my/abslotute/public/path')
console.log(' $ sui-svg dist --base https://my.full.url/public/path')
console.log('')
})
.parse(process.argv)

const {base = DEFAULT_BASE} = program.opts()

await build({
base,
root,
optimizeDeps: {
include: ['classnames', 'prop-types', 'react', 'react/jsx-runtime', 'react-dom']
Expand Down

0 comments on commit baa0ed1

Please sign in to comment.