Skip to content

Commit

Permalink
[SDPA-2181] Upgrade Ripple storybook to v5 (#415)
Browse files Browse the repository at this point in the history
* Move jest config to root

* Update storybook to latest, add to project at /src, remove ripple-ui-components package

* WIP on story conversion

* Adds all component stories

* Storybook 5 upgrade

* Storybook 5 upgrade

* Fix babel config for jest

* Fix corejs issue

* Fixes to get storyshots tests working.

* Add mock for moment timezone

* Update dockerfile

* fix babel path

* fix build-storybook command

* require svg-sprite-loader in storybook package

* Add babel dependencies to example project

* Added lagoon build env

* Remove storybook-readme plugin - add a11y and viewport

* Update snapshots

* Fix issues with imports and update snapshots

* Remove template components and stories

* Add TODO on RplDivider removal
  • Loading branch information
dylankelly authored Jul 10, 2019
1 parent f268352 commit 3b0a3fd
Show file tree
Hide file tree
Showing 659 changed files with 22,026 additions and 84,735 deletions.
38 changes: 0 additions & 38 deletions .babelrc

This file was deleted.

1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
key: v1-deps-{{ checksum "yarn.lock" }}
paths:
- node_modules
- packages/ripple-ui-components/node_modules
- packages/ripple-nuxt-tide/node_modules
- packages/ripple-nuxt-ui/node_modules
- packages/ripple-create-app/node_modules
Expand Down
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ packages/ripple-nuxt-tide/**/templates/*
packages/ripple-nuxt-ui/**/templates/*

# ignore storybook files
packages/ripple-ui-components/scripts
src/scripts

# Nuxt folders
/examples/**/dist
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ storybook-static
npm-debug.log*
yarn-debug.log*
yarn-error.log*
/src/public

# tests
coverage
Expand Down
5 changes: 5 additions & 0 deletions .jest/moment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const moment = require('moment-timezone')
jest.doMock('moment', () => {
moment.tz.setDefault('Australia/Melbourne')
return moment
})
2 changes: 2 additions & 0 deletions .jest/register-context.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import registerRequireContextHook from 'babel-plugin-require-context-hook/register'
registerRequireContextHook()
File renamed without changes.
6 changes: 5 additions & 1 deletion Dockerfile.app
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM amazeeio/node:10-builder as builder
COPY . /app/

# Remove storybook from reference site
RUN rm /app/packages/ripple-ui-components/package.json \
RUN rm /app/src/package.json \
&& mv /app/scripts/jira-post-comment-app.sh /app/scripts/jira-post-comment.sh \
&& yarn install

Expand All @@ -16,6 +16,10 @@ ARG CONTENT_API_AUTH_USER
ENV CONTENT_API_AUTH_PASS ${CONTENT_API_AUTH_PASS}
ENV CONTENT_API_AUTH_USER ${CONTENT_API_AUTH_USER}
ENV LAGOON_GIT_BRANCH ${LAGOON_GIT_BRANCH}
ARG CONTENT_API_AUTH_PASS
ARG CONTENT_API_AUTH_USER
ENV CONTENT_API_AUTH_PASS ${CONTENT_API_AUTH_PASS}
ENV CONTENT_API_AUTH_USER ${CONTENT_API_AUTH_USER}

WORKDIR /app/examples/vic-gov-au/

Expand Down
15 changes: 8 additions & 7 deletions Dockerfile.storybook
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
FROM amazeeio/node:10-builder as builder

COPY packages/ripple-ui-components /app/packages/ripple-ui-components
COPY package.json yarn.lock .eslintrc.js .babelrc /app/
COPY packages/components /app/packages/components
COPY src /app/src
COPY package.json yarn.lock .eslintrc.js babel.config.js /app/
RUN yarn install
WORKDIR /app/packages/ripple-ui-components
WORKDIR /app/src
RUN yarn run build-storybook

FROM amazeeio/node:10
COPY --from=builder /app/packages/ripple-ui-components/public /app
COPY --from=builder /app/src/public /app
COPY scripts/jira-post-comment-storybook.sh /app/scripts/jira-post-comment.sh

ARG LAGOON_GIT_BRANCH
ENV LAGOON_GIT_BRANCH ${LAGOON_GIT_BRANCH}

RUN npm config set unsafe-perm true \
# force it to load the environment variable during build time. Otherwise it cannot read $LAGOON_GIT_BRANCH.
RUN . /home/.bashrc \
&& npm config set unsafe-perm true \
&& npm install http-server -g \
# force it to load the environment variable during build time. Otherwise it cannot read $LAGOON_GIT_BRANCH.
&& . /home/.bashrc \
# For JIRA commit script work.
&& if [ $LAGOON_GIT_BRANCH != "production" ] ; then apk --update add curl; fi

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ Run `yarn run start:example`

## Running Storybook

Run `yarn run start:storybook`
Run `yarn run start:storybook`
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current'
}
}
]
],
plugins: [
'@babel/plugin-syntax-dynamic-import',
'transform-vue-jsx',
'@babel/plugin-transform-runtime'
],
env: {
test: {
presets: [['@babel/preset-env', { targets: { node: 'current' } }]],
plugins: ['require-context-hook', 'dynamic-import-node']
}
}
}
16 changes: 0 additions & 16 deletions examples/vic-gov-au/babel.config.js

