-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add scripts to help with packaging and publishing of .vsix
@W-4162004@
- Loading branch information
Nick Chen
committed
Jul 21, 2017
1 parent
1a5ef7b
commit 4102410
Showing
10 changed files
with
125 additions
and
4 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
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
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
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,19 @@ | ||
#!/usr/bin/env node | ||
|
||
const shell = require('shelljs'); | ||
|
||
// Generate the SHA256 for the .vsix that matches the version in package.json | ||
|
||
const packageVersion = JSON.parse(shell.cat('package.json')).version; | ||
const vsix = shell.ls().filter(file => file.match(`-${packageVersion}.vsix`)); | ||
|
||
if (!vsix.length) { | ||
shell.error('No VSIX found matching the requested version in package.json'); | ||
shell.exit(1); | ||
} | ||
|
||
if (/win32/.test(process.platform)) { | ||
shell.exec(`CertUtil -hashfile ${vsix} SHA256`); | ||
} else { | ||
shell.exec(`shasum -a 256 ${vsix}`); | ||
} |
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,24 @@ | ||
#!/usr/bin/env node | ||
|
||
const shell = require('shelljs'); | ||
|
||
// Publishes the .vsix that matches the version in package.json | ||
|
||
const packageVersion = JSON.parse(shell.cat('package.json')).version; | ||
const vsix = shell.ls().filter(file => file.match(`-${packageVersion}.vsix`)); | ||
|
||
if (!vsix.length) { | ||
shell.error('No VSIX found matching the requested version in package.json'); | ||
shell.exit(1); | ||
} | ||
|
||
const vsce = '../../node_modules/.bin/vsce'; | ||
const VSCE_PERSONAL_ACCESS_TOKEN = process.env['VSCE_PERSONAL_ACCESS_TOKEN']; | ||
if (VSCE_PERSONAL_ACCESS_TOKEN) { | ||
shell.exec( | ||
`${vsce} publish --pat ${VSCE_PERSONAL_ACCESS_TOKEN} --packagePath ${vsix}` | ||
); | ||
} else { | ||
// Assume that one has already been configured | ||
shell.exec(`${vsce} publish --packagePath ${vsix}`); | ||
} |
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,54 @@ | ||
#!/usr/bin/env node | ||
|
||
const shell = require('shelljs'); | ||
shell.set('-e'); | ||
shell.set('+v'); | ||
|
||
/* | ||
* Assumptions: | ||
* 0. The script is running locally - it's not optimized for Travis workflow | ||
* yet. | ||
* 1. The script is running in the right branch. | ||
* 2. The script is running in a clean environment - all changes have been | ||
* committed. | ||
*/ | ||
|
||
// Bootstrap | ||
shell.exec('npm run bootstrap'); | ||
|
||
// Compile | ||
shell.exec('npm run compile'); | ||
|
||
// Test | ||
shell.exec('npm run test'); | ||
|
||
// lerna publish | ||
// --skip-npm to increment the version number in all packages but not publish to npmjs | ||
// This will still make a commit in Git with the tag of the version used | ||
const nextVersion = process.env['VERSION_INCREMENT']; | ||
if (nextVersion) { | ||
shell.exec(`lerna publish --exact --repo-version ${nextVersion} --skip-npm`); | ||
} else { | ||
shell.exec('lerna publish --exact --cd-version minor --yes --skip-npm'); | ||
} | ||
|
||
// Generate the .vsix files | ||
shell.exec(`npm run vscode:package`); | ||
|
||
// Generate the SHA256 and append to the file | ||
shell.exec(`npm run vscode:sha256`); | ||
|
||
// Publish to VS Code Marketplace | ||
shell.exec(`npm run vscode:publish`); | ||
|
||
// Push the SHA256 to AWS | ||
shell.exec('aws s3 cp SHA256 s3://dfc-data-production/media/vscode/SHA256'); | ||
|
||
// Add SHA256 to git | ||
shell.exec(`git add SHA256`); | ||
|
||
// Perform these steps manually for now | ||
// Git commit | ||
// shell.exec(`git commit -m "Updated SHA256"`); | ||
// Push back to GitHub | ||
//shell.exec(`git push`); |