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

Output ES6 compatible JavaScript to support older browsers #3607

Merged
merged 2 commits into from
Dec 24, 2021
Merged

Output ES6 compatible JavaScript to support older browsers #3607

merged 2 commits into from
Dec 24, 2021

Conversation

FalxDraco
Copy link
Contributor

@FalxDraco FalxDraco commented Dec 23, 2021

Description

Fixes #3537

The project's build system has been modified to output ES6 compatible JavaScript, thus producing a reliable solution for the issue detailed in #3537 as well as defending against future possible issues stemming from usage of bleeding edge JavaScript features.

This allows you JavaScript Wizards to continue writing code the way you like it (with modern idioms) while offering an extra layer of protection against browsers with incomplete or absent coverage of your favorite features.

How Has This Been Tested?

  • Unit tests
  • Visually

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

@henon henon changed the title Reliable fix for #3537. Transpile ES6 to reliably ensure working JS on older browsers Dec 23, 2021
@henon
Copy link
Collaborator

henon commented Dec 23, 2021

Great job! This is a very sustainable solution because it guarantees that any modern JS we use will always be compiled into old-school JS.

@henon henon changed the title Transpile ES6 to reliably ensure working JS on older browsers Output ES6 compatible JavaScript to support older browsers Dec 23, 2021
@henon
Copy link
Collaborator

henon commented Dec 23, 2021

The only problem is the build server who doesn't like it

Run dotnet publish ./MudBlazor.Docs.Server -c Release --runtime win-x64 --self-contained -o /home/runner/.dotnet/mudblazor-dev
Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored /home/runner/work/MudBlazor/MudBlazor/src/MudBlazor.Examples.Data/MudBlazor.Examples.Data.csproj (in 2.41 sec).
  Restored /home/runner/work/MudBlazor/MudBlazor/src/MudBlazor/MudBlazor.csproj (in 2.46 sec).
  Restored /home/runner/work/MudBlazor/MudBlazor/src/MudBlazor.Docs/MudBlazor.Docs.csproj (in 80 ms).
  Restored /home/runner/work/MudBlazor/MudBlazor/src/MudBlazor.Docs.Client/MudBlazor.Docs.Client.csproj (in 99 ms).
  Restored /home/runner/work/MudBlazor/MudBlazor/src/MudBlazor.Docs.Server/MudBlazor.Docs.Server.csproj (in 1.3 sec).
  Generating Docs and Tests
  MudBlazor.Examples.Data -> /home/runner/work/MudBlazor/MudBlazor/src/MudBlazor.Examples.Data/bin/Release/net6.0/MudBlazor.Examples.Data.dll
tsc : error TS5055: Build:Cannot write file '/home/runner/work/MudBlazor/MudBlazor/src/MudBlazor/TScripts/combined/MudBlazor.js' because it would overwrite input file. [/home/runner/work/MudBlazor/MudBlazor/src/MudBlazor/MudBlazor.csproj] [/home/runner/work/MudBlazor/MudBlazor/src/MudBlazor.Docs/MudBlazor.Docs.csproj]
tsc : error TS5055: Build:Cannot write file '/home/runner/work/MudBlazor/MudBlazor/src/MudBlazor/TScripts/combined/MudBlazor.js' because it would overwrite input file. [/home/runner/work/MudBlazor/MudBlazor/src/MudBlazor/MudBlazor.csproj] [/home/runner/work/MudBlazor/MudBlazor/src/MudBlazor.Docs/MudBlazor.Docs.csproj]
  
  The build failed. Fix the build errors and run again.
/home/runner/work/MudBlazor/MudBlazor/src/MudBlazor.Docs/MudBlazor.Docs.csproj(42,5): error MSB3073: The command "dotnet run --configuration release --project "/home/runner/work/MudBlazor/MudBlazor/src/MudBlazor.Docs/../MudBlazor.Docs.Compiler/MudBlazor.Docs.Compiler.csproj"" exited with code 1.
tsc : error TS5055: Build:Cannot write file '/home/runner/work/MudBlazor/MudBlazor/src/MudBlazor/TScripts/combined/MudBlazor.js' because it would overwrite input file. [/home/runner/work/MudBlazor/MudBlazor/src/MudBlazor/MudBlazor.csproj]
tsc : error TS5055: Build:Cannot write file '/home/runner/work/MudBlazor/MudBlazor/src/MudBlazor/TScripts/combined/MudBlazor.js' because it would overwrite input file. [/home/runner/work/MudBlazor/MudBlazor/src/MudBlazor/MudBlazor.csproj]
Error: Process completed with exit code 1.

Any ideas?

@henon henon added the enhancement New feature or request label Dec 23, 2021
@henon henon added this to the 6.0.3 milestone Dec 23, 2021
@FalxDraco
Copy link
Contributor Author

@henon it appears the tsconfig.json file contains brain damage.

@henon henon merged commit 6a5753e into MudBlazor:dev Dec 24, 2021
@henon
Copy link
Collaborator

henon commented Dec 24, 2021

Thanks, you rock!

@FalxDraco
Copy link
Contributor Author

FalxDraco commented Dec 24, 2021

MudBlazor FTW! =>

like-a-boss

@mikes-gh
Copy link
Contributor

mikes-gh commented Jan 1, 2022

@henon This PR has caused a node dependancy.

@FalxDraco
Copy link
Contributor Author

@mikes-gh that would be truly odd. Any supporting facts?

@FalxDraco
Copy link
Contributor Author

@mikes-gh nevermind, I found your pull request details 3652

@mikes-gh
Copy link
Contributor

mikes-gh commented Jan 2, 2022

@FalxDrako Can you explain please. AFAIKS The package you added depends on node? Without it the build fails.

@mikes-gh
Copy link
Contributor

mikes-gh commented Jan 2, 2022

@mikes-gh that would be truly odd. Any supporting facts?

Supporting fact

Error The build task could not find node.exe which is required to run the TypeScript compiler. Please install Node and ensure that the system path contains its location. [C:\Users\xxxx\Source\Repos\GarderobenLast\src\MudBlazor\MudBlazor.csproj] MudBlazor.Docs C:\Users\xxxx.nuget\packages\microsoft.typescript.msbuild\4.5.3\tools\Microsoft.TypeScript.targets 315

mikes-gh pushed a commit to mikes-gh/MudBlazor that referenced this pull request Jan 3, 2022
@FalxDraco
Copy link
Contributor Author

@mikes-gh thanks for the log, it's clear now what is happening.

If you build the project manually from within Visual Studio, the system uses the node.exe binary in shipped with VS, eg. C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Microsoft\VisualStudio\NodeJs while this path is not automatically set by dotnet build.

I remember a time in which tsc was shipped as a binary without a node dependency. I guess I am too old.

To sum it up, node is a hard dependency and I stand corrected.

mikes-gh pushed a commit that referenced this pull request Jan 3, 2022
@mikes-gh
Copy link
Contributor

mikes-gh commented Jan 3, 2022

@mikes-gh thanks for the log, it's clear now what is happening.

If you build the project manually from within Visual Studio, the system uses the node.exe binary in shipped with VS, eg. C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Microsoft\VisualStudio\NodeJs while this path is not automatically set by dotnet build.

I remember a time in which tsc was shipped as a binary without a node dependency. I guess I am too old.

To sum it up, node is a hard dependency and I stand corrected.

Also not everyone is using windows :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please add polyfills for the more exotic JavaScript "features" in MudBlazor
3 participants