@cocreate/cli 1.14.30 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/repoList.js DELETED
@@ -1,44 +0,0 @@
1
- const path = require("path");
2
- const fs = require("fs");
3
-
4
- module.exports = async function getRepoList(){
5
- const currentRepoPath = path.resolve(process.cwd(), "./repositories.js");
6
- const packageJsonPath = path.resolve(process.cwd(), './package.json');
7
-
8
- let repos, repoDir, doAllRepo;
9
-
10
- if (fs.existsSync(currentRepoPath)) {
11
- repos = getRepositories(currentRepoPath);
12
- repoDir = path.dirname(currentRepoPath);
13
- doAllRepo = true;
14
- console.warn(`using ${currentRepoPath} configuration`.yellow);
15
- }
16
- else if (fs.existsSync(packageJsonPath)) {
17
- let repoPath = path.resolve(process.cwd());
18
- let packageObj = require(packageJsonPath);
19
- let repoUrl = packageObj.repository.url.substr(12);
20
- repos = [{
21
- path: `${repoPath}`,
22
- repo: `${repoUrl}`
23
- }];
24
- repoDir = path.dirname(packageJsonPath);
25
- doAllRepo = false;
26
- console.warn(`using ${packageJsonPath} configuration`.yellow);
27
- }
28
- else {
29
- console.error(`a configuration file can not be found`.red);
30
- process.exit(1);
31
- }
32
-
33
- return repos;
34
- }
35
-
36
- function getRepositories(path) {
37
- try {
38
- return require(path);
39
- }
40
- catch (err) {
41
- console.error('can not read repository file in'.red, path, 'error:'.red, err.message.red);
42
- process.exit(1);
43
- }
44
- }