This repository has been archived by the owner on Feb 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 263
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
Showing
11 changed files
with
107 additions
and
139 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"eslint.enable": true | ||
} | ||
"eslint.enable": true | ||
} |
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 |
---|---|---|
|
@@ -10,3 +10,4 @@ | |
<h1>Working in progess.</h1> | ||
</body> | ||
</html> | ||
w |
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,34 @@ | ||
/* global __dirname */ | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
/** | ||
* To find the nearest path which contains package.json. | ||
* @param {Function} callback A function which receives current project path. | ||
* @param {String} lastSearch Last path of searching. | ||
* @return {String} Path of current project. | ||
*/ | ||
function getProjPath (callback, lastSearch = __dirname) { | ||
|
||
fs.stat(path.resolve(lastSearch, 'package.json'), (err) => { | ||
|
||
if (err) { | ||
|
||
const nextSearch = path.resolve(lastSearch, '../'); | ||
if (nextSearch === lastSearch) { | ||
|
||
// Reach the root path, but still cannot find package.json | ||
throw new Error('Unable to locate current project path.'); | ||
|
||
} | ||
getProjPath(callback, nextSearch); | ||
|
||
} | ||
callback(lastSearch); | ||
|
||
}); | ||
|
||
} | ||
|
||
module.exports = getProjPath; |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es6" | ||
}, | ||
"checkJs": true, | ||
"exclude": [ | ||
"node_modules", | ||
"dist", | ||
"ghpages" | ||
] | ||
"compilerOptions": { | ||
"target": "es6" | ||
}, | ||
"checkJs": true, | ||
"exclude": [ | ||
"node_modules", | ||
"dist", | ||
"ghpages" | ||
] | ||
} |
Oops, something went wrong.