update
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2015 Douglas Christopher Wilson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/call-bind-apply-helpers
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
@@ -0,0 +1,100 @@
|
||||
module.exports = version;
|
||||
module.exports.pin = pin;
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var exec = require('child_process').exec;
|
||||
var root = null;
|
||||
|
||||
function pin() {
|
||||
return version().then(function (v) {
|
||||
version.pinned = v;
|
||||
});
|
||||
}
|
||||
|
||||
function version(callback) {
|
||||
// first find the package.json as this will be our root
|
||||
var promise = findPackage(path.dirname(module.parent.filename))
|
||||
.then(function (dir) {
|
||||
// now try to load the package
|
||||
var v = require(path.resolve(dir, 'package.json')).version;
|
||||
|
||||
if (v && v !== '0.0.0-development') {
|
||||
return v;
|
||||
}
|
||||
|
||||
root = dir;
|
||||
|
||||
// else we're in development, give the commit out
|
||||
// get the last commit and whether the working dir is dirty
|
||||
var promises = [
|
||||
branch().catch(function () { return 'master'; }),
|
||||
commit().catch(function () { return '<none>'; }),
|
||||
dirty().catch(function () { return 0; }),
|
||||
];
|
||||
|
||||
// use the cached result as the export
|
||||
return Promise.all(promises).then(function (res) {
|
||||
var branch = res[0];
|
||||
var commit = res[1];
|
||||
var dirtyCount = parseInt(res[2], 10);
|
||||
var curr = branch + ': ' + commit;
|
||||
if (dirtyCount !== 0) {
|
||||
curr += ' (' + dirtyCount + ' dirty files)';
|
||||
}
|
||||
|
||||
return curr;
|
||||
});
|
||||
}).catch(function (error) {
|
||||
console.log(error.stack);
|
||||
throw error;
|
||||
});
|
||||
|
||||
if (callback) {
|
||||
promise.then(function (res) {
|
||||
callback(null, res);
|
||||
}, callback);
|
||||
}
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
function findPackage(dir) {
|
||||
if (dir === '/') {
|
||||
return Promise.reject(new Error('package not found'));
|
||||
}
|
||||
return new Promise(function (resolve) {
|
||||
fs.stat(path.resolve(dir, 'package.json'), function (error, exists) {
|
||||
if (error || !exists) {
|
||||
return resolve(findPackage(path.resolve(dir, '..')));
|
||||
}
|
||||
|
||||
resolve(dir);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function command(cmd) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
exec(cmd, { cwd: root }, function (err, stdout, stderr) {
|
||||
var error = stderr.trim();
|
||||
if (error) {
|
||||
return reject(new Error(error));
|
||||
}
|
||||
resolve(stdout.split('\n').join(''));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function commit() {
|
||||
return command('git rev-parse HEAD');
|
||||
}
|
||||
|
||||
function branch() {
|
||||
return command('git rev-parse --abbrev-ref HEAD');
|
||||
}
|
||||
|
||||
function dirty() {
|
||||
return command('expr $(git status --porcelain 2>/dev/null| ' +
|
||||
'egrep "^(M| M)" | wc -l)');
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<HTMLCodeStyleSettings>
|
||||
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
||||
<option name="HTML_ENFORCE_QUOTES" value="true" />
|
||||
</HTMLCodeStyleSettings>
|
||||
<JSCodeStyleSettings version="0">
|
||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
||||
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||
</JSCodeStyleSettings>
|
||||
<TypeScriptCodeStyleSettings version="0">
|
||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
||||
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||
</TypeScriptCodeStyleSettings>
|
||||
<VueCodeStyleSettings>
|
||||
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
|
||||
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
|
||||
</VueCodeStyleSettings>
|
||||
<codeStyleSettings language="HTML">
|
||||
<option name="SOFT_MARGINS" value="100" />
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JavaScript">
|
||||
<option name="SOFT_MARGINS" value="100" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="TypeScript">
|
||||
<option name="SOFT_MARGINS" value="100" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Vue">
|
||||
<option name="SOFT_MARGINS" value="100" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
<option name="TAB_SIZE" value="4" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
||||
Reference in New Issue
Block a user