Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.

Commit

Permalink
feat(ensure-plugin-quality): Harmonize to NativeScript plugin guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
hypery2k committed Aug 24, 2017
1 parent aa717c8 commit 87b9d3d
Show file tree
Hide file tree
Showing 276 changed files with 2,229 additions and 126 deletions.
23 changes: 20 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ __build__/**
*.tgz
*.js
*.js.map
*.metadata.json
*.d.ts
*.ngsummary.json

!index.d.ts
!*.e2e.js
!karma*.js
Expand All @@ -69,6 +69,23 @@ src/hooks
src/node_modules
target/

# sample app
# demo apps
demo/node_modules/
demo/hooks
demo/lib
demo/platforms
demo/report
demo/app/tns_modules/
demo-angular/node_modules/
demo-angular/hooks
demo-angular/lib
demo-angular/platforms
demo-angular/app/tns_modules/
demo-angular/report

# end2end app
test/e2e/node_modules/
test/e2e/hooks
test/e2e/lib
test/e2e/platforms
test/e2e/app/tns_modules/
170 changes: 94 additions & 76 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,80 +1,98 @@
os: osx
osx_image: xcode8.3
sudo: false
language: objective-c

env:
global:
- API=19 # Google API 19 by default
- TAG=google_apis # Google APIs by default, alternatively use default
- ABI=armeabi-v7a # ARM ABI v7a by default
matrix:
- NODE_VERSION="6" NPM_VERSION="3" TNS_VERSION="2.5.5"
- NODE_VERSION="7" NPM_VERSION="3" TNS_VERSION="2.5.5"
- NODE_VERSION="7" NPM_VERSION="4" TNS_VERSION="2.5.5"
- NODE_VERSION="6" NPM_VERSION="3" TNS_VERSION="3.0.3"
- NODE_VERSION="6" NPM_VERSION="3" TNS_VERSION="3.0.3"
- NODE_VERSION="7" NPM_VERSION="4" TNS_VERSION="3.0.3"
- NODE_VERSION="6" NPM_VERSION="3" TNS_VERSION="3"
- NODE_VERSION="6" NPM_VERSION="3" TNS_VERSION="3"
- NODE_VERSION="7" NPM_VERSION="4" TNS_VERSION="3"
- ANDROID_PACKAGE='demo-debug.apk'
- ANDROID_PACKAGE_FOLDER=$TRAVIS_BUILD_DIR/demo/platforms/android/build/outputs/apk
- ANDROID_SAUCE_STORAGE="https://saucelabs.com/rest/v1/storage/$SAUCE_USER/$ANDROID_PACKAGE?overwrite=true"
- IOS_PACKAGE='demo.zip'
- IOS_PACKAGE_FOLDER=$TRAVIS_BUILD_DIR/demo/platforms/ios/build/emulator
- IOS_SAUCE_STORAGE="https://saucelabs.com/rest/v1/storage/$SAUCE_USER/$IOS_PACKAGE?overwrite=true"

matrix:
include:
- stage: "Lint"
language: node_js
os: linux
node_js: "6"
script: cd src && npm run ci.tslint && cd ../demo && npm run ci.tslint && cd ../demo-angular && npm run ci.tslint
- stage: "WebPack"
os: osx
env:
- Webpack="iOS"
osx_image: xcode8.3
language: node_js
node_js: "6"
jdk: oraclejdk8
before_install: cd src && npm i && cd ..
script: cd demo && npm run build.plugin && npm i && npm run build-ios-bundle && cd ../demo-angular && npm run build.plugin && npm i && npm run build-ios-bundle
- language: android
os: linux
env:
- Webpack="Android"
jdk: oraclejdk8
before_install: nvm install 6.10.3 && cd src && npm i && cd ..
script: cd demo && npm run build.plugin && npm i && npm run build-android-bundle && cd ../demo-angular && npm run build.plugin && npm i && npm run build-android-bundle
- stage: "Build"
env:
- BuildAndroid="25"
language: android
os: linux
jdk: oraclejdk8
before_install: nvm install 6.10.3 && cd src && npm i && cd ..
script:
- cd demo && npm run ci.android.build && cd ../demo-angular && npm run ci.android.build
- "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $ANDROID_SAUCE_STORAGE --data-binary @$ANDROID_PACKAGE_FOLDER/$ANDROID_PACKAGE"
- os: osx
env:
- BuildiOS="10.3"
- Xcode="8.3"
osx_image: xcode8.3
language: node_js
node_js: "6"
jdk: oraclejdk8
before_install: cd src && npm i && cd ..
script:
- cd demo && npm run ci.ios.build && cd ../demo-angular && npm run ci.ios.build
- cd $IOS_PACKAGE_FOLDER && zip -r $IOS_PACKAGE demo.app
- "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $IOS_SAUCE_STORAGE --data-binary @$IOS_PACKAGE_FOLDER/$IOS_PACKAGE"
- stage: "UI Tests"
env:
- Android="23"
language: node_js
os: linux
node_js: "6"
before_install: cd src && npm i && cd ..
script:
- npm i -g appium
- cd demo && npm i && npm run appium --runType=android23 --sauceLab=true --appLocation=$ANDROID_PACKAGE
- os: linux
env:
- iOS="10"
language: node_js
node_js: "6"
before_install: cd src && npm i && cd ..
script:
- npm i -g appium
- cd demo && npm i
- travis_wait npm run appium --runType=ios-simulator103iPhone6 --sauceLab=true --appLocation=$IOS_PACKAGE

android:
components:
- tools
- platform-tools
- build-tools-25.0.2
- android-25
- extra-android-m2repository

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock

before_install:
- export EMULATOR="system-images;android-${API};${TAG};${ABI}" # Used to install/create emulator
- export ANDROID_HOME=/usr/local/share/android-sdk
- export PATH=$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH
- wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
- source ~/.nvm/nvm.sh && nvm install $NODE_VERSION && nvm use $NODE_VERSION
- PATH="`npm bin`:`npm bin -g`:$PATH"
- brew update > /dev/null;
- brew install Caskroom/cask/android-sdk
# Tools
- echo y | sdkmanager 'tools'
# Platform tools
- echo y | sdkmanager 'platform-tools'
# SDKs
- echo y | sdkmanager 'platforms;android-25'
# build tools
- echo y | sdkmanager 'build-tools;25.0.2'
# Android System Images, for emulators
- echo y | sdkmanager 'system-images;android-24;default;armeabi-v7a'
- echo y | sdkmanager 'system-images;android-22;default;armeabi-v7a'
- echo y | sdkmanager 'system-images;android-21;default;armeabi-v7a'
- echo y | sdkmanager 'system-images;android-19;default;armeabi-v7a'
- echo y | sdkmanager 'system-images;android-19;google_apis;armeabi-v7a'
# Extras
- echo y | sdkmanager 'extras;android;m2repository'
- echo y | sdkmanager 'extras;google;google_play_services'
- echo y | sdkmanager 'extras;google;m2repository'
# google apis
- echo y | sdkmanager 'add-ons;addon-google_apis-google-23'
- mkdir "$ANDROID_HOME/licenses" || true
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
# create and start emulator
- echo no | avdmanager create avd --name test -k "$EMULATOR" -f --abi "$ABI" --tag "$TAG"
- emulator -avd test -gpu off -skin 768x1280 -no-window &
# CocoaPods
- gem install cocoapods --pre --no-rdoc --no-ri --no-document --quiet
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
- pod --version
- pod setup --silent
- pod repo update --silent
# Build Tools
- npm install -g npm@$NPM_VERSION
- npm install -g nativescript@$TNS_VERSION
- tns usage-reporting disable
- tns error-reporting disable
# Show environment info
- node --version
- npm --version
- xcpretty --version
- xcodebuild -version
- xcodebuild -showsdks
- echo $ANDROID_HOME
cache:
directories:
- .nvm
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/

script:
- npm run clean
- npm run build
- npm run test
- npm run e2e
install:
- npm install -g nativescript
- tns usage-reporting disable
- tns error-reporting disable
42 changes: 42 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": "0.2.0",
"configurations": [

{
"name": "Launch on iOS",
"type": "nativescript",
"request": "launch",
"platform": "ios",
"appRoot": "${workspaceRoot}",
"sourceMaps": true,
"watch": true
},
{
"name": "Attach on iOS",
"type": "nativescript",
"request": "attach",
"platform": "ios",
"appRoot": "${workspaceRoot}",
"sourceMaps": true,
"watch": false
},
{
"name": "Launch on Android",
"type": "nativescript",
"request": "launch",
"platform": "android",
"appRoot": "${workspaceRoot}",
"sourceMaps": true,
"watch": true
},
{
"name": "Attach on Android",
"type": "nativescript",
"request": "attach",
"platform": "android",
"appRoot": "${workspaceRoot}",
"sourceMaps": true,
"watch": false
}
]
}
25 changes: 14 additions & 11 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
properties properties: [
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '10']],
[$class: 'GithubProjectProperty', displayName: '', projectUrlStr: 'https://github.com/hypery2k/nativescript-urlhandler'],
disableConcurrentBuilds()
]

@Library('mare-build-library')
def nodeJS = new de.mare.ci.jenkins.NodeJS()

timeout(60) {
node('nativescript') {
def buildNumber = env.BUILD_NUMBER
Expand All @@ -23,23 +25,24 @@ timeout(60) {
checkout scm
}

stage('Build') {
sh "npm run clean && npm run build"
}
dir('src') {
stage('Build') {
sh "npm run clean && npm run build"
}

stage('Test') {
sh "npm run test"
junit 'target/junit-report/junitresults-*.xml'
stage('Test') {
sh "npm run test"
junit 'target/junit-report/junitresults-*.xml'
}
}

stage('End2End Test') {
sh "npm run e2e"
sh "cd demo && npm run build.plugin && npm i && npm run build-ios-bundle && npm run build-android-bundle"
sh "cd demo-angular && npm run build.plugin && npm i && npm run build-ios-bundle && npm run build-android-bundle"
}

stage('Publish NPM snapshot') {
def currentVersion = sh(returnStdout: true, script: "npm version | grep \"{\" | tr -s ':' | tr '_' '-' | tr '/' '-' | cut -d \"'\" -f 4").trim()
def newVersion = sh(returnStdout: true, script: "echo ${currentVersion}-${branchName}-${buildNumber} | tr '_' '-'").trim()
sh "npm version ${newVersion} --no-git-tag-version && npm publish --tag next"
nodeJS.publishSnapshot('src', buildNumber, branchName)
}

} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# NativeScript URL Handler Plugin
# NativeScript URL Handler Plugin ![apple](https://cdn3.iconfinder.com/data/icons/picons-social/57/16-apple-32.png) ![android](https://cdn4.iconfinder.com/data/icons/logos-3/228/android-32.png)

[![Greenkeeper badge](https://badges.greenkeeper.io/hypery2k/nativescript-urlhandler.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/hypery2k/nativescript-urlhandler.svg?branch=master)](https://travis-ci.org/hypery2k/nativescript-urlhandler)
Expand Down
30 changes: 30 additions & 0 deletions appium.capabilities.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"android23": {
"browserName": "",
"appium-version": "1.6.5",
"platformName": "Android",
"platformVersion": "6.0",
"deviceName": "Android Emulator",
"noReset": false,
"app": ""

},
"ios-simulator10iPhone6": {
"browserName": "",
"appium-version": "1.6.5",
"platformName": "iOS",
"platformVersion": "10.0",
"deviceName": "iPhone 6 Simulator",
"app": ""

},
"ios-simulator103iPhone6": {
"browserName": "",
"appium-version": "1.6.5",
"platformName": "iOS",
"platformVersion": "10.3",
"deviceName": "iPhone 6 Simulator",
"app": ""

}
}
43 changes: 43 additions & 0 deletions demo-angular/app/App_Resources/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="__PACKAGE__"
android:versionCode="1"
android:versionName="1.0">

<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"/>

<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="__APILEVEL__"/>

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>

<application
android:name="com.tns.NativeScriptApplication"
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme">

<activity
android:name="com.tns.NativeScriptActivity"
android:label="@string/title_activity_kimera"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@style/LaunchScreenTheme">

<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.tns.ErrorReportActivity"/>
</application>
</manifest>
16 changes: 16 additions & 0 deletions demo-angular/app/App_Resources/Android/app.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Add your native dependencies here:

// Uncomment to add recyclerview-v7 dependency
//dependencies {
// compile 'com.android.support:recyclerview-v7:+'
//}

android {
defaultConfig {
generatedDensities = []
applicationId = "org.nativescript.demoangular"
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
Loading

0 comments on commit 87b9d3d

Please sign in to comment.