diff --git a/doric-cli/assets-lib/.gitignore b/doric-cli/assets-lib/.gitignore
new file mode 100644
index 00000000..36480192
--- /dev/null
+++ b/doric-cli/assets-lib/.gitignore
@@ -0,0 +1,10 @@
+node_modules/
+build/
+bundle/
+xcuserdata
+.gradle
+.idea/
+Pods/
+*.lock
+*.xcworkspace/xcshareddata/xcdebugger/
+package-lock.json
\ No newline at end of file
diff --git a/doric-cli/assets-lib/.npmignore b/doric-cli/assets-lib/.npmignore
new file mode 100644
index 00000000..26e6363b
--- /dev/null
+++ b/doric-cli/assets-lib/.npmignore
@@ -0,0 +1,5 @@
+android/
+iOS/
+.vscode/
+node_modules/
+example/
diff --git a/doric-cli/assets-lib/Template.podspec b/doric-cli/assets-lib/Template.podspec
new file mode 100644
index 00000000..3c1d9246
--- /dev/null
+++ b/doric-cli/assets-lib/Template.podspec
@@ -0,0 +1,20 @@
+Pod::Spec.new do |s|
+ s.name = '__$RawName__'
+ s.version = '0.1.0'
+ s.summary = 'Doric extension library'
+
+ #s.description = <<-DESC
+ # DESC
+
+ s.homepage = 'http://xxx'
+ s.license = { :type => 'Apache-2.0', :file => 'LICENSE' }
+ s.author = { 'xxx' => 'xxx@xxx' }
+ s.source = { :git => 'git@xxx', :tag => s.version.to_s }
+
+ s.ios.deployment_target = '9.0'
+
+ s.source_files = 'iOS/Classes/**/*'
+ s.resource = "dist/**/*"
+ s.public_header_files = 'iOS/Classes/**/*.h'
+ s.dependency 'DoricCore'
+end
diff --git a/doric-cli/assets-lib/android/.gitignore b/doric-cli/assets-lib/android/.gitignore
new file mode 100644
index 00000000..42afabfd
--- /dev/null
+++ b/doric-cli/assets-lib/android/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/doric-cli/assets-lib/android/build.gradle b/doric-cli/assets-lib/android/build.gradle
new file mode 100644
index 00000000..4b249462
--- /dev/null
+++ b/doric-cli/assets-lib/android/build.gradle
@@ -0,0 +1,46 @@
+import groovy.json.JsonSlurper
+
+def model = new JsonSlurper().parse(new File(project.getProjectDir().parent + File.separator + "package.json"))
+def doricSDKVersion = model.dependencies.doric.replace("^", "").replace(">=","")
+
+println("Doric Version:" + doricSDKVersion)
+
+buildscript {
+ repositories {
+ mavenCentral()
+ google()
+ jcenter()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.5.3'
+ }
+}
+
+rootProject.allprojects {
+ repositories {
+ mavenCentral()
+ google()
+ jcenter()
+ }
+}
+
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 29
+
+ sourceSets {
+ main.assets.srcDirs += "../dist"
+ }
+ defaultConfig {
+ minSdkVersion 16
+ targetSdkVersion 29
+ versionCode 1
+ versionName "1.0"
+ }
+}
+
+dependencies {
+ api "pub.doric:core:$doricSDKVersion"
+}
diff --git a/doric-cli/assets-lib/android/consumer-rules.pro b/doric-cli/assets-lib/android/consumer-rules.pro
new file mode 100644
index 00000000..e69de29b
diff --git a/doric-cli/assets-lib/android/proguard-rules.pro b/doric-cli/assets-lib/android/proguard-rules.pro
new file mode 100644
index 00000000..481bb434
--- /dev/null
+++ b/doric-cli/assets-lib/android/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/doric-cli/assets-lib/android/src/main/AndroidManifest.xml b/doric-cli/assets-lib/android/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..c3a76b0b
--- /dev/null
+++ b/doric-cli/assets-lib/android/src/main/AndroidManifest.xml
@@ -0,0 +1,5 @@
+
+
+
+
\ No newline at end of file
diff --git a/doric-cli/assets-lib/android/src/main/java/pub/doric/library/DoricDemoPlugin.java b/doric-cli/assets-lib/android/src/main/java/pub/doric/library/DoricDemoPlugin.java
new file mode 100644
index 00000000..dfa294da
--- /dev/null
+++ b/doric-cli/assets-lib/android/src/main/java/pub/doric/library/DoricDemoPlugin.java
@@ -0,0 +1,21 @@
+package pub.doric.library;
+
+import com.github.pengfeizhou.jscore.JavaValue;
+
+import pub.doric.DoricContext;
+import pub.doric.extension.bridge.DoricMethod;
+import pub.doric.extension.bridge.DoricPlugin;
+import pub.doric.extension.bridge.DoricPromise;
+import pub.doric.plugin.DoricJavaPlugin;
+
+@DoricPlugin(name = "demoPlugin")
+public class DoricDemoPlugin extends DoricJavaPlugin {
+ public DoricDemoPlugin(DoricContext doricContext) {
+ super(doricContext);
+ }
+
+ @DoricMethod
+ public void call(DoricPromise promise) {
+ promise.resolve(new JavaValue("This is from android"));
+ }
+}
diff --git a/doric-cli/assets-lib/android/src/main/java/pub/doric/library/TemplateLibrary.java b/doric-cli/assets-lib/android/src/main/java/pub/doric/library/TemplateLibrary.java
new file mode 100644
index 00000000..708424b9
--- /dev/null
+++ b/doric-cli/assets-lib/android/src/main/java/pub/doric/library/TemplateLibrary.java
@@ -0,0 +1,26 @@
+package pub.doric.library;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import pub.doric.Doric;
+import pub.doric.DoricComponent;
+import pub.doric.DoricLibrary;
+import pub.doric.DoricRegistry;
+
+@DoricComponent
+public class __$RawName__Library extends DoricLibrary {
+ @Override
+ public void load(DoricRegistry registry) {
+ try {
+ InputStream is = Doric.application().getAssets().open("bundle___$__.js");
+ byte[] bytes = new byte[is.available()];
+ is.read(bytes);
+ String content = new String(bytes);
+ registry.registerJSBundle("__$__", content);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ registry.registerNativePlugin(DoricDemoPlugin.class);
+ }
+}
diff --git a/doric-cli/assets-lib/example/.gitignore b/doric-cli/assets-lib/example/.gitignore
new file mode 100644
index 00000000..36480192
--- /dev/null
+++ b/doric-cli/assets-lib/example/.gitignore
@@ -0,0 +1,10 @@
+node_modules/
+build/
+bundle/
+xcuserdata
+.gradle
+.idea/
+Pods/
+*.lock
+*.xcworkspace/xcshareddata/xcdebugger/
+package-lock.json
\ No newline at end of file
diff --git a/doric-cli/assets-lib/example/android/.gitignore b/doric-cli/assets-lib/example/android/.gitignore
new file mode 100644
index 00000000..7c1b8367
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/.gitignore
@@ -0,0 +1,15 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+/.idea
\ No newline at end of file
diff --git a/doric-cli/assets-lib/example/android/app/.gitignore b/doric-cli/assets-lib/example/android/app/.gitignore
new file mode 100644
index 00000000..796b96d1
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/doric-cli/assets-lib/example/android/app/build.gradle b/doric-cli/assets-lib/example/android/app/build.gradle
new file mode 100644
index 00000000..5731bad7
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/app/build.gradle
@@ -0,0 +1,48 @@
+import groovy.json.JsonSlurper
+
+def model = new JsonSlurper().parse(new File(project.rootDir.parentFile.parent + File.separator + "package.json"))
+def doricSDKVersion = model.dependencies.doric.replace("^", "").replace(">=","")
+
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 29
+ buildToolsVersion "29.0.2"
+ defaultConfig {
+ applicationId "pub.doric.android.example"
+ minSdkVersion 16
+ targetSdkVersion 29
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ sourceSets {
+ main {
+ assets.srcDirs = [project.getRootDir().getParent() + "/bundle"]
+ }
+ }
+
+ dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation 'androidx.appcompat:appcompat:1.1.0'
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ implementation project(":lib")
+ implementation "pub.doric:devkit:$doricSDKVersion"
+ }
+}
+
+afterEvaluate {
+ buildJSBundle.exec()
+}
+
+task buildJSBundle(type: Exec) {
+ workingDir project.rootDir.getParent()
+ commandLine 'npm', 'run', 'build'
+}
\ No newline at end of file
diff --git a/doric-cli/assets-lib/example/android/app/proguard-rules.pro b/doric-cli/assets-lib/example/android/app/proguard-rules.pro
new file mode 100644
index 00000000..f1b42451
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/doric-cli/assets-lib/example/android/app/src/main/AndroidManifest.xml b/doric-cli/assets-lib/example/android/app/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..d413fe49
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/doric-cli/assets-lib/example/android/app/src/main/java/pub/doric/android/MainActivity.java b/doric-cli/assets-lib/example/android/app/src/main/java/pub/doric/android/MainActivity.java
new file mode 100644
index 00000000..561139f0
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/app/src/main/java/pub/doric/android/MainActivity.java
@@ -0,0 +1,40 @@
+package pub.doric.android;
+
+import android.os.Bundle;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.appcompat.app.AppCompatActivity;
+import pub.doric.DoricFragment;
+import pub.doric.devkit.DoricDev;
+import pub.doric.navbar.BaseDoricNavBar;
+
+public class MainActivity extends AppCompatActivity {
+ private final String BUNDLE_NAME = "Example";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ String source = "assets://src/" + BUNDLE_NAME + ".js";
+ getIntent().putExtra("source", source);
+ getIntent().putExtra("alias", BUNDLE_NAME);
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ this.getSupportFragmentManager().beginTransaction().add(R.id.container, new DoricFragment()).commit();
+ BaseDoricNavBar doricNavBar = findViewById(R.id.doric_nav_bar);
+ doricNavBar.setBackIconVisible(false);
+
+ TextView textView = new TextView(this);
+ textView.setText("Devkit");
+ textView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ DoricDev.getInstance().openDevMode();
+ }
+ });
+ textView.setLayoutParams(new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.WRAP_CONTENT,
+ ViewGroup.LayoutParams.WRAP_CONTENT));
+ doricNavBar.setRight(textView);
+ }
+}
diff --git a/doric-cli/assets-lib/example/android/app/src/main/java/pub/doric/android/MainApplication.java b/doric-cli/assets-lib/example/android/app/src/main/java/pub/doric/android/MainApplication.java
new file mode 100644
index 00000000..09fb049a
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/app/src/main/java/pub/doric/android/MainApplication.java
@@ -0,0 +1,15 @@
+package pub.doric.android;
+
+import android.app.Application;
+
+import pub.doric.Doric;
+import pub.doric.library.__$RawName__Library;
+
+public class MainApplication extends Application {
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ Doric.init(this);
+ Doric.registerLibrary(new __$RawName__Library());
+ }
+}
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/doric-cli/assets-lib/example/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 00000000..1f6bb290
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/drawable/ic_launcher_background.xml b/doric-cli/assets-lib/example/android/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 00000000..0d025f9b
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/layout/activity_main.xml b/doric-cli/assets-lib/example/android/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 00000000..11345c56
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 00000000..eca70cfe
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 00000000..eca70cfe
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 00000000..898f3ed5
Binary files /dev/null and b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 00000000..dffca360
Binary files /dev/null and b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 00000000..64ba76f7
Binary files /dev/null and b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 00000000..dae5e082
Binary files /dev/null and b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 00000000..e5ed4659
Binary files /dev/null and b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 00000000..14ed0af3
Binary files /dev/null and b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 00000000..b0907cac
Binary files /dev/null and b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 00000000..d8ae0315
Binary files /dev/null and b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 00000000..2c18de9e
Binary files /dev/null and b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 00000000..beed3cdd
Binary files /dev/null and b/doric-cli/assets-lib/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/values/colors.xml b/doric-cli/assets-lib/example/android/app/src/main/res/values/colors.xml
new file mode 100644
index 00000000..69b22338
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #008577
+ #00574B
+ #D81B60
+
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/values/strings.xml b/doric-cli/assets-lib/example/android/app/src/main/res/values/strings.xml
new file mode 100644
index 00000000..0057fcb9
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/app/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ Example
+
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/values/styles.xml b/doric-cli/assets-lib/example/android/app/src/main/res/values/styles.xml
new file mode 100644
index 00000000..0eb88fe3
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/app/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/doric-cli/assets-lib/example/android/app/src/main/res/xml/network_security_config.xml b/doric-cli/assets-lib/example/android/app/src/main/res/xml/network_security_config.xml
new file mode 100644
index 00000000..dca93c07
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/app/src/main/res/xml/network_security_config.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/doric-cli/assets-lib/example/android/build.gradle b/doric-cli/assets-lib/example/android/build.gradle
new file mode 100644
index 00000000..97c353b3
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/build.gradle
@@ -0,0 +1,28 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ google()
+ jcenter()
+
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.5.3'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+ mavenCentral()
+ maven { url 'https://jitpack.io' }
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/doric-cli/assets-lib/example/android/gradle.properties b/doric-cli/assets-lib/example/android/gradle.properties
new file mode 100644
index 00000000..199d16ed
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/gradle.properties
@@ -0,0 +1,20 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Automatically convert third-party libraries to use AndroidX
+android.enableJetifier=true
+
diff --git a/doric-cli/assets-lib/example/android/gradle/wrapper/gradle-wrapper.jar b/doric-cli/assets-lib/example/android/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 00000000..f6b961fd
Binary files /dev/null and b/doric-cli/assets-lib/example/android/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/doric-cli/assets-lib/example/android/gradle/wrapper/gradle-wrapper.properties b/doric-cli/assets-lib/example/android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..6cceef16
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Thu Dec 05 19:41:10 CST 2019
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
diff --git a/doric-cli/assets-lib/example/android/gradlew b/doric-cli/assets-lib/example/android/gradlew
new file mode 100755
index 00000000..cccdd3d5
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/doric-cli/assets-lib/example/android/gradlew.bat b/doric-cli/assets-lib/example/android/gradlew.bat
new file mode 100644
index 00000000..e95643d6
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/doric-cli/assets-lib/example/android/settings.gradle b/doric-cli/assets-lib/example/android/settings.gradle
new file mode 100644
index 00000000..2c9fdc77
--- /dev/null
+++ b/doric-cli/assets-lib/example/android/settings.gradle
@@ -0,0 +1,5 @@
+include ':app'
+rootProject.name='Example'
+
+include ":lib"
+project(":lib").projectDir = file("../../android")
\ No newline at end of file
diff --git a/doric-cli/assets-lib/example/iOS/.gitignore b/doric-cli/assets-lib/example/iOS/.gitignore
new file mode 100644
index 00000000..35b3c56b
--- /dev/null
+++ b/doric-cli/assets-lib/example/iOS/.gitignore
@@ -0,0 +1,6 @@
+Podfile.lock
+*.xcworkspace/
+Pods/
+.idea/
+*.xcodeproj/xcuserdata/
+build/
\ No newline at end of file
diff --git a/doric-cli/assets-lib/example/iOS/App/AppDelegate.h b/doric-cli/assets-lib/example/iOS/App/AppDelegate.h
new file mode 100644
index 00000000..8ec7241c
--- /dev/null
+++ b/doric-cli/assets-lib/example/iOS/App/AppDelegate.h
@@ -0,0 +1,6 @@
+#import
+
+@interface AppDelegate : UIResponder
+@property (strong, nonatomic) UIWindow *window;
+@end
+
diff --git a/doric-cli/assets-lib/example/iOS/App/AppDelegate.m b/doric-cli/assets-lib/example/iOS/App/AppDelegate.m
new file mode 100644
index 00000000..8e4fd624
--- /dev/null
+++ b/doric-cli/assets-lib/example/iOS/App/AppDelegate.m
@@ -0,0 +1,38 @@
+#import "AppDelegate.h"
+#import
+#if __has_include()
+#import
+#import
+#endif
+
+@interface AppDelegate ()
+@end
+
+@implementation AppDelegate
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+#if __has_include()
+ [SDImageCodersManager.sharedManager addCoder:SDImageWebPCoder.sharedCoder];
+#endif
+ return YES;
+}
+
+
+#pragma mark - UISceneSession lifecycle
+
+
+- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
+ // Called when a new scene session is being created.
+ // Use this method to select a configuration to create the new scene with.
+ return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
+}
+
+
+- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet *)sceneSessions {
+ // Called when the user discards a scene session.
+ // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
+ // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
+}
+
+
+@end
diff --git a/doric-cli/assets-lib/example/iOS/App/Assets.xcassets/AppIcon.appiconset/Contents.json b/doric-cli/assets-lib/example/iOS/App/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 00000000..d8db8d65
--- /dev/null
+++ b/doric-cli/assets-lib/example/iOS/App/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,98 @@
+{
+ "images" : [
+ {
+ "idiom" : "iphone",
+ "size" : "20x20",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "iphone",
+ "size" : "20x20",
+ "scale" : "3x"
+ },
+ {
+ "idiom" : "iphone",
+ "size" : "29x29",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "iphone",
+ "size" : "29x29",
+ "scale" : "3x"
+ },
+ {
+ "idiom" : "iphone",
+ "size" : "40x40",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "iphone",
+ "size" : "40x40",
+ "scale" : "3x"
+ },
+ {
+ "idiom" : "iphone",
+ "size" : "60x60",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "iphone",
+ "size" : "60x60",
+ "scale" : "3x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "20x20",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "20x20",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "29x29",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "29x29",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "40x40",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "40x40",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "76x76",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "76x76",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "83.5x83.5",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "ios-marketing",
+ "size" : "1024x1024",
+ "scale" : "1x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/doric-cli/assets-lib/example/iOS/App/Assets.xcassets/Contents.json b/doric-cli/assets-lib/example/iOS/App/Assets.xcassets/Contents.json
new file mode 100644
index 00000000..da4a164c
--- /dev/null
+++ b/doric-cli/assets-lib/example/iOS/App/Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/doric-cli/assets-lib/example/iOS/App/Base.lproj/LaunchScreen.storyboard b/doric-cli/assets-lib/example/iOS/App/Base.lproj/LaunchScreen.storyboard
new file mode 100644
index 00000000..865e9329
--- /dev/null
+++ b/doric-cli/assets-lib/example/iOS/App/Base.lproj/LaunchScreen.storyboard
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doric-cli/assets-lib/example/iOS/App/Info.plist b/doric-cli/assets-lib/example/iOS/App/Info.plist
new file mode 100644
index 00000000..edbd4f30
--- /dev/null
+++ b/doric-cli/assets-lib/example/iOS/App/Info.plist
@@ -0,0 +1,67 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ $(DEVELOPMENT_LANGUAGE)
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ $(PRODUCT_NAME)
+ CFBundlePackageType
+ $(PRODUCT_BUNDLE_PACKAGE_TYPE)
+ CFBundleShortVersionString
+ 1.0
+ CFBundleVersion
+ 1
+ LSRequiresIPhoneOS
+
+ NSAppTransportSecurity
+
+ NSAllowsArbitraryLoads
+
+
+ NSCameraUsageDescription
+ Request to open camera
+ UIApplicationSceneManifest
+
+ UIApplicationSupportsMultipleScenes
+
+ UISceneConfigurations
+
+ UIWindowSceneSessionRoleApplication
+
+
+ UISceneConfigurationName
+ Default Configuration
+ UISceneDelegateClassName
+ SceneDelegate
+
+
+
+
+ UILaunchStoryboardName
+ LaunchScreen
+ UIRequiredDeviceCapabilities
+
+ armv7
+
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+
+
diff --git a/doric-cli/assets-lib/example/iOS/App/SceneDelegate.h b/doric-cli/assets-lib/example/iOS/App/SceneDelegate.h
new file mode 100644
index 00000000..87fc5082
--- /dev/null
+++ b/doric-cli/assets-lib/example/iOS/App/SceneDelegate.h
@@ -0,0 +1,5 @@
+#import
+
+@interface SceneDelegate : UIResponder
+@end
+
diff --git a/doric-cli/assets-lib/example/iOS/App/SceneDelegate.m b/doric-cli/assets-lib/example/iOS/App/SceneDelegate.m
new file mode 100644
index 00000000..59d7fe3f
--- /dev/null
+++ b/doric-cli/assets-lib/example/iOS/App/SceneDelegate.m
@@ -0,0 +1,77 @@
+#import "SceneDelegate.h"
+#import
+#import "__$RawName__Library.h"
+
+#if DEBUG
+
+#import
+
+#endif
+
+@interface SceneDelegate ()
+@end
+
+@implementation SceneDelegate
+- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
+ [Doric registerLibrary:[__$RawName__Library new]];
+ UIWindowScene *windowScene = (UIWindowScene *) scene;
+ NSString *bundleName = @"Example";
+ DoricViewController *doricViewController = [[DoricViewController alloc] initWithSource:[NSString stringWithFormat:@"assets://src/%@.js", bundleName]
+ alias:bundleName
+ extra:@""];
+ doricViewController.view.backgroundColor = [UIColor whiteColor];
+#if DEBUG
+ UIBarButtonItem *rightBarItem = [[UIBarButtonItem alloc] initWithTitle:@"Devkit" style:UIBarButtonItemStylePlain target:self action:@selector(onOpenDevkit)];
+ doricViewController.navigationItem.rightBarButtonItem = rightBarItem;
+#endif
+ UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:doricViewController];
+ UIWindow *window = [[UIWindow alloc] initWithWindowScene:windowScene];
+ window.frame = windowScene.coordinateSpace.bounds;
+ window.rootViewController = navigationController;
+ [UIApplication sharedApplication].delegate.window = window;
+ [window makeKeyAndVisible];
+}
+
+#if DEBUG
+
+- (void)onOpenDevkit {
+ [[DoricDev instance] openDevMode];
+}
+
+#endif
+
+- (void)sceneDidDisconnect:(UIScene *)scene {
+ // Called as the scene is being released by the system.
+ // This occurs shortly after the scene enters the background, or when its session is discarded.
+ // Release any resources associated with this scene that can be re-created the next time the scene connects.
+ // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
+}
+
+
+- (void)sceneDidBecomeActive:(UIScene *)scene {
+ // Called when the scene has moved from an inactive state to an active state.
+ // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
+}
+
+
+- (void)sceneWillResignActive:(UIScene *)scene {
+ // Called when the scene will move from an active state to an inactive state.
+ // This may occur due to temporary interruptions (ex. an incoming phone call).
+}
+
+
+- (void)sceneWillEnterForeground:(UIScene *)scene {
+ // Called as the scene transitions from the background to the foreground.
+ // Use this method to undo the changes made on entering the background.
+}
+
+
+- (void)sceneDidEnterBackground:(UIScene *)scene {
+ // Called as the scene transitions from the foreground to the background.
+ // Use this method to save data, release shared resources, and store enough scene-specific state information
+ // to restore the scene back to its current state.
+}
+
+
+@end
+
diff --git a/doric-cli/assets-lib/example/iOS/App/main.m b/doric-cli/assets-lib/example/iOS/App/main.m
new file mode 100644
index 00000000..dba295eb
--- /dev/null
+++ b/doric-cli/assets-lib/example/iOS/App/main.m
@@ -0,0 +1,11 @@
+#import
+#import "AppDelegate.h"
+
+int main(int argc, char * argv[]) {
+ NSString * appDelegateClassName;
+ @autoreleasepool {
+ // Setup code that might create autoreleased objects goes here.
+ appDelegateClassName = NSStringFromClass([AppDelegate class]);
+ }
+ return UIApplicationMain(argc, argv, nil, appDelegateClassName);
+}
diff --git a/doric-cli/assets-lib/example/iOS/Example.xcodeproj/project.pbxproj b/doric-cli/assets-lib/example/iOS/Example.xcodeproj/project.pbxproj
new file mode 100644
index 00000000..2792d81d
--- /dev/null
+++ b/doric-cli/assets-lib/example/iOS/Example.xcodeproj/project.pbxproj
@@ -0,0 +1,427 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 51;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 89ECE884CE4B563A091D6AD3 /* libPods-Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 435113A53785539DAF219B19 /* libPods-Example.a */; };
+ E2B059BF23C452BB007555C7 /* src in Resources */ = {isa = PBXBuildFile; fileRef = E2B059BE23C452BB007555C7 /* src */; };
+ E2F64CEF2399359C0006BD9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E2F64CEE2399359C0006BD9A /* AppDelegate.m */; };
+ E2F64CF22399359C0006BD9A /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E2F64CF12399359C0006BD9A /* SceneDelegate.m */; };
+ E2F64CFA2399359E0006BD9A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E2F64CF92399359E0006BD9A /* Assets.xcassets */; };
+ E2F64CFD2399359E0006BD9A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E2F64CFB2399359E0006BD9A /* LaunchScreen.storyboard */; };
+ E2F64D002399359E0006BD9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E2F64CFF2399359E0006BD9A /* main.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 197D29BBE572343DDD72F8A6 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = ""; };
+ 435113A53785539DAF219B19 /* libPods-Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 5D47A9D4EA2836D57373FDF6 /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = ""; };
+ 8B65D8E3CB45345BA0554208 /* Pods-TemplateLibrary.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TemplateLibrary.release.xcconfig"; path = "Target Support Files/Pods-TemplateLibrary/Pods-TemplateLibrary.release.xcconfig"; sourceTree = ""; };
+ 8CBFE74FB341E5BB3349F209 /* Pods-TemplateLibrary.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TemplateLibrary.debug.xcconfig"; path = "Target Support Files/Pods-TemplateLibrary/Pods-TemplateLibrary.debug.xcconfig"; sourceTree = ""; };
+ E2B059BE23C452BB007555C7 /* src */ = {isa = PBXFileReference; lastKnownFileType = folder; name = src; path = ../bundle/src; sourceTree = ""; };
+ E2F64CEA2399359C0006BD9A /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ E2F64CED2399359C0006BD9A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
+ E2F64CEE2399359C0006BD9A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
+ E2F64CF02399359C0006BD9A /* SceneDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = ""; };
+ E2F64CF12399359C0006BD9A /* SceneDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = ""; };
+ E2F64CF92399359E0006BD9A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
+ E2F64CFC2399359E0006BD9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
+ E2F64CFE2399359E0006BD9A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ E2F64CFF2399359E0006BD9A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ E2F64CE72399359C0006BD9A /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 89ECE884CE4B563A091D6AD3 /* libPods-Example.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 875E7B19E6A1ABA3F802B6B5 /* Pods */ = {
+ isa = PBXGroup;
+ children = (
+ 197D29BBE572343DDD72F8A6 /* Pods-Example.debug.xcconfig */,
+ 5D47A9D4EA2836D57373FDF6 /* Pods-Example.release.xcconfig */,
+ 8CBFE74FB341E5BB3349F209 /* Pods-TemplateLibrary.debug.xcconfig */,
+ 8B65D8E3CB45345BA0554208 /* Pods-TemplateLibrary.release.xcconfig */,
+ );
+ path = Pods;
+ sourceTree = "";
+ };
+ E2F64CE12399359C0006BD9A = {
+ isa = PBXGroup;
+ children = (
+ E2B059BE23C452BB007555C7 /* src */,
+ E2F64CEC2399359C0006BD9A /* App */,
+ E2F64CEB2399359C0006BD9A /* Products */,
+ 875E7B19E6A1ABA3F802B6B5 /* Pods */,
+ F654B22175F1FDDC9AE817FA /* Frameworks */,
+ );
+ sourceTree = "";
+ };
+ E2F64CEB2399359C0006BD9A /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ E2F64CEA2399359C0006BD9A /* Example.app */,
+ );
+ name = Products;
+ sourceTree = "";
+ };
+ E2F64CEC2399359C0006BD9A /* App */ = {
+ isa = PBXGroup;
+ children = (
+ E2F64CED2399359C0006BD9A /* AppDelegate.h */,
+ E2F64CEE2399359C0006BD9A /* AppDelegate.m */,
+ E2F64CF02399359C0006BD9A /* SceneDelegate.h */,
+ E2F64CF12399359C0006BD9A /* SceneDelegate.m */,
+ E2F64CF92399359E0006BD9A /* Assets.xcassets */,
+ E2F64CFB2399359E0006BD9A /* LaunchScreen.storyboard */,
+ E2F64CFE2399359E0006BD9A /* Info.plist */,
+ E2F64CFF2399359E0006BD9A /* main.m */,
+ );
+ path = App;
+ sourceTree = "";
+ };
+ F654B22175F1FDDC9AE817FA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 435113A53785539DAF219B19 /* libPods-Example.a */,
+ );
+ name = Frameworks;
+ sourceTree = "";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ E2F64CE92399359C0006BD9A /* Example */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = E2F64D032399359E0006BD9A /* Build configuration list for PBXNativeTarget "Example" */;
+ buildPhases = (
+ 8E2E7D30FF8381E7791EA41B /* [CP] Check Pods Manifest.lock */,
+ E2F64D0B2399FFB20006BD9A /* Package JS Bundle */,
+ E2F64CE62399359C0006BD9A /* Sources */,
+ E2F64CE72399359C0006BD9A /* Frameworks */,
+ E2F64CE82399359C0006BD9A /* Resources */,
+ 6AD83C2F33B6B646C36014B0 /* [CP] Copy Pods Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = Example;
+ productName = Example;
+ productReference = E2F64CEA2399359C0006BD9A /* Example.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ E2F64CE22399359C0006BD9A /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 1120;
+ ORGANIZATIONNAME = pengfei.zhou;
+ TargetAttributes = {
+ E2F64CE92399359C0006BD9A = {
+ CreatedOnToolsVersion = 11.2.1;
+ };
+ };
+ };
+ buildConfigurationList = E2F64CE52399359C0006BD9A /* Build configuration list for PBXProject "Example" */;
+ compatibilityVersion = "Xcode 9.3";
+ developmentRegion = en;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = E2F64CE12399359C0006BD9A;
+ productRefGroup = E2F64CEB2399359C0006BD9A /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ E2F64CE92399359C0006BD9A /* Example */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ E2F64CE82399359C0006BD9A /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ E2B059BF23C452BB007555C7 /* src in Resources */,
+ E2F64CFD2399359E0006BD9A /* LaunchScreen.storyboard in Resources */,
+ E2F64CFA2399359E0006BD9A /* Assets.xcassets in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 6AD83C2F33B6B646C36014B0 /* [CP] Copy Pods Resources */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources-${CONFIGURATION}-input-files.xcfilelist",
+ );
+ name = "[CP] Copy Pods Resources";
+ outputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources-${CONFIGURATION}-output-files.xcfilelist",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-resources.sh\"\n";
+ showEnvVarsInLog = 0;
+ };
+ 8E2E7D30FF8381E7791EA41B /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-Example-checkManifestLockResult.txt",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
+ showEnvVarsInLog = 0;
+ };
+ E2F64D0B2399FFB20006BD9A /* Package JS Bundle */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ );
+ name = "Package JS Bundle";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n# Type a script or drag a script file from your workspace to insert its path.\n\nexport NVM_DIR=\"$HOME/.nvm\"\n[ -s \"$NVM_DIR/nvm.sh\" ] && \\. \"$NVM_DIR/nvm.sh\" # This loads nvm\n[ -s \"$NVM_DIR/bash_completion\" ] && \\. \"$NVM_DIR/bash_completion\" # This loads nvm bash_completion\n\ncd ../ && npm run build\n";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ E2F64CE62399359C0006BD9A /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ E2F64CEF2399359C0006BD9A /* AppDelegate.m in Sources */,
+ E2F64D002399359E0006BD9A /* main.m in Sources */,
+ E2F64CF22399359C0006BD9A /* SceneDelegate.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ E2F64CFB2399359E0006BD9A /* LaunchScreen.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ E2F64CFC2399359E0006BD9A /* Base */,
+ );
+ name = LaunchScreen.storyboard;
+ sourceTree = "";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ E2F64D012399359E0006BD9A /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_ENABLE_OBJC_WEAK = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu11;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.2;
+ MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
+ MTL_FAST_MATH = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ };
+ name = Debug;
+ };
+ E2F64D022399359E0006BD9A /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_ENABLE_OBJC_WEAK = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu11;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.2;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ MTL_FAST_MATH = YES;
+ SDKROOT = iphoneos;
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ E2F64D042399359E0006BD9A /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 197D29BBE572343DDD72F8A6 /* Pods-Example.debug.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CODE_SIGN_STYLE = Automatic;
+ DEVELOPMENT_TEAM = 7EE2RX3L3P;
+ GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp;
+ INFOPLIST_FILE = "$(SRCROOT)/App/Info.plist";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = pub.doric.ios.example;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ E2F64D052399359E0006BD9A /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 5D47A9D4EA2836D57373FDF6 /* Pods-Example.release.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CODE_SIGN_STYLE = Automatic;
+ DEVELOPMENT_TEAM = 7EE2RX3L3P;
+ GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp;
+ INFOPLIST_FILE = "$(SRCROOT)/App/Info.plist";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = pub.doric.ios.example;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ E2F64CE52399359C0006BD9A /* Build configuration list for PBXProject "Example" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ E2F64D012399359E0006BD9A /* Debug */,
+ E2F64D022399359E0006BD9A /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ E2F64D032399359E0006BD9A /* Build configuration list for PBXNativeTarget "Example" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ E2F64D042399359E0006BD9A /* Debug */,
+ E2F64D052399359E0006BD9A /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = E2F64CE22399359C0006BD9A /* Project object */;
+}
diff --git a/doric-cli/assets-lib/example/iOS/Podfile b/doric-cli/assets-lib/example/iOS/Podfile
new file mode 100644
index 00000000..ac35ebd9
--- /dev/null
+++ b/doric-cli/assets-lib/example/iOS/Podfile
@@ -0,0 +1,26 @@
+require "json"
+
+package = JSON.parse(File.read(File.join(__dir__, "../../package.json")))
+version = package['dependencies']["doric"]
+version = version.gsub('^','').gsub('>=','')
+
+source 'https://cdn.cocoapods.org/'
+# Uncomment the next line to define a global platform for your project
+# platform :ios, '9.0'
+
+target 'Example' do
+ # Comment the next line if you don't want to use dynamic frameworks
+ use_modular_headers!
+
+ # Pods for TemplateLibrary
+ pod 'DoricCore', "#{version}"
+ pod 'DoricDevkit', "#{version}"
+
+ pod 'SDWebImage'
+
+ pod 'SDWebImageWebPCoder'
+
+ pod 'PINCache'
+
+ pod '__$RawName__', :path => '../../'
+end
diff --git a/doric-cli/assets-lib/example/index.ts b/doric-cli/assets-lib/example/index.ts
new file mode 100644
index 00000000..8b80b0c2
--- /dev/null
+++ b/doric-cli/assets-lib/example/index.ts
@@ -0,0 +1 @@
+export default ["src/Example"];
diff --git a/doric-cli/assets-lib/example/package.json b/doric-cli/assets-lib/example/package.json
new file mode 100644
index 00000000..9a00b351
--- /dev/null
+++ b/doric-cli/assets-lib/example/package.json
@@ -0,0 +1,23 @@
+{
+ "name": "example",
+ "version": "0.1.0",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1",
+ "build": "cd ../ && doric build && cd - && doric build",
+ "dev": "doric dev",
+ "clean": "doric clean",
+ "android": "doric run android",
+ "ios": "doric run iOS"
+ },
+ "license": "Apache-2.0",
+ "dependencies": {
+ "reflect-metadata": "^0.1.13",
+ "rollup": "^2.24.0",
+ "typescript": "^4.2.2",
+ "__$__": "file:../"
+ },
+ "optionalDependencies": {
+ "ios-deploy": "^1.11.4"
+ }
+}
diff --git a/doric-cli/assets-lib/example/rollup.config.js b/doric-cli/assets-lib/example/rollup.config.js
new file mode 100644
index 00000000..98ba56aa
--- /dev/null
+++ b/doric-cli/assets-lib/example/rollup.config.js
@@ -0,0 +1,134 @@
+import resolve from "@rollup/plugin-node-resolve";
+import commonjs from "@rollup/plugin-commonjs";
+import bundles from "./build/index";
+import fs from "fs";
+import path from "path";
+import buble from "@rollup/plugin-buble";
+import json from "@rollup/plugin-json";
+import image from "@rollup/plugin-image";
+
+function searchImages(dir, images) {
+ const files = fs.readdirSync(dir);
+ files.forEach((item, index) => {
+ var fullPath = path.join(dir, item);
+ const stat = fs.statSync(fullPath);
+ if (stat.isDirectory()) {
+ searchImages(path.join(dir, item), images);
+ } else {
+ if (fullPath.endsWith(".png")) {
+ images.push(fullPath);
+ }
+ }
+ });
+ return images;
+}
+
+const allImages = [];
+searchImages("src", allImages);
+
+function mkdirsSync(dirname) {
+ if (fs.existsSync(dirname)) {
+ return true;
+ } else {
+ if (mkdirsSync(path.dirname(dirname))) {
+ fs.mkdirSync(dirname);
+ return true;
+ }
+ }
+}
+
+allImages.forEach((value) => {
+ let path = __dirname + "/build/" + value;
+ let index = path.lastIndexOf("/");
+ mkdirsSync(path.substring(0, index));
+
+ fs.copyFile(
+ __dirname + "/" + value,
+ __dirname + "/build/" + value,
+ (error) => {
+ console.log(error);
+ }
+ );
+});
+
+function readDirs(dirPath, files) {
+ if (fs.statSync(dirPath).isDirectory()) {
+ fs.readdirSync(dirPath).forEach((e) => {
+ readDirs(path.join(dirPath, e), files);
+ });
+ } else {
+ for (let bundle of bundles) {
+ if (dirPath.match(new RegExp(`^${bundle}`))) {
+ files.push(dirPath);
+ }
+ }
+ }
+}
+
+const dirs = fs.readdirSync(".").filter((e) => {
+ for (let bundle of bundles) {
+ if (bundle.match(new RegExp(`^${e}/`))) {
+ return true;
+ }
+ }
+ return false;
+});
+
+const allFiles = [];
+
+dirs.forEach((e) => {
+ readDirs(e, allFiles);
+});
+export default allFiles
+ .map((e) => e.replace(".ts", ""))
+ .map((bundle) => {
+ return {
+ input: `build/${bundle}.js`,
+ output: {
+ format: "cjs",
+ file: `bundle/${bundle}.js`,
+ sourcemap: true,
+ },
+ plugins: [
+ resolve({ mainFields: ["jsnext"] }),
+ commonjs(),
+ json(),
+ image(),
+ ],
+ external: ["reflect-metadata", "doric", "templatelibrary"],
+ onwarn: function (warning) {
+ if (warning.code === "THIS_IS_UNDEFINED") {
+ return;
+ }
+ console.warn(warning.message);
+ },
+ };
+ });
+// If need ES5 support enable following configs
+// .concat(
+// allFiles
+// .map(e => e.replace('.ts', ''))
+// .map(bundle => {
+// return {
+// input: `build/${bundle}.js`,
+// output: {
+// format: "cjs",
+// file: `bundle/${bundle}.es5.js`,
+// sourcemap: true,
+// },
+// plugins: [
+// resolve({ mainFields: ["jsnext"] }),
+// commonjs(),
+// json(),
+// buble({
+// transforms: { dangerousForOf: true }
+// }),
+// image(),
+// ],
+// external: ['reflect-metadata', 'doric'],
+// onwarn: function (warning) {
+// if (warning.code === 'THIS_IS_UNDEFINED') { return }
+// console.warn(warning.message)
+// }
+// }
+// }))
diff --git a/doric-cli/assets-lib/example/src/Example.ts b/doric-cli/assets-lib/example/src/Example.ts
new file mode 100644
index 00000000..4792eecd
--- /dev/null
+++ b/doric-cli/assets-lib/example/src/Example.ts
@@ -0,0 +1,41 @@
+import {
+ Panel,
+ Group,
+ vlayout,
+ layoutConfig,
+ Gravity,
+ text,
+ Color,
+ navbar,
+ modal,
+} from "doric";
+import { demoPlugin } from "__$__";
+
+@Entry
+class Example extends Panel {
+ onShow() {
+ navbar(context).setTitle("Example");
+ }
+ build(rootView: Group) {
+ vlayout([
+ text({
+ text: "Click to call native plugin",
+ textSize: 20,
+ backgroundColor: Color.parse("#70a1ff"),
+ textColor: Color.WHITE,
+ onClick: async () => {
+ const result = await demoPlugin(this.context).call();
+ await modal(this.context).alert(result);
+ },
+ layoutConfig: layoutConfig().fit(),
+ padding: { left: 20, right: 20, top: 20, bottom: 20 },
+ }),
+ ])
+ .apply({
+ layoutConfig: layoutConfig().fit().configAlignment(Gravity.Center),
+ space: 20,
+ gravity: Gravity.Center,
+ })
+ .in(rootView);
+ }
+}
diff --git a/doric-cli/assets-lib/example/tsconfig.json b/doric-cli/assets-lib/example/tsconfig.json
new file mode 100644
index 00000000..597a9561
--- /dev/null
+++ b/doric-cli/assets-lib/example/tsconfig.json
@@ -0,0 +1,62 @@
+{
+ "compilerOptions": {
+ /* Basic Options */
+ // "incremental": true, /* Enable incremental compilation */
+ "target": "ES2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
+ "module": "es2015", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
+ "lib": [], /* Specify library files to be included in the compilation. */
+ // "allowJs": true, /* Allow javascript files to be compiled. */
+ // "checkJs": true, /* Report errors in .js files. */
+ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
+ // "declaration": true, /* Generates corresponding '.d.ts' file. */
+ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
+ "sourceMap": true, /* Generates corresponding '.map' file. */
+ // "outFile": "./", /* Concatenate and emit output to single file. */
+ "outDir": "build/", /* Redirect output structure to the directory. */
+ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
+ // "composite": true, /* Enable project compilation */
+ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
+ // "removeComments": true, /* Do not emit comments to output. */
+ // "noEmit": true, /* Do not emit outputs. */
+ // "importHelpers": true, /* Import emit helpers from 'tslib'. */
+ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
+ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
+ /* Strict Type-Checking Options */
+ "strict": true, /* Enable all strict type-checking options. */
+ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
+ // "strictNullChecks": true, /* Enable strict null checks. */
+ // "strictFunctionTypes": true, /* Enable strict checking of function types. */
+ // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
+ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
+ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
+ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
+ /* Additional Checks */
+ // "noUnusedLocals": true, /* Report errors on unused locals. */
+ // "noUnusedParameters": true, /* Report errors on unused parameters. */
+ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
+ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
+ /* Module Resolution Options */
+ "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
+ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
+ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
+ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
+ // "typeRoots": [], /* List of folders to include type definitions from. */
+ // "types": [], /* Type declaration files to be included in compilation. */
+ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
+ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
+ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
+ /* Source Map Options */
+ // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
+ // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
+ // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
+ /* Experimental Options */
+ "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
+ "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
+ "resolveJsonModule": true
+ },
+ "include": [
+ "**/*.ts",
+ ]
+}
\ No newline at end of file
diff --git a/doric-cli/assets-lib/iOS/Classes/DoricDemoPlugin.h b/doric-cli/assets-lib/iOS/Classes/DoricDemoPlugin.h
new file mode 100644
index 00000000..4ee12fc2
--- /dev/null
+++ b/doric-cli/assets-lib/iOS/Classes/DoricDemoPlugin.h
@@ -0,0 +1,5 @@
+#import
+#import
+
+@interface DoricDemoPlugin : DoricNativePlugin
+@end
\ No newline at end of file
diff --git a/doric-cli/assets-lib/iOS/Classes/DoricDemoPlugin.m b/doric-cli/assets-lib/iOS/Classes/DoricDemoPlugin.m
new file mode 100644
index 00000000..faa55155
--- /dev/null
+++ b/doric-cli/assets-lib/iOS/Classes/DoricDemoPlugin.m
@@ -0,0 +1,7 @@
+#import "DoricDemoPlugin.h"
+
+@implementation DoricDemoPlugin
+- (void)call:(NSDictionary *)dic withPromise:(DoricPromise *)promise {
+ [promise resolve:@"This is from iOS"];
+}
+@end
\ No newline at end of file
diff --git a/doric-cli/assets-lib/iOS/Classes/TemplateLibrary.h b/doric-cli/assets-lib/iOS/Classes/TemplateLibrary.h
new file mode 100644
index 00000000..75ae5927
--- /dev/null
+++ b/doric-cli/assets-lib/iOS/Classes/TemplateLibrary.h
@@ -0,0 +1,5 @@
+#import
+#import
+
+@interface __$RawName__Library : DoricLibrary
+@end
\ No newline at end of file
diff --git a/doric-cli/assets-lib/iOS/Classes/TemplateLibrary.m b/doric-cli/assets-lib/iOS/Classes/TemplateLibrary.m
new file mode 100644
index 00000000..e333786a
--- /dev/null
+++ b/doric-cli/assets-lib/iOS/Classes/TemplateLibrary.m
@@ -0,0 +1,12 @@
+#import "__$RawName__Library.h"
+#import "DoricDemoPlugin.h"
+
+@implementation __$RawName__Library
+- (void)load:(DoricRegistry *)registry {
+ NSString *path = [[NSBundle mainBundle] bundlePath];
+ NSString *fullPath = [path stringByAppendingPathComponent:@"bundle___$__.js"];
+ NSString *jsContent = [NSString stringWithContentsOfFile:fullPath encoding:NSUTF8StringEncoding error:nil];
+ [registry registerJSBundle:jsContent withName:@"__$__"];
+ [registry registerNativePlugin:DoricDemoPlugin.class withName:@"demoPlugin"];
+}
+@end
\ No newline at end of file
diff --git a/doric-cli/assets-lib/index.ts b/doric-cli/assets-lib/index.ts
new file mode 100644
index 00000000..1fa12e54
--- /dev/null
+++ b/doric-cli/assets-lib/index.ts
@@ -0,0 +1 @@
+export * from "./lib/DemoPlugin";
diff --git a/doric-cli/assets-lib/lib/DemoPlugin.ts b/doric-cli/assets-lib/lib/DemoPlugin.ts
new file mode 100644
index 00000000..c2dffd2a
--- /dev/null
+++ b/doric-cli/assets-lib/lib/DemoPlugin.ts
@@ -0,0 +1,9 @@
+import { BridgeContext } from "doric";
+
+export function demoPlugin(context: BridgeContext) {
+ return {
+ call: () => {
+ return context.callNative("demoPlugin", "call") as Promise;
+ },
+ };
+}
diff --git a/doric-cli/assets-lib/package.json b/doric-cli/assets-lib/package.json
new file mode 100644
index 00000000..6cee5c23
--- /dev/null
+++ b/doric-cli/assets-lib/package.json
@@ -0,0 +1,31 @@
+{
+ "name": "__$__",
+ "version": "0.1.0",
+ "main": "build/index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1",
+ "build": "doric build",
+ "dev": "cd example && doric dev",
+ "clean": "cd example && doric clean",
+ "android": "cd example && doric run android",
+ "ios": "cd example && doric run iOS"
+ },
+ "license": "Apache-2.0",
+ "dependencies": {
+ "doric": ">=__$Version__",
+ "doric-cli": ">=__$Version__",
+ "reflect-metadata": "^0.1.13",
+ "rollup": "^2.24.0",
+ "typescript": "^4.2.2"
+ },
+ "devDependencies": {
+ "@rollup/plugin-buble": "^0.21.3",
+ "@rollup/plugin-commonjs": "^14.0.0",
+ "@rollup/plugin-image": "^2.0.5",
+ "@rollup/plugin-json": "^4.1.0",
+ "@rollup/plugin-node-resolve": "^8.4.0"
+ },
+ "optionalDependencies": {
+ "ios-deploy": "^1.11.4"
+ }
+}
diff --git a/doric-cli/assets-lib/rollup.config.js b/doric-cli/assets-lib/rollup.config.js
new file mode 100644
index 00000000..8793ec0b
--- /dev/null
+++ b/doric-cli/assets-lib/rollup.config.js
@@ -0,0 +1,21 @@
+import resolve from "@rollup/plugin-node-resolve";
+import commonjs from "@rollup/plugin-commonjs";
+import json from "@rollup/plugin-json";
+export default [
+ {
+ input: `build/index.js`,
+ output: {
+ format: "cjs",
+ file: `dist/bundle___$__.js`,
+ sourcemap: true,
+ },
+ plugins: [resolve({ mainFields: ["jsnext"] }), commonjs(), json()],
+ external: ["reflect-metadata", "doric"],
+ onwarn: function (warning) {
+ if (warning.code === "THIS_IS_UNDEFINED") {
+ return;
+ }
+ console.warn(warning.message);
+ },
+ },
+];
diff --git a/doric-cli/assets-lib/tsconfig.json b/doric-cli/assets-lib/tsconfig.json
new file mode 100644
index 00000000..597a9561
--- /dev/null
+++ b/doric-cli/assets-lib/tsconfig.json
@@ -0,0 +1,62 @@
+{
+ "compilerOptions": {
+ /* Basic Options */
+ // "incremental": true, /* Enable incremental compilation */
+ "target": "ES2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
+ "module": "es2015", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
+ "lib": [], /* Specify library files to be included in the compilation. */
+ // "allowJs": true, /* Allow javascript files to be compiled. */
+ // "checkJs": true, /* Report errors in .js files. */
+ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
+ // "declaration": true, /* Generates corresponding '.d.ts' file. */
+ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
+ "sourceMap": true, /* Generates corresponding '.map' file. */
+ // "outFile": "./", /* Concatenate and emit output to single file. */
+ "outDir": "build/", /* Redirect output structure to the directory. */
+ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
+ // "composite": true, /* Enable project compilation */
+ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
+ // "removeComments": true, /* Do not emit comments to output. */
+ // "noEmit": true, /* Do not emit outputs. */
+ // "importHelpers": true, /* Import emit helpers from 'tslib'. */
+ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
+ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
+ /* Strict Type-Checking Options */
+ "strict": true, /* Enable all strict type-checking options. */
+ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
+ // "strictNullChecks": true, /* Enable strict null checks. */
+ // "strictFunctionTypes": true, /* Enable strict checking of function types. */
+ // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
+ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
+ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
+ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
+ /* Additional Checks */
+ // "noUnusedLocals": true, /* Report errors on unused locals. */
+ // "noUnusedParameters": true, /* Report errors on unused parameters. */
+ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
+ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
+ /* Module Resolution Options */
+ "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
+ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
+ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
+ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
+ // "typeRoots": [], /* List of folders to include type definitions from. */
+ // "types": [], /* Type declaration files to be included in compilation. */
+ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
+ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
+ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
+ /* Source Map Options */
+ // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
+ // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
+ // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
+ /* Experimental Options */
+ "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
+ "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
+ "resolveJsonModule": true
+ },
+ "include": [
+ "**/*.ts",
+ ]
+}
\ No newline at end of file
diff --git a/doric-cli/assets/android/app/src/main/java/pub/doric/android/MainApplication.java b/doric-cli/assets/android/app/src/main/java/pub/doric/android/MainApplication.java
index 8a0b0467..340ffd01 100644
--- a/doric-cli/assets/android/app/src/main/java/pub/doric/android/MainApplication.java
+++ b/doric-cli/assets/android/app/src/main/java/pub/doric/android/MainApplication.java
@@ -4,11 +4,6 @@ import android.app.Application;
import pub.doric.Doric;
-/**
- * @Description: pub.doric.android
- * @Author: pengfei.zhou
- * @CreateDate: 2019-12-05
- */
public class MainApplication extends Application {
@Override
public void onCreate() {
diff --git a/doric-cli/assets/iOS/App/AppDelegate.h b/doric-cli/assets/iOS/App/AppDelegate.h
index c8a0f013..8ec7241c 100644
--- a/doric-cli/assets/iOS/App/AppDelegate.h
+++ b/doric-cli/assets/iOS/App/AppDelegate.h
@@ -1,11 +1,3 @@
-//
-// AppDelegate.h
-// Example
-//
-// Created by pengfei.zhou on 2019/12/5.
-// Copyright © 2019 pengfei.zhou. All rights reserved.
-//
-
#import
@interface AppDelegate : UIResponder
diff --git a/doric-cli/assets/iOS/App/AppDelegate.m b/doric-cli/assets/iOS/App/AppDelegate.m
index 43e0ca40..8e4fd624 100644
--- a/doric-cli/assets/iOS/App/AppDelegate.m
+++ b/doric-cli/assets/iOS/App/AppDelegate.m
@@ -1,11 +1,3 @@
-//
-// AppDelegate.m
-// Example
-//
-// Created by pengfei.zhou on 2019/12/5.
-// Copyright © 2019 pengfei.zhou. All rights reserved.
-//
-
#import "AppDelegate.h"
#import
#if __has_include()
diff --git a/doric-cli/assets/iOS/App/SceneDelegate.h b/doric-cli/assets/iOS/App/SceneDelegate.h
index 30f72ed8..a58e9f23 100644
--- a/doric-cli/assets/iOS/App/SceneDelegate.h
+++ b/doric-cli/assets/iOS/App/SceneDelegate.h
@@ -1,13 +1,4 @@
-//
-// SceneDelegate.h
-// Example
-//
-// Created by pengfei.zhou on 2019/12/5.
-// Copyright © 2019 pengfei.zhou. All rights reserved.
-//
-
#import
@interface SceneDelegate : UIResponder
@end
-
diff --git a/doric-cli/assets/iOS/App/main.m b/doric-cli/assets/iOS/App/main.m
index 743b38cb..dba295eb 100644
--- a/doric-cli/assets/iOS/App/main.m
+++ b/doric-cli/assets/iOS/App/main.m
@@ -1,11 +1,3 @@
-//
-// main.m
-// Example
-//
-// Created by pengfei.zhou on 2019/12/5.
-// Copyright © 2019 pengfei.zhou. All rights reserved.
-//
-
#import
#import "AppDelegate.h"
diff --git a/doric-cli/src/create.ts b/doric-cli/src/create.ts
index a48ac35e..967d0024 100644
--- a/doric-cli/src/create.ts
+++ b/doric-cli/src/create.ts
@@ -1,7 +1,6 @@
import fs from "fs"
import path from "path"
-import { exec } from "child_process"
-import { getAssetsDir } from "./util"
+import { getAssetsDir, getLibAssetsDir } from "./util"
import { Shell } from "./shell";
const targetJSPath = getAssetsDir();
@@ -79,7 +78,7 @@ async function initiOS(dir: string, name: string) {
console.log(`Create Doric iOS Project Success`.green);
}
-export default async function create(name: string) {
+export async function create(name: string) {
const cwd = path.resolve(process.cwd(), name)
if (fs.existsSync(name)) {
console.warn(`Dir:${cwd}/${name} already exists`)
@@ -109,4 +108,77 @@ export default async function create(name: string) {
}
});
console.log("Installed, welcome!".green)
-}
\ No newline at end of file
+}
+
+async function modifyContent(cwd: string, name: string) {
+ const dealingFiles = [
+ "package.json",
+ "rollup.config.js",
+ "android/src/main/java/pub/doric/library/TemplateLibrary.java",
+ "iOS/Classes/TemplateLibrary.h",
+ "iOS/Classes/TemplateLibrary.m",
+ "Template.podspec",
+ "example/android/app/src/main/java/pub/doric/android/MainApplication.java",
+ "example/iOS/App/SceneDelegate.m",
+ "example/iOS/Podfile",
+ "example/src/Example.ts",
+ "example/package.json",
+ ]
+ for (let dealingFile of dealingFiles) {
+ const filePath = await path.resolve(cwd, dealingFile)
+ let content = await fs.promises.readFile(filePath, "utf-8")
+ content = content
+ .replace(/__\$__/g, name.toLocaleLowerCase())
+ .replace(/__\$RawName__/g, name)
+ .replace(/__\$Version__/g, currentVersion)
+ await fs.promises.writeFile(filePath, content, "utf-8")
+ }
+}
+
+async function renameFiles(cwd: string, name: string) {
+ const renameFiles: [string, string][] = [
+ ["android/src/main/java/pub/doric/library", "TemplateLibrary.java"],
+ [".", "Template.podspec"],
+ ["iOS/Classes", "TemplateLibrary.h"],
+ ["iOS/Classes", "TemplateLibrary.m"],
+ ]
+ for (let renameFile of renameFiles) {
+ await fs.promises.rename(
+ path.resolve(cwd, renameFile[0], renameFile[1]),
+ path.resolve(cwd, renameFile[0], renameFile[1].replace("Template", name)))
+ }
+}
+
+export async function createLib(name: string) {
+ const cwd = path.resolve(process.cwd(), name)
+ if (fs.existsSync(name)) {
+ console.warn(`Dir:${cwd}/${name} already exists`)
+ return;
+ }
+ await fs.promises.mkdir(name)
+ const libAssets = getLibAssetsDir()
+ console.log(`Create doric library project at ${cwd}`)
+ const files = await fs.promises.readdir(libAssets)
+ for (let file of files) {
+ await shellCopy(cwd, path.resolve(libAssets, file))
+ }
+ await modifyContent(cwd, name)
+ await renameFiles(cwd, name)
+ console.log("Install node modules ...".green)
+ await Shell.exec('npm', ['install'], {
+ cwd,
+ env: process.env,
+ consoleHandler: (info) => {
+ console.log(info)
+ }
+ });
+ console.log("Install example project ...".green)
+ await Shell.exec('npm', ['install'], {
+ cwd: path.resolve(cwd, "example"),
+ env: process.env,
+ consoleHandler: (info) => {
+ console.log(info)
+ }
+ });
+ console.log("Installed, welcome!".green)
+}
diff --git a/doric-cli/src/index.ts b/doric-cli/src/index.ts
index 4e9e4c71..cc5f8556 100644
--- a/doric-cli/src/index.ts
+++ b/doric-cli/src/index.ts
@@ -2,7 +2,7 @@
import commander from "commander"
import { build, clean } from "./actions";
-import create from "./create"
+import { create, createLib } from "./create"
import dev from "./dev"
import { run } from "./run";
@@ -13,6 +13,11 @@ commander
.action(async function (name, cmd) {
await create(name);
})
+commander
+ .command('createLib ')
+ .action(async function (name, cmd) {
+ await createLib(name);
+ })
commander
.command('new ')
.action(async function (name, cmd) {
diff --git a/doric-cli/src/util.ts b/doric-cli/src/util.ts
index e59e25c0..7f3c5813 100644
--- a/doric-cli/src/util.ts
+++ b/doric-cli/src/util.ts
@@ -11,7 +11,9 @@ export async function delay(timeout: number) {
export function getAssetsDir() {
return `${__dirname}/../assets`;
}
-
+export function getLibAssetsDir() {
+ return `${__dirname}/../assets-lib`;
+}
export async function glob(pattern: string, options?: IOptions) {
return new Promise((resolve, reject) => {
if (options) {