Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ local.properties

# Platform-specific files
.gradle
platforms/android/app/src/main/assets/bundle
platforms/ios/shellular/bundle
platforms/browser/bundle
platforms/**/*/bundle
platforms/android/app/release
platforms/android/build
keystore.jks
Expand Down
4 changes: 2 additions & 2 deletions dev/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import config from "./config.js";
config("production");

const args = process.argv.slice(2);
const platform = args.find((arg) => /(android|ios|browser)/i.test(arg));
const platform = args.find((arg) => /(android|ios|macos|browser)/i.test(arg));

if (!platform) {
console.error("Please specify a platform: android, ios, or browser");
console.error("Please specify a platform: android, ios, macos, or browser");
process.exit(1);
}

Expand Down
12 changes: 12 additions & 0 deletions dev/macos/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { exec } from "node:child_process";
import { join } from "node:path";

export default async function build() {
const root = join(process.cwd(), "platforms/macos");
await new Promise((resolve, reject) => {
const child = exec(`xcodebuild archive -project "${join(root, "shellular.xcodeproj")}" -scheme shellular -configuration Release -destination 'generic/platform=macOS' -archivePath "${join(root, "shellular.xcarchive")}"`);
child.stdout?.pipe(process.stdout); child.stderr?.pipe(process.stderr);
child.on("close", code => code === 0 ? resolve() : reject(new Error(`xcodebuild exited ${code}`)));
child.on("error", reject);
});
}
9 changes: 9 additions & 0 deletions dev/macos/start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { exec } from "node:child_process";
import { join } from "node:path";

export default async function start(server) {
const project = join(process.cwd(), "platforms/macos/shellular.xcodeproj");
exec(`open "${project}"`);
console.log("Build and run the shellular scheme (My Mac).");
if (server) console.log(`Dev server: http://${server.host}:${server.port}`);
}
4 changes: 2 additions & 2 deletions dev/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import config from "./config.js";
import getIp from "./getIp.js";

const args = process.argv.slice(2);
const platform = args.find((arg) => /(android|ios|browser)/i.test(arg)) || "android";
const platform = args.find((arg) => /(android|ios|macos|browser)/i.test(arg)) || "android";
const isRelease = args.includes("--release") || args.includes("-r") || false;

const { default: start } = await import(`./${platform}/start.js`);
Expand Down Expand Up @@ -64,7 +64,7 @@ async function main() {
// For android/ios, wait until the first successful compilation so the
// bundle with the current port is on disk before installing the APK.
// For browser, any output is fine — the browser will wait for the page.
const needsBundle = platform === "android" || platform === "ios";
const needsBundle = platform === "android" || platform === "ios" || platform === "macos";
if (needsBundle && !chunk.includes("compiled successfully")) {
return;
}
Expand Down
6 changes: 6 additions & 0 deletions dev/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ const INCREMENT = revert ? -1 : 1;
const packageJsonFile = resolve(process.cwd(), "package.json");
const manifestXmlFile = resolve(process.cwd(), "platforms/android/app/src/main/AndroidManifest.xml");
const pbxprojFile = resolve(process.cwd(), "platforms/ios/shellular.xcodeproj/project.pbxproj");
const macPbxprojFile = resolve(process.cwd(), "platforms/macos/shellular.xcodeproj/project.pbxproj");

main();

async function main() {
const packageContent = readFileSync(packageJsonFile, "utf8");
const manifestContent = readFileSync(manifestXmlFile, "utf8");
const pbxprojContent = readFileSync(pbxprojFile, "utf8");
const macPbxprojContent = readFileSync(macPbxprojFile, "utf8");
const packageJson = JSON.parse(packageContent);

if (!version) {
Expand Down Expand Up @@ -51,6 +53,10 @@ async function main() {
newPbxprojContent = newPbxprojContent.replace(/CURRENT_PROJECT_VERSION = \d+;/g, `CURRENT_PROJECT_VERSION = ${versionCode};`);
writeFileSync(pbxprojFile, newPbxprojContent, "utf8");

let newMacPbxprojContent = macPbxprojContent.replace(/MARKETING_VERSION = [\d.]+;/g, `MARKETING_VERSION = ${version};`);
newMacPbxprojContent = newMacPbxprojContent.replace(/CURRENT_PROJECT_VERSION = \d+;/g, `CURRENT_PROJECT_VERSION = ${versionCode};`);
writeFileSync(macPbxprojFile, newMacPbxprojContent, "utf8");

writeFileSync(packageJsonFile, JSON.stringify({ ...packageJson, version, versionCode }, undefined, 2), "utf8");

console.log(`Version updated to ${version} and versionCode to ${versionCode}`);
Expand Down
2 changes: 1 addition & 1 deletion platforms/android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
agp = "9.2.0"
agp = "9.2.1"
barcodeScanning = "18.11.0"
browser = "1.8.0"
cameraCamera2 = "1.4.2"
Expand Down
Loading