Skip to content

Commit

Permalink
Merge pull request #1011 from townmi/account
Browse files Browse the repository at this point in the history
feat(login): add no-captcha validation
  • Loading branch information
ipy authored Oct 11, 2019
2 parents 552c405 + 2c4ebdc commit 208e6c7
Show file tree
Hide file tree
Showing 25 changed files with 980 additions and 106 deletions.
35 changes: 24 additions & 11 deletions .electron-vue/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const Multispinner = require('multispinner');

const mainConfig = require('./webpack.main.config');
const rendererConfig = require('./webpack.renderer.config');
const webConfig = require('./webpack.web.config');

const doneLog = chalk.bgGreen.white(' DONE ') + ' ';
const errorLog = chalk.bgRed.white(' ERROR ') + ' ';
Expand Down Expand Up @@ -60,17 +61,29 @@ function build() {
process.exit(1);
});

pack(rendererConfig)
.then(result => {
results += result + '\n\n';
m.success('renderer');
})
.catch(err => {
m.error('renderer');
console.log(`\n ${errorLog}failed to build renderer process`);
console.error(`\n${err}\n`);
process.exit(1);
});
pack(rendererConfig)
.then(result => {
results += result + '\n\n';
m.success('renderer');
})
.catch(err => {
m.error('renderer');
console.log(`\n ${errorLog}failed to build renderer process`);
console.error(`\n${err}\n`);
process.exit(1);
});

pack(webConfig)
.then(result => {
results += result + '\n\n';
m.success('renderer');
})
.catch(err => {
m.error('renderer');
console.log(`\n ${errorLog}failed to build renderer process`);
console.error(`\n${err}\n`);
process.exit(1);
});
}

function pack(config) {
Expand Down
46 changes: 45 additions & 1 deletion .electron-vue/dev-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const webpackHotMiddleware = require('webpack-hot-middleware');

const mainConfig = require('./webpack.main.config');
const rendererConfig = require('./webpack.renderer.config');
const webConfig = require('./webpack.web.config');

let electronProcess = null;
let manualRestart = false;
Expand Down Expand Up @@ -83,6 +84,49 @@ function startRenderer() {
});
}



function startWeb() {
return new Promise((resolve, reject) => {
webConfig.entry.index = [path.join(__dirname, 'dev-client')].concat(
webConfig.entry.index,
);
webConfig.mode = 'development';
const compiler = webpack(webConfig);
hotMiddleware = webpackHotMiddleware(compiler, {
log: false,
heartbeat: 2500,
});

compiler.hooks.compilation.tap('compilation', compilation => {
compilation.hooks.htmlWebpackPluginAfterEmit.tapAsync(
'html-webpack-plugin-after-emit',
(data, cb) => {
hotMiddleware.publish({ action: 'reload' });
cb();
},
);
});

compiler.hooks.done.tap('done', stats => {
logStats('Renderer', stats);
});

const server = new WebpackDevServer(compiler, {
contentBase: path.join(__dirname, '../'),
quiet: true,
before(app, ctx) {
app.use(hotMiddleware);
ctx.middleware.waitUntilValid(() => {
resolve();
});
},
});

server.listen(9081);
});
}

function startMain() {
return new Promise((resolve, reject) => {
mainConfig.entry.main = [path.join(__dirname, '../src/main/index.dev.js')].concat(
Expand Down Expand Up @@ -189,7 +233,7 @@ function greeting() {
function init() {
greeting();

Promise.all([startRenderer(), startMain()])
Promise.all([startRenderer(), startMain(), startWeb()])
.then(() => {
startElectron();
})
Expand Down
2 changes: 0 additions & 2 deletions .electron-vue/webpack.renderer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ let rendererConfig = {
devtool: '#module-eval-source-map',
entry: {
preference: path.join(__dirname, '../src/renderer/preference.js'),
login: path.join(__dirname, '../src/renderer/login.ts'),
about: path.join(__dirname, '../src/renderer/about.js'),
labor: path.join(__dirname, '../src/renderer/labor.ts'),
index: path.join(__dirname, '../src/renderer/main.ts'),
Expand Down Expand Up @@ -201,7 +200,6 @@ let rendererConfig = {
new HtmlWebpackPlugin(generateHtmlWebpackPluginConfig('index')),
new HtmlWebpackPlugin(generateHtmlWebpackPluginConfig('labor')),
new HtmlWebpackPlugin(generateHtmlWebpackPluginConfig('about')),
new HtmlWebpackPlugin(generateHtmlWebpackPluginConfig('login')),
new HtmlWebpackPlugin(generateHtmlWebpackPluginConfig('preference')),
new HtmlWebpackPlugin(generateHtmlWebpackPluginConfig('browsing')),
new webpack.HotModuleReplacementPlugin(),
Expand Down
Loading

0 comments on commit 208e6c7

Please sign in to comment.