15815213711
2024-08-26 67b8b6731811983447e053d4396b3708c14dfe3c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/usr/bin/env node
 
const { program } = require('commander');
 
/**
 * move - Moves resources
 */
program
  .command('move')
  .description('Move multip resources')
  .option('--config <folder>', 'config file', './electron/config/bin.js')
  .option('--flag <flag>', 'Custom flag')
  .action(function() {
    const moveScript = require('./tools/move');
    moveScript.run(this.opts());
  });
 
/**
 * (deprecated) rd - Moves front-end resources to a specified directory
 */
program
  .command('rd')
  .description('Move frontend resources to public/dist')
  .option('--config <folder>', 'config file', './electron/config/bin.js')
  .option('--dist <folder>', 'title to use before name')
  .option('--target <folder>', 'title to use before name')
  .action(function() {
    const replaceDist = require('./tools/replaceDist');
    replaceDist.run(this.opts());
  });
 
/**
 * encrypt - Code encryption
 */
program
  .command('encrypt')
  .description('Code encryption')
  .option('--config <folder>', 'config file')
  .option('--out <folder>', 'output directory', './public')
  .action(function() {
    const encrypt = require('./tools/encrypt');
    encrypt.run(this.opts());
  });
 
/**
 * clean - Clear the encrypted code
 */
program
  .command('clean')
  .description('Clear the encrypted code')
  .option('-d, --dir <folder>', 'clean directory')
  .action(function() {
    const encrypt = require('./tools/encrypt');
    encrypt.clean(this.opts());
  });
 
/**
 * icon
 */
program
  .command('icon')
  .description('Generate logo')
  .option('-i, --input <file>', 'image file default /public/images/logo.png')
  .option('-o, --output <folder>', 'output directory default /build/icons/')
  .action(function() {
    const iconGen = require('./tools/iconGen');
    iconGen.run();
  });
 
/**
 * dev
 */
program
  .command('dev')
  .description('create frontend-serve and electron-serve')
  .option('--config <folder>', 'config file', './electron/config/bin.js')
  .option('--serve <mode>', 'serve mode')
  .action(function() {
    const serve = require('./tools/serve');
    serve.dev(this.opts());
  });
 
/**
 * build
 */
program
  .command('build')
  .description('building multiple resources')
  .option('--config <folder>', 'config file', './electron/config/bin.js')
  .option('--cmds <flag>', 'custom commands')
  .action(function() {
    const serve = require('./tools/serve');
    serve.build(this.opts());
  });
 
/**
 * start
 */
program
  .command('start')
  .description('preview effect')
  .option('--config <folder>', 'config file', './electron/config/bin.js')
  .action(function() {
    const serve = require('./tools/serve');
    serve.start(this.opts());
  });
 
/**
 * exec
 */
program
  .command('exec')
  .description('create frontend-serve and electron-serve')
  .option('--config <folder>', 'config file', './electron/config/bin.js')
  .option('--command <command>', 'Custom command')
  .option('--cmds <flag>', 'custom commands')
  .action(function() {
    // command 选项是关键字,不再使用,改为 cmds
    const serve = require('./tools/serve');
    serve.exec(this.opts());
  });
 
program.parse();