mirror of
https://github.com/tauri-apps/realworld.git
synced 2026-02-04 02:31:21 +01:00
Quicksave
This commit is contained in:
10
apps.yaml
10
apps.yaml
@@ -14,7 +14,9 @@
|
||||
- title: Elm
|
||||
repo: rtfeldman/elm-spa-example
|
||||
logo: https://cloud.githubusercontent.com/assets/556934/25448178/3e7dc5c0-2a7d-11e7-8069-06da5169dae6.png
|
||||
install: 'yarn global add elm'
|
||||
preinstall:
|
||||
- 'npm install -g elm'
|
||||
- 'node init-package'
|
||||
build: 'elm make src/Main.elm --output elm.js --optimize'
|
||||
tauri:
|
||||
build:
|
||||
@@ -54,8 +56,10 @@
|
||||
- title: Vue
|
||||
repo: gothinkster/vue-realworld-example-app
|
||||
logo: https://github.com/gothinkster/vue-realworld-example-app/blob/master/static/rwv-logo.png
|
||||
install: 'yarn'
|
||||
build: 'yarn build'
|
||||
preinstall:
|
||||
- npm install -g @vue/cli
|
||||
install: 'npm install'
|
||||
build: './node_modules/.bin/vue-cli-service build'
|
||||
tauri:
|
||||
build:
|
||||
distDir: '../dist'
|
||||
|
||||
36
build.js
36
build.js
@@ -1,8 +1,9 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const { safeLoad } = require('js-yaml')
|
||||
const { spawn } = require('child_process')
|
||||
// const { spawn } = require('child_process')
|
||||
const deepmerge = require('deepmerge')
|
||||
const spawn = require('cross-spawn')
|
||||
|
||||
const clone = (repo, directory) => {
|
||||
return exec(`git clone ${repo} ${directory}`)
|
||||
@@ -32,7 +33,7 @@ const exec = (command, directory = null) => {
|
||||
console.log(stdErr.join(''))
|
||||
return
|
||||
}
|
||||
// resolve(stdOut.join(''))
|
||||
resolve(stdOut.join(''))
|
||||
})
|
||||
|
||||
child.on('exit', () => {
|
||||
@@ -41,14 +42,17 @@ const exec = (command, directory = null) => {
|
||||
})
|
||||
}
|
||||
const bundle = async (tauriConfig, directory) => {
|
||||
await exec('tauri init', directory)
|
||||
// await exec('tauri init', directory)
|
||||
await exec(
|
||||
`${directory}/node_modules/.bin/tauri init --directory ${directory}`
|
||||
)
|
||||
const tauriConfigPath = path.join(directory, 'src-tauri', 'tauri.conf.json')
|
||||
const mergedTauriConfig = deepmerge(
|
||||
JSON.parse(fs.readFileSync(tauriConfigPath)),
|
||||
tauriConfig
|
||||
)
|
||||
fs.writeFileSync(tauriConfigPath, JSON.stringify(mergedTauriConfig, null, 2))
|
||||
return exec('tauri build --debug', directory)
|
||||
return exec(`./node_modules/.bin/tauri build`, directory)
|
||||
}
|
||||
|
||||
;(() => {
|
||||
@@ -65,18 +69,34 @@ const bundle = async (tauriConfig, directory) => {
|
||||
|
||||
await clone('https://github.com/' + app.repo, directory)
|
||||
|
||||
console.log(' Installing dependencies...')
|
||||
await exec(app.install, directory)
|
||||
console.log(' Preparing project & tools...')
|
||||
|
||||
console.log(app.preinstall);
|
||||
|
||||
const promises = app.preinstall
|
||||
? app.preinstall.map(line => exec(line, directory))
|
||||
: []
|
||||
|
||||
await Promise.all(promises)
|
||||
|
||||
console.log(' Installing Tauri CLI & dependencies...')
|
||||
await exec('npm install tauri', directory)
|
||||
if (app.install) {
|
||||
await exec(app.install, directory)
|
||||
}
|
||||
// await exec(app.install, directory)
|
||||
console.log(' Building app...')
|
||||
|
||||
await exec(app.build, directory)
|
||||
console.log(' Bundling...')
|
||||
await bundle(app.tauri, directory)
|
||||
console.log('Done!')
|
||||
} catch (e) {
|
||||
console.log('Failure!', e)
|
||||
console.log('Failure!\n', e)
|
||||
}
|
||||
})
|
||||
} catch (e) {
|
||||
// console.log(e)
|
||||
console.log(e)
|
||||
process.exit(1)
|
||||
}
|
||||
})()
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"author": "Laegel <valentin.chouaf@laposte.net>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cross-spawn": "^7.0.1",
|
||||
"deepmerge": "^4.2.2",
|
||||
"js-yaml": "^3.13.1"
|
||||
}
|
||||
|
||||
38
yarn.lock
38
yarn.lock
@@ -9,6 +9,15 @@ argparse@^1.0.7:
|
||||
dependencies:
|
||||
sprintf-js "~1.0.2"
|
||||
|
||||
cross-spawn@^7.0.1:
|
||||
version "7.0.1"
|
||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.1.tgz#0ab56286e0f7c24e153d04cc2aa027e43a9a5d14"
|
||||
integrity sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg==
|
||||
dependencies:
|
||||
path-key "^3.1.0"
|
||||
shebang-command "^2.0.0"
|
||||
which "^2.0.1"
|
||||
|
||||
deepmerge@^4.2.2:
|
||||
version "4.2.2"
|
||||
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955"
|
||||
@@ -19,6 +28,11 @@ esprima@^4.0.0:
|
||||
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
|
||||
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
|
||||
|
||||
isexe@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
|
||||
integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=
|
||||
|
||||
js-yaml@^3.13.1:
|
||||
version "3.13.1"
|
||||
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847"
|
||||
@@ -27,7 +41,31 @@ js-yaml@^3.13.1:
|
||||
argparse "^1.0.7"
|
||||
esprima "^4.0.0"
|
||||
|
||||
path-key@^3.1.0:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
|
||||
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
|
||||
|
||||
shebang-command@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"
|
||||
integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==
|
||||
dependencies:
|
||||
shebang-regex "^3.0.0"
|
||||
|
||||
shebang-regex@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
|
||||
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
|
||||
|
||||
sprintf-js@~1.0.2:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
|
||||
integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=
|
||||
|
||||
which@^2.0.1:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
|
||||
integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==
|
||||
dependencies:
|
||||
isexe "^2.0.0"
|
||||
|
||||
Reference in New Issue
Block a user