feat:update template files

This commit is contained in:
pengfeizhou 2021-02-26 15:03:28 +08:00 committed by osborn
parent a997ac7646
commit 1d12e8985f
7 changed files with 95 additions and 12 deletions

View File

@ -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

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pub.doric.example">
package="pub.doric.android.__$appKey__">
<application
android:name=".MainApplication"
android:name="pub.doric.android.MainApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@ -11,7 +11,7 @@
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name="pub.doric.android.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View File

@ -1,4 +1,4 @@
package pub.doric.example;
package pub.doric.android;
import android.os.Bundle;
import android.view.View;

View File

@ -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
*/

View File

@ -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";
};

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E2F64CE92399359C0006BD9A"
BuildableName = "__$__.app"
BlueprintName = "__$__"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E2F64CE92399359C0006BD9A"
BuildableName = "__$__.app"
BlueprintName = "__$__"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E2F64CE92399359C0006BD9A"
BuildableName = "__$__.app"
BlueprintName = "__$__"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -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);