-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a599507
commit f389d7c
Showing
1 changed file
with
27 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ const gitHubAuthFunct = () => { return { username: process.env.GITHUB_AUTH_TOKEN | |
|
||
const org = 'jupiterone'; | ||
const repo = process.argv.slice(2); | ||
const prbranch = "yarn2npm-patch1"; | ||
const prbranch = "yarn2npm-patch-1"; | ||
|
||
const tmpDir="yarn2npm_tmp"; | ||
const fs = require('fs'); | ||
|
@@ -75,7 +75,7 @@ const main = async () => { | |
}); | ||
|
||
//Find and replace yarn commands | ||
onsole.log(`Replacing yarn commands with npm`); | ||
console.log(`Replacing yarn commands with npm`); | ||
const packageFile = fs.readFileSync(`package.json`, { | ||
encoding: 'utf8', | ||
flag: 'r', | ||
|
@@ -86,12 +86,37 @@ const main = async () => { | |
if (err) return console.log(err); | ||
}); | ||
|
||
// Check to see if changes needs to be pushed | ||
await pushChanges(`${currentPath}/${dir}`); | ||
|
||
return []; | ||
} catch (e) { | ||
console.log(`Error ${e}`); | ||
} | ||
} | ||
|
||
async function pushChanges (dir) { | ||
console.log(`Pushing changes`); | ||
await git.commit({ | ||
fs, | ||
dir, | ||
author: { | ||
name: 'J1 Security', | ||
email: '[email protected]' | ||
}, | ||
message: 'Updating yarn to npm' | ||
}); | ||
|
||
await git.push({ | ||
fs, | ||
http, | ||
dir, | ||
remote: 'origin', | ||
force: true, | ||
onAuth: gitHubAuthFunct | ||
}); | ||
} | ||
|
||
async function createYarn2NpmBranch (repo, dir, org, branch = prbranch) { | ||
console.log(`Cloning Repo ${org}/${repo}...`); | ||
await cloneRepo(repo, dir, org); | ||
|