Skip to content

Commit

Permalink
feat: added prepping and finalizing scripts for versioning when deplo…
Browse files Browse the repository at this point in the history
…ying
  • Loading branch information
czaas-mb committed Feb 19, 2020
1 parent 58b8371 commit 543b6da
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 16 deletions.
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ yarn create react-app app-name --template cra-mb-shared-ui

Run `yarn add husky` then add the following to your `package.json`

```
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
```

## Workflow

By default CRA is used for building single page applications (SPA's). This template was made for the use of consuming a package as a bundle in existing applications. This means the default `yarn start` will not be used for building shared UI's.
Expand All @@ -32,7 +24,7 @@ Using storybook you can work locally with different views by running `yarn story

This project is setup to use @testing-library/react for behavioral driven tests giving you the most confidence when shipping your application.

Setting up jest to transform SCSS and handle ES6 modules in our component library
Setting up jest to transform SCSS and handle ES6 modules from our component library you will need to add this to your package.json

```
"jest": {
Expand Down
10 changes: 6 additions & 4 deletions template.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@storybook/addon-links": "^5.3.9",
"@storybook/addons": "^5.3.9",
"@storybook/react": "^5.3.9",
"cra-shared-ui-scripts": "^1.1.0",
"cross-env": "^7.0.0",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
Expand All @@ -21,13 +22,14 @@
"@types/react": "^16.9.0",
"@types/react-dom": "^16.9.0",
"node-sass": "^4.13.1",
"typescript": "~3.7.2"
"typescript": "~3.7.2",
"mb-ui-tools": "1.0.0"
},
"scripts": {
"version:bump": "standard-version",
"build:ci": "TODO add build script",
"test:ci": "cross-env CI=true react-scripts test --transformIgnorePatterns \"node_modules/(?!(@mindbody/*)/)\" --env=jsdom",
"test:watch": "react-scripts test --transformIgnorePatterns \"node_modules/(?!(@mindbody/*)/)\" --env=jsdom",
"build:shared-ui": "yarn prep-shared-ui && react-scripts build && yarn finalize-shared-ui",
"test:ci": "cross-env CI=true react-scripts test --transformIgnorePatterns \"node_modules/(?!(@mbkit/*)/)\" --env=jsdom",
"test:watch": "react-scripts test --transformIgnorePatterns \"node_modules/(?!(@mbkit/*)/)\" --env=jsdom",
"storybook": "start-storybook -p 9009 -s public",
"storybook:build": "build-storybook -s public"
}
Expand Down
27 changes: 26 additions & 1 deletion template/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# Your Shared UI

Tell us the purpose of the shared UI and how to consume it and any other notes
Tell us the purpose of the shared UI and how to consume it and any other notes

## You're almost set to go

You'll need to run `yarn add husky` to get conventional commits to work correctly

For jest you will need to add this to your package.json

```
"jest": {
"collectCoverageFrom": [
"src/**/*.ts",
"src/**/*.tsx",
"!src/**/*.stories.tsx",
"!src/**/index.ts",
"!src/**/index.tsx",
"!src/**/*.d.ts"
],
"transformIgnorePatterns": [
"./node_modules/(?!(@mbkit/*)/)"
],
"moduleNameMapper": {
"\\.(css|less|scss|sass)$": "identity-obj-proxy"
}
}
```
4 changes: 3 additions & 1 deletion template/build.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ RUN yarn install --pure-lockfile

# Build packages
FROM prep as build
RUN yarn build:ci

# Build packages
RUN yarn build:shared-ui

FROM base as artifact
COPY --from=build /prepping-ui/build /ui/arcusOutput
2 changes: 1 addition & 1 deletion template/gated.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ RUN yarn install --pure-lockfile
RUN yarn test:ci

# Build packages
RUN yarn build:ci
RUN yarn build:shared-ui

0 comments on commit 543b6da

Please sign in to comment.