Adopt monaco-plugin-helpers
parent
2ad83718b7
commit
a8741f55a9
@ -1,30 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const source = path.join(process.cwd(), process.argv[2]);
|
||||
const destination = path.join(process.cwd(), process.argv[3]);
|
||||
|
||||
// ensure target dir
|
||||
(function () {
|
||||
let dirs = [];
|
||||
let dirname = path.dirname(destination);
|
||||
while (dirname !== process.cwd()) {
|
||||
dirs.push(dirname);
|
||||
dirname = path.dirname(dirname);
|
||||
}
|
||||
|
||||
dirs.reverse();
|
||||
|
||||
dirs.forEach((dir) => {
|
||||
try { fs.mkdirSync(dir); } catch (err) { }
|
||||
})
|
||||
})();
|
||||
|
||||
fs.writeFileSync(destination, fs.readFileSync(source));
|
||||
|
||||
console.log(`Copied ${process.argv[2]} to ${process.argv[3]}`);
|
@ -1,52 +0,0 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
exports.getGitVersion = function(repo) {
|
||||
var git = path.join(repo, '.git');
|
||||
var headPath = path.join(git, 'HEAD');
|
||||
var head;
|
||||
|
||||
try {
|
||||
head = fs.readFileSync(headPath, 'utf8').trim();
|
||||
} catch (e) {
|
||||
return void 0;
|
||||
}
|
||||
|
||||
if (/^[0-9a-f]{40}$/i.test(head)) {
|
||||
return head;
|
||||
}
|
||||
|
||||
var refMatch = /^ref: (.*)$/.exec(head);
|
||||
|
||||
if (!refMatch) {
|
||||
return void 0;
|
||||
}
|
||||
|
||||
var ref = refMatch[1];
|
||||
var refPath = path.join(git, ref);
|
||||
|
||||
try {
|
||||
return fs.readFileSync(refPath, 'utf8').trim();
|
||||
} catch (e) {
|
||||
// noop
|
||||
}
|
||||
|
||||
var packedRefsPath = path.join(git, 'packed-refs');
|
||||
var refsRaw;
|
||||
|
||||
try {
|
||||
refsRaw = fs.readFileSync(packedRefsPath, 'utf8').trim();
|
||||
} catch (e) {
|
||||
return void 0;
|
||||
}
|
||||
|
||||
var refsRegex = /^([0-9a-f]{40})\s+(.+)$/gm;
|
||||
var refsMatch;
|
||||
var refs = {};
|
||||
|
||||
while (refsMatch = refsRegex.exec(refsRaw)) {
|
||||
refs[refsMatch[2]] = refsMatch[1];
|
||||
}
|
||||
|
||||
return refs[ref];
|
||||
};
|
@ -1,28 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const target = path.join(process.cwd(), process.argv[2]);
|
||||
if (fs.existsSync(target)) {
|
||||
rmDir(target);
|
||||
}
|
||||
console.log(`Deleted ${process.argv[2]}`);
|
||||
|
||||
function rmDir(dirPath) {
|
||||
let entries = fs.readdirSync(dirPath);
|
||||
if (entries.length > 0) {
|
||||
for (var i = 0; i < entries.length; i++) {
|
||||
var filePath = path.join(dirPath, entries[i]);
|
||||
if (fs.statSync(filePath).isFile()) {
|
||||
fs.unlinkSync(filePath);
|
||||
} else {
|
||||
rmDir(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
fs.rmdirSync(dirPath);
|
||||
}
|
Loading…
Reference in New Issue