@cocreate/cli
Advanced tools
Comparing version 1.10.0 to 1.11.0
@@ -0,1 +1,8 @@ | ||
# [1.11.0](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.10.0...v1.11.0) (2021-10-01) | ||
### Features | ||
* if repository.js is not found will run on current repo using package.json repository url ([5d21460](https://github.com/CoCreate-app/CoCreate-cli/commit/5d2146071ac181f2089787918515d8b8ec602e79)) | ||
# [1.10.0](https://github.com/CoCreate-app/CoCreate-cli/compare/v1.9.4...v1.10.0) (2021-10-01) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@cocreate/cli", | ||
"version": "1.10.0", | ||
"version": "1.11.0", | ||
"description": "A simple cli component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
#!/usr/bin/env node | ||
const minimist = require('minimist'); | ||
const colors = require('colors'); | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
const execute = require('./execute') | ||
const execute = require('./execute'); | ||
const argv = process.argv.slice(2); | ||
@@ -38,10 +35,11 @@ | ||
console.error('can not read repository file in'.red, path, 'error:'.red, err.message.red); | ||
process.exit(1) | ||
process.exit(1); | ||
} | ||
} | ||
const currentRepoPath = path.resolve(process.cwd(), "./repositories.js") | ||
let cliRepoPath = path.resolve(__dirname, '..', 'repositories.js'); | ||
const currentRepoPath = path.resolve(process.cwd(), "./repositories.js"); | ||
// let cliRepoPath = path.resolve(__dirname, '..', 'repositories.js'); | ||
let packageJsonPath = path.resolve(process.cwd(), './package.json'); | ||
let repoDir, doAllRepo; | ||
console.log(cliRepoPath) | ||
if (fs.existsSync(config['c'])) { | ||
@@ -51,22 +49,33 @@ repos = getRepositories(config['c']); | ||
doAllRepo = false; | ||
console.warn(`using ${config['c']} configuration`.yellow) | ||
console.warn(`using ${config['c']} configuration`.yellow); | ||
} | ||
else if(fs.existsSync(currentRepoPath)) | ||
{ | ||
repos = getRepositories(currentRepoPath); | ||
repoDir = path.dirname(currentRepoPath); | ||
doAllRepo = true; | ||
console.warn(`using ${currentRepoPath} configuration`.yellow); | ||
else if(fs.existsSync(currentRepoPath)) { | ||
repos = getRepositories(currentRepoPath); | ||
repoDir = path.dirname(currentRepoPath); | ||
doAllRepo = true; | ||
console.warn(`using ${currentRepoPath} configuration`.yellow); | ||
} | ||
else if (fs.existsSync(cliRepoPath)) { | ||
else if (fs.existsSync(packageJsonPath)) { | ||
let repoPath = path.resolve(process.cwd()); | ||
let packageObj = require(packageJsonPath); | ||
let repoUrl = packageObj.repository.url.substr(12); | ||
repos = [{ | ||
path: `${repoPath}`, | ||
repo: `${repoUrl}` | ||
}]; | ||
repoDir = path.dirname(packageJsonPath); | ||
doAllRepo = false; | ||
console.warn(`using ${packageJsonPath} configuration`.yellow); | ||
} | ||
// else if (fs.existsSync(cliRepoPath)) { | ||
repos = getRepositories(cliRepoPath) | ||
repoDir = path.dirname(cliRepoPath); | ||
doAllRepo = false; | ||
console.warn(`using ${cliRepoPath} configuration`.yellow) | ||
// repos = getRepositories(cliRepoPath) | ||
// repoDir = path.dirname(cliRepoPath); | ||
// doAllRepo = false; | ||
// console.warn(`using ${cliRepoPath} configuration`.yellow) | ||
} | ||
// } | ||
else { | ||
console.error(`a condfiguration file can not be found`.red) | ||
process.exit(1) | ||
console.error(`a configuration file can not be found`.red); | ||
process.exit(1); | ||
} | ||
@@ -81,5 +90,5 @@ config = {hideMessage: false, ...config, repoDir, doAllRepo }; | ||
if (!fs.existsSync(ppath)) | ||
console.error(`${ppath} not found`.red) | ||
console.error(`${ppath} not found`.red); | ||
return { ...meta, name, ppath, plainName } | ||
return { ...meta, name, ppath, plainName }; | ||
} | ||
@@ -95,9 +104,9 @@ catch (err) { | ||
let failed = await execute(command, repoFullMeta, config) | ||
let failed = await execute(command, repoFullMeta, config); | ||
if (failed.length === 0) | ||
process.exit(0); | ||
else { | ||
console.log(' **************** failures **************** '.red) | ||
console.log(' **************** failures **************** '.red); | ||
for (let failure of failed) | ||
console.log(`${failure.name}: ${failure.des}`.red) | ||
console.log(`${failure.name}: ${failure.des}`.red); | ||
@@ -104,0 +113,0 @@ } |
@@ -38,2 +38,4 @@ const colors = require('colors'); | ||
for (let repo of repos) { | ||
if (!repo) | ||
console.log(repo, repos) | ||
// let repo = {name: 'aa', ppath: '/home/ubuntu/environment/CoCreate-plugins/CoCreate-sendgrid'} | ||
@@ -40,0 +42,0 @@ try { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
102985
1975
28