SlideShare a Scribd company logo
React-Native
Packages
Setup
• Run following command in terminal
npm init
• This command create a package file with default configuration.
• Now create folder and file in root folder according to men tioned
folder structure (in next slide)
Folder Structure
• RootFolder
• index.js
• Package.js
• lib
• Publishable JS file
• ios
• Publishable static library
• Android
• Publishable library
• example (React native project)
index.js
• It is entry point for npm package
• Export all accessible classes
import OktaUtil from './lib/oktaUtil'
export default OktaUtil
Package.js
{
"name": "reactoktaauth",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"author": "",
"license": "ISC"
}
Package.js
• name:
• Should be small case.
• Contain only alphanumeric character or ‘-’
• version: Current package version
• description: package description
• main: Package entry point (index.js)
• auther: Optional and your name
lib, ios, android, example
• Implement JS code in lib folder, static library in iOS folder, package in
android folder
• Now run following command into package folder
react-native init example
• Open package.json of example project and write your npm package in
dependiencies.
"reactoktaauth": "../"
example
• Now run following command to connect npm package
npm install
• Now link ios and android folder to project.
react-native link
• Open xcode project. You are able to static librarhy into lib folder.
• Now add static library into library binaries setting
• Now you can run your application successfully.
Use pod in static library
• If you want to use pod file into static folder the change your pod file.
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
use_frameworks!
workspace 'example'
def shared_pods
pod "OktaAuth"
end
target 'example' do
shared_pods
end
target 'OktaAuthRN' do
project './../../ios/OktaAuthRN/OktaAuthRN'
shared_pods
end
Publish package
• Run following command into terminal
npm adduser
• It will ask npm account user name, password, email ID (You must have
npm account)
• Now publish npm with following command
npm publish

More Related Content

What's hot (20)

PDF
Easy access to open stack object storage
Juan José Martínez
 
PPTX
Practical Glusto Example
Gluster.org
 
ODP
Automated testing: Openshift on Openstack
Oleg Popov
 
PDF
CoreOS introduction - Johann Romefort
Stylight
 
PDF
Docker puppetcamp london 2013
Tomas Doran
 
PDF
Docker 入門 Introduction to Docker
Genchi Lu
 
PDF
CoreOS Overview
Nikolay Yurin
 
PDF
Laravel Poznań Meetup #12 - "Speed up web API with Laravel and Swoole using ...
HighSolutions Sp. z o.o.
 
PPTX
Containers: Anti Pattern
Jeeva Chelladhurai
 
PPTX
[FDD 2016] Marek Śledziński - Microsoft Windows a sprawa kontenerów
Future Processing
 
PPTX
NodeJs Session03
Jainul Musani
 
PPT
Ferrara Linux Day 2011
Gianluca Padovani
 
PDF
Distributed locks in Ruby - Correctness vs Efficiency - Knapsack Pro case stu...
Artur Trzop
 
PDF
Docker n co
Rohit Jnagal
 
PPTX
Nodejs Session01
Jainul Musani
 
PDF
Docker 102 - Immutable Infrastructure
Adrian Otto
 
PDF
An Introduction of Node Package Manager (NPM)
iFour Technolab Pvt. Ltd.
 
PDF
Docker Compose and Panamax - ContainerDays Boston - June 2015
Jonas Rosland
 
PDF
Introduction to ansible
Mukul Malhotra
 
DOCX
DockerCoreNet
Eimantas Žlabys
 
Easy access to open stack object storage
Juan José Martínez
 
Practical Glusto Example
Gluster.org
 
Automated testing: Openshift on Openstack
Oleg Popov
 
CoreOS introduction - Johann Romefort
Stylight
 
Docker puppetcamp london 2013
Tomas Doran
 
Docker 入門 Introduction to Docker
Genchi Lu
 
CoreOS Overview
Nikolay Yurin
 
Laravel Poznań Meetup #12 - "Speed up web API with Laravel and Swoole using ...
HighSolutions Sp. z o.o.
 
Containers: Anti Pattern
Jeeva Chelladhurai
 
[FDD 2016] Marek Śledziński - Microsoft Windows a sprawa kontenerów
Future Processing
 
NodeJs Session03
Jainul Musani
 
Ferrara Linux Day 2011
Gianluca Padovani
 
Distributed locks in Ruby - Correctness vs Efficiency - Knapsack Pro case stu...
Artur Trzop
 
Docker n co
Rohit Jnagal
 
Nodejs Session01
Jainul Musani
 
Docker 102 - Immutable Infrastructure
Adrian Otto
 
An Introduction of Node Package Manager (NPM)
iFour Technolab Pvt. Ltd.
 
Docker Compose and Panamax - ContainerDays Boston - June 2015
Jonas Rosland
 
