-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move more work into initialise script.
- Loading branch information
1 parent
3adadb4
commit ba706c5
Showing
6 changed files
with
71 additions
and
17 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# npm rescue | ||
|
||
This is an npm-rescue git repository. Each branch in this repo contains a backup of a `node_modules` directory and its corresponding `package.json` file for a given npm project. | ||
|
||
See [npm-rescue](http://github.com/lifebeyondfife/npm-rescue) for project home. |
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,22 @@ | ||
'use strict'; | ||
const fs = require('fs-extra'); | ||
const git = require('nodegit'); | ||
const path = require('path'); | ||
|
||
const headCommit = (repo, gitDirectory, gitUsername, gitEmailAddress) => { | ||
return new Promise((resolve, reject) => { | ||
const readme = path.resolve(gitDirectory, 'README.md'); | ||
|
||
fs.copySync(path.resolve('./docs', 'README.md'), readme); | ||
|
||
const signature = git.Signature.now(gitUsername, gitEmailAddress); | ||
|
||
repo.createCommitOnHead([readme], signature, signature, 'Initial npm-rescue commit.').then(oid => { | ||
return resolve({headCommitOid: oid.tostrS(), gitDirectory}); | ||
}).catch(error => { | ||
return reject(error); | ||
}); | ||
}); | ||
}; | ||
|
||
module.exports = headCommit; |
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