diff --git a/package.json b/package.json index 0cd0832d..79ef5fd6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@boomerang-io/carbon-addons-boomerang-react", "description": "Carbon Addons for Boomerang apps", - "version": "2.0.1", + "version": "2.0.2", "author": { "name": "Tim Bula", "email": "timrbula@gmail.com" @@ -70,8 +70,8 @@ "window-or-global": "1.0.1" }, "peerDependencies": { - "axios": ">=0.26.0", "@carbon/icons-react": "^10.38.0", + "axios": ">=0.26.0", "carbon-components": "^10.25.0", "carbon-components-react": "^7.25.0", "carbon-icons": "^7.0.7", @@ -121,6 +121,7 @@ "carbon-components": "^10.54.0", "carbon-components-react": "^7.54.0", "carbon-icons": "^7.0.7", + "cpy": "^8.0.0", "cross-env": "^7.0.3", "formik": "^2.2.9", "in-publish": "^2.0.1", diff --git a/scripts/build.js b/scripts/build.js index 06a13003..afa5c56f 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -1,8 +1,8 @@ -'use strict'; - +const cpy = require('cpy'); +const path = require('path'); +const which = require('npm-which')(__dirname); const { execSync } = require('child_process'); const { inInstall } = require('in-publish'); -const which = require('npm-which')(__dirname); if (inInstall()) { process.exit(0); @@ -18,16 +18,24 @@ const exec = (command, extraEnv) => const ignoreGlobs = ['**/*.spec.js', '**/*.stories.js'].join(','); -try { - exec(`${babelPath} src --quiet -d es --ignore "${ignoreGlobs}"`, { - BABEL_ENV: 'es', - }); - exec(`${babelPath} src --quiet -d lib --ignore "${ignoreGlobs}"`, { - BABEL_ENV: 'cjs', - }); - exec(`mkdir -p styles/scss`); - exec(`rsync -avm --include='*.scss' -f 'hide,! */' ./src/* ./styles/scss`); -} catch (error) { - console.error('One of the commands failed:', error.stack); // eslint-disable-line no-console - process.exit(1); +async function build() { + try { + exec(`"${babelPath}" src --quiet -d es --ignore "${ignoreGlobs}"`, { + BABEL_ENV: 'es', + }); + exec(`"${babelPath}" src --quiet -d lib --ignore "${ignoreGlobs}"`, { + BABEL_ENV: 'cjs', + }); + await cpy('**/*.scss', '../styles/scss', { + parents: true, + cwd: path.resolve(process.cwd(), 'src'), + }); + } catch (error) { + console.error('One of the commands failed:', error.stack); // eslint-disable-line no-console + process.exit(1); + } } + +(async (args) => { + await build(args); +})(process.argv); diff --git a/src/components/ContactUs/ContactUs.js b/src/components/ContactUs/ContactUs.js deleted file mode 100644 index c6962224..00000000 --- a/src/components/ContactUs/ContactUs.js +++ /dev/null @@ -1,122 +0,0 @@ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import axios from 'axios'; -import { settings } from 'carbon-components'; -import { Button, TextArea } from 'carbon-components-react'; -import { ModalHeader, ModalBody, ModalFooter } from 'carbon-components-react'; - -import notify from '../Notifications/notify'; -import HeaderMenuItem from '../HeaderMenuItem'; -import ToastNotification from '../Notifications/ToastNotification'; - -const { prefix } = settings; - -const initialState = { - description: '', - error: false, - hasSubmitted: false, - isPosting: false, -}; - -class ContactUs extends Component { - state = { - ...initialState, - }; - - handleOnDescriptionChange = (event) => { - const description = event.target.value; - this.setState({ - description, - }); - }; - - handleCloseModal = (closeModal) => { - this.setState({ ...initialState }); - closeModal(); - }; - - handleSubmit = async (event, closeModal) => { - event.preventDefault(); - - const serviceUrl = `${this.props.baseServiceUrl}/support/contact`; - const body = { - message: this.state.description, - }; - - this.setState({ - isPosting: true, - }); - - try { - await axios.post(serviceUrl, body); - notify( - , - { containerId: `${prefix}--bmrg-header-notifications` } - ); - this.handleCloseModal(closeModal); - } catch (error) { - this.setState({ error, isPosting: false }); - } - }; - - render() { - return ( - - {({ closeModal }) => { - return ( -
this.handleSubmit(event, closeModal)}> - this.handleCloseModal(closeModal)} - /> - -
-