Total Pageviews

Saturday, 11 July 2020

Noder, A React-Native Client for cnodejs.org

The mobile app of cnodejs.org written in React Native.


A new cnodejs.org mobile & web app powered by react-native and react-web and CodeceptJS .

Install

微信浏览器中若无法打开安装链接,请复制链接到系统浏览器中打开

Develop

For local development you need to follow the below commands:
git clone https://github.com/soliury/noder-react-native.git noder
cd noder
yarn install
Click the run button in Xcode, if something went wrong, you need to rebuild all packages that be used in this project with Xcode (Just select the package and press command+B to run compile).
If you want to run it on your iPhone, please follow the Offical Doc.
If you want to run it on your Android, please run:
npm run android
npm start
If you want to run it on your Browser (localhost:3000), please run:
npm run web

e2e test

JS app code in src/write once run on Android, iOS and Web by react-native and react-web, now JS test case in e2e/ with locator ~ write once run on them too with CodeceptJS .

Web test

After install server side of test by npm run e2e-update-server-web, please run:
npm run web
npm run e2e-server-web
Then run client side of test by npm run e2e-web, thus a web page will be opened in firefox automatically and complete the test.

Android test

After install server side of test by npm install -g appium, please run:
npm run android
npm start
npm run e2e-server-native
Then run client side of test by npm run e2e-android, thus an apk will be installed to android automatically and complete the test.
If npm install -g appium is unavailable in china, ref to node_modules-appium .

React-Native Modules In Using:

This project is heavily influenced by the above modules.
frm https://github.com/soliury/noder-react-native
--------------------

The mobile app of https://cnodejs.org made by Ionic 1.x, web demo http://lanceli.com/cnodejs-ionic

CNodejs Ionic app

https://cnodejs.org hybird mobile application powered by Ionic Framework 1.x using AngularJS 1.x and Cordova. The development stage powered by Ionic Framework generator.
Download on the app store
There is another one made by Ionic 3, check it out here https://github.com/lanceli/cnodejs-ionic3

Developing

If you'd like to run it locally, and modify something, you can do so by cloning this repo and running the following commands (assuming that you have Node, NPM, Ionic, Cordova, Grunt and Bower installed).
# Clone and Install dependencies
$ git clone git://github.com/lanceli/cnodejs-ionic.git
$ npm install
$ bower install

# Config api url on development mode
# At line 54 in Gruntfile.js
$ vim Gruntfile.js

# Start the server on localhost:8010 on development mode
# Watches for changes, automatically recompiles files and refreshes the browser
$ grunt serve 

# Start the server on production mode
$ grunt serve:compress

# Add platform target
$ grunt platform:add:ios
$ grunt platform:add:android

# Run on platform target on development mode
$ grunt run:ios
$ grunt run:android

# Run on platform target on production mode
$ grunt build:ios
$ ionic run ios
$ grunt build:android
$ ionic run android
Need more detail? Please chekout Ionic Framework and Ionic Framework generator.

Question

if you have some problem with window system, please follow the blow step may help you fixed it.
grunt-contrib-compass/node_modules/tmp/lib/tmp.js:261
        throw err;
      ^
     Error: cannot read property 'stdout' of undefined
    at compile
  • Make sure you have installed Ruby tools
  • After you install ruby, use gem to install sass and compass(in cmd):
  1. gem install sass
  2. gem install compass
  • use npm to install modules(in cmd), choose one to install:
  1. npm install cordova ionic
  2. npm install -g cordova ionic
After install all the modules, you may face the child_process error. This is a windows system bug. you can fixed it like this:
grunt-contrib-compass/node_modules/tmp/lib/tmp.js:261
        throw err;
      ^
     Error: spawn ENOENT
    at errnoException (child_process.js:1001:11) 
   at Process.ChildProcess._handle.onexit (child_process.js:802:34)
A solution would be to replace spawn by win-spawn:
  1. npm install win-spawn
  2. Replace the line in the Gruntfile.js:
replace child_process to win-spawn
var spawn = require('child_process').spawn;
to
var spawn = require('win-spawn');
more information about this defect,please see:
have try, it should work now.

Cross-Origin

When you run it locally in browser, CORS is a problem.
Disable web security of chrome
open -a /Applications/Google\ Chrome.app --args --disable-web-security --allow-file-access-from-files
OR Allow cross origin access in nginx
add_header Access-Control-Allow-Origin *;

No comments:

Post a Comment