Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: felipecrs/semantic-release-vsce
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.2.0
Choose a base ref
...
head repository: felipecrs/semantic-release-vsce
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.3.0
Choose a head ref
  • 4 commits
  • 6 files changed
  • 2 contributors

Commits on Mar 2, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    5fa5f1c View commit details

Commits on Mar 4, 2021

  1. Verified

    This commit was signed with the committer’s verified signature.
    crazy-max CrazyMax
    Copy the full SHA
    c061342 View commit details

Commits on Mar 11, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    1bb5721 View commit details
  2. feat: add support for VSCE_PAT env var and deprecate VSCE_TOKEN (#…

    …109)
    
    This adds support for using the VSCE_PAT environment variable supported in vsce. If both VSCE_PAT
    and VSCE_TOKEN are set in the environment then VSCE_PAT is preferred.
    
    Also deprecates the VSCE_TOKEN.
    
    Closes #84
    ewanharris authored Mar 11, 2021

    Verified

    This commit was signed with the committer’s verified signature.
    crazy-max CrazyMax
    Copy the full SHA
    fbe1ea9 View commit details
Showing with 140 additions and 135 deletions.
  1. +1 −1 README.md
  2. +1 −3 lib/publish.js
  3. +9 −4 lib/verify-auth.js
  4. +73 −125 package-lock.json
  5. +28 −2 test/publish.test.js
  6. +28 −0 test/verify-auth.test.js
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ Prior to v13, you had to override `getLastRelease` to use `@semantic-release/git

#### Travis example

Secret environment variables: `VSCE_TOKEN`
Secret environment variables: `VSCE_PAT`

Example:

4 changes: 1 addition & 3 deletions lib/publish.js
Original file line number Diff line number Diff line change
@@ -2,13 +2,11 @@ const execa = require('execa');
const { readJson } = require('fs-extra');

module.exports = async (version, yarn, logger) => {
const { VSCE_TOKEN } = process.env;

const { publisher, name } = await readJson('./package.json');

logger.log('Publishing version %s to vs code marketplace', version);

const options = ['publish', '--pat', VSCE_TOKEN];
const options = ['publish'];

if (yarn) {
options.push('--yarn');
13 changes: 9 additions & 4 deletions lib/verify-auth.js
Original file line number Diff line number Diff line change
@@ -3,14 +3,19 @@ const SemanticReleaseError = require('@semantic-release/error');

module.exports = async (logger) => {
logger.log('Verify authentication for vsce');
const { VSCE_TOKEN } = process.env;

if (!VSCE_TOKEN) {
throw new SemanticReleaseError('No vsce personal access token specified (set the "VSCE_TOKEN" environment variable).', 'ENOVSCEPAT');
if (!('VSCE_PAT' in process.env) && ('VSCE_TOKEN' in process.env)) {
logger.log('VSCE_TOKEN is deprecated and may be removed in the next major release, please use VSCE_PAT instead.');
process.env.VSCE_PAT = process.env.VSCE_TOKEN;
}

if (!process.env.VSCE_PAT) {
throw new SemanticReleaseError('No vsce personal access token specified (set the "VSCE_PAT" environment variable).', 'ENOVSCEPAT');
}

try {
execa.sync('vsce', ['verify-pat', '--pat', VSCE_TOKEN]);
const options = ['verify-pat'];
execa.sync('vsce', options);
} catch (e) {
throw new SemanticReleaseError(`Invalid vsce token. Additional information:\n\n${e}`, 'EINVALIDVSCETOKEN');
}
Loading