Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
neutrino.register('publish', () => {
const isNextRelease = neutrino.options.args.next
const packageJson = neutrino.options.packageJson
const mainFile = path.resolve(path.join(neutrino.options.output, packageJson.main))
const readme = path.join(__dirname, 'README.md')
return Future.node(done => fs.access(mainFile, done))
.mapRej(() => {
console.log()
console.error('No main file in output directory. Please run npm build')
})
// Create package.json for publishing
.chain(() => {
const trimPackageJson = R.omit([ 'devDependencies', 'scripts' ])()(packageJson)
return Future.encase3(JSON.stringify, trimPackageJson, null, ' ')
})
.chain(packageJsonString => {
const publishablePackageJsonPath = path.resolve(path.join(neutrino.options.output, 'package.json'))
return Future
.node(done => fs.writeFile(publishablePackageJsonPath, packageJsonString, done))
})
export const getNixConfigList = (dirPath: string) =>
node(done => {
readdir(dirPath, done);
}).map(files => files.filter(fileName => /.*\.nix/i.test(fileName)));
user_id =>
Future.node(done => client.post('blocks/destroy', { user_id }, done)).mapRej(
err => new Error(`error on ${user_id} ${err.message}`),
);
.chain(totalEnvCount =>
totalEnvCount > 0
? node(done =>
vscode.commands
.executeCommand(Command.SELECT_ENV_DIALOG)
.then(_ => done(null, true), err => done(err))
)
.map(some)
: of(none)
);
const readFile = file => Future.node(fs.readFile(file, 'utf-8', _))
exports.httpServerBootstrapper = App.do(function*(next) {
log('Connecting HTTP server');
const state = yield Middleware.get;
const mergeState = next => Middleware.modify(req => merge(state, {req})).chain(K(next));
const app = B(mergeState, require('./app'));
const connections = new Set;
const server = App.mount(app, 3000);
server.on('connection', connection => {
connection.once('close', _ => connections.delete(connection));
connections.add(connection);
});
log('Connected HTTP server');
const res = yield next;
log('Disconnecting HTTP server');
yield Middleware.lift(Future.node(done => {
connections.forEach(connection => connection.destroy());
server.close(done);
}));
log('Disconnected HTTP server');
return res;
});
.use(App.do(function*(next) {
const mysqlPool = yield getService('mysqlPool');
const connection = yield Middleware.lift(Future.node(done => mysqlPool.getConnection(done)));
yield putService('connection', connection);
const res = yield next;
connection.release();
return res;
}))