Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!opts.dotfiles && ('.' === name[0])) {
return false;
}
if (opts.extensions && opts.extensions.length) {
if (!opts.extensions.some(function (ext) {
return new RegExp('\\.' + escapeRegExp(ext) + '$').test(name);
})) {
return false;
}
}
return true;
}
return new PromiseA(function (resolve) {
var walker = walk.walk(trueRoot)
;
walker.on('nodeError', function (filepath, stat, next) {
//stats.forEach(function (stat) {
if (!filter(stat.name)) {
return;
}
stat.error.path = path.join(strip(prefix, filepath), stat.name);
files.push({
name: stat.name
, relativePath: strip(prefix, filepath)
, path: path.join(strip(prefix, filepath), stat.name)
, type: undefined
private waitUntilDiagramIsDeployed(cancelCallback?: Function): Promise {
return new Bluebird.Promise((resolve: Function, reject: Function, onCancel: Function): void => {
const subscription: Subscription = this.eventAggregator.subscribeOnce(
environment.events.tutorial.diagramDeployed,
() => {
resolve();
},
);
onCancel(() => {
subscription.dispose();
if (cancelCallback) {
cancelCallback();
}
});
});
}
async deleteS3Attachment(accountId, objectId) {
const uploadId = `${accountId}-${objectId}`;
return new Promise((resolve, reject) => {
s3.deleteObject({
Bucket: BUCKET_NAME,
Key: uploadId,
}, (err, data) => {
if (err) {
reject(err);
}
resolve(data);
})
});
}
export function stat(path: string): Promise {
return new Promise((res, rej) => {
fs.stat(path, (err, data) => {
if (err) return rej(err);
res(data);
});
});
}
start () {
return new Promise((resolve, reject) => {
this.server.listen(PORT, () => {
let host = this.server.address().address;
let port = this.server.address().port;
resolve({ host: host, port: port });
}).on('error', (err) => {
reject(err);
});
});
}
interpret(
code: string,
nowExecutingPath: ?string,
asString: boolean,
postErrors: boolean,
getBacktrace: boolean
): Promise {
return new Promise((resolve, reject) => {
var escaped = code
.replace(/[\n\r]/g, '__NL__')
.replace(/\\/g, '__SLASH__')
.replace(/\"/g, '\\"');
var guid = cuid();
var args = [
'"' + guid + '"',
'"' + escaped + '"',
nowExecutingPath ? '"' + nowExecutingPath + '"' : 'nil',
asString ? 'true' : 'false',
postErrors ? 'true' : 'false',
getBacktrace ? 'true' : 'false'
].join(',');
this.stateWatcher.registerCall(guid, { resolve, reject });
resolveIdentifier(identifier: string, file: File): Promise {
const {fileName, baseDirectory, trap} = file;
return new Promise((res, rej) => {
browserResolve(
identifier,
{
filename: fileName,
basedir: baseDirectory,
modules: browserifyBuiltins,
readFile: (path, cb) => trap.readTextCallBack(path, cb),
isFile: (path, cb) => trap.isFileCallBack(path, cb)
},
(err, fileName) => {
if (err) return rej(err);
res(fileName);
}
);
});
}
private waitForDiagramAlreadyExistsModalToStart(): Promise {
return new Bluebird.Promise((resolve: Function): void => {
this.eventAggregator.subscribeOnce(environment.events.tutorial.diagramAlreadyExistsModalStarted, () => {
setTimeout(() => {
resolve();
}, 0);
});
});
}
_invokeLambda(params) {
return new Promise((resolve, reject) => {
this.lambdaClient.invoke(params, (err, data) => {
if (err) {
logger().error('SendEmailService._invokeLambda', 'Error invoking lambda', err, err.stack);
reject(err);
} else {
logger().debug('SendEmailService._invokeLambda', 'Invoked successfully', params);
resolve(data);
}
});
});
}
askQuestions() {
var p = new Promise(resolve => {
inquirer
.prompt([
{
type: 'input',
name: 'name',
message:
"Enter the name of the project you want to create (only letters and '-' allowed)"
},
{
type: 'confirm',
name: 'theme',
message: 'Do you want to install a theme ?',
default: true
},
{
type: 'list',