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

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

What's hot (20)

Easy access to open stack object storage
Easy access to open stack object storageEasy access to open stack object storage
Easy access to open stack object storage
 
Practical Glusto Example
Practical Glusto ExamplePractical Glusto Example
Practical Glusto Example
 
Automated testing: Openshift on Openstack
Automated testing: Openshift on OpenstackAutomated testing: Openshift on Openstack
Automated testing: Openshift on Openstack
 
CoreOS introduction - Johann Romefort
CoreOS introduction - Johann RomefortCoreOS introduction - Johann Romefort
CoreOS introduction - Johann Romefort
 
Docker puppetcamp london 2013
Docker puppetcamp london 2013Docker puppetcamp london 2013
Docker puppetcamp london 2013
 
Docker 入門 Introduction to Docker
Docker 入門  Introduction to DockerDocker 入門  Introduction to Docker
Docker 入門 Introduction to Docker
 
CoreOS Overview
CoreOS OverviewCoreOS Overview
CoreOS Overview
 
Laravel Poznań Meetup #12 - "Speed up web API with Laravel and Swoole using ...
 Laravel Poznań Meetup #12 - "Speed up web API with Laravel and Swoole using ... Laravel Poznań Meetup #12 - "Speed up web API with Laravel and Swoole using ...
Laravel Poznań Meetup #12 - "Speed up web API with Laravel and Swoole using ...
 
Containers: Anti Pattern
Containers:  Anti PatternContainers:  Anti Pattern
Containers: Anti Pattern
 
[FDD 2016] Marek Śledziński - Microsoft Windows a sprawa kontenerów
[FDD 2016] Marek Śledziński - Microsoft Windows a sprawa kontenerów[FDD 2016] Marek Śledziński - Microsoft Windows a sprawa kontenerów
[FDD 2016] Marek Śledziński - Microsoft Windows a sprawa kontenerów
 
NodeJs Session03
NodeJs Session03NodeJs Session03
NodeJs Session03
 
Ferrara Linux Day 2011
Ferrara Linux Day 2011Ferrara Linux Day 2011
Ferrara Linux Day 2011
 
Distributed locks in Ruby - Correctness vs Efficiency - Knapsack Pro case stu...
Distributed locks in Ruby - Correctness vs Efficiency - Knapsack Pro case stu...Distributed locks in Ruby - Correctness vs Efficiency - Knapsack Pro case stu...
Distributed locks in Ruby - Correctness vs Efficiency - Knapsack Pro case stu...
 
Docker n co
Docker n coDocker n co
Docker n co
 
Nodejs Session01
Nodejs Session01Nodejs Session01
Nodejs Session01
 
Docker 102 - Immutable Infrastructure
Docker 102 - Immutable InfrastructureDocker 102 - Immutable Infrastructure
Docker 102 - Immutable Infrastructure
 
An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)
 
Docker Compose and Panamax - ContainerDays Boston - June 2015
Docker Compose and Panamax - ContainerDays Boston - June 2015Docker Compose and Panamax - ContainerDays Boston - June 2015
Docker Compose and Panamax - ContainerDays Boston - June 2015
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
DockerCoreNet
DockerCoreNetDockerCoreNet
DockerCoreNet
 

Similar to 5. react native-package

Node.js
Node.jsNode.js
Mastering composer
Mastering composerMastering composer
Mastering composer
Adán Lobato Lorenzo
 
NDK Programming in Android
NDK Programming in AndroidNDK Programming in Android
NDK Programming in Android
Arvind Devaraj
 
Using Conda in Oracle Data Science.pdf
Using Conda in Oracle Data Science.pdfUsing Conda in Oracle Data Science.pdf
Using Conda in Oracle Data Science.pdf
Nicholas Toscano
 
Introduction to package manager
Introduction to package managerIntroduction to package manager
Introduction to package manager
yashobantabai
 
1. react - native: setup
1. react - native: setup1. react - native: setup
1. react - native: setup
Govind Prasad Gupta
 
Docker, LinuX Container
Docker, LinuX ContainerDocker, LinuX Container
Docker, LinuX Container
Araf Karsh Hamid
 
2015 TechSummit Web & Cloud - Gem, NPM, Bower, Nuget, Paket - Päckchen hier, ...
2015 TechSummit Web & Cloud - Gem, NPM, Bower, Nuget, Paket - Päckchen hier, ...2015 TechSummit Web & Cloud - Gem, NPM, Bower, Nuget, Paket - Päckchen hier, ...
2015 TechSummit Web & Cloud - Gem, NPM, Bower, Nuget, Paket - Päckchen hier, ...
Daniel Fisher
 
