Skip to content

Commit

Permalink
format scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dmstern committed Sep 25, 2018
1 parent 3f364cb commit d099534
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 42 deletions.
30 changes: 19 additions & 11 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,44 @@
#!/usr/bin/env node

const exec = require("child_process").exec;
const path = require("path");
const pm2Config = require("./pm2.config");
const exec = require('child_process').exec;
const path = require('path');
const pm2Config = require('./pm2.config');
const port = pm2Config.serveUIStatic.env.PM2_SERVE_PORT;
const logFiles = {
ui: path.join(__dirname, pm2Config.runServer.cwd || '', pm2Config.runServer.log),
server: path.join(__dirname, pm2Config.serveUIStatic.cwd || '', pm2Config.serveUIStatic.log),
ui: path.join(
__dirname,
pm2Config.runServer.cwd || '',
pm2Config.runServer.log,
),
server: path.join(
__dirname,
pm2Config.serveUIStatic.cwd || '',
pm2Config.serveUIStatic.log,
),
};
const programm = 'npmfrog';
const firstArg = process.argv[2];
const command = firstArg === "stop" ? "stop" : "start";
const command = firstArg === 'stop' ? 'stop' : 'start';

exec(
`npm ${command}`,
{
cwd: __dirname
cwd: __dirname,
},
(error, stdout, stderr) => {
console.log(`${stdout}`);
console.error(`${stderr}`);
if (command === "start") {
if (command === 'start') {
console.log(`Running npmFrog in background on http://localhost:${port}`);
console.log(`To stop npmFrog, run \`${programm} stop\``);
console.log(
`Logs can be found in ${logFiles.server} and ${logFiles.ui} .`
`Logs can be found in ${logFiles.server} and ${logFiles.ui} .`,
);
} else if (command === "stop") {
} else if (command === 'stop') {
console.log(`Stopped npmFrog.`);
}
if (error !== null) {
console.error(`npmFrog error: ${error}`);
}
}
},
);
44 changes: 22 additions & 22 deletions pm2.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const env_local = {
MOCK: true
MOCK: true,
};

const log_date_format = "DD-MM-YYYY HH:mm:ss";
const log_date_format = 'DD-MM-YYYY HH:mm:ss';

module.exports = {
watchUI: {
name: "frog-ui",
script: "./node_modules/@vue/cli-service/bin/vue-cli-service.js",
args: "serve",
env_local
name: 'frog-ui',
script: './node_modules/@vue/cli-service/bin/vue-cli-service.js',
args: 'serve',
env_local,
},
// tslint: {
// name: 'frog-tslint',
Expand All @@ -19,32 +19,32 @@ module.exports = {
// env_local
// },
compileServer: {
name: "frog-compile-server",
script: "./node_modules/typescript/bin/tsc",
cwd: "server",
args: "--watch",
env_local
name: 'frog-compile-server',
script: './node_modules/typescript/bin/tsc',
cwd: 'server',
args: '--watch',
env_local,
},
runServer: {
name: "frog-server",
script: "index.js",
cwd: "dist/server/",
name: 'frog-server',
script: 'index.js',
cwd: 'dist/server/',
log: '../../frog-server.log',
env_local
env_local,
},
serveUIStatic: {
name: "frog-ui-static",
script: "serve",
name: 'frog-ui-static',
script: 'serve',
log: './frog-ui.log',
log_date_format,
env: {
PM2_SERVE_PATH: "dist/webui",
PM2_SERVE_PORT: 8000
PM2_SERVE_PATH: 'dist/webui',
PM2_SERVE_PORT: 8000,
},
env_local: {
PM2_SERVE_PATH: "dist/webui",
PM2_SERVE_PATH: 'dist/webui',
PM2_SERVE_PORT: 8000,
MOCK: env_local.MOCK,
}
}
},
},
};
4 changes: 2 additions & 2 deletions pm2.dev.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const tasks = require("./pm2.config");
const tasks = require('./pm2.config');

const runServer = tasks.runServer;
runServer.watch = true;
Expand All @@ -9,5 +9,5 @@ module.exports = {
tasks.compileServer,
tasks.watchUI,
runServer,
]
],
};
4 changes: 2 additions & 2 deletions pm2.prod.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const tasks = require("./pm2.config");
const tasks = require('./pm2.config');

module.exports = {
apps: [tasks.runServer, tasks.serveUIStatic]
apps: [tasks.runServer, tasks.serveUIStatic],
};
8 changes: 4 additions & 4 deletions src/views/PackageDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,8 @@ pre code.hljs {
list-style: none;
li {
width: 100%;
display: flex;
width: 100%;
}
}
Expand All @@ -485,17 +485,17 @@ pre code.hljs {
&::before,
&::after {
font-size: 10em;
position: absolute;
font-family: Georgia, 'Times New Roman', Times, serif;
color: $color-gray-extralight;
font-family: Georgia, 'Times New Roman', Times, serif;
font-size: 10em;
opacity: 0.3;
}
&::before {
content: '';
left: 0;
bottom: -60px;
left: 0;
}
&::after {
Expand Down
2 changes: 1 addition & 1 deletion vue.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
configureWebpack: {
devtool: "source-map"
devtool: 'source-map',
},
devServer: {
disableHostCheck: true,
Expand Down

0 comments on commit d099534

Please sign in to comment.