Comparing version 0.0.11 to 0.0.12
@@ -15,4 +15,7 @@ #!/usr/bin/env node | ||
const fs = require('fs-extra') | ||
const { log, error } = require('./libs/helper') | ||
const { log, error, getIPAddress } = require('./libs/helper') | ||
const { createReadmeFile } = require('./libs/init/create-files') | ||
const ipAddress = getIPAddress() | ||
program.version(pkg.version) | ||
@@ -43,2 +46,3 @@ | ||
shell.exec(`npm i`) | ||
createReadmeFile(name) | ||
echoEndedInfo(name) | ||
@@ -89,4 +93,5 @@ return | ||
npm run dev | ||
The project will run at http://0.0.0.0:4000 or http://localhost/:4000 | ||
The project will run at | ||
http://${ipAddress}:4000 or http://localhost:4000 | ||
`) | ||
} |
@@ -40,5 +40,20 @@ /** | ||
function getIPAddress() { | ||
const interfaces = require('os').networkInterfaces() | ||
let temp | ||
for (let devName in interfaces) { | ||
temp = interfaces[devName] | ||
for (let i = 0; i < temp.length; i++) { | ||
let alias = temp[i] | ||
if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal) { | ||
return alias.address | ||
} | ||
} | ||
} | ||
} | ||
module.exports = { | ||
log, | ||
error, | ||
getIPAddress, | ||
warn, | ||
@@ -45,0 +60,0 @@ info, |
@@ -14,2 +14,3 @@ /** | ||
const { createReact } = require('./react') | ||
const { createReadmeFile } = require('./readme') | ||
@@ -24,24 +25,3 @@ function createFiles(entry, name, arr) { | ||
// create README.md | ||
const readmeCode = [ | ||
`# ${name}`, | ||
BLANK_LINE, | ||
'This project was created by the <a href="https://github.com/capricorncd/dev3cli" target="_blank">dev3cli</a> command tool.', | ||
'https://github.com/capricorncd/dev3cli', | ||
BLANK_LINE, | ||
'## Build Setup', | ||
BLANK_LINE, | ||
'```bash', | ||
'# serve with hot reload at localhost:4000', | ||
'$ npm run dev', | ||
'# or', | ||
'$ yarn dev', | ||
BLANK_LINE, | ||
'# build static project', | ||
'$ npm run build', | ||
'# or', | ||
'$ yarn build', | ||
'```', | ||
] | ||
fs.writeFileSync('README.md', readmeCode.join(SYS_EOL)) | ||
createReadmeFile(name) | ||
@@ -95,3 +75,4 @@ // create js/vue/react files | ||
module.exports = { | ||
createFiles | ||
createFiles, | ||
createReadmeFile, | ||
} |
{ | ||
"name": "dev3cli", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "Quickly build command line interface for Web development environment.", | ||
"main": "index.js", | ||
"bin": { | ||
"dev3cli": "./index.js" | ||
}, | ||
"bin": "./index.js", | ||
"scripts": { | ||
@@ -10,0 +8,0 @@ "test": "echo \"Error: no test specified\" && exit 1" |
@@ -118,2 +118,3 @@ //__HEADER__ | ||
// publicPath: './dist', | ||
useLocalIp: true, | ||
host: '0.0.0.0', | ||
@@ -120,0 +121,0 @@ port: 4000 |
@@ -22,2 +22,3 @@ /** | ||
host: '0.0.0.0', | ||
port: 4000, | ||
// https://github.com/http-party/node-http-proxy#options | ||
@@ -24,0 +25,0 @@ proxy: { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45660
1575
10
2