Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(babel-preset): Consolidate Babel configs #871

Merged
merged 6 commits into from
Apr 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 34 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ jobs:
<<: *defaults
steps:
- checkout
- run:
name: Create dependency hash
command: yarn run create-dependency-hash
- restore_cache:
key: hig-dependencies-{{ checksum "yarn.lock" }}
key: hig-dependencies-{{ checksum ".dependency-hash" }}
- run:
name: Install Dependencies
command: yarn
- save_cache:
key: hig-dependencies-{{ checksum "yarn.lock" }}
key: hig-dependencies-{{ checksum ".dependency-hash" }}
paths:
- .dependency-hash
- node_modules
- packages/banner/node_modules
- packages/eslint-config/node_modules
Expand All @@ -31,8 +35,11 @@ jobs:
<<: *defaults
steps:
- checkout
- run:
name: Create dependency hash
command: yarn run create-dependency-hash
- restore_cache:
key: hig-dependencies-{{ checksum "yarn.lock" }}
key: hig-dependencies-{{ checksum ".dependency-hash" }}
- run:
name: Build all packages
command: yarn build
Expand All @@ -51,8 +58,11 @@ jobs:
<<: *defaults
steps:
- checkout
- run:
name: Create dependency hash
command: yarn run create-dependency-hash
- restore_cache:
key: hig-dependencies-{{ checksum "yarn.lock" }}
key: hig-dependencies-{{ checksum ".dependency-hash" }}
- restore_cache:
key: package-build-{{ .Revision }}
- run:
Expand All @@ -68,8 +78,11 @@ jobs:
<<: *defaults
steps:
- checkout
- run:
name: Create dependency hash
command: yarn run create-dependency-hash
- restore_cache:
key: hig-dependencies-{{ checksum "yarn.lock" }}
key: hig-dependencies-{{ checksum ".dependency-hash" }}
- restore_cache:
key: package-build-{{ .Revision }}
- run:
Expand All @@ -96,8 +109,11 @@ jobs:
<<: *defaults
steps:
- checkout
- run:
name: Create dependency hash
command: yarn run create-dependency-hash
- restore_cache:
key: hig-dependencies-{{ checksum "yarn.lock" }}
key: hig-dependencies-{{ checksum ".dependency-hash" }}
- restore_cache:
key: package-build-{{ .Revision }}
- run:
Expand All @@ -108,8 +124,11 @@ jobs:
<<: *defaults
steps:
- checkout
- run:
name: Create dependency hash
command: yarn run create-dependency-hash
- restore_cache:
key: hig-dependencies-{{ checksum "yarn.lock" }}
key: hig-dependencies-{{ checksum ".dependency-hash" }}
- restore_cache:
key: package-build-{{ .Revision }}
- run:
Expand All @@ -122,8 +141,11 @@ jobs:
<<: *defaults
steps:
- checkout
- run:
name: Create dependency hash
command: yarn run create-dependency-hash
- restore_cache:
key: hig-dependencies-{{ checksum "yarn.lock" }}
key: hig-dependencies-{{ checksum ".dependency-hash" }}
- restore_cache:
key: package-build-{{ .Revision }}
- run:
Expand All @@ -134,8 +156,11 @@ jobs:
<<: *defaults
steps:
- checkout
- run:
name: Create dependency hash
command: yarn run create-dependency-hash
- restore_cache:
key: hig-dependencies-{{ checksum "yarn.lock" }}
key: hig-dependencies-{{ checksum ".dependency-hash" }}
- restore_cache:
key: package-build-{{ .Revision }}
- run:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ gemini-report/
# Files created by CircleCI
nohup.out

# Files generated during CI
.dependency-hash

