@bacons/apple-targets 0.0.0

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.
@@ -0,0 +1,4 @@
1
+ import { XcodeProject } from "@bacons/xcode";
2
+ import { ConfigPlugin, Mod } from "@expo/config-plugins";
3
+ export declare const withXcodeProjectBeta: ConfigPlugin<Mod<XcodeProject>>;
4
+ export declare const withXcodeProjectBetaBaseMod: ConfigPlugin<void>;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.withXcodeProjectBetaBaseMod = exports.withXcodeProjectBeta = void 0;
27
+ const xcode_1 = require("@bacons/xcode");
28
+ const xcodeParse = __importStar(require("@bacons/xcode/json"));
29
+ const config_plugins_1 = require("@expo/config-plugins");
30
+ const fs = __importStar(require("fs"));
31
+ const customModName = "xcodeProjectBeta";
32
+ const withXcodeProjectBeta = (config, action) => {
33
+ return (0, config_plugins_1.withMod)(config, {
34
+ platform: "ios",
35
+ mod: customModName,
36
+ action,
37
+ });
38
+ };
39
+ exports.withXcodeProjectBeta = withXcodeProjectBeta;
40
+ const withXcodeProjectBetaBaseModInternal = (config) => {
41
+ return config_plugins_1.BaseMods.withGeneratedBaseMods(config, {
42
+ platform: "ios",
43
+ saveToInternal: true,
44
+ skipEmptyMod: false,
45
+ providers: {
46
+ // Append a custom rule to supply AppDelegate header data to mods on `mods.ios.AppClipInfoPlist`
47
+ [customModName]: config_plugins_1.BaseMods.provider({
48
+ isIntrospective: false,
49
+ // isIntrospective: true,
50
+ async getFilePath({ modRequest, _internal }) {
51
+ // console.log("_internal", _internal.projectRoot);
52
+ // HACK: To keep soft-clean working, we need to read from the the project and not the template.
53
+ return config_plugins_1.IOSConfig.Paths.getPBXProjectPath(_internal.projectRoot);
54
+ // return IOSConfig.Paths.getPBXProjectPath(modRequest.projectRoot);
55
+ },
56
+ async read(filePath) {
57
+ try {
58
+ return xcode_1.XcodeProject.open(filePath);
59
+ }
60
+ catch (error) {
61
+ throw new Error(`Failed to parse the Xcode project: "${filePath}". ${error.message}}`);
62
+ }
63
+ },
64
+ async write(filePath, { modResults, modRequest: { introspect } }) {
65
+ if (introspect) {
66
+ return;
67
+ }
68
+ const contents = xcodeParse.build(modResults.toJSON());
69
+ if (contents.trim().length) {
70
+ await fs.promises.writeFile(filePath, contents);
71
+ }
72
+ },
73
+ }),
74
+ },
75
+ });
76
+ };
77
+ exports.withXcodeProjectBetaBaseMod = (0, config_plugins_1.createRunOncePlugin)(withXcodeProjectBetaBaseModInternal, "withXcodeProjectBetaBaseMod");
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@bacons/apple-targets",
3
+ "version": "0.0.0",
4
+ "description": "Generate Apple Targets with Expo Prebuild",
5
+ "main": "build/index.js",
6
+ "files": [
7
+ "app.plugin.js",
8
+ "build"
9
+ ],
10
+ "scripts": {
11
+ "build": "expo-module build",
12
+ "clean": "expo-module clean",
13
+ "lint": "expo-module lint",
14
+ "test": "jest --watch",
15
+ "prepare": "expo-module prepare",
16
+ "prepublishOnly": "expo-module prepublishOnly",
17
+ "expo-module": "expo-module"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/evanbacon/expo-apple-targets.git"
22
+ },
23
+ "keywords": [
24
+ "expo",
25
+ "config-plugins",
26
+ "apple-targets"
27
+ ],
28
+ "author": "Evan Bacon",
29
+ "license": "MIT",
30
+ "dependencies": {
31
+ "glob": "^10.2.6",
32
+ "@bacons/xcode": "^1.0.0-alpha.9",
33
+ "fs-extra": "^11.2.0"
34
+ },
35
+ "devDependencies": {
36
+ "@types/fs-extra": "^11.0.4",
37
+ "@types/glob": "^8.1.0",
38
+ "@expo/babel-preset-cli": "^0.3.1",
39
+ "jest-environment-node": "^26"
40
+ }
41
+ }