Skip to content

Commit

Permalink
Removed tmpdir from script.
Browse files Browse the repository at this point in the history
Added readme.
  • Loading branch information
electricgull committed Mar 10, 2023
1 parent 0547906 commit 677a390
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
31 changes: 31 additions & 0 deletions yarn2npm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Yarn to NPM script

This script will convert a project from yarn to npm.

## Building

Install dependencies and build with:

```
npm install
```

## Running the script

You must set the following ENV vars:

```
GITHUB_AUTH_TOKEN=<your token here>
```

Run the script from within a temp directory

```
cameron@laptop Code % git clone [email protected]:JupiterOne/secops-automation-examples.git
cameron@laptop Code % mkdir tmpDir
cameron@laptop Code % cd tmpDir
cgriffin@cgriffin-MBP tmpDir % node ../secops-automation-examples/yarn2npm/yarn2npm.js test-aut-web-juno
```

A new branch will be created in the repo specified. Log files will be stored in a yarn2npm folder. Please remove these before
pushing changes to main. If there was a problem running npm install, a failure.lock will be present in the yarn2npm folder.
1 change: 0 additions & 1 deletion yarn2npm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions yarn2npm/yarn2npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,19 @@ const http = require('isomorphic-git/http/node');
const gitHubAuthFunct = () => { return { username: process.env.GITHUB_AUTH_TOKEN, password: '' }; };

const org = 'jupiterone';
const repoName = process.argv.slice(2);
const prbranch = "yarn2npm-patch-1";

const repoPath= './yarn2npm_tmp';
const fs = require('fs');
const path = require("path");
const dir = `${repoPath}/${repoName}`;
const repoName = process.argv.slice(2);
const dir = `./${repoName}`;
const backupDir = 'yarn2npm';



const main = async () => {
try {
const origPath = process.cwd();

//Create tmp working
if (!fs.existsSync(repoPath)){
fs.mkdirSync(repoPath);
}

//Create github branch
await createYarn2NpmBranch(repoName, dir, org)
Expand Down

0 comments on commit 677a390

Please sign in to comment.