Skip to content

Commit

Permalink
fix: keep babel build for CJS packages
Browse files Browse the repository at this point in the history
  • Loading branch information
emmenko committed Nov 25, 2020
1 parent d5f3e1a commit e8c370b
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 26 deletions.
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"template-starter:start": "yarn --cwd application-templates/starter start",
"template-starter:start:prod:local": "yarn --cwd application-templates/starter start:prod:local",
"prebuild": "lerna run prebuild --no-private",
"build": "preconstruct build && yarn workspace @commercetools-frontend/application-shell run build",
"build:watch": "preconstruct watch & yarn workspace @commercetools-frontend/application-shell run build:bundles:watch",
"build": "preconstruct build && NODE_ENV=production lerna run build --no-private",
"build:watch": "preconstruct watch & NODE_ENV=development lerna run --no-private --parallel build:bundles:watch",
"build:website": "yarn build && yarn --cwd website build && yarn --cwd website-components-playground build",
"now-build": "yarn build:website && rm -rf public && mv website/public public",
"labels:sync": "github-labels sync",
Expand Down Expand Up @@ -76,11 +76,8 @@
"packages/application-shell-connectors",
"packages/browser-history",
"packages/constants",
"packages/create-mc-app",
"packages/i18n",
"packages/l10n",
"packages/mc-html-template",
"packages/mc-scripts",
"packages/notifications",
"packages/permissions",
"packages/react-notifications",
Expand Down
3 changes: 0 additions & 3 deletions packages/create-mc-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
"publishConfig": {
"access": "public"
},
"main": "dist/commercetools-frontend-create-mc-app.cjs.js",
"module": "dist/commercetools-frontend-create-mc-app.esm.js",
"files": ["bin", "dist", "package.json", "LICENSE", "README.md"],
"bin": {
"create-mc-app": "./bin/create-mc-app.js"
},
Expand Down
37 changes: 34 additions & 3 deletions packages/mc-html-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,21 @@
"publishConfig": {
"access": "public"
},
"main": "dist/commercetools-frontend-mc-html-template.cjs.js",
"module": "dist/commercetools-frontend-mc-html-template.esm.js",
"main": "./build/index.js",
"files": [
"dist",
"build",
"html-scripts",
"html-styles",
"webpack.js",
"package.json",
"LICENSE",
"README.md"
],
"scripts": {
"prebuild": "rimraf build/**",
"build": "babel src --out-dir build",
"build:bundles:watch": "yarn build -w"
},
"dependencies": {
"@babel/runtime": "7.12.5",
"@babel/runtime-corejs3": "7.12.5",
Expand All @@ -35,8 +39,35 @@
"uglify-es": "3.3.9",
"uglifycss": "0.0.29"
},
"devDependencies": {
"@babel/plugin-transform-runtime": "7.12.1",
"@babel/preset-env": "7.12.7"
},
"engines": {
"node": ">=10",
"npm": ">=5"
},
"babel": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "10"
},
"modules": "commonjs",
"useBuiltIns": "usage",
"corejs": 3
}
]
],
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"corejs": 3
}
]
]
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
// For backwards compatibilty
const {
createWebpackConfigForDevelopment,
} = require('../dist/commercetools-frontend-mc-scripts.cjs');
module.exports = createWebpackConfigForDevelopment;
module.exports = require('../build/config/create-webpack-config-for-development');
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
// For backwards compatibilty
const {
createWebpackConfigForProduction,
} = require('../dist/commercetools-frontend-mc-scripts.cjs');
module.exports = createWebpackConfigForProduction;
module.exports = require('../build/config/create-webpack-config-for-production');
5 changes: 1 addition & 4 deletions packages/mc-scripts/config/vendors-to-transpile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
// For backwards compatibilty
const {
vendorsToCompile,
} = require('../dist/commercetools-frontend-mc-scripts.cjs');
module.exports = vendorsToCompile;
module.exports = require('../build/config/vendors-to-transpile');
37 changes: 34 additions & 3 deletions packages/mc-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@
"publishConfig": {
"access": "public"
},
"main": "dist/commercetools-frontend-mc-scripts.cjs.js",
"module": "dist/commercetools-frontend-mc-scripts.esm.js",
"files": ["bin", "dist", "config", "package.json", "LICENSE", "README.md"],
"main": "./build/index.js",
"files": ["bin", "build", "config", "package.json", "LICENSE", "README.md"],
"bin": {
"mc-scripts": "./bin/mc-scripts.js"
},
"browserslist": {
"production": [">1%", "not op_mini all", "not dead"],
"development": ["last 2 firefox versions", "last 2 chrome versions"]
},
"scripts": {
"prebuild": "rimraf build/**",
"build": "babel src --out-dir build",
"build:bundles:watch": "yarn build -w"
},
"dependencies": {
"@babel/runtime": "7.12.5",
"@babel/runtime-corejs3": "7.12.5",
Expand Down Expand Up @@ -74,8 +78,35 @@
"webpack-dev-server": "3.11.0",
"webpackbar": "4.0.0"
},
"devDependencies": {
"@babel/plugin-transform-runtime": "7.12.1",
"@babel/preset-env": "7.12.7"
},
"engines": {
"node": ">=10",
"npm": ">=5"
},
"babel": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "10"
},
"modules": "commonjs",
"useBuiltIns": "usage",
"corejs": 3
}
]
],
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"corejs": 3
}
]
]
}
}
2 changes: 2 additions & 0 deletions packages/mc-scripts/src/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
const createWebpackConfigForDevelopment = require('./config/create-webpack-config-for-development');
const createWebpackConfigForProduction = require('./config/create-webpack-config-for-production');
const createDevServerConfig = require('./config/webpack-dev-server.config');
const vendorsToCompile = require('./config/vendors-to-transpile');

module.exports = {
createWebpackConfigForDevelopment,
createWebpackConfigForProduction,
createDevServerConfig,
vendorsToCompile,
};
1 change: 1 addition & 0 deletions playground/.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CLOUD_IDENTIFIER="gcp-eu"
APP_URL="https://<your_app_hostname>"
ECHO_SERVER_URL="http://localhost:3000/api/echo"
HOST_GCP_STAGING=""
TRACKING_GTM="GTM-XXXXXX"
ENABLE_NEW_JSX_TRANSFORM="true"
FAST_REFRESH="true"

0 comments on commit e8c370b

Please sign in to comment.