mirror of
https://github.com/microsoft/playwright.git
synced 2024-11-28 01:15:10 +03:00
chore(dotnet): fix channel generation for 1.17 (#10711)
This commit is contained in:
parent
7765131a14
commit
c3687a693b
@ -96,7 +96,7 @@ classNameMap.set('Readable', 'Stream');
|
||||
* @param {string} folder
|
||||
* @param {string} extendsName
|
||||
*/
|
||||
function writeFile(kind, name, spec, body, folder, extendsName = null, namespace = "Microsoft.Playwright") {
|
||||
function writeFile(kind, name, spec, body, folder, extendsName = null) {
|
||||
const out = [];
|
||||
// console.log(`Generating ${name}`);
|
||||
|
||||
@ -122,7 +122,7 @@ function writeFile(kind, name, spec, body, folder, extendsName = null, namespace
|
||||
out.push(...body);
|
||||
out.push('}');
|
||||
|
||||
let content = template.replace('[NAMESPACE]', namespace).replace('[CONTENT]', out.join(EOL));
|
||||
let content = template.replace('[CONTENT]', out.join(EOL));
|
||||
fs.writeFileSync(path.join(folder, name + '.cs'), content);
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ using System.Threading.Tasks;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace [NAMESPACE]
|
||||
namespace Microsoft.Playwright
|
||||
{
|
||||
[CONTENT]
|
||||
}
|
||||
|
9
utils/generate_dotnet_channels.js
Executable file → Normal file
9
utils/generate_dotnet_channels.js
Executable file → Normal file
@ -18,7 +18,6 @@
|
||||
// @ts-check
|
||||
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const yaml = require('yaml');
|
||||
|
||||
@ -41,8 +40,13 @@ function mapType(type) {
|
||||
return 'bool';
|
||||
if (type === 'number')
|
||||
return 'int';
|
||||
// TODO: keep the same names in .NET as upstream
|
||||
if (type === 'ResourceTiming')
|
||||
return 'RequestTimingResult';
|
||||
if (type === 'LifecycleEvent')
|
||||
return 'WaitUntilState';
|
||||
if (type === 'NameValue')
|
||||
return 'HeaderEntry';
|
||||
return type;
|
||||
}
|
||||
|
||||
@ -65,7 +69,7 @@ function inlineType(type, indent = '', wrapEnums = false) {
|
||||
return { ts: mapType(type), scheme: `t${titleCase(type)}`, optional };
|
||||
}
|
||||
if (channels.has(type))
|
||||
return { ts: `${type}`, scheme: `tChannel('${type}')` , optional };
|
||||
return { ts: `Core.${type}`, scheme: `tChannel('${type}')` , optional };
|
||||
if (type === 'Channel')
|
||||
return { ts: `Channel`, scheme: `tChannel('*')`, optional };
|
||||
return { ts: mapType(type), scheme: `tType('${type}')`, optional };
|
||||
@ -179,7 +183,6 @@ for (const [name, item] of Object.entries(protocol)) {
|
||||
*/
|
||||
`)
|
||||
channels_ts.push('using System.Collections.Generic;');
|
||||
channels_ts.push('using Microsoft.Playwright.Core;');
|
||||
channels_ts.push(``);
|
||||
channels_ts.push(`namespace Microsoft.Playwright.Transport.Protocol`);
|
||||
channels_ts.push(`{`);
|
||||
|
Loading…
Reference in New Issue
Block a user