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

Move babel-preset-env-standalone to the monorepo. #6438

Merged
merged 44 commits into from
Nov 15, 2017

Conversation

yavorsky
Copy link
Member

@yavorsky yavorsky commented Oct 6, 2017

Q                       A
Fixed Issues?
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR
Any Dependency Changes?

I've modified Gulpfile a bit to be more flexible and allow building standalone packages besides Babel.
Currently, the size of babel-preset-env-standalone is 162 kb.
I've added tests which passed successfully with different targets/cases.

I don't know about the name in package.json, because we already have babel-preset-env-standalone, which represents https://github.com/yavorsky/babel-preset-env-standalone and babel-env-standalone from https://github.com/babel/babel-standalone/tree/v7/packages/babel-env-standalone.

@yavorsky yavorsky changed the title Move babel-preset-env-standalone to monorepo. Move babel-preset-env-standalone to the monorepo. Oct 6, 2017
@babel-bot
Copy link
Collaborator

babel-bot commented Oct 7, 2017

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/5831/

Gulpfile.js Outdated
libraryTarget: "umd",
},
plugins: [
new webpack.DefinePlugin({
"process.env.NODE_ENV": '"production"',
BABEL_VERSION: JSON.stringify(version),
"process.env": JSON.stringify({ NODE_ENV: "production" }),
Copy link
Member

Choose a reason for hiding this comment

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

is this the same ^?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah why do you need this? NODE_ENV is already defined two lines above.

Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't work for me with cases like var env = process.env: https://github.com/ai/browserslist/blob/master/index.js#L35

Gulpfile.js Outdated
@@ -82,7 +82,7 @@ gulp.task("build-babel-standalone", cb => {
pump(
[
gulp.src(__dirname + "/packages/babel-standalone/src/index.js"),
webpackBuild(),
webpackBuild({ filename: "babel.js", library: "Babel" }),
Copy link
Member

Choose a reason for hiding this comment

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

Rather than doing this, I'd prefer if this entire task was made reusable again. I'm not sure why it was changed to not be reusable. See my original implementation: https://github.com/Daniel15/babel/blob/5b9722c8255ce65584a31effe4518c0677176525/packages/babel-standalone/src/gulpTasks.js

function registerBabelStandaloneTask(gulp, name, exportName, path, version) {
  gulp.task("build-" + name + "-standalone", cb => {
    pump(
      [
        gulp.src(path + "/src/index.js"),
        webpackBuild(
          name + ".js",
          exportName,
          version
        ),
        gulp.dest(path),
        uglify(),
        rename({ extname: ".min.js" }),
        gulp.dest(path),
      ],
      cb
    );
  });
}

Gulpfile.js Outdated
gulp.dest(__dirname + "/experimental/babel-preset-env-standalone"),
uglify(),
rename({ extname: ".min.js" }),
gulp.dest(__dirname + "/experimental/babel-preset-env-standalone"),
Copy link
Member

Choose a reason for hiding this comment

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

These steps are all identical to the regular babel-standalone build, except with a different path. Please remove the repetition :)

Gulpfile.js Outdated
libraryTarget: "umd",
},
plugins: [
new webpack.DefinePlugin({
"process.env.NODE_ENV": '"production"',
BABEL_VERSION: JSON.stringify(version),
"process.env": JSON.stringify({ NODE_ENV: "production" }),
Copy link
Member

Choose a reason for hiding this comment

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

Yeah why do you need this? NODE_ENV is already defined two lines above.

new webpack.optimize.ModuleConcatenationPlugin(),
];

registerBabelStandaloneTask(
Copy link
Member

Choose a reason for hiding this comment

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

Why do you have this build defined in two separate Gulpfiles?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops, just remained after the merge. Thanks!

@yavorsky yavorsky requested a review from hzoo November 1, 2017 10:25
@@ -0,0 +1,8 @@
{
"env": {
"mocha": true
Copy link
Member

Choose a reason for hiding this comment

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

@existentialism existentialism added pkg: preset-env PR: New Feature 🚀 A type of pull request used for our changelog categories labels Nov 15, 2017
@existentialism existentialism merged commit 262d751 into master Nov 15, 2017
@hzoo
Copy link
Member

hzoo commented Nov 15, 2017

nice work @yavorsky!! whoo that was a lot..

hopefully eventually we can simplify all these config+build steps.. and if we can make it small enough just merge it into babel-standalone

@yavorsky yavorsky deleted the babel-preset-env-standalone branch November 17, 2017 00:31
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: preset-env PR: New Feature 🚀 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants