diff --git a/doric-cli/assets/android/app/build.gradle b/doric-cli/assets/android/app/build.gradle index d361169e..67ba42ff 100644 --- a/doric-cli/assets/android/app/build.gradle +++ b/doric-cli/assets/android/app/build.gradle @@ -11,7 +11,7 @@ android { compileSdkVersion 29 buildToolsVersion "29.0.2" defaultConfig { - applicationId "pub.doric.example" + applicationId "pub.doric.android.__$appKey__" minSdkVersion 16 targetSdkVersion 29 versionCode 1 diff --git a/doric-cli/assets/android/app/src/main/AndroidManifest.xml b/doric-cli/assets/android/app/src/main/AndroidManifest.xml index c7fca909..c888ca96 100644 --- a/doric-cli/assets/android/app/src/main/AndroidManifest.xml +++ b/doric-cli/assets/android/app/src/main/AndroidManifest.xml @@ -1,9 +1,9 @@ + package="pub.doric.android.__$appKey__"> - + diff --git a/doric-cli/assets/android/app/src/main/java/pub/doric/example/MainActivity.java b/doric-cli/assets/android/app/src/main/java/pub/doric/android/MainActivity.java similarity index 98% rename from doric-cli/assets/android/app/src/main/java/pub/doric/example/MainActivity.java rename to doric-cli/assets/android/app/src/main/java/pub/doric/android/MainActivity.java index f55302a2..848be244 100644 --- a/doric-cli/assets/android/app/src/main/java/pub/doric/example/MainActivity.java +++ b/doric-cli/assets/android/app/src/main/java/pub/doric/android/MainActivity.java @@ -1,4 +1,4 @@ -package pub.doric.example; +package pub.doric.android; import android.os.Bundle; import android.view.View; diff --git a/doric-cli/assets/android/app/src/main/java/pub/doric/example/MainApplication.java b/doric-cli/assets/android/app/src/main/java/pub/doric/android/MainApplication.java similarity index 81% rename from doric-cli/assets/android/app/src/main/java/pub/doric/example/MainApplication.java rename to doric-cli/assets/android/app/src/main/java/pub/doric/android/MainApplication.java index bd6147a3..8a0b0467 100644 --- a/doric-cli/assets/android/app/src/main/java/pub/doric/example/MainApplication.java +++ b/doric-cli/assets/android/app/src/main/java/pub/doric/android/MainApplication.java @@ -1,11 +1,11 @@ -package pub.doric.example; +package pub.doric.android; import android.app.Application; import pub.doric.Doric; /** - * @Description: pub.doric.example + * @Description: pub.doric.android * @Author: pengfei.zhou * @CreateDate: 2019-12-05 */ diff --git a/doric-cli/assets/iOS/Example.xcodeproj/project.pbxproj b/doric-cli/assets/iOS/Example.xcodeproj/project.pbxproj index 6f4b3f03..85344c22 100644 --- a/doric-cli/assets/iOS/Example.xcodeproj/project.pbxproj +++ b/doric-cli/assets/iOS/Example.xcodeproj/project.pbxproj @@ -371,7 +371,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = pub.doric.Example; + PRODUCT_BUNDLE_IDENTIFIER = "pub.doric.ios.__$appKey__"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -390,7 +390,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = pub.doric.Example; + PRODUCT_BUNDLE_IDENTIFIER = "pub.doric.ios.__$appKey__"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; }; diff --git a/doric-cli/assets/iOS/Example.xcodeproj/xcshareddata/xcschemes/__$__.xcscheme b/doric-cli/assets/iOS/Example.xcodeproj/xcshareddata/xcschemes/__$__.xcscheme new file mode 100644 index 00000000..972168b8 --- /dev/null +++ b/doric-cli/assets/iOS/Example.xcodeproj/xcshareddata/xcschemes/__$__.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doric-cli/src/create.ts b/doric-cli/src/create.ts index a33c6689..beaa5b10 100644 --- a/doric-cli/src/create.ts +++ b/doric-cli/src/create.ts @@ -43,7 +43,8 @@ async function initAndroid(dir: string, name: string) { const androidDir = `${dir}/android` await shellCopy(dir, targetAndroidPath); for (let file of [ - 'app/src/main/java/pub/doric/example/MainActivity.java', + 'app/src/main/java/pub/doric/android/MainActivity.java', + 'app/src/main/AndroidManifest.xml', 'app/build.gradle', 'app/src/main/res/values/strings.xml', 'settings.gradle', @@ -52,7 +53,9 @@ async function initAndroid(dir: string, name: string) { await fs.promises.writeFile( sourceFile, (await fs.promises.readFile(sourceFile, "utf-8")) - .replace(/__\$__/g, name).replace(/__\$Version__/g, currentVersion)); + .replace(/__\$__/g, name) + .replace(/__\$appKey__/g, name.replace(/-/g,"_").toLowerCase()) + .replace(/__\$Version__/g, currentVersion)); } console.log(`Create Doric Android Project Success`.green); } @@ -69,7 +72,9 @@ async function initiOS(dir: string, name: string) { await fs.promises.writeFile( sourceFile, (await fs.promises.readFile(sourceFile, "utf-8")) - .replace(/__\$__/g, name).replace(/__\$Version__/g, currentVersion)); + .replace(/__\$__/g, name) + .replace(/__\$appKey__/g, name.replace(/-/g,"_").toLowerCase()) + .replace(/__\$Version__/g, currentVersion)); } await fs.promises.rename(path.resolve(iOSDir, "Example.xcodeproj"), path.resolve(iOSDir, `${name}.xcodeproj`)); console.log(`Create Doric iOS Project Success`.green);