@rock-js/plugin-brownfield-android 0.12.4 → 0.12.5
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/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lib/pluginBrownfieldAndroid.d.ts +12 -0
- package/dist/src/lib/pluginBrownfieldAndroid.d.ts.map +1 -0
- package/dist/src/lib/pluginBrownfieldAndroid.js +36 -22
- package/dist/src/lib/pluginBrownfieldAndroid.js.map +1 -1
- package/package.json +4 -4
- package/src/lib/pluginBrownfieldAndroid.ts +61 -26
- package/template/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC"}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
import type { AndroidProjectConfig } from '@react-native-community/cli-types';
|
|
2
2
|
import type { PluginApi, PluginOutput } from '@rock-js/config';
|
|
3
|
+
export declare const packageAarAction: ({ variant, moduleName, projectRoot, pluginConfig, }: {
|
|
4
|
+
variant: string;
|
|
5
|
+
moduleName: string | undefined;
|
|
6
|
+
projectRoot: string;
|
|
7
|
+
pluginConfig?: AndroidProjectConfig;
|
|
8
|
+
}) => Promise<void>;
|
|
9
|
+
export declare const publishLocalAarAction: ({ moduleName, projectRoot, pluginConfig, }: {
|
|
10
|
+
moduleName: string | undefined;
|
|
11
|
+
projectRoot: string;
|
|
12
|
+
pluginConfig?: AndroidProjectConfig;
|
|
13
|
+
}) => Promise<void>;
|
|
3
14
|
export declare const pluginBrownfieldAndroid: (pluginConfig?: AndroidProjectConfig) => (api: PluginApi) => PluginOutput;
|
|
15
|
+
//# sourceMappingURL=pluginBrownfieldAndroid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pluginBrownfieldAndroid.d.ts","sourceRoot":"","sources":["../../../src/lib/pluginBrownfieldAndroid.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAsB/D,eAAO,MAAM,gBAAgB,GAAU,qDAKpC;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACrC,kBAWA,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAU,4CAIzC;IACD,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACrC,kBAWA,CAAC;AAEF,eAAO,MAAM,uBAAuB,GACjC,eAAe,oBAAoB,MACnC,KAAK,SAAS,KAAG,YAiCjB,CAAC"}
|
|
@@ -1,28 +1,46 @@
|
|
|
1
1
|
import { projectConfig } from '@react-native-community/cli-config-android';
|
|
2
2
|
import { packageAar, packageAarOptions, publishLocalAar, publishLocalAarOptions, } from '@rock-js/platform-android';
|
|
3
3
|
import { intro, RockError } from '@rock-js/tools';
|
|
4
|
-
const getAarConfig = (
|
|
4
|
+
const getAarConfig = (moduleName, androidConfig) => {
|
|
5
5
|
const config = {
|
|
6
6
|
sourceDir: androidConfig.sourceDir,
|
|
7
|
-
moduleName:
|
|
7
|
+
moduleName: moduleName ?? '',
|
|
8
8
|
};
|
|
9
9
|
return config;
|
|
10
10
|
};
|
|
11
|
+
export const packageAarAction = async ({ variant, moduleName, projectRoot, pluginConfig, }) => {
|
|
12
|
+
intro('Creating an AAR file');
|
|
13
|
+
const androidConfig = projectConfig(projectRoot, pluginConfig);
|
|
14
|
+
if (androidConfig) {
|
|
15
|
+
const config = getAarConfig(moduleName, androidConfig);
|
|
16
|
+
await packageAar(config, variant);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
throw new RockError('Android project not found.');
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export const publishLocalAarAction = async ({ moduleName, projectRoot, pluginConfig, }) => {
|
|
23
|
+
intro('Publishing AAR');
|
|
24
|
+
const androidConfig = projectConfig(projectRoot, pluginConfig);
|
|
25
|
+
if (androidConfig) {
|
|
26
|
+
const config = getAarConfig(moduleName, androidConfig);
|
|
27
|
+
await publishLocalAar(config);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
throw new RockError('Android project not found.');
|
|
31
|
+
}
|
|
32
|
+
};
|
|
11
33
|
export const pluginBrownfieldAndroid = (pluginConfig) => (api) => {
|
|
12
|
-
const projectRoot = api.getProjectRoot();
|
|
13
34
|
api.registerCommand({
|
|
14
35
|
name: 'package:aar',
|
|
15
36
|
description: 'Produces an AAR file suitable for including React Native app in native projects.',
|
|
16
|
-
action:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
throw new RockError('Android project not found.');
|
|
25
|
-
}
|
|
37
|
+
action: (args) => {
|
|
38
|
+
return packageAarAction({
|
|
39
|
+
variant: args.variant,
|
|
40
|
+
moduleName: args.moduleName,
|
|
41
|
+
projectRoot: api.getProjectRoot(),
|
|
42
|
+
pluginConfig,
|
|
43
|
+
});
|
|
26
44
|
},
|
|
27
45
|
options: packageAarOptions,
|
|
28
46
|
});
|
|
@@ -30,15 +48,11 @@ export const pluginBrownfieldAndroid = (pluginConfig) => (api) => {
|
|
|
30
48
|
name: 'publish-local:aar',
|
|
31
49
|
description: 'Publishes a AAR to local maven repo',
|
|
32
50
|
action: async (args) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
throw new RockError('Android project not found.');
|
|
41
|
-
}
|
|
51
|
+
return publishLocalAarAction({
|
|
52
|
+
moduleName: args.moduleName,
|
|
53
|
+
projectRoot: api.getProjectRoot(),
|
|
54
|
+
pluginConfig,
|
|
55
|
+
});
|
|
42
56
|
},
|
|
43
57
|
options: publishLocalAarOptions,
|
|
44
58
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginBrownfieldAndroid.js","sourceRoot":"","sources":["../../../src/lib/pluginBrownfieldAndroid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAG3E,OAAO,EACL,UAAU,EAEV,iBAAiB,EACjB,eAAe,
|
|
1
|
+
{"version":3,"file":"pluginBrownfieldAndroid.js","sourceRoot":"","sources":["../../../src/lib/pluginBrownfieldAndroid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAG3E,OAAO,EACL,UAAU,EAEV,iBAAiB,EACjB,eAAe,EAEf,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,YAAY,GAAG,CACnB,UAA8B,EAC9B,aAAmC,EACnC,EAAE;IACF,MAAM,MAAM,GAAG;QACb,SAAS,EAAE,aAAa,CAAC,SAAS;QAClC,UAAU,EAAE,UAAU,IAAI,EAAE;KAC7B,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,EACrC,OAAO,EACP,UAAU,EACV,WAAW,EACX,YAAY,GAMb,EAAE,EAAE;IACH,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAE9B,MAAM,aAAa,GAAG,aAAa,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAE/D,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,MAAM,GAAG,YAAY,CAA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,qBAAqB,CAAC;gBAC3B,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,WAAW,EAAE,GAAG,CAAC,cAAc,EAAE;gBACjC,YAAY;aACb,CAAC,CAAC;QACL,CAAC;QACD,OAAO,EAAE,sBAAsB;KAChC,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,2BAA2B;QACjC,WAAW,EAAE,qCAAqC;KACnD,CAAC;AACJ,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rock-js/plugin-brownfield-android",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.5",
|
|
4
4
|
"description": "Plugin for integrating Rock projects with existing Android apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/src/index.d.ts",
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"publish:verdaccio": "npm publish --registry http://localhost:4873 --userconfig ../../.npmrc"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@rock-js/tools": "^0.12.
|
|
24
|
-
"@rock-js/platform-android": "^0.12.
|
|
23
|
+
"@rock-js/tools": "^0.12.5",
|
|
24
|
+
"@rock-js/platform-android": "^0.12.5",
|
|
25
25
|
"@react-native-community/cli-config-android": "^20.0.0",
|
|
26
26
|
"tslib": "^2.3.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@rock-js/config": "^0.12.
|
|
29
|
+
"@rock-js/config": "^0.12.5",
|
|
30
30
|
"@react-native-community/cli-types": "^20.0.0"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
@@ -6,40 +6,80 @@ import {
|
|
|
6
6
|
type PackageAarFlags,
|
|
7
7
|
packageAarOptions,
|
|
8
8
|
publishLocalAar,
|
|
9
|
+
type PublishLocalAarFlags,
|
|
9
10
|
publishLocalAarOptions,
|
|
10
11
|
} from '@rock-js/platform-android';
|
|
11
12
|
import { intro, RockError } from '@rock-js/tools';
|
|
12
13
|
|
|
13
14
|
const getAarConfig = (
|
|
14
|
-
|
|
15
|
+
moduleName: string | undefined,
|
|
15
16
|
androidConfig: AndroidProjectConfig,
|
|
16
17
|
) => {
|
|
17
18
|
const config = {
|
|
18
19
|
sourceDir: androidConfig.sourceDir,
|
|
19
|
-
moduleName:
|
|
20
|
+
moduleName: moduleName ?? '',
|
|
20
21
|
};
|
|
21
22
|
return config;
|
|
22
23
|
};
|
|
24
|
+
|
|
25
|
+
export const packageAarAction = async ({
|
|
26
|
+
variant,
|
|
27
|
+
moduleName,
|
|
28
|
+
projectRoot,
|
|
29
|
+
pluginConfig,
|
|
30
|
+
}: {
|
|
31
|
+
variant: string;
|
|
32
|
+
moduleName: string | undefined;
|
|
33
|
+
projectRoot: string;
|
|
34
|
+
pluginConfig?: AndroidProjectConfig;
|
|
35
|
+
}) => {
|
|
36
|
+
intro('Creating an AAR file');
|
|
37
|
+
|
|
38
|
+
const androidConfig = projectConfig(projectRoot, pluginConfig);
|
|
39
|
+
|
|
40
|
+
if (androidConfig) {
|
|
41
|
+
const config = getAarConfig(moduleName, androidConfig);
|
|
42
|
+
await packageAar(config, variant);
|
|
43
|
+
} else {
|
|
44
|
+
throw new RockError('Android project not found.');
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const publishLocalAarAction = async ({
|
|
49
|
+
moduleName,
|
|
50
|
+
projectRoot,
|
|
51
|
+
pluginConfig,
|
|
52
|
+
}: {
|
|
53
|
+
moduleName: string | undefined;
|
|
54
|
+
projectRoot: string;
|
|
55
|
+
pluginConfig?: AndroidProjectConfig;
|
|
56
|
+
}) => {
|
|
57
|
+
intro('Publishing AAR');
|
|
58
|
+
|
|
59
|
+
const androidConfig = projectConfig(projectRoot, pluginConfig);
|
|
60
|
+
|
|
61
|
+
if (androidConfig) {
|
|
62
|
+
const config = getAarConfig(moduleName, androidConfig);
|
|
63
|
+
await publishLocalAar(config);
|
|
64
|
+
} else {
|
|
65
|
+
throw new RockError('Android project not found.');
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
23
69
|
export const pluginBrownfieldAndroid =
|
|
24
70
|
(pluginConfig?: AndroidProjectConfig) =>
|
|
25
71
|
(api: PluginApi): PluginOutput => {
|
|
26
|
-
const projectRoot = api.getProjectRoot();
|
|
27
|
-
|
|
28
72
|
api.registerCommand({
|
|
29
73
|
name: 'package:aar',
|
|
30
74
|
description:
|
|
31
75
|
'Produces an AAR file suitable for including React Native app in native projects.',
|
|
32
|
-
action:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
await packageAar(config, args);
|
|
40
|
-
} else {
|
|
41
|
-
throw new RockError('Android project not found.');
|
|
42
|
-
}
|
|
76
|
+
action: (args: PackageAarFlags) => {
|
|
77
|
+
return packageAarAction({
|
|
78
|
+
variant: args.variant,
|
|
79
|
+
moduleName: args.moduleName,
|
|
80
|
+
projectRoot: api.getProjectRoot(),
|
|
81
|
+
pluginConfig,
|
|
82
|
+
});
|
|
43
83
|
},
|
|
44
84
|
options: packageAarOptions,
|
|
45
85
|
});
|
|
@@ -47,17 +87,12 @@ export const pluginBrownfieldAndroid =
|
|
|
47
87
|
api.registerCommand({
|
|
48
88
|
name: 'publish-local:aar',
|
|
49
89
|
description: 'Publishes a AAR to local maven repo',
|
|
50
|
-
action: async (args:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const config = getAarConfig(args, androidConfig);
|
|
57
|
-
await publishLocalAar(config);
|
|
58
|
-
} else {
|
|
59
|
-
throw new RockError('Android project not found.');
|
|
60
|
-
}
|
|
90
|
+
action: async (args: PublishLocalAarFlags) => {
|
|
91
|
+
return publishLocalAarAction({
|
|
92
|
+
moduleName: args.moduleName,
|
|
93
|
+
projectRoot: api.getProjectRoot(),
|
|
94
|
+
pluginConfig,
|
|
95
|
+
});
|
|
61
96
|
},
|
|
62
97
|
options: publishLocalAarOptions,
|
|
63
98
|
});
|