-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from hawkerm/0.9-beta-prep
v0.9 beta work
- Loading branch information
Showing
73 changed files
with
2,140 additions
and
465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[*.cs] | ||
|
||
# CS1591: Missing XML comment for publicly visible type or member | ||
dotnet_diagnostic.CS1591.severity = none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Generate Monaco Typings | ||
======================= | ||
|
||
This [Node.js](https://nodejs.org/) project is provided as a simple way to download the required dependencies needed to take the Monaco TypeScript definition file and generate C# classes for the API via the [TypedocConverter](https://github.com/hez2010/TypedocConverter) project. | ||
|
||
This document assumes you have a Node.js environment setup running on Windows (as PowerShell is also required), but all other dependencies should be installed/setup as part of the script. | ||
|
||
To get started, in this directory just run: | ||
|
||
``` | ||
npm install | ||
``` | ||
|
||
Voila! C# Typings should be generated! Run `npm install` or `npm run postinstall` to re-generate typings again. | ||
|
||
**Note:** The script is configured to overwrite the existing definitions within the main repo, you can configure an alternate output directory (`outdir`) via the `npm config set` command. It defaults to the `MonacoEditorComponent` directory and the namespace will automatically create a `Monaco` sub-directory. | ||
|
||
**Note:** This script is currently meant as a guide-post, the typings generated are not all meant to be consumed directly by the project, and certain interfaces have been sculpted to provide a better experience to C# developers. This tool is mostly meant to boot-strap enabling features from the Monaco API and adapting to new versions of the Monaco API. If you have any questions or need a specific feature, please first file an issue on [our repo](https://github.com/hawkerm/monaco-editor-uwp). Thanks! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# This script run after downloading the npm package dependencies inorder to generate the C# typings. | ||
# https://github.com/hez2010/TypedocConverter | ||
|
||
# Requires .NET Core Runtime 3.1.x to be installed | ||
|
||
# ------------------------ | ||
$monaco_file = ".\node_modules\monaco-editor\monaco.d.ts" | ||
$typedoc_bin_url = $env:npm_package_config_typedocConverter #see config in package.json | ||
$temp_dir_name = ".temp" | ||
|
||
function Get-ScriptDirectory { | ||
Split-Path -parent $PSCommandPath | ||
} | ||
|
||
$script_dir = Get-ScriptDirectory | ||
|
||
Push-Location $script_dir | ||
|
||
# Create Temp Directory and Output | ||
New-Item -Name $temp_dir_name -ItemType Directory | Out-Null | ||
|
||
# Make sure we can see our 'monaco.d.ts' file | ||
|
||
if (!(Test-Path $monaco_file -PathType Leaf)) { | ||
Write-Error "Monaco Definitions Not Found, run npm install first." | ||
|
||
Pop-Location | ||
exit | ||
} | ||
|
||
# Copy monaco.d.ts to monaco.ts in temp folder (need to change extension) | ||
|
||
Copy-Item $monaco_file -Destination (Join-Path $temp_dir_name "monaco.ts") | ||
|
||
Push-Location $temp_dir_name | ||
|
||
# Run typedoc to generate json representation | ||
Write-Output '{"compilerOptions":{"target":"es2020"}}' > tsconfig.json | ||
Invoke-Expression "npx typedoc monaco.ts --json monaco.json" | ||
|
||
# Need TypedocConverter next | ||
Write-Host "Downloading TypedocConverter" | ||
|
||
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls" | ||
Invoke-WebRequest -Uri $typedoc_bin_url -OutFile "TypedocConverter.zip" | ||
|
||
Write-Host "Extracting..." | ||
Expand-Archive "TypedocConverter.zip" -DestinationPath . | ||
|
||
# Now run TypedocConverter on our monaco.json | ||
Invoke-Expression ".\TypedocConverter.exe --inputfile monaco.json --splitfiles true --outputdir ../$env:npm_package_config_outdir --promise-type WinRT --nrt-disabled true" | ||
|
||
Pop-Location | ||
|
||
# Clean-up Temp Dir | ||
Remove-Item $temp_dir_name -Force -Recurse -ErrorAction SilentlyContinue | ||
|
||
Pop-Location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "generatemonacotypings", | ||
"version": "1.0.0", | ||
"description": "Used to Generate C# Typing info for the Monaco editor from its TypeScript definitions (also requires PowerShell)", | ||
"main": "index.js", | ||
"scripts": { | ||
"postinstall": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./generate-typings.ps1" | ||
}, | ||
"author": "", | ||
"license": "MIT", | ||
"config": { | ||
"outdir": "../MonacoEditorComponent", | ||
"typedocConverter": "https://github.com/hez2010/TypedocConverter/releases/download/v2.6/Windows_x64_Native.zip" | ||
}, | ||
"dependencies": { | ||
"monaco-editor": "0.21.3" | ||
}, | ||
"devDependencies": { | ||
"typedoc": "0.20.37", | ||
"typescript": "4.2.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.