Skip to content

Commit

Permalink
fixed build issues (#229)
Browse files Browse the repository at this point in the history
* fixed build issues

* version bump
  • Loading branch information
dayhaysoos authored Aug 22, 2021
1 parent c17cb0d commit 5c9b781
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion use-shopping-cart/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "use-shopping-cart",
"version": "3.0.1",
"version": "3.0.2",
"description": "Shopping cart state and logic for Stripe",
"author": "dayhaysoos",
"license": "MIT",
Expand Down
27 changes: 26 additions & 1 deletion use-shopping-cart/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import replace from '@rollup/plugin-replace'
import externals from 'rollup-plugin-node-externals'
import visualizer from 'rollup-plugin-visualizer'

import { promises as fs } from 'fs'
import { promises as fs, existsSync } from 'fs'

import path from 'path'

import pkg from './package.json'
Expand Down Expand Up @@ -42,6 +43,23 @@ function copyTypes() {
)
console.error(error)
}

try {
await fs.copyFile(
path.join(process.cwd(), 'core', 'index.d.ts'),
path.join(process.cwd(), 'dist', 'index.d.ts')
)
} catch (error) {
console.log(
`Unable to copy ${path.join(
process.cwd(),
'core',
'index.d.ts'
)} ${path.join(process.cwd(), 'dist', 'index.d.ts')}`
)

console.error(error)
}
}
}
}
Expand All @@ -60,6 +78,13 @@ function clearDist() {
if (cleared) return
cleared = true

if (existsSync(path.resolve('dist'))) {
console.log('dist folder exists')
} else {
console.log('dist folder unavailable, creating one...')
fs.mkdir('dist')
}

try {
await fs.rm(path.resolve('dist'), { recursive: true })
await fs.mkdir(path.resolve('dist'))
Expand Down

0 comments on commit 5c9b781

Please sign in to comment.