Skip to content

Commit

Permalink
feat(packgage.json): add package.json for project init
Browse files Browse the repository at this point in the history
  • Loading branch information
robophil committed Oct 13, 2017
1 parent c55e6a9 commit 446f5db
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
16 changes: 14 additions & 2 deletions bin/cmd/new.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require('fs-extra')
const path = require('path')
const replace = require('replace-in-file')
const cwd = process.cwd()

const postfixName = '-service'
Expand All @@ -24,8 +25,19 @@ module.exports = (name, options) => {
const src = path.resolve(__dirname, '..', '..', 'files/action')
const dest = `${cwd}/${name}`

return fs.copy(src, dest)
const configSrc = path.resolve(__dirname, '..', '..', 'files/config')
const configDest = `${cwd}/${name}/config`

return Promise.all([fs.copy(src, dest), fs.copy(configSrc, configDest)])
}).then(() => {
console.log('made new projject')
console.log(`\n\tNew Project has been created at '${name}'`)
const dest = `${cwd}/${name}/package.json`
return replace({
files: `${dest}`,
from: /microservice-lite/g,
to: `${name}`
}).then(() => {
console.log(`\tcd into ${name} and run 'npm install'\n\trun 'mslite help' for assistance and \n\trun 'npm start' to see your project up and running\n`)
})
})
}
27 changes: 27 additions & 0 deletions files/action/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "microservice-lite",
"version": "0.1.0",
"description": "A tiny microservice built using mslite",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
},
"keywords": [
"microservices",
"cote.js",
"cote",
"javascript",
"node",
"microservicelite",
"mslite"
],
"author": "Balogun Oghenerobo Philip <oghenerobo@gmail.com>",
"license": "MIT",
"dependencies": {
"require-all": "^2.2.0",
"fs-extra": "^4.0.2",
"sails-disk": "^0.10.10",
"waterline": "^0.11.11"
}
}

0 comments on commit 446f5db

Please sign in to comment.