# Environment Variables
.env

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"version": "1.0.1",
"scripts": {
"build": "lerna run build",
"create-dependency-hash": "cat yarn.lock > .dependency-hash && ls ./packages >> .dependency-hash",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

"lint": "lerna run lint",
"publish-canary": "lerna publish --canary --yes --exact",
"update-packages": "lerna publish --skip-npm"
Expand Down
26 changes: 26 additions & 0 deletions packages/babel-preset/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = function createBuildPreset() {
return {
exclude: [
"**/node_modules/**",
"**/*.css",
"**/*.scss",
"**/*.html",
"**/*.svg",
"**/*.json"
],
presets: [
[
"env",
{
modules: false,
targets: {
browser: ">1%"
}
}
],
"stage-2",
"react"
],
plugins: ["react-docgen"]
};
};
23 changes: 23 additions & 0 deletions packages/babel-preset/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"private": true,
"name": "@hig/babel-preset",
"version": "0.1.0",
"description": "HIG Babel preset",
"author": "Autodesk Inc.",
"license": "Apache-2.0",
"homepage": "https://hig.autodesk.com",
"repository": {
"type": "git",
"url": "https://github.com/Autodesk/hig"
},
"main": "index.js",
"dependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-plugin-react-docgen": "^1.8.1",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1"
}
}
6 changes: 6 additions & 0 deletions packages/babel-preset/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = function createTestPreset() {
return {
presets: [["env", { modules: "umd" }], "react", "stage-2"],
plugins: ["transform-object-rest-spread", "react-docgen"]
};
};
10 changes: 1 addition & 9 deletions packages/banner/.babelrc
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
{
"env": {
"test": {
"presets": [
["env", { "modules": "umd" }],
"react",
"stage-2"
],
"plugins": [
"transform-object-rest-spread",
"react-docgen"
]
"presets": ["@hig/babel-preset/test"]
}
}
}
1 change: 1 addition & 0 deletions packages/banner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"style": "build/index.css",
"files": ["build/*"],
"devDependencies": {
"@hig/babel-preset": "0.1.0",
"@hig/scripts": "^0.1.0",
"@hig/styles": "^0.1.0-alpha",
"@hig/eslint-config": "0.1.0",
Expand Down
7 changes: 1 addition & 6 deletions packages/icon/.babelrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"env": {
"test": {
"presets": [
["env", { "modules": "umd" }],
"react",
"stage-2"
],
"plugins": ["react-docgen"]
"presets": ["@hig/babel-preset/test"]
}
}
}
1 change: 1 addition & 0 deletions packages/icon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@hig/icons": "^0.1.0-alpha"
},
"devDependencies": {
"@hig/babel-preset": "0.1.0",
"@hig/scripts": "^0.1.0",
"@hig/styles": "^0.1.0-alpha"
},
Expand Down
7 changes: 1 addition & 6 deletions packages/icons/.babelrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"env": {
"test": {
"presets": [
["env", { "modules": "umd" }],
"react",
"stage-2"
],
"plugins": ["react-docgen"]
"presets": ["@hig/babel-preset/test"]
}
}
}
1 change: 1 addition & 0 deletions packages/icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"module": "build/index.es.js",
"files": ["build/*"],
"devDependencies": {
"@hig/babel-preset": "0.1.0",
"@hig/scripts": "^0.1.0",
"@hig/styles": "^0.1.0-alpha"
},
Expand Down
7 changes: 1 addition & 6 deletions packages/react/.babelrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"env": {
"test": {
"presets": [
["env", { "modules": "umd" }],
"react",
"stage-2"
],
"plugins": ["react-docgen"]
"presets": ["@hig/babel-preset/test"]
}
},
"presets": [
Expand Down
1 change: 1 addition & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"react-dom": "^15.4.1"
},
"devDependencies": {
"@hig/babel-preset": "0.1.0",
"@hig/styles": "^0.1.0-alpha",
"@types/jest": "^19.2.3",
"@types/node": "^7.0.21",
Expand Down
26 changes: 2 additions & 24 deletions packages/scripts/bin/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const postcss = require("rollup-plugin-postcss");
const json = require("rollup-plugin-json");
const postcssFuncitons = require("postcss-functions");
const postcssImport = require("postcss-import");
const createBuildPreset = require('@hig/babel-preset/build');

const packageMeta = require(path.resolve(process.cwd(), "package.json"));

Expand All @@ -33,30 +34,7 @@ const inputOptions = {
nodeResolve(),
babel({
babelrc: false,
exclude: [
"**/node_modules/**",
"**/*.css",
"**/*.scss",
"**/*.html",
"**/*.svg",
"**/*.json"
],
presets: [
[
"env",
{
modules: false,
targets: {
browser: ">1%"
}
}
],
"stage-2",
"react"
],
plugins: [
"react-docgen"
]
...createBuildPreset()
}),
commonjs(),
json(),
Expand Down
1 change: 1 addition & 0 deletions packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"hig-scripts-build": "bin/build.js"
},
"dependencies": {
"@hig/babel-preset": "0.1.0",
"babel-plugin-external-helpers": "^6.22.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
Expand Down
7 changes: 1 addition & 6 deletions packages/skeleton-item/.babelrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"env": {
"test": {
"presets": [
["env", { "modules": "umd" }],
"react",
"stage-2"
],
"plugins": ["react-docgen"]
"presets": ["@hig/babel-preset/test"]
}
}
}
1 change: 1 addition & 0 deletions packages/skeleton-item/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@hig/themes": "^0.1.0-alpha"
},
"devDependencies": {
"@hig/babel-preset": "0.1.0",
"@hig/scripts": "^0.1.0",
"@hig/styles": "^0.1.0-alpha"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/storybook/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ module.exports = {
rootDir: "../../",
setupFiles: ["raf/polyfill"],
setupTestFrameworkScriptFile: "<rootDir>/packages/storybook/support/jest/setupTests.js",
testPathIgnorePatterns: ["<rootDir>/packages/vanilla"],
testPathIgnorePatterns: ["<rootDir>/packages/vanilla", "<rootDir>/packages/babel-preset"],
unmockedModulePathPatterns: ["node_modules"]
};
10 changes: 1 addition & 9 deletions packages/themes/.babelrc
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
{
"env": {
"test": {
"presets": [
["env", { "modules": "umd" }],
"react",
"stage-2"
],
"plugins": [
"transform-object-rest-spread",
"react-docgen"
]
"presets": ["@hig/babel-preset/test"]
}
}
}
1 change: 1 addition & 0 deletions packages/themes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"main": "build/index.js",
"module": "build/index.es.js",
"devDependencies": {
"@hig/babel-preset": "0.1.0",
"@hig/scripts": "^0.1.0",
"@hig/styles": "^0.1.0-alpha"
},
Expand Down
7 changes: 1 addition & 6 deletions packages/typography/.babelrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"env": {
"test": {
"presets": [
["env", { "modules": "umd" }],
"react",
"stage-2"
],
"plugins": ["react-docgen"]
"presets": ["@hig/babel-preset/test"]
}
}
}
Loading