@pi-r/android 0.3.5 → 0.3.6

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/LICENSE CHANGED
@@ -1,7 +1,7 @@
1
- Copyright 2024 An Pham
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
1
+ Copyright 2023 An Pham
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
7
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
- # @pi-r/android
2
-
3
- PEP 402 - Forever
4
-
5
- ## LICENSE
6
-
1
+ # @pi-r/android
2
+
3
+ ## LICENSE
4
+
7
5
  MIT
@@ -20,14 +20,14 @@ function finalize(instance) {
20
20
  const profileable = config.profileable;
21
21
  let modified;
22
22
  if (!existing) {
23
- source = (0, util_1.replaceAll)(source, (name) => {
23
+ source = (0, util_1.replaceAll)(source.replace(manifestPackage ? '{{package}}' : ' package="{{package}}"', manifestPackage || ''), (name) => {
24
24
  switch (name) {
25
25
  case 'supportsRtl':
26
26
  return supportsRtl === false ? 'false' : 'true';
27
27
  case 'label':
28
28
  return '@string/' + (label || 'app_name');
29
29
  case 'theme':
30
- return '@style/' + (theme || 'Theme.Android2');
30
+ return theme ? '@style/' + theme : '';
31
31
  case 'activityName':
32
32
  return activityName || '';
33
33
  case 'profileable':
@@ -45,7 +45,7 @@ function finalize(instance) {
45
45
  }
46
46
  let target = null;
47
47
  if (manifestPackage && (target = domutils.findOne(elem => elem.tagName === 'manifest', dom, true))) {
48
- target.attribs.package = manifestPackage;
48
+ target.attribs['package'] = manifestPackage;
49
49
  modified = true;
50
50
  }
51
51
  if (target = domutils.findOne(elem => elem.tagName === 'application', dom, true)) {
@@ -10,8 +10,7 @@ function finalize(instance) {
10
10
  if (!profileable && !dependencies && !dataBinding && !versionName && !versionCode && !config.namespace) {
11
11
  return;
12
12
  }
13
- const detect = this.incremental !== 'staging';
14
- let { localUri, source, existing, kotlin } = instance.findTemplate(path.join(this.baseDirectory, config.mainParentDir), "build.gradle", { detect, languageOf: 'gradle' });
13
+ let { localUri, source, existing, kotlin } = instance.findTemplate(path.join(this.baseDirectory, config.mainParentDir), 'build.gradle', { detect: this.incremental !== 'staging', languageOf: 'gradle' });
15
14
  if (localUri && source && instance.canWrite(localUri, { ownPermissionOnly: true })) {
16
15
  let { namespace, javaVersion } = config, jvmTarget, modified;
17
16
  const upgrade = javaVersion > 0;
@@ -97,9 +96,9 @@ function finalize(instance) {
97
96
  output = Document.updateGradle(output, ['android', 'buildFeatures'], 'compose = true');
98
97
  }
99
98
  else {
100
- output = Document.updateGradle(output, ['plugins'], "id 'org.jetbrains.kotlin.android'", { upgrade: true, multiple: true, addendum: `version '${instance.findVersion('org.jetbrains.kotlin:kotlin-stdlib', "1.9.22")}'` });
99
+ output = Document.updateGradle(output, ['plugins'], "id 'org.jetbrains.kotlin.android'", { upgrade: true, multiple: true, addendum: `version '${instance.findVersion('org.jetbrains.kotlin:kotlin-stdlib', "1.9.24")}'` });
101
100
  output = Document.updateGradle(output, ['android', 'buildFeatures'], "compose true");
102
- output = Document.updateGradle(output, ['android', 'composeOptions'], `kotlinCompilerExtensionVersion '${instance.findVersion('kotlinCompilerExtensionVersion', "1.5.9")}'`, true);
101
+ output = Document.updateGradle(output, ['android', 'composeOptions'], `kotlinCompilerExtensionVersion '${instance.findVersion('kotlinCompilerExtensionVersion', "1.5.14")}'`, true);
103
102
  if (upgrade) {
104
103
  output = Document.updateGradle(output, ['android', 'kotlinOptions'], `jvmTarget = '${javaVersion}'`, true);
105
104
  }
@@ -201,19 +200,6 @@ function finalize(instance) {
201
200
  }
202
201
  }
203
202
  }
204
- if (!existing) {
205
- ({ localUri, source, existing, kotlin } = instance.findTemplate(this.baseDirectory, "build.gradle", { detect, languageOf: 'gradle', subDir: 'static' }));
206
- if (localUri && source && instance.canWrite(localUri, { ownPermissionOnly: true })) {
207
- try {
208
- if (instance.writeFile(localUri, source, { encoding: 'utf-8', ownPermissionOnly: true, throwsPermission: true })) {
209
- this.add(localUri);
210
- }
211
- }
212
- catch (err) {
213
- this.writeFail(["Unable to write file", path.basename(localUri)], err, 8192);
214
- }
215
- }
216
- }
217
203
  }
218
204
 
219
205
  module.exports = finalize;
@@ -3,13 +3,14 @@ const path = require("path");
3
3
  const util_1 = require("@e-mc/document/util");
4
4
  const parse_1 = require("@e-mc/document/parse");
5
5
  function finalize(instance) {
6
- const { dependencies, projectName, manifest, mainParentDir } = instance.config;
6
+ const { dependencies, projectName, mainParentDir } = instance.config;
7
7
  if (!dependencies && !projectName) {
8
8
  return;
9
9
  }
10
10
  let { localUri, source, existing, kotlin } = instance.findTemplate(this.baseDirectory, 'settings.gradle', { detect: this.incremental !== 'staging', languageOf: 'gradle' });
11
11
  if (localUri && source && instance.canWrite(localUri, { ownPermissionOnly: true })) {
12
- let targetName = projectName === null || projectName === void 0 ? void 0 : projectName.replace(/"/g, '\\"'), modified;
12
+ const targetName = projectName ? projectName.replace(/"/g, '\\"') : '';
13
+ let modified;
13
14
  if (existing) {
14
15
  let match;
15
16
  if (dependencies) {
@@ -49,14 +50,10 @@ function finalize(instance) {
49
50
  }
50
51
  }
51
52
  else {
52
- if (!targetName && (targetName = manifest === null || manifest === void 0 ? void 0 : manifest.package)) {
53
- const index = targetName.lastIndexOf('.');
54
- targetName = index !== -1 ? targetName.substring(index + 1) : '';
55
- }
56
53
  source = (0, util_1.replaceAll)(source, (name) => {
57
54
  switch (name) {
58
55
  case 'projectName':
59
- return targetName || '';
56
+ return targetName;
60
57
  case 'name':
61
58
  return ':' + mainParentDir;
62
59
  default:
@@ -5,7 +5,7 @@ const child_process = require("child_process");
5
5
  const types_1 = require("@e-mc/types");
6
6
  const Document = require("@e-mc/document");
7
7
  async function finalize(instance) {
8
- var _a, _b;
8
+ var _a, _b, _c;
9
9
  const commands = instance.config.commands;
10
10
  if (!commands || this.incremental === 'staging') {
11
11
  return;
@@ -25,15 +25,13 @@ async function finalize(instance) {
25
25
  else {
26
26
  return;
27
27
  }
28
- const settings = ((_a = instance.settings.extensions) === null || _a === void 0 ? void 0 : _a.task) || {};
29
- const exec = settings.exec;
30
- let { broadcastId, baseDirectory } = this, command = settings.command, uid, gid, title, name, foundCwd;
28
+ let { broadcastId, baseDirectory } = this, command = (_b = (_a = instance.settings.extensions) === null || _a === void 0 ? void 0 : _a.task) === null || _b === void 0 ? void 0 : _b.command, title, name, foundCwd;
31
29
  if (command) {
32
30
  if (command.indexOf('mvn') !== -1) {
33
31
  title = 'maven';
34
32
  }
35
33
  else {
36
- title = ((_b = /([^\\/]+?)(?:\.[a-z]+)?$/i.exec(command)) === null || _b === void 0 ? void 0 : _b[1]) || 'SPAWN';
34
+ title = ((_c = /([^\\/]+?)(?:\.[a-z]+)?$/i.exec(command)) === null || _c === void 0 ? void 0 : _c[1]) || 'SPAWN';
37
35
  }
38
36
  command = path.normalize(command);
39
37
  if (!command.includes(path.sep)) {
@@ -63,15 +61,6 @@ async function finalize(instance) {
63
61
  catch {
64
62
  }
65
63
  }
66
- if ((0, types_1.isPlainObject)(exec)) {
67
- let { uid: u, gid: g } = exec;
68
- if ((u = parseInt(u)) >= 0) {
69
- uid = u;
70
- }
71
- if ((g = parseInt(g)) >= 0) {
72
- gid = g;
73
- }
74
- }
75
64
  for (const args of taskArgs) {
76
65
  if (instance.aborted) {
77
66
  return Promise.reject((0, types_1.createAbortError)());
@@ -81,7 +70,7 @@ async function finalize(instance) {
81
70
  await new Promise((resolve, reject) => {
82
71
  this.formatMessage(4, title, ['Executing task...', task], baseDirectory);
83
72
  let out = '', message = '';
84
- const { stdout, stderr } = child_process.spawn(command, Document.sanitizeArgs(args), { cwd: baseDirectory, shell: true, stdio: Document.hasLogType(32768) && !broadcastId ? 'inherit' : undefined, signal: instance.signal, uid, gid })
73
+ const { stdout, stderr } = child_process.spawn(command, Document.sanitizeArgs(args), { cwd: baseDirectory, shell: true, stdio: Document.hasLogType(32768) && !broadcastId ? 'inherit' : undefined, signal: instance.signal })
85
74
  .on('exit', code => {
86
75
  if (!code) {
87
76
  instance.addLog(types_1.STATUS_TYPE.INFO, out);
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { IFileManager } from '@e-mc/types/lib';
2
-
3
- import type { AndroidDocumentConstructor, DocumentAsset } from './types';
4
-
5
- declare const Android: AndroidDocumentConstructor<IFileManager<DocumentAsset>>;
6
-
1
+ import type { IFileManager } from '@e-mc/types/lib';
2
+
3
+ import type { AndroidDocumentConstructor, DocumentAsset } from './types';
4
+
5
+ declare const Android: AndroidDocumentConstructor<IFileManager<DocumentAsset>>;
6
+
7
7
  export = Android;
package/index.js CHANGED
@@ -162,9 +162,9 @@ class AndroidDocument extends Document {
162
162
  }
163
163
  findTemplate(baseDir, filename, options) {
164
164
  var _a;
165
- let detect, languageOf, subDir;
165
+ let detect, languageOf;
166
166
  if (options) {
167
- ({ detect, languageOf, subDir } = options);
167
+ ({ detect, languageOf } = options);
168
168
  }
169
169
  let kotlin, language;
170
170
  if (languageOf) {
@@ -178,14 +178,7 @@ class AndroidDocument extends Document {
178
178
  const localUri = path.join(baseDir, filename);
179
179
  try {
180
180
  const existing = detect && fs.existsSync(localUri);
181
- const paths = [];
182
- if (language) {
183
- paths.push(language);
184
- }
185
- if (subDir) {
186
- paths.push(...Array.isArray(subDir) ? subDir : [subDir]);
187
- }
188
- paths.push(filename);
181
+ const paths = language ? [language, filename] : [filename];
189
182
  let uri;
190
183
  if (!existing && !(uri = this.resolveDir('template', ...paths)) && !fs.existsSync(uri = path.join(__dirname, 'template', ...paths))) {
191
184
  throw (0, types_1.errorValue)("File not found", uri);
package/package.json CHANGED
@@ -1,27 +1,30 @@
1
- {
2
- "name": "@pi-r/android",
3
- "version": "0.3.5",
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.6.7",
24
- "@e-mc/types": "^0.6.7",
25
- "htmlparser2": "^9.1.0"
26
- }
27
- }
1
+ {
2
+ "name": "@pi-r/android",
3
+ "version": "0.3.6",
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.6.16",
24
+ "@e-mc/types": "^0.6.16",
25
+ "dom-serializer": "^2.0.0",
26
+ "domhandler": "^5.0.3",
27
+ "domutils": "^3.1.0",
28
+ "htmlparser2": "^9.1.0"
29
+ }
30
+ }
@@ -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,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,4 +1,4 @@
1
- plugins {
2
- id 'com.android.application' version '8.2.0' apply false
3
- id 'com.android.library' version '8.2.0' apply false
1
+ plugins {
2
+ id 'com.android.application' version '8.2.0' apply false
3
+ id 'com.android.library' version '8.2.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.12.0'
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.12.0'
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,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.2.0' apply false
3
- id 'com.android.library' version '8.2.0' apply false
4
- id 'org.jetbrains.kotlin.android' version '1.9.22' apply false
1
+ plugins {
2
+ id 'com.android.application' version '8.2.0' apply false
3
+ id 'com.android.library' version '8.2.0' apply false
4
+ id 'org.jetbrains.kotlin.android' version '1.9.22' 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.22")
42
- implementation("androidx.core:core-ktx:1.12.0")
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.22")
42
+ implementation("androidx.core:core-ktx:1.12.0")
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.2.0" apply false
3
- id("com.android.library") version "8.2.0" apply false
4
- id("org.jetbrains.kotlin.android") version "1.9.22" apply false
1
+ plugins {
2
+ id("com.android.application") version "8.2.0" apply false
3
+ id("com.android.library") version "8.2.0" apply false
4
+ id("org.jetbrains.kotlin.android") version "1.9.22" apply false
5
5
  }
package/types/index.d.ts CHANGED
@@ -1,69 +1,67 @@
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 { DocumentDirectory as IDocumentDirectory, DocumentModule as IDocumentModule, ExecAction } from '@e-mc/types/lib/settings';
6
-
7
- import type { DocumentOutput } from './squared';
8
-
9
- interface DocumentDirectory extends IDocumentDirectory {
10
- template?: string;
11
- }
12
-
13
- interface AndroidDocumentSettings extends PlainObject {
14
- extensions?: {
15
- task?: {
16
- exec?: ExecAction;
17
- command?: string;
18
- };
19
- };
20
- language?: {
21
- gradle?: "java" | "kotlin" | "java+kotlin";
22
- };
23
- directory?: DocumentDirectory;
24
- }
25
-
26
- type LanguageType = "gradle";
27
- type DocumentProperties = "targetAPI" | "elements" | "extensionData" | "directories";
28
-
29
- export interface UserConfig extends Omit<DocumentOutput, DocumentProperties> {
30
- mainParentDir: string;
31
- mainSrcDir: string;
32
- mainActivityFile: string;
33
- javaVersion: number;
34
- dataBinding: boolean;
35
- }
36
-
37
- export interface DocumentModule extends IDocumentModule {
38
- settings?: AndroidDocumentSettings;
39
- }
40
-
41
- export interface TemplateData {
42
- localUri?: string;
43
- source?: string;
44
- existing?: boolean;
45
- kotlin?: boolean;
46
- language?: string;
47
- }
48
-
49
- export interface FindTemplateOptions {
50
- detect?: boolean;
51
- languageOf?: LanguageType;
52
- subDir?: ArrayOf<string>;
53
- }
54
-
55
- export interface IAndroidDocument<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends IDocument<T, U>, Pick<DocumentOutput, DocumentProperties> {
56
- config: UserConfig;
57
- elements: FinalizedElement[];
58
- extensionData: PlainObject;
59
- findTemplate(baseDir: string, filename: string, options?: FindTemplateOptions): TemplateData;
60
- detectKts(...paths: string[]): Null<boolean>;
61
- get settings(): AndroidDocumentSettings;
62
- }
63
-
64
- export interface AndroidDocumentConstructor<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends DocumentConstructor<T, U> {
65
- readonly prototype: IAndroidDocument<T, U>;
66
- new(module?: DocumentModule, ...args: unknown[]): IAndroidDocument<T, U>;
67
- }
68
-
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 { DocumentDirectory as IDocumentDirectory, DocumentModule as IDocumentModule } from '@e-mc/types/lib/settings';
6
+
7
+ import type { DocumentOutput } from './squared';
8
+
9
+ interface DocumentDirectory extends IDocumentDirectory {
10
+ template?: string;
11
+ }
12
+
13
+ interface AndroidDocumentSettings extends PlainObject {
14
+ extensions?: {
15
+ task?: {
16
+ command?: string;
17
+ };
18
+ };
19
+ language?: {
20
+ gradle?: "java" | "kotlin" | "java+kotlin";
21
+ };
22
+ directory?: DocumentDirectory;
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
+ }
52
+
53
+ export interface IAndroidDocument<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends IDocument<T, U>, Pick<DocumentOutput, DocumentProperties> {
54
+ config: UserConfig;
55
+ elements: FinalizedElement[];
56
+ extensionData: PlainObject;
57
+ findTemplate(baseDir: string, filename: string, options?: FindTemplateOptions): TemplateData;
58
+ detectKts(...paths: string[]): Null<boolean>;
59
+ get settings(): AndroidDocumentSettings;
60
+ }
61
+
62
+ export interface AndroidDocumentConstructor<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends DocumentConstructor<T, U> {
63
+ readonly prototype: IAndroidDocument<T, U>;
64
+ new(module?: DocumentModule, ...args: unknown[]): IAndroidDocument<T, U>;
65
+ }
66
+
69
67
  export type DocumentAsset = ExternalAsset;
@@ -1,53 +1,53 @@
1
- import type { FinalizedElement, ControllerSettingsDirectoryUI as IControllerSettingsDirectoryUI } from '@e-mc/types/lib/squared';
2
-
3
- import type { ExternalAsset } from '@e-mc/types/lib/asset';
4
- import type { RequestData as IRequestData } from '@e-mc/types/lib/node';
5
-
6
- export interface DocumentOutput {
7
- targetAPI?: NumString;
8
- manifest?: ManifestData;
9
- namespace?: string;
10
- profileable?: boolean | StringOfArray;
11
- dependencies?: string[];
12
- directories?: ControllerSettingsDirectoryUI;
13
- elements?: FinalizedElement[];
14
- projectName?: string;
15
- mainParentDir?: string;
16
- mainSrcDir?: string;
17
- mainActivityFile?: string;
18
- javaVersion?: NumString;
19
- versionName?: string;
20
- versionCode?: number;
21
- dataBinding?: boolean;
22
- commands?: ArrayOf<StringOfArray>;
23
- extensionData?: PlainObject;
24
- }
25
-
26
- export interface RequestData extends IRequestData<ExternalAsset>, DocumentOutput {}
27
-
28
- export interface ManifestData {
29
- package?: string;
30
- application?: {
31
- supportsRtl?: boolean;
32
- label?: string;
33
- theme?: string;
34
- metaData?: { name?: string; resource?: string; value?: string }[];
35
- activity?: ObjectMap<{
36
- layout?: {
37
- defaultWidth?: string;
38
- defaultHeight?: string;
39
- minWidth?: string;
40
- minHeight?: string;
41
- gravity?: string;
42
- };
43
- }>;
44
- activityName?: string;
45
- fontProvider?: string;
46
- };
47
- }
48
-
49
- export interface ControllerSettingsDirectoryUI extends IControllerSettingsDirectoryUI {
50
- main: string;
51
- animation: string;
52
- theme: string;
1
+ import type { FinalizedElement, ControllerSettingsDirectoryUI as IControllerSettingsDirectoryUI } from '@e-mc/types/lib/squared';
2
+
3
+ import type { ExternalAsset } from '@e-mc/types/lib/asset';
4
+ import type { RequestData as IRequestData } from '@e-mc/types/lib/node';
5
+
6
+ export interface DocumentOutput {
7
+ targetAPI?: NumString;
8
+ manifest?: ManifestData;
9
+ namespace?: string;
10
+ profileable?: boolean | StringOfArray;
11
+ dependencies?: string[];
12
+ directories?: ControllerSettingsDirectoryUI;
13
+ elements?: FinalizedElement[];
14
+ projectName?: string;
15
+ mainParentDir?: string;
16
+ mainSrcDir?: string;
17
+ mainActivityFile?: string;
18
+ javaVersion?: NumString;
19
+ versionName?: string;
20
+ versionCode?: number;
21
+ dataBinding?: boolean;
22
+ commands?: ArrayOf<StringOfArray>;
23
+ extensionData?: PlainObject;
24
+ }
25
+
26
+ export interface RequestData extends IRequestData<ExternalAsset>, DocumentOutput {}
27
+
28
+ export interface ManifestData {
29
+ package?: string;
30
+ application?: {
31
+ supportsRtl?: boolean;
32
+ label?: string;
33
+ theme?: string;
34
+ metaData?: { name?: string; resource?: string; value?: string }[];
35
+ activity?: ObjectMap<{
36
+ layout?: {
37
+ defaultWidth?: string;
38
+ defaultHeight?: string;
39
+ minWidth?: string;
40
+ minHeight?: string;
41
+ gravity?: string;
42
+ };
43
+ }>;
44
+ activityName?: string;
45
+ fontProvider?: string;
46
+ };
47
+ }
48
+
49
+ export interface ControllerSettingsDirectoryUI extends IControllerSettingsDirectoryUI {
50
+ main: string;
51
+ animation: string;
52
+ theme: string;
53
53
  }