Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

wire-widget-asset-catalog.cjs

30 lines1.0 KB

1"use strict";
2​
3// One-off: apply the widget asset-catalog wiring to the already-generated
4// ios/ project so the current build compiles ExpoWidgetsTarget/Assets.xcassets
5// without a full `expo prebuild`. The durable equivalent lives in
6// plugins/withWidgetLogoAsset.cjs and runs on prebuild.
7​
8const path = require("path");
9const fs = require("fs");
10​
11const xcodePath = require.resolve("xcode", {
12 paths: [
13 require.resolve("@expo/config-plugins", { paths: [require.resolve("expo/package.json")] }),
14 ],
15});
16const xcode = require(xcodePath);
17const { addWidgetAssetCatalog } = require("../plugins/lib/addWidgetAssetCatalog.cjs");
18​
19const pbxprojPath = path.join(__dirname, "..", "ios", "T3CodeDev.xcodeproj", "project.pbxproj");
20const proj = xcode.project(pbxprojPath);
21proj.parseSync();
22​
23const added = addWidgetAssetCatalog(proj, { targetName: "ExpoWidgetsTarget" });
24​
25if (added) {
26 fs.writeFileSync(pbxprojPath, proj.writeSync());
27 console.log("Added widget asset-compile phase to ExpoWidgetsTarget.");
28} else {
29 console.log("No change: phase already present.");