tauri/cli/tauri.js/bin/tauri-init.js
nothingismagick 6dcccf5a8e feature/env (#80)
* fix(js-cli) resolve correct paths on `tauri init`

* feat(js-cli) inject src-tauri/ as lodash template

* fix(js-cli) entry paths

* feat(js-cli) rename APP_URL to devPath and allow .html values

* feat(js-cli) reload config when `tauri.conf.js` change detected

* feat(node): update to testing

* feat(template): fix phf, remove updater

* feat(samples): add vanillajs

* fix(templates): objectify tauri
Closes #99.

* fix(examples): update cargo.toml
 - to match signature

* chore(tauri): version update

* feat(workflows): fix dirs, add tokens

* fix(config): more robust env checking

* feat(fixture): start a testing fixture for tauri

* fix(workflow): use fixture for ENV

* fix(examples:vanilla): remove updater

* addition to previous commit re. fixture

* fix(config.rs): fix the unfix

* feat(js-cli) use the new cargo-tauri-cli

* chore(template) cleanup src-tauri/Cargo.toml

* chore(js-cli) toml features cleanup

* chore(js-cli) move edge to config > tauri

* fix(js-cli) appPaths resolve() instead of join()
2019-11-30 08:48:39 -03:00

53 lines
1.3 KiB
JavaScript

const parseArgs = require('minimist')
const appPaths = require('../helpers/app-paths')
const logger = require('../helpers/logger')
const log = logger('app:tauri')
const warn = logger('app:tauri (init)', 'red')
/**
* @type {object}
* @property {boolean} h
* @property {boolean} help
* @property {string|boolean} f
* @property {string|boolean} force
* @property {boolean} l
* @property {boolean} log
* @property {boolean} d
* @property {boolean} directory
*/
const argv = parseArgs(process.argv.slice(2), {
alias: {
h: 'help',
f: 'force',
l: 'log',
d: 'directory',
t: 'tauriPath'
},
boolean: ['h', 'l']
})
if (argv.help) {
console.log(`
Description
Inits the Tauri template. If Tauri cannot find the tauri.conf.js
it will create one.
Usage
$ tauri init
Options
--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)
`)
process.exit(0)
}
const { inject } = require('../template')
inject(argv.d || appPaths.appDir, 'all', {
force: argv.f || null,
logging: argv.l || null,
tauriPath: argv.t || null
})