Native development kit (ndk) introduction
Native development kit (ndk)  introductionNative development kit (ndk)  introduction
Native development kit (ndk) introduction
Rakesh Jha
 
CocoaPods.pptx
CocoaPods.pptxCocoaPods.pptx
CocoaPods.pptx
Nicole and Yoonseo
 
Overview of Node JS
Overview of Node JSOverview of Node JS
Overview of Node JS
Jacob Nelson
 
Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript
Serge van den Oever
 
Using Docker with OpenStack - Hands On!
 Using Docker with OpenStack - Hands On! Using Docker with OpenStack - Hands On!
Using Docker with OpenStack - Hands On!
Adrian Otto
 
Virtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management servicesVirtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management services
abhishek chawla
 
UKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basicsUKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basics
Ulrich Krause
 
XPages -Beyond the Basics
XPages -Beyond the BasicsXPages -Beyond the Basics
XPages -Beyond the Basics
Ulrich Krause
 
Drupal 8 + Elasticsearch + Docker
Drupal 8 + Elasticsearch + DockerDrupal 8 + Elasticsearch + Docker
Drupal 8 + Elasticsearch + Docker
Roald Umandal
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with Composer
Adam Englander
 
Docker 101 - Intro to Docker
Docker 101 - Intro to DockerDocker 101 - Intro to Docker
Docker 101 - Intro to Docker
Adrian Otto
 
Containerization using docker and its applications
Containerization using docker and its applicationsContainerization using docker and its applications
Containerization using docker and its applications
Puneet Kumar Bhatia (MBA, ITIL V3 Certified)
 

Similar to 5. react native-package (20)

Node.js
Node.jsNode.js
Node.js
 
Mastering composer
Mastering composerMastering composer
Mastering composer
 
NDK Programming in Android
NDK Programming in AndroidNDK Programming in Android
NDK Programming in Android
 
Using Conda in Oracle Data Science.pdf
Using Conda in Oracle Data Science.pdfUsing Conda in Oracle Data Science.pdf
Using Conda in Oracle Data Science.pdf
 
Introduction to package manager
Introduction to package managerIntroduction to package manager
Introduction to package manager
 
1. react - native: setup
1. react - native: setup1. react - native: setup
1. react - native: setup
 
Docker, LinuX Container
Docker, LinuX ContainerDocker, LinuX Container
Docker, LinuX Container
 
2015 TechSummit Web & Cloud - Gem, NPM, Bower, Nuget, Paket - Päckchen hier, ...
2015 TechSummit Web & Cloud - Gem, NPM, Bower, Nuget, Paket - Päckchen hier, ...2015 TechSummit Web & Cloud - Gem, NPM, Bower, Nuget, Paket - Päckchen hier, ...
2015 TechSummit Web & Cloud - Gem, NPM, Bower, Nuget, Paket - Päckchen hier, ...
 
Native development kit (ndk) introduction
Native development kit (ndk)  introductionNative development kit (ndk)  introduction
Native development kit (ndk) introduction
 
CocoaPods.pptx
CocoaPods.pptxCocoaPods.pptx
CocoaPods.pptx
 
Overview of Node JS
Overview of Node JSOverview of Node JS
Overview of Node JS
 
Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript Building an Ionic hybrid mobile app with TypeScript
Building an Ionic hybrid mobile app with TypeScript
 
Using Docker with OpenStack - Hands On!
 Using Docker with OpenStack - Hands On! Using Docker with OpenStack - Hands On!
Using Docker with OpenStack - Hands On!
 
Virtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management servicesVirtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management services
 
UKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basicsUKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basics
 
XPages -Beyond the Basics
XPages -Beyond the BasicsXPages -Beyond the Basics
XPages -Beyond the Basics
 
Drupal 8 + Elasticsearch + Docker
Drupal 8 + Elasticsearch + DockerDrupal 8 + Elasticsearch + Docker
Drupal 8 + Elasticsearch + Docker
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with Composer
 
Docker 101 - Intro to Docker
Docker 101 - Intro to DockerDocker 101 - Intro to Docker
Docker 101 - Intro to Docker
 
Containerization using docker and its applications
Containerization using docker and its applicationsContainerization using docker and its applications
Containerization using docker and its applications
 

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