@pi-r/android 0.7.2 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { IFileManager } from '@e-mc/types/lib';
2
-
3
- import type { AndroidDocumentConstructor } from './types';
4
-
5
- declare const Android: AndroidDocumentConstructor<IFileManager>;
6
-
1
+ import type { IFileManager } from '@e-mc/types/lib';
2
+
3
+ import type { AndroidDocumentConstructor } from './types';
4
+
5
+ declare const Android: AndroidDocumentConstructor<IFileManager>;
6
+
7
7
  export = Android;
package/index.js CHANGED
@@ -4,6 +4,30 @@ const path = require("path");
4
4
  const types_1 = require("@e-mc/types");
5
5
  const Document = require('@e-mc/document');
6
6
  class AndroidDocument extends Document {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.config = {
10
+ mainParentDir: 'app',
11
+ mainSrcDir: 'src/main',
12
+ mainActivityFile: '',
13
+ javaVersion: 0,
14
+ dataBinding: false,
15
+ projectName: undefined,
16
+ versionName: undefined,
17
+ versionCode: 0,
18
+ manifest: undefined,
19
+ namespace: undefined,
20
+ applicationId: undefined,
21
+ profileable: undefined,
22
+ dependencies: undefined,
23
+ dependencyScopes: undefined,
24
+ commands: undefined
25
+ };
26
+ this.elements = [];
27
+ this.extensionData = {};
28
+ this._moduleName = 'android';
29
+ this._threadable = true;
30
+ }
7
31
  static async finalize(instance) {
8
32
  if (instance.aborted) {
9
33
  return (0, types_1.createAbortError)(true);
@@ -30,29 +54,6 @@ class AndroidDocument extends Document {
30
54
  }
31
55
  return super.finalize.call(this, instance);
32
56
  }
33
- config = {
34
- mainParentDir: 'app',
35
- mainSrcDir: 'src/main',
36
- mainActivityFile: '',
37
- javaVersion: 0,
38
- dataBinding: false,
39
- projectName: undefined,
40
- versionName: undefined,
41
- versionCode: 0,
42
- manifest: undefined,
43
- namespace: undefined,
44
- applicationId: undefined,
45
- profileable: undefined,
46
- dependencies: undefined,
47
- dependencyScopes: undefined,
48
- commands: undefined
49
- };
50
- elements = [];
51
- extensionData = {};
52
- targetAPI;
53
- directories;
54
- _moduleName = 'android';
55
- _threadable = true;
56
57
  init(assets, config) {
57
58
  if (config) {
58
59
  const { targetAPI, mainParentDir, mainSrcDir, mainActivityFile, javaVersion, projectName, versionName, versionCode = 0, manifest, namespace, applicationId, profileable, dependencies, dependencyScopes, dataBinding, commands, directories, elements, extensionData } = config;
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
- {
2
- "name": "@pi-r/android",
3
- "version": "0.7.2",
4
- "description": "Android document constructor for E-mc.",
5
- "main": "index.js",
6
- "publishConfig": {
7
- "access": "public"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/anpham6/pi-r.git",
12
- "directory": "src/module/android"
13
- },
14
- "keywords": [
15
- "squared",
16
- "e-mc",
17
- "squared-functions"
18
- ],
19
- "author": "An Pham <anpham6@gmail.com>",
20
- "license": "MIT",
21
- "homepage": "https://github.com/anpham6/pi-r#readme",
22
- "dependencies": {
23
- "@e-mc/document": "^0.9.4",
24
- "@e-mc/types": "^0.9.4",
25
- "htmlparser2": "^9.1.0",
26
- "which": "^2.0.2"
27
- }
28
- }
1
+ {
2
+ "name": "@pi-r/android",
3
+ "version": "0.7.4",
4
+ "description": "Android document constructor for E-mc.",
5
+ "main": "index.js",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/anpham6/pi-r.git",
12
+ "directory": "src/module/android"
13
+ },
14
+ "keywords": [
15
+ "squared",
16
+ "e-mc",
17
+ "squared-functions"
18
+ ],
19
+ "author": "An Pham <anpham6@gmail.com>",
20
+ "license": "MIT",
21
+ "homepage": "https://github.com/anpham6/pi-r#readme",
22
+ "dependencies": {
23
+ "@e-mc/document": "^0.9.12",
24
+ "@e-mc/types": "^0.9.12",
25
+ "htmlparser2": "^9.1.0",
26
+ "which": "^2.0.2"
27
+ }
28
+ }
@@ -1,25 +1,25 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
-
4
- <application
5
- android:allowBackup="true"
6
- android:icon="@mipmap/ic_launcher"
7
- android:label="{{label}}"
8
- android:roundIcon="@mipmap/ic_launcher_round"
9
- android:supportsRtl="{{supportsRtl}}"
10
- android:theme="{{theme}}">
11
- <activity
12
- android:name="{{activityName}}"
13
- android:exported="true"
14
- android:label="{{label}}"
15
- android:theme="{{theme}}">
16
- <intent-filter>
17
- <action android:name="android.intent.action.MAIN" />
18
-
19
- <category android:name="android.intent.category.LAUNCHER" />
20
- </intent-filter>
21
- </activity>
22
- <profileable android:shell="true" android:enabled="{{profileable}}" />
23
- </application>
24
-
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
+
4
+ <application
5
+ android:allowBackup="true"
6
+ android:icon="@mipmap/ic_launcher"
7
+ android:label="{{label}}"
8
+ android:roundIcon="@mipmap/ic_launcher_round"
9
+ android:supportsRtl="{{supportsRtl}}"
10
+ android:theme="{{theme}}">
11
+ <activity
12
+ android:name="{{activityName}}"
13
+ android:exported="true"
14
+ android:label="{{label}}"
15
+ android:theme="{{theme}}">
16
+ <intent-filter>
17
+ <action android:name="android.intent.action.MAIN" />
18
+
19
+ <category android:name="android.intent.category.LAUNCHER" />
20
+ </intent-filter>
21
+ </activity>
22
+ <profileable android:shell="true" android:enabled="{{profileable}}" />
23
+ </application>
24
+
25
25
  </manifest>
@@ -1,39 +1,39 @@
1
- plugins {
2
- id 'com.android.application'
3
- }
4
-
5
- android {
6
- namespace ''
7
- compileSdk 34
8
-
9
- defaultConfig {
10
- applicationId ''
11
- minSdk 21
12
- targetSdk 34
13
- versionCode 1
14
- versionName '1.0'
15
-
16
- testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
17
- }
18
- buildTypes {
19
- release {
20
- debuggable false
21
- minifyEnabled true
22
- shrinkResources false
23
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24
- }
25
- }
26
- compileOptions {
27
- sourceCompatibility JavaVersion.VERSION_1_8
28
- targetCompatibility JavaVersion.VERSION_1_8
29
- }
30
- buildFeatures {
31
- viewBinding false
32
- }
33
- }
34
-
35
- dependencies {
36
- testImplementation 'junit:junit:4.13.2'
37
- androidTestImplementation 'androidx.test.ext:junit:1.1.5'
38
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
1
+ plugins {
2
+ id 'com.android.application'
3
+ }
4
+
5
+ android {
6
+ namespace ''
7
+ compileSdk 34
8
+
9
+ defaultConfig {
10
+ applicationId ''
11
+ minSdk 21
12
+ targetSdk 34
13
+ versionCode 1
14
+ versionName '1.0'
15
+
16
+ testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
17
+ }
18
+ buildTypes {
19
+ release {
20
+ debuggable false
21
+ minifyEnabled true
22
+ shrinkResources false
23
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24
+ }
25
+ }
26
+ compileOptions {
27
+ sourceCompatibility JavaVersion.VERSION_1_8
28
+ targetCompatibility JavaVersion.VERSION_1_8
29
+ }
30
+ buildFeatures {
31
+ viewBinding false
32
+ }
33
+ }
34
+
35
+ dependencies {
36
+ testImplementation 'junit:junit:4.13.2'
37
+ androidTestImplementation 'androidx.test.ext:junit:1.1.5'
38
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
39
39
  }
@@ -1,4 +1,4 @@
1
- plugins {
2
- id 'com.android.application' version '8.4.0' apply false
3
- id 'com.android.library' version '8.4.0' apply false
1
+ plugins {
2
+ id 'com.android.application' version '8.4.0' apply false
3
+ id 'com.android.library' version '8.4.0' apply false
4
4
  }
@@ -1,44 +1,44 @@
1
- plugins {
2
- id 'com.android.application'
3
- id 'org.jetbrains.kotlin.android'
4
- }
5
-
6
- android {
7
- namespace ''
8
- compileSdk 34
9
-
10
- defaultConfig {
11
- applicationId ''
12
- minSdk 21
13
- targetSdk 34
14
- versionCode 1
15
- versionName '1.0'
16
-
17
- testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
18
- }
19
- buildTypes {
20
- release {
21
- debuggable false
22
- minifyEnabled true
23
- shrinkResources false
24
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
25
- }
26
- }
27
- compileOptions {
28
- sourceCompatibility JavaVersion.VERSION_1_8
29
- targetCompatibility JavaVersion.VERSION_1_8
30
- }
31
- kotlinOptions {
32
- jvmTarget = '1.8'
33
- }
34
- buildFeatures {
35
- viewBinding false
36
- }
37
- }
38
-
39
- dependencies {
40
- implementation 'androidx.core:core-ktx:1.13.1'
41
- testImplementation 'junit:junit:4.13.2'
42
- androidTestImplementation 'androidx.test.ext:junit:1.1.5'
43
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
1
+ plugins {
2
+ id 'com.android.application'
3
+ id 'org.jetbrains.kotlin.android'
4
+ }
5
+
6
+ android {
7
+ namespace ''
8
+ compileSdk 34
9
+
10
+ defaultConfig {
11
+ applicationId ''
12
+ minSdk 21
13
+ targetSdk 34
14
+ versionCode 1
15
+ versionName '1.0'
16
+
17
+ testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
18
+ }
19
+ buildTypes {
20
+ release {
21
+ debuggable false
22
+ minifyEnabled true
23
+ shrinkResources false
24
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
25
+ }
26
+ }
27
+ compileOptions {
28
+ sourceCompatibility JavaVersion.VERSION_1_8
29
+ targetCompatibility JavaVersion.VERSION_1_8
30
+ }
31
+ kotlinOptions {
32
+ jvmTarget = '1.8'
33
+ }
34
+ buildFeatures {
35
+ viewBinding false
36
+ }
37
+ }
38
+
39
+ dependencies {
40
+ implementation 'androidx.core:core-ktx:1.13.1'
41
+ testImplementation 'junit:junit:4.13.2'
42
+ androidTestImplementation 'androidx.test.ext:junit:1.1.5'
43
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
44
44
  }
@@ -1,5 +1,5 @@
1
- plugins {
2
- id 'com.android.application' version '8.4.0' apply false
3
- id 'com.android.library' version '8.4.0' apply false
4
- id 'org.jetbrains.kotlin.android' version '1.9.24' apply false
1
+ plugins {
2
+ id 'com.android.application' version '8.4.0' apply false
3
+ id 'com.android.library' version '8.4.0' apply false
4
+ id 'org.jetbrains.kotlin.android' version '1.9.24' apply false
5
5
  }
@@ -1,46 +1,46 @@
1
- plugins {
2
- id("com.android.application")
3
- id("org.jetbrains.kotlin.android")
4
- }
5
-
6
- android {
7
- namespace = ""
8
- compileSdk = 34
9
-
10
- defaultConfig {
11
- applicationId = ""
12
- minSdk = 21
13
- targetSdk = 34
14
- versionCode = 1
15
- versionName = "1.0"
16
-
17
- testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
18
- }
19
- buildTypes {
20
- release {
21
- isDebuggable = false
22
- isMinifyEnabled = true
23
- isShrinkResources = false
24
- proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
25
- }
26
- }
27
- kotlinOptions {
28
- jvmTarget = "1.8"
29
- }
30
- buildFeatures {
31
- viewBinding = true
32
- }
33
- }
34
-
35
- java {
36
- sourceCompatibility = JavaVersion.VERSION_1_8
37
- targetCompatibility = JavaVersion.VERSION_1_8
38
- }
39
-
40
- dependencies {
41
- implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.24")
42
- implementation("androidx.core:core-ktx:1.13.1")
43
- testImplementation("junit:junit:4.13.2")
44
- androidTestImplementation("androidx.test.ext:junit:1.1.5")
45
- androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
1
+ plugins {
2
+ id("com.android.application")
3
+ id("org.jetbrains.kotlin.android")
4
+ }
5
+
6
+ android {
7
+ namespace = ""
8
+ compileSdk = 34
9
+
10
+ defaultConfig {
11
+ applicationId = ""
12
+ minSdk = 21
13
+ targetSdk = 34
14
+ versionCode = 1
15
+ versionName = "1.0"
16
+
17
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
18
+ }
19
+ buildTypes {
20
+ release {
21
+ isDebuggable = false
22
+ isMinifyEnabled = true
23
+ isShrinkResources = false
24
+ proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
25
+ }
26
+ }
27
+ kotlinOptions {
28
+ jvmTarget = "1.8"
29
+ }
30
+ buildFeatures {
31
+ viewBinding = true
32
+ }
33
+ }
34
+
35
+ java {
36
+ sourceCompatibility = JavaVersion.VERSION_1_8
37
+ targetCompatibility = JavaVersion.VERSION_1_8
38
+ }
39
+
40
+ dependencies {
41
+ implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.24")
42
+ implementation("androidx.core:core-ktx:1.13.1")
43
+ testImplementation("junit:junit:4.13.2")
44
+ androidTestImplementation("androidx.test.ext:junit:1.1.5")
45
+ androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
46
46
  }
@@ -1,18 +1,18 @@
1
- pluginManagement {
2
- repositories {
3
- google()
4
- mavenCentral()
5
- gradlePluginPortal()
6
- }
7
- }
8
-
9
- dependencyResolutionManagement {
10
- repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
11
- repositories {
12
- google()
13
- mavenCentral()
14
- }
15
- }
16
-
17
- rootProject.name = "{{projectName}}"
1
+ pluginManagement {
2
+ repositories {
3
+ google()
4
+ mavenCentral()
5
+ gradlePluginPortal()
6
+ }
7
+ }
8
+
9
+ dependencyResolutionManagement {
10
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
11
+ repositories {
12
+ google()
13
+ mavenCentral()
14
+ }
15
+ }
16
+
17
+ rootProject.name = "{{projectName}}"
18
18
  include("{{name}}")
@@ -1,5 +1,5 @@
1
- plugins {
2
- id("com.android.application") version "8.4.0" apply false
3
- id("com.android.library") version "8.4.0" apply false
4
- id("org.jetbrains.kotlin.android") version "1.9.24" apply false
1
+ plugins {
2
+ id("com.android.application") version "8.4.0" apply false
3
+ id("com.android.library") version "8.4.0" apply false
4
+ id("org.jetbrains.kotlin.android") version "1.9.24" apply false
5
5
  }
package/types/index.d.ts CHANGED
@@ -1,77 +1,77 @@
1
- import type { FinalizedElement } from '@e-mc/types/lib/squared';
2
-
3
- import type { DocumentConstructor, IDocument, IFileManager } from '@e-mc/types/lib';
4
- import type { ExternalAsset } from '@e-mc/types/lib/asset';
5
- import type { ExecAction, DocumentDirectory as IDocumentDirectory, DocumentModule as IDocumentModule, DocumentSettings as IDocumentSettings } from '@e-mc/types/lib/settings';
6
-
7
- import type { DependencyScopes, DocumentOutput } from './squared';
8
-
9
- interface DocumentDirectory extends IDocumentDirectory {
10
- template?: string;
11
- }
12
-
13
- interface AndroidDocumentSettings extends Pick<IDocumentSettings, "users" | "directory">, PlainObject {
14
- extensions?: {
15
- task?: {
16
- exec?: ExecAction;
17
- command?: string;
18
- };
19
- };
20
- language?: {
21
- gradle?: "java" | "kotlin" | "java+kotlin";
22
- };
23
- }
24
-
25
- type LanguageType = "gradle";
26
- type DocumentProperties = "targetAPI" | "elements" | "extensionData" | "directories";
27
-
28
- export interface UserConfig extends Omit<DocumentOutput, DocumentProperties> {
29
- mainParentDir: string;
30
- mainSrcDir: string;
31
- mainActivityFile: string;
32
- javaVersion: number;
33
- dataBinding: boolean;
34
- }
35
-
36
- export interface DocumentModule extends IDocumentModule {
37
- settings?: AndroidDocumentSettings;
38
- }
39
-
40
- export interface TemplateData {
41
- localUri?: string;
42
- source?: string;
43
- existing?: boolean;
44
- kotlin?: boolean;
45
- language?: string;
46
- }
47
-
48
- export interface FindTemplateOptions {
49
- detect?: boolean;
50
- languageOf?: LanguageType;
51
- subDir?: ArrayOf<string>;
52
- }
53
-
54
- export interface MavenArtifact {
55
- groupId: string;
56
- artifactId: string;
57
- version: string;
58
- scope?: DependencyScopes;
59
- dependencies?: MavenArtifact[];
60
- }
61
-
62
- export interface IAndroidDocument<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends IDocument<T, U>, Pick<DocumentOutput, DocumentProperties> {
63
- config: UserConfig;
64
- elements: FinalizedElement[];
65
- extensionData: PlainObject;
66
- findTemplate(baseDir: string, filename: string, options?: FindTemplateOptions): TemplateData;
67
- findData<V = AnyObject>(filename: string, format?: string): Null<V>;
68
- detectKts(...paths: string[]): Null<boolean>;
69
- get settings(): AndroidDocumentSettings;
70
- }
71
-
72
- export interface AndroidDocumentConstructor<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends DocumentConstructor<T, U> {
73
- readonly prototype: IAndroidDocument<T, U>;
74
- new(module?: DocumentModule, ...args: unknown[]): IAndroidDocument<T, U>;
75
- }
76
-
1
+ import type { FinalizedElement } from '@e-mc/types/lib/squared';
2
+
3
+ import type { DocumentConstructor, IDocument, IFileManager } from '@e-mc/types/lib';
4
+ import type { ExternalAsset } from '@e-mc/types/lib/asset';
5
+ import type { ExecAction, DocumentDirectory as IDocumentDirectory, DocumentModule as IDocumentModule, DocumentSettings as IDocumentSettings } from '@e-mc/types/lib/settings';
6
+
7
+ import type { DependencyScopes, DocumentOutput } from './squared';
8
+
9
+ interface DocumentDirectory extends IDocumentDirectory {
10
+ template?: string;
11
+ }
12
+
13
+ interface AndroidDocumentSettings extends Pick<IDocumentSettings, "users" | "directory">, PlainObject {
14
+ extensions?: {
15
+ task?: {
16
+ exec?: ExecAction;
17
+ command?: string;
18
+ };
19
+ };
20
+ language?: {
21
+ gradle?: "java" | "kotlin" | "java+kotlin";
22
+ };
23
+ }
24
+
25
+ type LanguageType = "gradle";
26
+ type DocumentProperties = "targetAPI" | "elements" | "extensionData" | "directories";
27
+
28
+ export interface UserConfig extends Omit<DocumentOutput, DocumentProperties> {
29
+ mainParentDir: string;
30
+ mainSrcDir: string;
31
+ mainActivityFile: string;
32
+ javaVersion: number;
33
+ dataBinding: boolean;
34
+ }
35
+
36
+ export interface DocumentModule extends IDocumentModule {
37
+ settings?: AndroidDocumentSettings;
38
+ }
39
+
40
+ export interface TemplateData {
41
+ localUri?: string;
42
+ source?: string;
43
+ existing?: boolean;
44
+ kotlin?: boolean;
45
+ language?: string;
46
+ }
47
+
48
+ export interface FindTemplateOptions {
49
+ detect?: boolean;
50
+ languageOf?: LanguageType;
51
+ subDir?: ArrayOf<string>;
52
+ }
53
+
54
+ export interface MavenArtifact {
55
+ groupId: string;
56
+ artifactId: string;
57
+ version: string;
58
+ scope?: DependencyScopes;
59
+ dependencies?: MavenArtifact[];
60
+ }
61
+
62
+ export interface IAndroidDocument<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends IDocument<T, U>, Pick<DocumentOutput, DocumentProperties> {
63
+ config: UserConfig;
64
+ elements: FinalizedElement[];
65
+ extensionData: PlainObject;
66
+ findTemplate(baseDir: string, filename: string, options?: FindTemplateOptions): TemplateData;
67
+ findData<V = AnyObject>(filename: string, format?: string): Null<V>;
68
+ detectKts(...paths: string[]): Null<boolean>;
69
+ get settings(): AndroidDocumentSettings;
70
+ }
71
+
72
+ export interface AndroidDocumentConstructor<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends DocumentConstructor<T, U> {
73
+ readonly prototype: IAndroidDocument<T, U>;
74
+ new(module?: DocumentModule, ...args: unknown[]): IAndroidDocument<T, U>;
75
+ }
76
+
77
77
  export type DocumentAsset = ExternalAsset;