* Deploy the project to a file store used for iife distribution. This is a * feature deprecated by the cdn.formk.it content delivery network. * @param {string} version
(version)
| 208 | * @param {string} version |
| 209 | */ |
| 210 | async function deployIIFE(version) { |
| 211 | const dir = await mkdtemp(path.join(os.tmpdir(), 'formkit-')) |
| 212 | glob('packages/*/dist/formkit-*.js', (err, matches) => { |
| 213 | matches.forEach((file) => { |
| 214 | const dest = `${dir}/${path.parse(file).name}.js` |
| 215 | copyFile(file, dest) |
| 216 | }) |
| 217 | }) |
| 218 | glob('packages/themes/dist/*/*.css', (err, matches) => { |
| 219 | matches.forEach((file) => { |
| 220 | const theme = path.parse(file).dir.split('/').pop() |
| 221 | const alreadyExists = existsSync(`${dir}/${theme}`) |
| 222 | if (!alreadyExists) { |
| 223 | mkdir(`${dir}/${theme}`, { recursive: true }, (err) => { |
| 224 | if (err) { |
| 225 | console.error(err) |
| 226 | } |
| 227 | }) |
| 228 | } |
| 229 | const dest = `${dir}/${theme}/${path.parse(file).name}.css` |
| 230 | copyFile(file, dest) |
| 231 | }) |
| 232 | }) |
| 233 | const output = await execa('rsync', [ |
| 234 | '-avz', |
| 235 | dir + '/', |
| 236 | '-e ssh', |
| 237 | `root@159.203.159.68:/var/www/vhosts/assets.wearebraid.com/formkit/unpkg${ |
| 238 | version ? '/' + version : '' |
| 239 | }`, |
| 240 | '--chmod=Do+rwx', |
| 241 | ]) |
| 242 | if (output.exitCode) { |
| 243 | console.error(output) |
| 244 | } else { |
| 245 | console.log('Successfully deployed') |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | export default function () { |
| 250 | const cli = cac() |