Skip to content

Commit a2e01db

Browse files
authored
Merge branch 'main' into benibenj/narrow-smelt
2 parents 134eaa6 + 3090717 commit a2e01db

File tree

4 files changed

+92
-47
lines changed

4 files changed

+92
-47
lines changed

package-lock.json

+67-43
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"hosted-git-info": "^4.0.2",
5151
"jsonc-parser": "^3.2.0",
5252
"leven": "^3.1.0",
53-
"markdown-it": "^12.3.2",
53+
"markdown-it": "^14.1.0",
5454
"mime": "^1.3.4",
5555
"minimatch": "^3.0.3",
5656
"parse-semver": "^1.1.1",
@@ -95,4 +95,4 @@
9595
"watch-files": "src/**",
9696
"spec": "src/test/**/*.ts"
9797
}
98-
}
98+
}

src/main.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import program from 'commander';
22
import leven from 'leven';
3-
import { packageCommand, ls, Targets, generateManifest } from './package';
3+
import { packageCommand, ls, Targets, generateManifest, verifySignature } from './package';
44
import { publish, unpublish } from './publish';
55
import { show } from './show';
66
import { search } from './search';
@@ -317,6 +317,14 @@ module.exports = function (argv: string[]): void {
317317
.option('-o, --out <path>', 'Output the extension manifest to <path> location (defaults to <packagename>.manifest)')
318318
.action(({ packagePath, out }) => main(generateManifest(packagePath, out)));
319319

320+
program
321+
.command('verify-signature')
322+
.description('Verifies the provided signature file against the provided VSIX package and manifest.')
323+
.requiredOption('-i, --packagePath <path>', 'Path to the VSIX package')
324+
.requiredOption('-m, --manifestPath <path>', 'Path to the Manifest file')
325+
.requiredOption('-s, --signaturePath <path>', 'Path to the Signature file')
326+
.action(({ packagePath, manifestPath, signaturePath }) => main(verifySignature(packagePath, manifestPath, signaturePath)));
327+
320328
program
321329
.command('ls-publishers')
322330
.description('Lists all known publishers')

src/package.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -1885,6 +1885,19 @@ export function generateManifest(packageFile: string, outputFile?: string): Prom
18851885
return vsceSign.generateManifest(packageFile, outputFile);
18861886
}
18871887

1888+
export async function verifySignature(packageFile: string, manifestFile: string, signatureFile: string): Promise<void> {
1889+
const sigzipPath = await createSignatureArchive(manifestFile, signatureFile);
1890+
try {
1891+
const result = await vsceSign.verify(packageFile, sigzipPath, true);
1892+
console.log(`Signature verification result: ${result.code}`);
1893+
if (result.output) {
1894+
console.log(result.output)
1895+
}
1896+
} finally {
1897+
await fs.promises.unlink(sigzipPath);
1898+
}
1899+
}
1900+
18881901
// Create a signature zip file containing the manifest and signature file
18891902
export async function createSignatureArchive(manifestFile: string, signatureFile: string, outputFile?: string): Promise<string> {
18901903
return vsceSign.zip(manifestFile, signatureFile, outputFile)
@@ -2021,7 +2034,7 @@ export async function printAndValidatePackagedFiles(files: IFile[], cwd: string,
20212034
message += unusedIncludePatterns.map(p => ` - ${p}`).join('\n');
20222035
message += '\nRemove any include pattern which is not needed.\n';
20232036
message += `\n=> Run ${chalk.bold('vsce ls --tree')} to see all included files.\n`;
2024-
message += `=> Use ${chalk.bold('--allow-unused-files-patterns')} to skip this check`;
2037+
message += `=> Use ${chalk.bold('--allow-unused-files-pattern')} to skip this check`;
20252038
util.log.error(message);
20262039
process.exit(1);
20272040
}

0 commit comments

Comments
 (0)