Introduction to ansible
Mukul Malhotra
 
DockerCoreNet
Eimantas Žlabys
 

Similar to 5. react native-package (20)

PDF
Mastering composer
Adán Lobato Lorenzo
 
PDF
NDK Programming in Android
Arvind Devaraj
 
PDF
Using Conda in Oracle Data Science.pdf
Nicholas Toscano
 
PDF
Introduction to package manager
yashobantabai
 
PPTX
1. react - native: setup
Govind Prasad Gupta
 
PPTX
Docker, LinuX Container
Araf Karsh Hamid
 
PPTX
2015 TechSummit Web & Cloud - Gem, NPM, Bower, Nuget, Paket - Päckchen hier, ...
Daniel Fisher
 
PPTX
Native development kit (ndk) introduction
Rakesh Jha
 
PPTX
CocoaPods.pptx
Nicole and Yoonseo
 
PPTX
Overview of Node JS
Jacob Nelson
 
PPTX
Building an Ionic hybrid mobile app with TypeScript
Serge van den Oever
 
PDF
Using Docker with OpenStack - Hands On!
Adrian Otto
 
PPTX
Virtualization, Containers, Docker and scalable container management services
abhishek chawla
 
PDF
UKLUG 2012 - XPages, Beyond the basics
Ulrich Krause
 
PPT
XPages -Beyond the Basics
Ulrich Krause
 
PPTX
Drupal 8 + Elasticsearch + Docker
Roald Umandal
 
PPTX
PHP Dependency Management with Composer
Adam Englander
 
PDF
Docker 101 - Intro to Docker
Adrian Otto
 
PDF
Docker Containers - everything about docker Containers
ninita397
 
Mastering composer
Adán Lobato Lorenzo
 
NDK Programming in Android
Arvind Devaraj
 
Using Conda in Oracle Data Science.pdf
Nicholas Toscano
 
Introduction to package manager
yashobantabai
 
1. react - native: setup
Govind Prasad Gupta
 
Docker, LinuX Container
Araf Karsh Hamid
 
2015 TechSummit Web & Cloud - Gem, NPM, Bower, Nuget, Paket - Päckchen hier, ...
Daniel Fisher
 
Native development kit (ndk) introduction
Rakesh Jha
 
CocoaPods.pptx
Nicole and Yoonseo
 
Overview of Node JS
Jacob Nelson
 
Building an Ionic hybrid mobile app with TypeScript
Serge van den Oever
 
Using Docker with OpenStack - Hands On!
Adrian Otto
 
Virtualization, Containers, Docker and scalable container management services
abhishek chawla
 
UKLUG 2012 - XPages, Beyond the basics
Ulrich Krause
 
XPages -Beyond the Basics
Ulrich Krause
 
Drupal 8 + Elasticsearch + Docker
Roald Umandal
 
PHP Dependency Management with Composer
Adam Englander
 
Docker 101 - Intro to Docker
Adrian Otto
 
Docker Containers - everything about docker Containers
ninita397
 
Ad

5. react native-package

  • 2. Setup • Run following command in terminal npm init • This command create a package file with default configuration. • Now create folder and file in root folder according to men tioned folder structure (in next slide)
  • 3. Folder Structure • RootFolder • index.js • Package.js • lib • Publishable JS file • ios • Publishable static library • Android • Publishable library • example (React native project)
  • 4. index.js • It is entry point for npm package • Export all accessible classes import OktaUtil from './lib/oktaUtil' export default OktaUtil
  • 5. Package.js { "name": "reactoktaauth", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo "Error: no test specified" && exit 1" }, "author": "", "license": "ISC" }
  • 6. Package.js • name: • Should be small case. • Contain only alphanumeric character or ‘-’ • version: Current package version • description: package description • main: Package entry point (index.js) • auther: Optional and your name
  • 7. lib, ios, android, example • Implement JS code in lib folder, static library in iOS folder, package in android folder • Now run following command into package folder react-native init example • Open package.json of example project and write your npm package in dependiencies. "reactoktaauth": "../"
  • 8. example • Now run following command to connect npm package npm install • Now link ios and android folder to project. react-native link • Open xcode project. You are able to static librarhy into lib folder. • Now add static library into library binaries setting • Now you can run your application successfully.
  • 9. Use pod in static library • If you want to use pod file into static folder the change your pod file. # Uncomment the next line to define a global platform for your project platform :ios, '9.0' use_frameworks! workspace 'example' def shared_pods pod "OktaAuth" end target 'example' do shared_pods end target 'OktaAuthRN' do project './../../ios/OktaAuthRN/OktaAuthRN' shared_pods end
  • 10. Publish package • Run following command into terminal npm adduser • It will ask npm account user name, password, email ID (You must have npm account) • Now publish npm with following command npm publish