From 41ad6e8d39fef3965e4a1fe40ee2d85541f37c56 Mon Sep 17 00:00:00 2001 From: szymonrybczak Date: Wed, 28 Aug 2024 12:46:28 +0200 Subject: [PATCH] feat!: add support for `add-platform` command fix: include `postInitScript.js` in package files fix: remove `chalk` dependency --- package.json | 3 ++- postInitScript.js | 28 ++++++++++++++++++++++++++++ template.config.js | 2 ++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100755 postInitScript.js diff --git a/package.json b/package.json index 79a8fed..b28eef2 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "type": "commonjs", "files": [ "template/*", - "template.config.js" + "template.config.js", + "postInitScript.js" ], "dependencies": {}, "devDependencies": { diff --git a/postInitScript.js b/postInitScript.js new file mode 100755 index 0000000..f0d99a7 --- /dev/null +++ b/postInitScript.js @@ -0,0 +1,28 @@ +#!/usr/bin/env node + +const path = require("path"); + +// ANSI escape codes for colors and formatting +const reset = "\x1b[0m"; +const cyan = "\x1b[36m"; +const bold = "\x1b[1m"; + +function printInitScript() { + const projectDir = path.resolve(); + + const instructions = ` + ${cyan}Run instructions for ${bold}visionOS${reset}${cyan}:${reset} + • cd "${projectDir}/visionos" + + • Install Cocoapods + • bundle install # you need to run this only once in your project. + • bundle exec pod install + • cd .. + + • npx react-native run-visionos + `; + + console.log(instructions); +} + +printInitScript(); diff --git a/template.config.js b/template.config.js index c075f1d..555c2d2 100644 --- a/template.config.js +++ b/template.config.js @@ -9,4 +9,6 @@ module.exports = { placeholderName: 'HelloWorld', titlePlaceholder: 'Hello App Display Name', templateDir: './template', + platforms: ['visionos'], + postInitScript: './postInitScript.js', };