This file was deleted.

14 changes: 11 additions & 3 deletions examples/vic-gov-au/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,19 @@
"svgo-loader": "^2.1.0"
},
"devDependencies": {
"@vue/test-utils": "^1.0.0-beta.29",
"@babel/core": "^7.5.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/runtime": "^7.5.1",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/preset-env": "^7.5.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^24.8.0",
"babel-plugin-dynamic-import-node": "^2.3.0",
"babel-plugin-require-context-hook": "^1.0.0",
"babel-preset-vue": "^2.0.2",
"babel-eslint": "^10.0.1",
"babel-plugin-dynamic-import-node": "^2.2.0",
"cross-env": "^5.2.0",
"core-js": "^2.6.5",
"eslint": "^4.15.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
Expand All @@ -44,7 +53,6 @@
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue": "^4.0.0",
"jest": "^24.4.0",
"node-sass": "^4.11.0",
"sass-lint": "^1.12.1",
"sass-loader": "^6.0.7",
Expand Down
31 changes: 19 additions & 12 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
module.exports = {
'verbose': true,
'testURL': 'http://localhost',
'collectCoverage': true,
'testMatch': ['**/unit/**/*.test.js'],
'moduleFileExtensions': [
'js',
'json',
'vue'
],
'transform': {
'^.+\\.js$': '<rootDir>/node_modules/babel-jest'
verbose: true,
testURL: 'http://localhost',
collectCoverage: true,
testMatch: ['**/unit/**/*.test.js', '**/*.test.js'],
moduleFileExtensions: ['js', 'json', 'vue'],
setupFiles: ['<rootDir>/.jest/register-context.js', 'jest-canvas-mock'],
setupFilesAfterEnv: ['<rootDir>/.jest/moment.js'],
transform: {
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
'.*\\.(vue)$': '<rootDir>/node_modules/jest-vue-preprocessor',
'^.+\\.md?$': 'markdown-loader-jest'
},
'transformIgnorePatterns': ['node_modules/(?!(@dpc-sdp*)/)']
transformIgnorePatterns: [
'node_modules/(?!(@dpc-sdp*|ol|ol-ext|storybook-addon-vue-info|@storybook*)/)'
],
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|svg)$':
'<rootDir>/__mocks__/fileMock.js',
'\\.(css|scss)$': '<rootDir>/__mocks__/styleMock.js'
}
}
62 changes: 41 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,30 @@
"description": "Ripple Monorepo for DPC Single Digital Presence sites.",
"homepage": "https://ripple.sdp.vic.gov.au",
"private": true,
"workspaces": [
"packages/ripple-ui-components",
"packages/ripple-ui-components/components/**/*",
"packages/ripple-nuxt-tide",
"packages/ripple-nuxt-ui",
"packages/ripple-create-app",
"packages/ripple-test-tools",
"examples/**/*"
],
"workspaces": {
"packages": [
"packages/components/**/*",
"packages/ripple-nuxt-tide",
"packages/ripple-nuxt-ui",
"packages/ripple-create-app",
"packages/ripple-test-tools",
"examples/**/*",
"src"
],
"nohoist": ["src"]
},
"scripts": {
"publish": "lerna publish",
"start:storybook": "cd packages/ripple-ui-components/ && yarn run storybook",
"start:storybook": "cd src && yarn start",
"start:example": "cd examples/vic-gov-au/ && yarn run dev",
"start:build-example": "cd examples/vic-gov-au/ && nuxt build && nuxt start",
"test:dev": "NODE_ENV=dev start-server-and-test start:example http://localhost:3000 cy:open",
"test:storybook": "cd packages/ripple-ui-components/ && yarn run test",
"test:e2e": "NODE_ENV=test start-server-and-test start:build-example http://localhost:3000 cy:run-smoke",
"test:unit": "NODE_ENV=test jest",
"test:dev": "cross-env NODE_ENV=dev start-server-and-test start:example http://localhost:3000 cy:open",
"test:e2e": "cross-env NODE_ENV=test start-server-and-test start:build-example http://localhost:3000 cy:run-smoke",
"test:unit": "jest --colors",
"build:storybook": "cd src && yarn build-storybook",
"build:example": "cd examples/vic-gov-au && yarn run build",
"cy:open": "cypress open",
"cy:run": "cypress run",
"cy:run": "cypress run -e TAGS='not @skip'",
"cy:run-smoke": "cypress run -e TAGS='@smoke'",
"lint": "eslint --ext .js,.vue . && sass-lint -qv --max-warnings 0",
"lint:fix": "eslint --ext .js,.vue . --fix",
Expand All @@ -36,15 +40,24 @@
"bay:pull": "docker image ls --format \"{{.Repository}}:{{.Tag}}\" | grep amazeeio | grep -v none | xargs -n1 docker pull | cat"
},
"devDependencies": {
"lerna": "^3.0.0",
"@babel/core": "^7.5.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/preset-env": "^7.5.0",
"@ljharb/eslint-config": "^13.1.1",
"@vue/test-utils": "^1.0.0-beta.29",
"axe-core": "^3.2.2",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.8.0",
"babel-plugin-dynamic-import-node": "^2.3.0",
"babel-plugin-require-context-hook": "^1.0.0",
"babel-preset-vue": "^2.0.2",
"cross-env": "^5.2.0",
"cypress": "^3.1.5",
"cypress-axe": "^0.4.0",
"cypress-cucumber-preprocessor": "^1.11.0",
"axe-core": "^3.2.2",
"start-server-and-test": "^1.7.11",
"babel-eslint": "^10.0.1",
"eslint": "^5.11.1",
"@ljharb/eslint-config": "^13.1.1",
"eslint-config-standard": "^12.0.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-plugin-import": "^2.7.0",
Expand All @@ -53,7 +66,14 @@
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue": "^4.0.0",
"sass-lint": "^1.12.1"
"jest": "^24.8.0",
"jest-canvas-mock": "^2.1.0",
"jest-vue-preprocessor": "^1.5.0",
"lerna": "^3.0.0",
"markdown-loader-jest": "^0.1.1",
"sass-lint": "^1.12.1",
"start-server-and-test": "^1.7.11",
"vue-jest": "^3.0.4"
},
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "Apache-2.0",
"main": "index.vue",
"homepage": "https://ripple.sdp.vic.gov.au",
"repository": "https://github.com/dpc-sdp/ripple/tree/master/packages/ripple-ui-components/components/Atoms/Button",
"repository": "https://github.com/dpc-sdp/ripple/tree/master/packages/components/Atoms/Button",
"publishConfig": {
"access": "public"
},
Expand Down
Loading

0 comments on commit 3b0a3fd

Please sign in to comment.