Conversation
| const unresolvedUserFolder: string = homedir(); | ||
| const userProfilePath: string = path.resolve(unresolvedUserFolder); | ||
| if (!FileSystem.exists(userProfilePath)) { | ||
| throw new Error("Unable to determine the current user's home directory"); | ||
| } | ||
|
|
||
| const serveDataPath: string = path.join(userProfilePath, '.rushstack'); | ||
| FileSystem.ensureFolder(serveDataPath); | ||
|
|
||
| const caCertificatePath: string = path.join(serveDataPath, 'rushstack-ca.pem'); | ||
| const certificatePath: string = path.join(serveDataPath, 'rushstack-serve.pem'); | ||
| const keyPath: string = path.join(serveDataPath, 'rushstack-serve.key'); | ||
|
|
||
| if (pemCaCertificate) { | ||
| await FileSystem.writeFileAsync(caCertificatePath, pemCaCertificate); | ||
| } | ||
|
|
||
| await FileSystem.writeFileAsync(certificatePath, pemCertificate); | ||
| await FileSystem.writeFileAsync(keyPath, pemKey); |
There was a problem hiding this comment.
This code should all be redundant; ensureCertificateAsync contains exactly this logic internally.
| const certificateManager: CertificateManager = new CertificateManager(); | ||
|
|
||
| // logger.terminal.writeLine(`Untrusting existing CA certificate`); | ||
| // await certificateManager.untrustCertificateAsync(logger.terminal); | ||
|
|
||
| terminal.writeLine(`Obtaining a TLS certificate signed by a local self-signed Certificate Authority`); | ||
|
|
||
| const { | ||
| pemCaCertificate, | ||
| pemCertificate, | ||
| pemKey | ||
| }: ICertificate & { | ||
| pemCaCertificate?: string; | ||
| } = await certificateManager.ensureCertificateAsync(true, terminal); | ||
|
|
||
| if (!pemCertificate || !pemKey) { | ||
| throw new Error(`No certificate available, exiting.`); | ||
| } | ||
| terminal.writeLine(`Trusted TLS certificate successfully obtained`); |
There was a problem hiding this comment.
| const certificateManager: CertificateManager = new CertificateManager(); | |
| // logger.terminal.writeLine(`Untrusting existing CA certificate`); | |
| // await certificateManager.untrustCertificateAsync(logger.terminal); | |
| terminal.writeLine(`Obtaining a TLS certificate signed by a local self-signed Certificate Authority`); | |
| const { | |
| pemCaCertificate, | |
| pemCertificate, | |
| pemKey | |
| }: ICertificate & { | |
| pemCaCertificate?: string; | |
| } = await certificateManager.ensureCertificateAsync(true, terminal); | |
| if (!pemCertificate || !pemKey) { | |
| throw new Error(`No certificate available, exiting.`); | |
| } | |
| terminal.writeLine(`Trusted TLS certificate successfully obtained`); | |
| context.subscriptions.push( | |
| vscode.commands.registerCommand('rushstack.ensureDebugCertificate', async () => { | |
| const certificateManager: CertificateManager = new CertificateManager(); | |
| // logger.terminal.writeLine(`Untrusting existing CA certificate`); | |
| // await certificateManager.untrustCertificateAsync(logger.terminal); | |
| terminal.writeLine(`Obtaining a TLS certificate signed by a local self-signed Certificate Authority`); | |
| const { | |
| pemCaCertificate, | |
| pemCertificate, | |
| pemKey | |
| }: ICertificate & { | |
| pemCaCertificate?: string; | |
| } = await certificateManager.ensureCertificateAsync(true, terminal); | |
| if (!pemCertificate || !pemKey) { | |
| throw new Error(`No certificate available, exiting.`); | |
| } | |
| terminal.writeLine(`Trusted TLS certificate successfully obtained`); | |
| // TODO: Save the certificates to the remote machine. | |
| // If this ends up requiring a separate extension, this will look something like: | |
| // await vscode.commands.executeCommand('rushstack.saveDebugCertificates', pemCaCertificate, pemCertificate, pemKey); | |
| }); | |
| ); |
dmichon-msft
left a comment
There was a problem hiding this comment.
Although there's a bunch of bogus stuff in package.json, I don't see anything that would explain why the code doesn't run
| // eslint-disable-next-line @typescript-eslint/naming-convention | ||
| '@microsoft/rush-lib': 'commonjs @microsoft/rush-lib', |
There was a problem hiding this comment.
| // eslint-disable-next-line @typescript-eslint/naming-convention | |
| '@microsoft/rush-lib': 'commonjs @microsoft/rush-lib', |
We won't need these for this extension.
| { | ||
| "command": "rushstack.saveDebugCertificate", | ||
| "category": "RushStack", | ||
| "title": "Save Debug Certificate" | ||
| } |
There was a problem hiding this comment.
| { | |
| "command": "rushstack.saveDebugCertificate", | |
| "category": "RushStack", | |
| "title": "Save Debug Certificate" | |
| } |
This belongs to the other extension
| "taskDefinitions": [ | ||
| { | ||
| "type": "rush", | ||
| "required": [ | ||
| "cwd", | ||
| "displayName", | ||
| "command", | ||
| "args" | ||
| ], | ||
| "properties": { | ||
| "cwd": { | ||
| "type": "string", | ||
| "description": "The working directory for the task" | ||
| }, | ||
| "displayName": { | ||
| "type": "string", | ||
| "description": "The display name for the command" | ||
| }, | ||
| "command": { | ||
| "type": "string", | ||
| "description": "The command to run" | ||
| }, | ||
| "args": { | ||
| "type": "array", | ||
| "description": "The arguments to pass to the command" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "type": "rushx", | ||
| "required": [ | ||
| "cwd", | ||
| "command" | ||
| ], | ||
| "properties": { | ||
| "cwd": { | ||
| "type": "string", | ||
| "description": "The working directory for the command" | ||
| }, | ||
| "displayName": { | ||
| "type": "string", | ||
| "description": "The display name for the command" | ||
| }, | ||
| "command": { | ||
| "type": "string", | ||
| "description": "The command to run" | ||
| } | ||
| } | ||
| } | ||
| ], | ||
| "viewsContainers": { | ||
| "activitybar": [ | ||
| { | ||
| "id": "rushstack", | ||
| "title": "Rush Stack", | ||
| "icon": "resources/rushstack-icon.svg" | ||
| } | ||
| ] | ||
| }, |
There was a problem hiding this comment.
| "taskDefinitions": [ | |
| { | |
| "type": "rush", | |
| "required": [ | |
| "cwd", | |
| "displayName", | |
| "command", | |
| "args" | |
| ], | |
| "properties": { | |
| "cwd": { | |
| "type": "string", | |
| "description": "The working directory for the task" | |
| }, | |
| "displayName": { | |
| "type": "string", | |
| "description": "The display name for the command" | |
| }, | |
| "command": { | |
| "type": "string", | |
| "description": "The command to run" | |
| }, | |
| "args": { | |
| "type": "array", | |
| "description": "The arguments to pass to the command" | |
| } | |
| } | |
| }, | |
| { | |
| "type": "rushx", | |
| "required": [ | |
| "cwd", | |
| "command" | |
| ], | |
| "properties": { | |
| "cwd": { | |
| "type": "string", | |
| "description": "The working directory for the command" | |
| }, | |
| "displayName": { | |
| "type": "string", | |
| "description": "The display name for the command" | |
| }, | |
| "command": { | |
| "type": "string", | |
| "description": "The command to run" | |
| } | |
| } | |
| } | |
| ], | |
| "viewsContainers": { | |
| "activitybar": [ | |
| { | |
| "id": "rushstack", | |
| "title": "Rush Stack", | |
| "icon": "resources/rushstack-icon.svg" | |
| } | |
| ] | |
| }, |
These aren't provided by this extension
| } | ||
| }, | ||
| "activationEvents": [ | ||
| "onView:rushCommands" |
There was a problem hiding this comment.
| "onView:rushCommands" |
Not applicable
| "@rushstack/rush-sdk": "workspace:*", | ||
| "@rushstack/ts-command-line": "workspace:*", | ||
| "@rushstack/rush-vscode-command-webview": "workspace:*", |
There was a problem hiding this comment.
| "@rushstack/rush-sdk": "workspace:*", | |
| "@rushstack/ts-command-line": "workspace:*", | |
| "@rushstack/rush-vscode-command-webview": "workspace:*", |
| - script: node $(Build.SourcesDirectory)/common/scripts/install-run-rushx.js package | ||
| workingDirectory: $(Build.SourcesDirectory)/vscode-extensions/tls-certification-ui | ||
| displayName: 'Package tls certification ui extension' | ||
|
|
||
| - script: node $(Build.SourcesDirectory)/common/scripts/install-run-rushx.js deploy | ||
| workingDirectory: $(Build.SourcesDirectory)/vscode-extensions/tls-certification-ui | ||
| displayName: 'Publish tls certification ui extension' | ||
| env: | ||
| VSCE_PAT: $(vscePat) |
There was a problem hiding this comment.
Better to just replicate these two steps for each extension folder in the repository, and keep it all in one pipeline.
Summary
Details
How it was tested
Impacted documentation