From fd5dc6dc950e16ff4afde6a90318f7230e55f6d4 Mon Sep 17 00:00:00 2001 From: amorokh Date: Wed, 12 Apr 2017 13:02:25 +0200 Subject: [PATCH] Added UWP platform support --- re-natal.coffee | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/re-natal.coffee b/re-natal.coffee index baf44cd..2ca7cb7 100644 --- a/re-natal.coffee +++ b/re-natal.coffee @@ -41,6 +41,7 @@ interfaceConf = sources: ios: ["core.cljs"] android: ["core.cljs"] + windows: ["core.cljs"] common: ["handlers.cljs", "subs.cljs", "db.cljs"] other: [] deps: ['[reagent "0.5.1" :exclusions [cljsjs/react]]' @@ -53,6 +54,7 @@ interfaceConf = sources: ios: ["core.cljs"] android: ["core.cljs"] + windows: ["core.cljs"] common: ["events.cljs", "subs.cljs", "db.cljs"] other: [["reagent_dom.cljs","reagent/dom.cljs"], ["reagent_dom_server.cljs","reagent/dom/server.cljs"]] deps: ['[reagent "0.6.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server]]' @@ -65,6 +67,7 @@ interfaceConf = sources: ios: ["core.cljs"] android: ["core.cljs"] + windows: ["core.cljs"] common: ["state.cljs"] other: [["support.cljs","re_natal/support.cljs"]] deps: ['[org.omcljs/om "1.0.0-alpha48" :exclusions [cljsjs/react cljsjs/react-dom]]'] @@ -74,8 +77,9 @@ interfaceConf = 'rum': cljsDir: "cljs-rum" sources: - ios: ["core.cljs"] + ios: ["core.cljs"] android: ["core.cljs"] + windows: ["core.cljs"] common: [] other: [["sablono_compiler.clj","sablono/compiler.clj"],["support.cljs","re_natal/support.cljs"]] deps: ['[rum "0.10.8" :exclusions [cljsjs/react cljsjs/react-dom sablono]]'] @@ -415,7 +419,7 @@ init = (interfaceName, projName) -> log 'Creating React Native skeleton.' - fs.writeFileSync 'package.json', JSON.stringify + pkg = name: projName version: '0.0.1' private: true @@ -425,7 +429,11 @@ init = (interfaceName, projName) -> 'react-native': rnVersion # Fixes issue with packager 'TimeoutError: transforming ... took longer than 301 seconds.' 'babel-plugin-transform-es2015-block-scoping': '6.15.0' - , null, 2 + + if 'windows' in platforms + pkg.dependencies['react-native-windows'] = rnVersion + + fs.writeFileSync 'package.json', JSON.stringify pkg, null, 2 exec 'npm i' @@ -434,6 +442,12 @@ init = (interfaceName, projName) -> \"require('react-native/local-cli/cli').init('.', '#{projName}')\" " + if 'windows' in platforms + log 'Creating React Native UWP skeleton.' + exec "node -e + \"require('react-native-windows/local-cli/generate-windows')('.', '#{projName}', '#{projName}')\" + " + updateGitIgnore() generateConfig(interfaceName, projName) @@ -619,6 +633,7 @@ cli.version pkgJson.version cli.command 'init ' .description 'create a new ClojureScript React Native project' .option "-i, --interface [#{interfaceNames.join ' '}]", 'specify React interface', defaultInterface + .option '-u, --uwp', 'create skeleton for UWP' .action (name, cmd) -> if typeof name isnt 'string' logErr ''' @@ -628,6 +643,8 @@ cli.command 'init ' ''' unless interfaceConf[cmd.interface] logErr "Unsupported React interface: #{cmd.interface}, one of [#{interfaceNames}] was expected." + if cmd.uwp? + platforms.push 'windows' ensureFreePort -> init(cmd.interface, name) cli.command 'upgrade'