Skip to content

Commit 6a46c30

Browse files
committed
Added: Static App module
1 parent 59e41ed commit 6a46c30

File tree

7 files changed

+784
-28
lines changed

7 files changed

+784
-28
lines changed

package-lock.json

Lines changed: 11 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GitListDir.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export function lsGit(user: string, repo: string, dir: string, callback) {
1616
}
1717

1818

19-
export function getDownloadLink(user: string, repo: string) {
20-
return `https://github.com/${user}/${repo}/archive/master.zip`;
19+
export function getDownloadLink(user: string, repo: string, branch ="master") {
20+
return `https://github.com/${user}/${repo}/archive/${branch}.zip`;
2121
}
2222

2323
/// TODO: need to update this function

src/Interfaces.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ export namespace Interfaces {
1212
dir: string
1313
debug?: boolean
1414
cache: string
15-
commander: Command
15+
commander: Command | any
1616
}
1717

1818
export interface IEnv {
1919
force: boolean
2020
release: boolean
2121
project: Interfaces.IProject
2222
builder: Interfaces.IBuilder
23+
debuggable?: boolean
2324
}
2425

2526
export interface IContext {

src/bin.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ import * as path from 'path';
77
import * as fs from 'fs';
88
import * as inquirer from "inquirer";
99
import {Webview} from './modules/webview';
10+
import {StaticApp} from './modules/static_app';
11+
1012
import {ReactApp} from "./modules/react";
1113

1214
import {symlink} from "fs";
1315

14-
const pkg = require('../package.json');
16+
const pkg = require('./package.json');
1517

1618
const project: Interfaces.IProject = {
1719
dir: process.cwd(),
@@ -51,6 +53,7 @@ export interface IContext {
5153

5254
const context: IContext = {
5355
webview: Webview,
56+
static: StaticApp,
5457
'react-native': ReactApp
5558
};
5659

@@ -74,6 +77,9 @@ commander
7477
env.force = args.forceBuild ? true : false;
7578
env.builder.debug = args.debug ? true : false;
7679

80+
81+
82+
7783
// load module
7884
if(context.hasOwnProperty(APPTYPE)){
7985
let mod = new context[APPTYPE]();
@@ -96,7 +102,6 @@ commander
96102
env.force = args.force ? true : false;
97103
env.release = args.release ? true : false;
98104
env.builder.debug = args.debug ? true : false;
99-
100105
// check for the project type
101106
if(context.hasOwnProperty(_package['project-type'])){
102107
let mod = new context[_package['project-type']]();
@@ -159,6 +164,7 @@ const questions = [
159164
// chalk.yellow("React"),
160165
// chalk.green("Flutter"),
161166
"webview",
167+
"static",
162168
// "react-native"
163169
],
164170
// filter: function (val) {

src/modules/Html/ManifestBuilder.ts

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ function createDeepLink(deep_link:IDeepLink): Node {
7979

8080
export function getManifest(env: IEnv, args, permissions: Array<string>, deep_links: Array<Interfaces.IDeepLink>, screenOrientation: String = null): string {
8181
let package_name = env.project.package["package-name"];
82+
let env_manifist = args.manifist;
83+
8284
const sdkPath = path.join(env.builder.cache, args.sdk.repo);
8385

8486
if(!package_name){
@@ -90,32 +92,19 @@ export function getManifest(env: IEnv, args, permissions: Array<string>, deep_li
9092
keys: {
9193
'xmlns:android': "http://schemas.android.com/apk/res/android",
9294
'package':`com.androidjs.${package_name}`,
93-
platformBuildVersionCode:"28",
94-
platformBuildVersionName:"9"
95+
platformBuildVersionCode: env_manifist.platformBuildVersionCode,
96+
platformBuildVersionName: env_manifist.platformBuildVersionName
9597
}
9698
});
9799

98100
let application = new Node({
99101
name: 'application',
100-
keys: {
101-
'android:allowBackup':"true",
102-
'android:appComponentFactory':"android.support.v4.app.CoreComponentFactory",
103-
'android:debuggable':"false",
104-
'android:icon':"@mipmap/ic_launcher",
105-
'android:label':"@string/app_name",
106-
'android:roundIcon':"@mipmap/ic_launcher_round",
107-
'android:supportsRtl':"true",
108-
'android:theme':"@style/AppTheme",
109-
'android:usesCleartextTraffic':"true"
110-
}
102+
keys: env_manifist.application
111103
});
112104

113105
let activity = new Node({
114106
name: 'activity',
115-
keys: {
116-
'android:configChanges':"keyboard|keyboardHidden|orientation|screenSize",
117-
'android:name':"com.android.js.webview.MainActivity"
118-
}
107+
keys: env_manifist.activity
119108
});
120109

121110
if(screenOrientation !== null) {
@@ -151,5 +140,10 @@ export function getManifest(env: IEnv, args, permissions: Array<string>, deep_li
151140
let deepLink = createDeepLink(deep_links[i]);
152141
activity.children.push(deepLink)
153142
}
143+
if(env.builder.debug) {
144+
console.log("Built AndroidManifest.xml")
145+
console.log(" platformBuildVersionCode:", env_manifist.platformBuildVersionCode)
146+
console.log(" platformBuildVersionName:", env_manifist.platformBuildVersionName)
147+
}
154148
return header + manifest.render({padding:0, paddingValue: 4});
155149
}

0 commit comments

Comments
 (0)