Skip to content

Commit 812ef1f

Browse files
authored
Merge pull request #2 from sumcumo/feat/copyUrlOnStart
feat(copy_url_on_start): integrate mr
2 parents 0d5aa37 + 6dd5a0b commit 812ef1f

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

docs/guide/configuration.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ module.exports = {
2727
const cookieParser = require('cookie-parser')
2828
app.use(cookieParser())
2929
},
30+
// Copy URL to system clipboard on start
31+
copyUrlOnStart: true,
3032
// Paths
3133
distPath: path.resolve(__dirname, './dist'),
3234
error500Html: null,

lib/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = {
99
skipRequests: req => req.originalUrl === '/graphql',
1010
nodeExternalsWhitelist: [/\.css$/, /\?vue&type=style/],
1111
extendServer: null,
12+
copyUrlOnStart: true,
1213
// Paths
1314
distPath: null,
1415
error500Html: null,

lib/dev-server.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,13 @@ module.exports.setupDevServer = ({ server, templatePath, onUpdate, webpackConfig
116116
})
117117

118118
function onCompilationCompleted () {
119+
copied = ''
119120
if (firstRun) {
120121
firstRun = false
121-
require('clipboardy').write(url)
122-
copied = chalk.dim('(copied to clipboard)')
123-
} else {
124-
copied = ''
122+
if(config.copyUrlOnStart) {
123+
require('clipboardy').write(url)
124+
copied = chalk.dim('(copied to clipboard)')
125+
}
125126
}
126127

127128
setTimeout(() => {

0 commit comments

Comments
 (0)