This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": [ | |
[ | |
"@babel/preset-env", | |
{ | |
"useBuiltIns": false | |
} | |
] | |
], | |
"plugins": ["@babel/plugin-transform-runtime"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (plop) => { | |
require('component-generator-library')(plop); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const templatesPath = path.resolve(__dirname, 'templates'); // this is the path to our templates | |
const consumerPath = process.cwd(); // returns the current working directory | |
module.exports = (plop) => { | |
plop.setGenerator('component', componentPrompts({ templatesPath, consumerPath })); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('should show water bottles when a user navigates to `product/water-bottles`', () => { | |
const { findByText } = renderWithRouterMatch( | |
<ProductPage />, | |
{ | |
path: '/:product', | |
route: '/water-bottles/' | |
}, | |
{ store = {} } | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createMemoryHistory } from 'history'; | |
export const renderWithRouterMatch = ( | |
Component, | |
{ path = '/', route = '/', history = createMemoryHistory({ initialEntries: [route] }) } = {}, | |
{ store } = {} | |
) => ({ | |
...render( | |
<BrowserRouter> | |
<Router history={history}> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { renderWithRedux, createReduxStore } from './tests/testHelpers'; | |
import Cart from './Cart'; | |
describe('Cart', () => { | |
it('displays the monetary value of the cart items', () => { | |
const cart = { | |
items: [ | |
{ | |
variant_name: 'Water Jug', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function renderWithRedux(component, { store } = {}) { | |
const rendered = render( | |
<BrowserRouter> | |
<ThemeProvider theme="bri"> | |
<Provider store={store}>{component}</Provider> | |
</ThemeProvider> | |
</BrowserRouter> | |
); | |
// return the methods and properties from our custom render |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const { useBabelRc, override } = require('customize-cra'); | |
module.exports = override((config) => { | |
// we need the display names to NOT be mangled in order for our component library to work | |
// it uses the display name of a component to map it to the correct style rules | |
const updatedConfig = { ...config }; | |
// use our node_modules and avoid duplicate react errors from deps that also use react | |
// when npm-linking | |
const npmLinkPaths = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const https = require('https'); | |
//////////// UPDATE THESE VALUES ///////////// | |
const releaseBranch = 'release_branch'; | |
const masterBranch = 'main'; | |
const githubUsername = 'username'; | |
const githubPassword = 'pw'; | |
////////////////////////////////////////////// | |
// let's use a set so we don't count the same story/repo more than once | |
const stories = new Set(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* logic for determing a button color based on the page location: */ | |
// using conditional logic | |
const location = window.location.pathname; | |
let buttonColor = 'red'; | |
if(location === 'signIn'){ | |
buttonColor = 'yellow'; |