Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// EXEC INTERFACE
export const exec = (command, settings) => {
return new Promise((resolve, reject) => {
_exec(command, settings, (error, stdout) => {
if (error) {
reject(error);
} else {
resolve(stdout);
}
});
});
};
// CUSTOM ERROR
export const SmoothReleaseError = errorEx('SmoothReleaseError');
export const onError = e => {
status.stop();
if (e instanceof SmoothReleaseError) {
error(`\nError: ${e.message}\n`);
} else {
error('\n', e.stack);
}
process.exit(1);
};
// UTILS
export const getCurrentBranch = () => execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8' }).trim();
export const isVersionTag = tag => (
'use strict';
const errorEx = require('error-ex');
const fallback = require('json-parse-better-errors');
const {default: LinesAndColumns} = require('lines-and-columns');
const {codeFrameColumns} = require('@babel/code-frame');
const JSONError = errorEx('JSONError', {
fileName: errorEx.append('in %s'),
codeFrame: errorEx.append('\n\n%s\n')
});
module.exports = (string, reviver, filename) => {
if (typeof reviver === 'string') {
filename = reviver;
reviver = null;
}
try {
try {
return JSON.parse(string, reviver);
} catch (error) {
fallback(string, reviver);
throw error;
}
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
var errorEx = require('error-ex');
var fallback = require('./vendor/parse');
var JSONError = errorEx('JSONError', {
fileName: errorEx.append('in %s')
});
module.exports = function (x, reviver, filename) {
if (typeof reviver === 'string') {
filename = reviver;
reviver = null;
}
try {
try {
return JSON.parse(x, reviver);
} catch (err) {
fallback.parse(x, {
mode: 'json',
reviver: reviver
});
'use strict';
const errorEx = require('error-ex');
const fallback = require('json-parse-better-errors');
const {default: LinesAndColumns} = require('lines-and-columns');
const {codeFrameColumns} = require('@babel/code-frame');
const JSONError = errorEx('JSONError', {
fileName: errorEx.append('in %s'),
codeFrame: errorEx.append('\n\n%s\n')
});
module.exports = (string, reviver, filename) => {
if (typeof reviver === 'string') {
filename = reviver;
reviver = null;
}
try {
try {
return JSON.parse(string, reviver);
} catch (error) {
fallback(string, reviver);
throw error;
}
} catch (error) {