Comparing version 1.3.2 to 1.3.7
{ | ||
"name": "depsync", | ||
"version": "1.3.2", | ||
"version": "1.3.7", | ||
"author": "Dom Chen", | ||
@@ -5,0 +5,0 @@ "homepage": "http://www.idom.me/", |
@@ -33,2 +33,3 @@ ////////////////////////////////////////////////////////////////////////////////////// | ||
const ActionTask = require("./ActionTask"); | ||
const SubRepoTask = require("./SubRepoTask"); | ||
const TaskRunner = require("./TaskRunner"); | ||
@@ -42,2 +43,3 @@ const path = require("path"); | ||
this.nonRecursive = nonRecursive; | ||
this.unfinishFile = path.join(path.dirname(this.configFile), ".git/.DEPS.unfinished"); | ||
} | ||
@@ -62,4 +64,10 @@ | ||
} | ||
let repoDirty = false; | ||
if (commit !== item.commit || wasShallow !== item.shallow) { | ||
repoDirty = true; | ||
tasks.push(new RepoTask(item)); | ||
} | ||
if (repoDirty || fs.existsSync(this.unfinishFile)) { | ||
let subRepoTask = new SubRepoTask(item); | ||
tasks.push(subRepoTask); | ||
if (!this.nonRecursive) { | ||
@@ -80,4 +88,9 @@ let depsFile = path.join(item.dir, "DEPS"); | ||
} | ||
let item = {dir: path.dirname(this.configFile)}; | ||
let subRepoTask = new SubRepoTask(item); | ||
tasks.push(subRepoTask); | ||
Utils.writeFile(this.unfinishFile, "depsync is syncing..."); | ||
TaskRunner.runTasks(tasks, () => { | ||
Utils.deletePath(this.unfinishFile); | ||
Utils.deleteEmptyDir(path.dirname(this.unfinishFile)); | ||
callback && callback(); | ||
@@ -84,0 +97,0 @@ }); |
@@ -29,2 +29,3 @@ ////////////////////////////////////////////////////////////////////////////////////// | ||
const fs = require('fs'); | ||
const os = require('os') | ||
const Utils = require("../Utils"); | ||
@@ -82,9 +83,7 @@ | ||
Utils.exec("git fetch --depth 1 origin " + item.commit, item.dir); | ||
Utils.exec("git reset --hard FETCH_HEAD -q", item.dir); | ||
Utils.exec("git submodule update --quiet --init --recursive --depth=1", item.dir, false); | ||
} else { | ||
Utils.exec("git fetch origin " + item.commit, item.dir); | ||
Utils.exec("git reset --hard FETCH_HEAD -q", item.dir); | ||
Utils.exec("git submodule update --quiet --init --recursive", item.dir, false); | ||
} | ||
process.env["GIT_LFS_SKIP_SMUDGE"]="1"; | ||
Utils.exec("git reset --hard FETCH_HEAD", item.dir); | ||
callback && callback(); | ||
@@ -91,0 +90,0 @@ }; |
@@ -168,4 +168,11 @@ ////////////////////////////////////////////////////////////////////////////////////// | ||
function exec(cmd, dir, quiet) { | ||
if (!dir) { | ||
dir = process.cwd(); | ||
} else { | ||
dir = path.resolve(dir); | ||
} | ||
let options = { | ||
shell: os.platform() === "win32" ? "cmd.exe" : true, cwd: dir, env: process.env | ||
shell: os.platform() === "win32" ? "cmd.exe" : true, | ||
cwd: dir, | ||
env: process.env | ||
} | ||
@@ -187,2 +194,22 @@ | ||
function execSafe(cmd, dir) { | ||
if (!dir) { | ||
dir = process.cwd(); | ||
} else { | ||
dir = path.resolve(dir); | ||
} | ||
let options = { | ||
shell: os.platform() === "win32" ? "cmd.exe" : true, | ||
cwd: dir, | ||
env: process.env | ||
} | ||
try { | ||
let result = childProcess.spawnSync(cmd, options); | ||
return result.stdout.toString(); | ||
} catch (e) { | ||
return ""; | ||
} | ||
} | ||
function addLineBreaker() { | ||
@@ -198,4 +225,5 @@ hasLineBreaker = true; | ||
exports.exec = exec; | ||
exports.execSafe = execSafe; | ||
exports.log = log; | ||
exports.error = error; | ||
exports.addLineBreaker = addLineBreaker; |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
52457
16
1235
14