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(build): update babel deps, fix production build of docs and build on Windows #3214

Merged
merged 3 commits into from
Oct 12, 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
2 changes: 1 addition & 1 deletion docs/src/components/Document.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Document = ({ Body, children, Head, Html, siteData: { dev, versions } }) =
/>
<script
src={`https://cdn.jsdelivr.net/npm/@babel/preset-env-standalone@${
versions.babel.standalone
versions.babel.standaloneEnv
}/babel-preset-env.min.js`}
/>
<script src={`https://cdn.jsdelivr.net/faker.js/${versions.faker}/faker.min.js`} />
Expand Down
27 changes: 23 additions & 4 deletions gulp/sh.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
import { exec } from 'child_process'
import { spawn } from 'child_process'

const sh = (command, cb, pipeOutputToResult = false) => {
const [cmd, ...args] = command.split(' ')

const sh = (cmd, cb) => {
const options = {
cwd: process.cwd(),
env: process.env,
stdio: 'inherit',
stdio: pipeOutputToResult ? 'pipe' : [0, 1, 2],
shell: true,
}

const child = spawn(cmd, args, options)

let stdoutData = ''

if (child.stdout) {
child.stdout.on('data', (data) => {
stdoutData += data
})
}

exec(cmd, options, cb)
child.on('close', (code) => {
if (code === 0) {
cb(stdoutData)
}

cb(new Error(`child process exited with code ${code}`))
})
}
Copy link
Member Author

Choose a reason for hiding this comment

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


export default sh
4 changes: 2 additions & 2 deletions gulp/tasks/dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ task('clean:dist', (cb) => {
// ----------------------------------------

task('build:dist:commonjs:js', (cb) => {
sh(`cross-env NODE_ENV=build babel ${paths.src()} -d ${paths.dist('commonjs')}`, cb)
sh(`yarn cross-env NODE_ENV=build babel ${paths.src()} -d ${paths.dist('commonjs')}`, cb)
})

task('build:dist:commonjs:tsd', () =>
Expand All @@ -29,7 +29,7 @@ task('build:dist:commonjs:tsd', () =>
task('build:dist:commonjs', parallel('build:dist:commonjs:js', 'build:dist:commonjs:tsd'))

task('build:dist:es', (cb) => {
sh(`cross-env NODE_ENV=build-es babel ${paths.src()} -d ${paths.dist('es')}`, cb)
sh(`yarn cross-env NODE_ENV=build-es babel ${paths.src()} -d ${paths.dist('es')}`, cb)
})

task('build:dist:umd', (cb) => {
Expand Down
8 changes: 6 additions & 2 deletions gulpfile.babel.js → gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { task, series, parallel } from 'gulp'
import path from 'path'
require('@babel/register')({
ignore: [/node_modules/, /docs\/dist/],
})

const { task, series, parallel } = require('gulp')
const path = require('path')
Copy link
Member Author

Choose a reason for hiding this comment

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


// add node_modules/.bin to the path so we can invoke .bin CLIs in tasks
process.env.PATH = `${process.env.PATH}:${path.resolve('./node_modules/.bin')}`
Expand Down
33 changes: 19 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
},
"homepage": "https://github.com/Semantic-Org/Semantic-UI-React#readme",
"dependencies": {
"@babel/runtime": "^7.0.0",
"@babel/runtime": "^7.1.2",
"@semantic-ui-react/event-stack": "^3.0.0",
"classnames": "^2.2.6",
"keyboard-key": "^1.0.2",
Expand All @@ -75,28 +75,29 @@
"shallowequal": "^1.1.0"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/cli": "^7.1.2",
"@babel/core": "^7.1.2",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.1.0",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-env-standalone": "7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"@babel/standalone": "^7.0.0",
"@babel/standalone": "^7.1.0",
"@mdx-js/loader": "^0.15.5",
"@types/react": "^16.0.18",
"anchor-js": "^4.1.1",
"babel-eslint": "^9.0.0",
"babel-loader": "^8.0.2",
"babel-plugin-filter-imports": "^2.0.2",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.4",
"babel-plugin-filter-imports": "^2.0.3",
"babel-plugin-istanbul": "^5.0.1",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-transform-react-handled-props": "^1.0.1",
"babel-plugin-transform-react-remove-prop-types": "^0.4.15",
"babel-plugin-transform-react-handled-props": "^1.0.2",
"babel-plugin-transform-react-remove-prop-types": "^0.4.18",
"babel-plugin-universal-import": "^2.0.2",
"chai": "^4.1.2",
"chai-enzyme": "^1.0.0-beta.1",
Expand All @@ -108,7 +109,7 @@
"doctrine": "^2.1.0",
"enzyme": "^3.6.0",
"enzyme-adapter-react-16": "^1.4.0",
"eslint": "^4.4.1",
"eslint": "^4.12.1",
"eslint-config-airbnb": "^15.1.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
Expand Down Expand Up @@ -145,7 +146,7 @@
"react-static": "^5.9.7",
"react-static-routes": "^1.0.0",
"react-test-renderer": "^16.4.2",
"react-universal-component": "^2.9.0",
"react-universal-component": "^3.0.3",
"rimraf": "^2.6.2",
"satisfied": "^1.1.2",
"semantic-ui-css": "^2.4.0",
Expand All @@ -164,5 +165,9 @@
"peerDependencies": {
"react": "^16.0.0",
"react-dom": "^16.0.0"
},
"resolutions": {
"babel-plugin-universal-import": "^2.0.2",
"react-universal-component": "^3.0.3"
}
}
1 change: 1 addition & 0 deletions static.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default {
anchor: require('anchor-js/package.json').version,
babel: {
standalone: require('@babel/standalone/package.json').version,
standaloneEnv: require('@babel/preset-env-standalone/package.json').version,
},
faker: require('faker/package.json').version,
prettier: require('prettier/package.json').version,
Expand Down
2 changes: 1 addition & 1 deletion static.webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default (webpackConfig, { stage }) => ({
use: {
loader: 'babel-loader',
options: {
cacheDirectory: true,
cacheDirectory: stage === 'dev',
},
},
},
Expand Down
Loading