Skip to content

Commit

Permalink
Chore: Fix issues with release.ts on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Antón Molleda authored and alrra committed Sep 8, 2017
1 parent ab11a17 commit b087bd5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/release.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { promisify } from 'util';
import * as path from 'path';

import * as chalk from 'chalk';
import * as inquirer from 'inquirer';
Expand Down Expand Up @@ -251,7 +252,7 @@ const stopToUpdateChangelog = async (): Promise<boolean> => {
};

const tagNewVersion = (version: string) => {
exec('Commit changes and tag a new version.', `git add -A && git commit -m 'v${version}' && git tag -a '${version}' -m 'v${version}'`);
exec('Commit changes and tag a new version.', `git add -A && git commit -m "v${version}" && git tag -a "${version}" -m "v${version}"`);
};

const updateFile = (filePath: string, content) => {
Expand All @@ -275,7 +276,7 @@ const updatePackageJSON = (newVersion: SemVer): string => {
const updateSnykSnapshotJSONFile = async () => {

const downloadURL = 'https://snyk.io/partners/api/v2/vulndb/clientside.json';
const downloadLocation = 'src/lib/rules/no-vulnerable-javascript-libraries/snyk-snapshot.json';
const downloadLocation = path.normalize('src/lib/rules/no-vulnerable-javascript-libraries/snyk-snapshot.json');

const res = await promisify(request)({ url: downloadURL });

Expand All @@ -287,7 +288,7 @@ const updateSnykSnapshotJSONFile = async () => {

updateFile(downloadLocation, res.body);

exec(`Commit updated version (if exists) of '${downloadLocation}'.`, `git reset HEAD && git add ${downloadLocation} && git diff --cached --quiet ${downloadLocation} || git commit -m 'Update: \`snyk-snapshot.json\`'`);
exec(`Commit updated version (if exists) of '${downloadLocation}'.`, `git reset HEAD && git add ${downloadLocation} && git diff --cached --quiet ${downloadLocation} || git commit -m "Update: \`snyk-snapshot.json\`"`);

};

Expand All @@ -311,15 +312,15 @@ const main = async () => {
updateChangelog(changelogBody, version);

// Allow users to tweak the changelog file.
if ((await stopToUpdateChangelog()) === false){
if ((await stopToUpdateChangelog()) === false) {
return;
}

// Commit changes and tag a new version.
await tagNewVersion(version);

// Push changes upstreem.
exec('Push changes upstream.', `git push origin master ${version}`);
exec('Push changes upstream.', `git push origin master "${version}"`);

// Extract the release notes from the updated changelog file.
const releaseNotes = await getReleaseNotes();
Expand Down

0 comments on commit b087bd5

Please sign in to comment.