Skip to content

Use babel@7 and webpack@4 to build#156

Merged
compulim merged 9 commits intomicrosoft:masterfrom
compulim:preview2
Feb 5, 2019
Merged

Use babel@7 and webpack@4 to build#156
compulim merged 9 commits intomicrosoft:masterfrom
compulim:preview2

Conversation

@compulim
Copy link
Copy Markdown
Collaborator

@compulim compulim commented Feb 2, 2019

This PR is based on some of the work from #111.

Implementation

Instead of using ts-loader to build during Webpack, we are using Babel to do all transpilation.

As suggested by TypeScript team, the following plugins and presets are used.

  • @babel/plugin-proposal-class-properties
  • @babel/plugin-proposal-object-rest-spread
  • @babel/preset-typescript
  • @babel/preset-env

In addition, we will use @babel/plugin-transform-runtime to bundle @babel/runtime.

We kept the original file architecture (/directLine.js, /built/directLine.js), instead of opting for a more modern approach. This is a consideration for users using our bundle thru https://unpkg.com/botframework-directlinejs/directLine.js.

This PR also added a test harness which will emulate response from Azure Bot Services.

Also added a test page for trying out directLine.js bundle in pure JavaScript (without Web Chat). This is useful because some of our customers use DirectLineJS directly from CDN. We should turn this test page into a sample later.

image

Changelog

Changed

  • Used @babel/preset-typescript and webpack@4 to build, in PR #156
    • Moved to inline source map for pre-bundle
    • Added .editorconfig and .vscode for new line and tab size rules

Comment thread .editorconfig Outdated
@@ -0,0 +1,18 @@
[*]
charset=utf-8
end_of_line=crlf
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👎

This should not be necessary with the git attribute

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@justinwilaby can you chime in?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

.editorconfig is an editor/ide agnostic config used for formatting and is mutually exclusive from git attribute. For open source, these are important since a wide range of editors support it even if there is some duplication

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should allow our editors to write the file with their native line ending. Git will convert it to whatever your os prefers on checkout.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also to be clear, I just mean removing the end_of_line config, not the entire editor config.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is inconsequential since all modern platforms recognize \r\n, especially editors editing js. ¯_(ツ)_/¯

We can remove it if it unblocks this PR. I think we should have some more consistent guidelines around what constitutes blocking a PR by requesting changes. It seems silly to prevent this PR from going in because of this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Removed for now. Let's discuss it later in meetings.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's incorrect. Shell scripts must have unix line endings.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it looks like the editorconfig project has quite a discussion on this. it seems inconclusive but generally the recommendation is the following:

end_of_line
Line ending file format (Unix, DOS, Mac)

The values are case insensitive. They will be lowercased by the core library.

NOTE: if you want to use native line endings between different operating systems it is better not to set this option and leave that task to the VCS! In the future we might add a value like native for this scenario (cf #226).

thread: editorconfig/editorconfig#226

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry. I did't realize we are using shell scripts in this project.

Comment thread .editorconfig Outdated
Copy link
Copy Markdown
Contributor

@a-b-r-o-w-n a-b-r-o-w-n left a comment

Choose a reason for hiding this comment

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

Overall this looks good. There is one thing that I don't think is needed in the editorconfig though

@compulim
Copy link
Copy Markdown
Collaborator Author

compulim commented Feb 4, 2019

Pinged @justinwilaby, the original author of .editorconfig.

@compulim compulim merged commit 6139191 into microsoft:master Feb 5, 2019
@compulim compulim deleted the preview2 branch February 5, 2019 22:24
@compulim
Copy link
Copy Markdown
Collaborator Author

compulim commented Feb 5, 2019

It's in!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants