Skip to content

Commit

Permalink
Issue deployd#16 - fixed eslint issue | no-param-reassign rule
Browse files Browse the repository at this point in the history
  • Loading branch information
saloni.kathuria committed Oct 26, 2019
1 parent 7018e20 commit fb3b01e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
26 changes: 13 additions & 13 deletions lib/cli/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ const start = require('./start');
* Create a new app with folder structure and files
*/
const create = function (name) {
name = name || 'my-deployd-app';
if (test('-d', name)) {
return console.info(`${name} already exists in this directory`);
const newName = name || 'my-deployd-app';
if (test('-d', newName)) {
return console.info(`${newName} already exists in this directory`);
}

mkdir('-p', name);
cp('-Rf', path.join(__dirname, '../createtemplate/*'), name);
mkdir('-p', `${name}/.dpd`);
mkdir('-p', `${name}/.dpd/pids`);
('').to(`${name}/.dpd/pids/mongod`);
mkdir('-p', newName);
cp('-Rf', path.join(__dirname, '../createtemplate/*'), newName);
mkdir('-p', `${newName}/.dpd`);
mkdir('-p', `${newName}/.dpd/pids`);
('').to(`${newName}/.dpd/pids/mongod`);
('# npm\r\nnode_modules/\r\nnpm-debug.log\r\n\r\n# deployd\r\n.dpd/\r\ndata/')
.to(`${name}/.gitignore`);
rm(ls('-R', name).filter(p => path.basename(p) === 'PLACEHOLDER').map(p => `${name}/${p}`));
.to(`${newName}/.gitignore`);
rm(ls('-R', newName).filter(p => path.basename(p) === 'PLACEHOLDER').map(p => `${newName}/${p}`));

process.chdir(name);
process.chdir(newName);

console.log('dpd is installing the dependencies... please be patient (this may take a few minutes)');
const child = exec('npm install',
Expand All @@ -40,10 +40,10 @@ const create = function (name) {
console.log(stderr);
console.log(`npm install error: ${error}`);
} else if (program.dashboard || program.open) {
start(`${name}/app.dpd`);
start(`${newName}/app.dpd`);
} else {
console.info('to start your app:');
console.info('\t$ cd', name);
console.info('\t$ cd', newName);
console.info('\t$ dpd');
}
});
Expand Down
6 changes: 4 additions & 2 deletions lib/keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ Keys.prototype.create = function (fn) {
this.readFile((err, data) => {
if (err) return fn(err);

data[key] = true;
keys.writeFile(data, (errW) => {
const fileData = data;

fileData[key] = true;
keys.writeFile(fileData, (errW) => {
fn(errW, key);
});
});
Expand Down

0 comments on commit fb3b01e

Please sign in to comment.