2019-11-18 00:30:14 +03:00
|
|
|
const parseArgs = require('minimist')
|
2019-11-16 21:51:46 +03:00
|
|
|
const appPaths = require('../helpers/app-paths')
|
|
|
|
const logger = require('../helpers/logger')
|
|
|
|
const log = logger('app:tauri')
|
|
|
|
const warn = logger('app:tauri (init)', 'red')
|
2019-08-20 00:09:29 +03:00
|
|
|
|
2019-10-07 21:36:56 +03:00
|
|
|
/**
|
|
|
|
* @type {object}
|
|
|
|
* @property {boolean} h
|
|
|
|
* @property {boolean} help
|
|
|
|
* @property {string|boolean} f
|
|
|
|
* @property {string|boolean} force
|
|
|
|
* @property {boolean} l
|
|
|
|
* @property {boolean} log
|
2019-11-18 00:30:14 +03:00
|
|
|
* @property {boolean} d
|
|
|
|
* @property {boolean} directory
|
2019-10-07 21:36:56 +03:00
|
|
|
*/
|
2019-08-20 00:09:29 +03:00
|
|
|
const argv = parseArgs(process.argv.slice(2), {
|
2019-11-16 21:51:46 +03:00
|
|
|
alias: {
|
|
|
|
h: 'help',
|
|
|
|
f: 'force',
|
|
|
|
l: 'log',
|
2019-11-30 14:48:39 +03:00
|
|
|
d: 'directory',
|
|
|
|
t: 'tauriPath'
|
2019-11-16 21:51:46 +03:00
|
|
|
},
|
|
|
|
boolean: ['h', 'l']
|
2019-08-20 00:09:29 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
if (argv.help) {
|
2019-11-16 21:51:46 +03:00
|
|
|
console.log(`
|
2019-08-20 00:09:29 +03:00
|
|
|
Description
|
2019-10-07 21:36:56 +03:00
|
|
|
Inits the Tauri template. If Tauri cannot find the tauri.conf.js
|
|
|
|
it will create one.
|
2019-08-20 00:09:29 +03:00
|
|
|
Usage
|
|
|
|
$ tauri init
|
|
|
|
Options
|
2019-11-30 14:48:39 +03:00
|
|
|
--help, -h Displays this message
|
|
|
|
--force, -f Force init to overwrite [conf|template|all]
|
|
|
|
--log, -l Logging [boolean]
|
|
|
|
--directory, -d Set target directory for init
|
|
|
|
--tauriPath, -t Path of the Tauri project to use (relative to the cwd)
|
2019-11-16 21:51:46 +03:00
|
|
|
`)
|
|
|
|
process.exit(0)
|
2019-08-20 00:09:29 +03:00
|
|
|
}
|
|
|
|
|
2019-10-07 21:36:56 +03:00
|
|
|
const { inject } = require('../template')
|
|
|
|
|
2019-12-02 01:30:22 +03:00
|
|
|
inject(argv.d || process.cwd(), 'all', {
|
2019-11-30 14:48:39 +03:00
|
|
|
force: argv.f || null,
|
|
|
|
logging: argv.l || null,
|
|
|
|
tauriPath: argv.t || null
|
|
|
|
})
|