Skip to content

Commit 8ac8fe4

Browse files
feat: create expo-plugin-aboutlibraries
Signed-off-by: Henry Gressmann <[email protected]>
1 parent 078f1d1 commit 8ac8fe4

File tree

23 files changed

+3539
-1139
lines changed

23 files changed

+3539
-1139
lines changed

.changeset/curly-ladybugs-protect.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"expo-plugin-aboutlibraries": patch
3+
---
4+
5+
initial version

.changeset/eighty-wasps-hug.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
"ucmd": patch
2+
"ucmd": minor
33
---
44

55
finish parse function

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66

77
## Projects
88

9-
| Stable | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
10-
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
11-
| [![](https://img.shields.io/npm/v/rollup-plugin-minify-template-literals?style=flat&colorA=000000&colorB=efefef)](https://www.npmjs.com/package/rollup-plugin-minify-template-literals) | [**`rollup-plugin-minify-template-literals`**](./packages/rollup-plugin-minify-template-literals) <br/> A rollup & vite plugin to minify html/css template literals |
12-
| [![](https://img.shields.io/npm/v/minify-literals?style=flat&colorA=000000&colorB=efefef)](https://www.npmjs.com/package/minify-literals) | [**`minify-literals`**](./packages/minify-literals) <br/> A library to minify html/css template literals |
9+
| Stable | |
10+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11+
| [![](https://img.shields.io/npm/v/rollup-plugin-minify-template-literals?style=flat&colorA=000000&colorB=efefef)](https://www.npmjs.com/package/rollup-plugin-minify-template-literals) | [**`rollup-plugin-minify-template-literals`**](./packages/rollup-plugin-minify-template-literals) <br/> A rollup & vite plugin to minify html/css template literals |
12+
| [![](https://img.shields.io/npm/v/minify-literals?style=flat&colorA=000000&colorB=efefef)](https://www.npmjs.com/package/minify-literals) | [**`minify-literals`**](./packages/minify-literals) <br/> A library to minify html/css template literals |
1313

14-
| Unstable | |
15-
| --------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
16-
| [![](https://img.shields.io/npm/v/ucmd?style=flat&colorA=000000&colorB=efefef)](https://www.npmjs.com/package/ucmd) | [**`ucmd`**](./packages/ucmd) <br/> minimal and strictly typed argument parsing for node.js 19+ |
17-
| [![](https://img.shields.io/npm/v/lit-q?style=flat&colorA=000000&colorB=efefef)](https://www.npmjs.com/package/lit-q) | [**`lit-q`**](./packages/lit-q) <br/> A simple async query/mutation library for Lit/LitElement inspired by react-query |
14+
| Unstable | |
15+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
16+
| [![](https://img.shields.io/npm/v/ucmd?style=flat&colorA=000000&colorB=efefef)](https://www.npmjs.com/package/ucmd) | [**`ucmd`**](./packages/ucmd) <br/> minimal and strictly typed argument parsing for node.js 19+ |
17+
| [![](https://img.shields.io/npm/v/lit-q?style=flat&colorA=000000&colorB=efefef)](https://www.npmjs.com/package/lit-q) | [**`lit-q`**](./packages/lit-q) <br/> A simple async query/mutation library for Lit/LitElement inspired by react-query |
18+
| [![](https://img.shields.io/npm/v/expo-plugin-aboutlibraries?style=flat&colorA=000000&colorB=efefef)](https://www.npmjs.com/package/expo-plugin-aboutlibraries) | [**`expo-plugin-aboutlibraries`**](./packages/expo-plugin-aboutlibraries) <br/> A simple expo config plugin to install the AboutLibraries gradle plugin |
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# template
2+
3+
## 0.1.1
4+
5+
### Patch Changes
6+
7+
- [`1a2bed9`](https://github.com/explodingcamera/esm/commit/1a2bed92806690fe6bd2eba714c81d05d4d725c8) Thanks [@explodingcamera](https://github.com/explodingcamera)! - add api docs link to readme
8+
9+
## 0.1.0
10+
11+
### Minor Changes
12+
13+
- [`cb24d87`](https://github.com/explodingcamera/esm/commit/cb24d87d3027b6da3477a2ab8eb7e9fe79ba5656) Thanks [@explodingcamera](https://github.com/explodingcamera)! - cleanup package.json
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# `expo-plugin-aboutlibraries`
2+
3+
A simple expo config plugin to add [AboutLibraries](https://github.com/mikepenz/AboutLibraries) as a gradle plugin to your app.
4+
5+
## Installation
6+
7+
```sh
8+
expo install expo-plugin-aboutlibraries
9+
```
10+
11+
## Usage
12+
13+
```js
14+
// app.config.js or app.json
15+
16+
module.exports = {
17+
plugins: [
18+
[
19+
"expo-plugin-aboutlibraries",
20+
{
21+
aboutLibrariesVersion: "10.5.2", // optional, defaults to 10.5.2
22+
},
23+
],
24+
],
25+
};
26+
```
27+
28+
Now you can use AboutLibraries to generate a list of native libraries used in your app.
29+
30+
```sh
31+
# apply the new config
32+
$ expo prebuild
33+
34+
$ cd android
35+
36+
# This will generate a file called aboutLibraries.json in the assets folder
37+
$ ./gradlew app:exportLibraryDefinitions -PaboutLibraries.exportPath=../../assets -PaboutLibraries.exportVariant=release
38+
```
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { test, expect } from "vitest";
2+
3+
test("test", async () => {
4+
expect(1).toBe(1);
5+
});
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { ConfigPlugin, createRunOncePlugin, withAppBuildGradle, withProjectBuildGradle } from "@expo/config-plugins";
2+
import pkg from "../package.json";
3+
4+
const DEFAULT_VERSION = "10.5.2";
5+
6+
const newString = (text: string) =>
7+
`// --- start of expo-plugin-aboutlibraries\n${text}\n// --- end of expo-plugin-aboutlibraries`;
8+
9+
const withAboutLibrariesApp: ConfigPlugin = (config) => {
10+
return withAppBuildGradle(config, (config) => {
11+
if (config.modResults.contents.includes("// --- start of expo-plugin-aboutlibraries")) return config;
12+
13+
if (config.modResults.language !== "groovy")
14+
throw new Error(`Cannot automatically configure project build.gradle if it's not groovy`);
15+
16+
config.modResults.contents = `${newString("apply plugin: 'com.mikepenz.aboutlibraries.plugin'")}\n${
17+
config.modResults.contents
18+
}`;
19+
20+
return config;
21+
});
22+
};
23+
24+
const withAboutLibrariesProject: ConfigPlugin<{ aboutLibrariesVersion: string }> = (
25+
config,
26+
{ aboutLibrariesVersion },
27+
) => {
28+
return withProjectBuildGradle(config, (config) => {
29+
if (config.modResults.contents.includes("// --- start of expo-plugin-aboutlibraries")) {
30+
config.modResults.contents = config.modResults.contents.replace(
31+
// replace the version number
32+
/id 'com.mikepenz.aboutlibraries.plugin' version '(.*)' apply false/,
33+
`id 'com.mikepenz.aboutlibraries.plugin' version '${aboutLibrariesVersion}' apply false`,
34+
);
35+
return config;
36+
}
37+
38+
if (config.modResults.language !== "groovy")
39+
throw new Error(`Cannot automatically configure project build.gradle if it's not groovy`);
40+
41+
const plugin = newString(
42+
`plugins {\n id 'com.mikepenz.aboutlibraries.plugin' version "${aboutLibrariesVersion}" apply false\n}`,
43+
);
44+
45+
config.modResults.contents = config.modResults.contents.replace("allprojects {", `\n${plugin}\n\nallprojects {`);
46+
47+
return config;
48+
});
49+
};
50+
51+
const withAboutLibraries: ConfigPlugin<{
52+
aboutLibrariesVersion?: string;
53+
}> = (config, value) => {
54+
const ABOUT_LIBRARIES_VERSION = value?.aboutLibrariesVersion ?? DEFAULT_VERSION;
55+
56+
config = withAboutLibrariesApp(config);
57+
config = withAboutLibrariesProject(config, { aboutLibrariesVersion: ABOUT_LIBRARIES_VERSION });
58+
59+
return config;
60+
};
61+
62+
export const withAndroidAboutLibraries = createRunOncePlugin(withAboutLibraries, pkg.name, pkg.version);
63+
export default withAndroidAboutLibraries;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "expo-plugin-aboutlibraries",
3+
"version": "0.1.0",
4+
"private": true,
5+
"description": "",
6+
"keywords": [],
7+
"homepage": "https://github.com/explodingcamera/esm/tree/main/packages/expo-plugin-aboutlibraries",
8+
"repository": "https://github.com/explodingcamera/esm",
9+
"license": "ISC",
10+
"author": "Henry Gressmann <[email protected]> (https://henrygressmann.de)",
11+
"type": "module",
12+
"exports": {
13+
".": {
14+
"require": "./dist/index.cjs",
15+
"import": "./dist/index.js",
16+
"types": "./types/index.d.ts"
17+
}
18+
},
19+
"main": "dist/index.cjs",
20+
"module": "dist/index.js",
21+
"types": "dist/index.d.ts",
22+
"files": [
23+
"dist"
24+
],
25+
"scripts": {
26+
"build": "scripts build --name expo-plugin-aboutlibraries",
27+
"test": "scripts test run"
28+
},
29+
"devDependencies": {
30+
"scripts": "workspace:*",
31+
"vitest": "^0.28.3"
32+
},
33+
"dependencies": {
34+
"@expo/config-plugins": "^5.0.4"
35+
}
36+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"compilerOptions": {
3+
"resolveJsonModule": true
4+
},
5+
"exclude": ["dist/", "node_modules/"],
6+
"extends": "../../configs/tsconfig.base.json"
7+
}

packages/legalizer/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# template
2+
3+
## 0.1.1
4+
5+
### Patch Changes
6+
7+
- [`1a2bed9`](https://github.com/explodingcamera/esm/commit/1a2bed92806690fe6bd2eba714c81d05d4d725c8) Thanks [@explodingcamera](https://github.com/explodingcamera)! - add api docs link to readme
8+
9+
## 0.1.0
10+
11+
### Minor Changes
12+
13+
- [`cb24d87`](https://github.com/explodingcamera/esm/commit/cb24d87d3027b6da3477a2ab8eb7e9fe79ba5656) Thanks [@explodingcamera](https://github.com/explodingcamera)! - cleanup package.json

0 commit comments

Comments
 (0)