• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MicroAppJS / plugin-vuepress / 7004622455

27 Nov 2023 11:56AM UTC coverage: 43.081%. Remained the same
7004622455

push

github

zyao89
feat: update deploy

41 of 139 branches covered (0.0%)

Branch coverage included in aggregate %.

124 of 244 relevant lines covered (50.82%)

1.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

25.64
/src/commands/command.js
1
'use strict';
2

3
module.exports = (api, argv, opts) => {
1✔
4
    const createConfig = require('./createConfig');
3✔
5

6
    function autoCreateConfig() {
7
        return createConfig(api, argv, opts);
3✔
8
    }
9

10
    const logger = api.logger;
3✔
11

12
    let chain = Promise.resolve();
3✔
13

14
    chain = chain.then(() => autoCreateConfig());
3✔
15

16
    if (process.env.MICRO_APP_TEST) {
3!
17
        logger.debug('MICRO_APP_TEST --> Exit!!!');
3✔
18
        return chain;
3✔
19
    }
20

21
    chain = chain.then(vuepressConfig => {
×
22

23
        if (argv._[0] === 'dev') { // refresh
×
24
            const { watchFiles } = require('../utils');
×
25
            watchFiles(vuepressConfig, target => {
×
26
                logger.info('REFRESH Config !!! --> ', target);
×
27
                if (target.endsWith('.js')) { // Bust cache.
×
28
                    delete require.cache[target];
×
29
                }
30
                vuepressConfig = autoCreateConfig();
×
31
            });
32
        }
33

34
        const OPTIONS = {
×
35
            sourceDir: vuepressConfig.sourceDir,
36
            siteConfig: new Proxy(vuepressConfig, {
37
                get(target, name) {
38
                    return vuepressConfig[name];
×
39
                },
40
            }),
41
            vuepressDir: vuepressConfig.vuepressDir,
42
        };
43

44
        return OPTIONS;
×
45
    });
46

47
    chain = chain.then(OPTIONS => {
×
48
        const { yUnParser } = require('@micro-app/shared-utils');
×
49
        const CAC = require('cac');
×
50
        const handleUnknownCommand = require('vuepress/lib/handleUnknownCommand');
×
51
        const registerCoreCommands = require('./lib/registerCoreCommands');
×
52

53
        const cli = CAC();
×
54
        return Promise.resolve()
×
55
            .then(() => registerCoreCommands(cli, OPTIONS))
×
56
            .then(() => handleUnknownCommand(cli, OPTIONS))
×
57
            .then(() => {
58
                const orginalArgv = process.argv.slice(0, 2).concat(yUnParser(argv));
×
59
                return cli.parse(orginalArgv, { run: false });
×
60
            })
61
            .then(() => {
62
                return cli.runMatchedCommand();
×
63
            });
64
    });
65

66
    return chain;
×
67
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc