ohanhi / elm-native-ui

[CLOSED] Experiment: mobile apps in Elm using React Native.
BSD 3-Clause "New" or "Revised" License
1.54k stars 76 forks source link

Unclear getting started documentation #60

Closed kristianmandrup closed 7 years ago

kristianmandrup commented 7 years ago

"Go ahead and copy the files from the examples in your React Native app directory now." Where exactly do I copy the examples files to? I assume I copy a directory from examples with all its files into the React app root folder created by react init ?? Please make this clearer in the docs and include a concrete example for setting up one of these example projects. Thanks!

kristianmandrup commented 7 years ago

So I copied all the files from the Counter example into my ReactNative app folder, overwriting the index files for ios and android:

screenshot 2017-01-25 13 55 07
$ npm run compile

> Counter@0.0.1 precompile /Users/kristianmandrup/repos/elm-projs/MyAppName
> rm -f elm.js

> Counter@0.0.1 compile /Users/kristianmandrup/repos/elm-projs/MyAppName
> elm-make Main.elm --output elm.js

sh: elm-make: command not found
dbanck commented 7 years ago

Might be a silly question, but did you install Elm? Binaries like elm and elm-make should be in your $PATH.

Have a look at the Elm docs for how to install it.

kristianmandrup commented 7 years ago

I had it installed. But my elm installation was corrupted when I tried to update my node and npm using brew, so I had to reinstall node and elm from .pkg files. Now elm is working again.

But now is using Elm Platform 0.16, not sure this is compatible? Hate all this config stuff!!

14:08 $ elm-package install
Packages configured successfully!
✔ ~/repos/elm-projs/MyAppName 
14:10 $ npm run compile

> Counter@0.0.1 precompile /Users/kristianmandrup/repos/elm-projs/MyAppName
> rm -f elm.js

> Counter@0.0.1 compile /Users/kristianmandrup/repos/elm-projs/MyAppName
> elm-make Main.elm --output elm.js

Could not find package elm-lang/core.

Maybe your elm-stuff/ directory has been corrupted? You can usually fix stuff
like this by deleting elm-stuff/ and rebuilding your project.
kristianmandrup commented 7 years ago

Now I installed elm 0.18 via npm i -g elm

kristianmandrup commented 7 years ago

This is more like it!

$ elm-package install
Some new packages are needed. Here is the upgrade plan.

  Install:
    elm-lang/core 5.1.1
    elm-lang/html 2.0.0
    elm-lang/virtual-dom 2.0.4

Do you approve of this plan? [Y/n] Y
Starting downloads...

  ● elm-lang/html 2.0.0
  ● elm-lang/virtual-dom 2.0.4
  ● elm-lang/core 5.1.1

Packages configured successfully!

Now I get native package problems!?

 $ npm run compile

> Counter@0.0.1 precompile /Users/kristianmandrup/repos/elm-projs/MyAppName
> rm -f elm.js

> Counter@0.0.1 compile /Users/kristianmandrup/repos/elm-projs/MyAppName
> elm-make Main.elm --output elm.js

I cannot find module 'NativeUi'.

Module 'Main' is trying to import it.

Potential problems could be:
  * Misspelled the module name
  * Need to add a source directory or new dependency to elm-package.json
kristianmandrup commented 7 years ago

If we could use Exponent (created by core team members of RN) with Elm it would make this path much easier as per #59

cem2ran commented 7 years ago

Exponent wouldn't solve the above problem.

dbanck commented 7 years ago

To which path did you clone elm-native-ui to? Have a look at the elm-package.json and modify this block:

    "source-directories": [
        ".",
        "../../src"
    ],

that ../../src matches the elm-native-ui/src folder.

kristianmandrup commented 7 years ago

Thanks, will do. When I manage to get it working I will update the guide to include proper nOOb setup, config, install and run instructions ;)

kristianmandrup commented 7 years ago

Also would love if one or more of you guys would help me out integrating with Expedient. Then I might create a project generator as well to avoid this manual config process.

kristianmandrup commented 7 years ago

@dbanck Cool ;)

Changed it to:

    "source-directories": [
        ".",
        "../elm-native-ui/src"
    ],
$ npm run compile

> Counter@0.0.1 precompile /Users/kristianmandrup/repos/elm-projs/MyAppName
> rm -f elm.js

> Counter@0.0.1 compile /Users/kristianmandrup/repos/elm-projs/MyAppName
> elm-make Main.elm --output elm.js

Success! Compiled 43 modules.                                       
Successfully generated elm.js
kristianmandrup commented 7 years ago

Now I'm not sure about this part:

Edit the `index.*.js` files' last lines in case your React Native app is not called 'MyAppName' at this point. You may also need to rename the project in the `package.json` file.

I copied the files from examples/Counter into MyAppName folder, so I have

AppRegistry.registerComponent('Counter', () => component); in index.ios.js, so in this case I rename it to: AppRegistry.registerComponent('MyAppName', () => component); ??

How do I use/install this elm_self_publish in my project? or do I install globally via pip? It is unclear!

We will then use elm_self_publish to publish the Elm Native UI package into our project.

Assuming we're in the parent directory where elm-native-ui reside:

$ python path/to/elm_self_publish.py ./elm-native-ui ./MyAppName

kristianmandrup commented 7 years ago

I'm guessing I need to copy the raw code/file at https://raw.githubusercontent.com/NoRedInk/elm-ops-tooling/master/elm_self_publish.py ??

kristianmandrup commented 7 years ago

Now I get error:

$ npm run compile

> Counter@0.0.1 precompile /Users/kristianmandrup/repos/elm-projs/MyAppName
> rm -f elm.js

> Counter@0.0.1 compile /Users/kristianmandrup/repos/elm-projs/MyAppName
> elm-make Main.elm --output elm.js

I found multiple modules named 'NativeUi'.

Module 'Main' is trying to import it.

Modules with that name were found in the following locations:

    directory ./../elm-native-ui/src/NativeUi.elm
    package ohanhi/elm-native-ui

Fuck! Someone please write a proper guide for how to get this shit running! :) Thanks!

ohanhi commented 7 years ago

I am sorry you are experiencing problems, but this is a very experimental technology. You are expected to get problems during development, too, and there will likely be no documentation at all concerning those issues. For now, I feel like the "Getting started" guide is clear enough for most people who are interested in contributing to this project. Those people are definitely the target group at the moment.

ohanhi commented 7 years ago

Closing this now, after two months of inactivity. :)