Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: visionOS support #5783

Merged
merged 45 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
747866f
chore: wip platform for visionos
rigor789 Sep 28, 2023
96830fc
feat: initial visionOS platform handling
rigor789 Sep 29, 2023
b5a3da5
chore: bump ios-sim-portable
rigor789 Sep 29, 2023
f4b7a69
fix(visionos): fallback to App_Resources/ios
rigor789 Sep 29, 2023
3e50cb3
fix: rename TNSNativeSource > NSNativeSources
NathanWalker Sep 29, 2023
eb2de47
fix(vision): write runtime package.json
rigor789 Sep 29, 2023
9acc5f9
fix: path platform detect handling for visionOS
NathanWalker Sep 29, 2023
df85555
chore(release): nativescript 8.6.0-vision.0
rigor789 Sep 29, 2023
c672cca
fix(vision): platform paths
rigor789 Sep 29, 2023
f445267
chore(release): nativescript 8.6.0-vision.1
rigor789 Sep 29, 2023
6392c75
fix(visionos): use App_Resources/visionOS to merge Info.plist
NathanWalker Oct 4, 2023
bc72497
release: 8.6.0-vision.2
NathanWalker Oct 4, 2023
8fbc23f
feat(create): vision flags
NathanWalker Oct 5, 2023
e666686
release: 8.6.0-vision.3
NathanWalker Oct 6, 2023
0a5cf4d
chore: cleanup
NathanWalker Oct 9, 2023
724f9bc
release: 8.6.0-vision.4
NathanWalker Oct 9, 2023
3da7962
release: 8.6.0-vision.6
NathanWalker Oct 10, 2023
74f2f31
fix: vision support
NathanWalker Oct 10, 2023
e36d0ab
release: 8.6.0-vision.7
NathanWalker Oct 10, 2023
8f10833
feat(visionos): allow platform specific SPM Packages
NathanWalker Oct 30, 2023
165e459
release: 8.6.2-vision.8
NathanWalker Oct 30, 2023
30acce0
fix(ios): skip package validation on xcodebuild
NathanWalker Jan 27, 2024
7c8a46a
chore: cleanup
NathanWalker Feb 3, 2024
d7ec912
fix: visionOS simulator logs
rigor789 Feb 7, 2024
0c87c46
chore: ensure arm64 if vision productType
NathanWalker Feb 7, 2024
af292bb
release: 8.6.6-vision.9
NathanWalker Feb 7, 2024
2cb22c8
feat(visionos): add device run support
NathanWalker Feb 13, 2024
064078f
feat(start): visionOS for ns start commands
NathanWalker Feb 13, 2024
d3ab25d
release: 8.6.6-vision.10
NathanWalker Feb 13, 2024
2d8faf6
feat: add visionOS to start menu
NathanWalker Feb 18, 2024
f6f23e3
fix: vision device info
NathanWalker Feb 18, 2024
d4d3531
fix(visionos): entitlement handling
NathanWalker Feb 18, 2024
b5084c3
release: 8.6.6-vision.11
NathanWalker Feb 18, 2024
fcaa07a
feat: allow macros to be defined in users build.xcconfig
NathanWalker Apr 1, 2024
3aed320
Merge branch 'main' into feat/visions-platform
rigor789 Apr 2, 2024
29d5c18
chore: fix deps
rigor789 Apr 2, 2024
b70477e
feat: allow NS_SWIFTUI_BOOT user defined value
NathanWalker Apr 2, 2024
7605441
release: 8.7.0-rc.0
NathanWalker Apr 2, 2024
afab03b
fix: ensure ts vision template is handled via flag
NathanWalker Apr 3, 2024
f8505ba
release: 8.7.0-rc.1
NathanWalker Apr 3, 2024
c34b49d
feat: build|visionos placeholder
rigor789 Apr 3, 2024
55f4d98
fix: vision template selection
rigor789 Apr 3, 2024
9550fbd
chore: cleanup
rigor789 Apr 3, 2024
b6f281d
chore: fix tests
rigor789 Apr 3, 2024
fdf76e0
release: 8.7.0-rc.2
rigor789 Apr 3, 2024
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
63 changes: 42 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<br>
</h1>

<h4 align="center">The NativeScript CLI lets you create, build, and deploy <a href="https://docs.nativescript.org/" target="_blank">NativeScript</a>-based apps on iOS and Android devices.</h4>
<h4 align="center">The NativeScript CLI lets you create, build, and deploy <a href="https://docs.nativescript.org/" target="_blank">NativeScript</a> apps.</h4>
</a>
</h4>

Expand All @@ -18,30 +18,51 @@

Get it using: `npm install -g nativescript`

* [What is NativeScript](#what-is-nativescript "Quick overview of NativeScript, the JavaScript framework for cross-platform development of native iOS and Android apps")
* [How the NativeScript CLI works](#how-the-nativescript-cli-works "How the CLI works in more detail")
* [Supported Platforms](#supported-platforms "The mobile platforms you can target with NativeScript")
* [System Requirements](#system-requirements "The hardware and software requirements for setting up and working with the NativeScript CLI")
* [Installation](#installation "How to configure and install the NativeScript CLI")
* [Install the NativeScript CLI](#install-the-nativescript-cli)
* [Configure Proxy Usage](#configure-proxy-settings)
* [Quick Start](#quick-start "Get started with the NativeScript CLI")
* [The Commands](#the-commands)
* [Create Project](#create-project)
* [Develop Your Project](#develop-your-project)
* [Build Your Project](#build-your-project)
* [Run Your Project](#run-your-project)
* [Extending the CLI](#extending-the-cli)
* [Troubleshooting](#troubleshooting)
* [How to Contribute](#how-to-contribute)
* [How to Build](#how-to-build)
* [Get Help](#get-help)
* [License](#license)
- [What is NativeScript](#what-is-nativescript)
- [How the NativeScript CLI works](#how-the-nativescript-cli-works)
- [Supported Platforms](#supported-platforms)
- [System Requirements](#system-requirements)
- [Installation](#installation)
- [Install the NativeScript CLI](#install-the-nativescript-cli)
- [Configure Proxy Settings](#configure-proxy-settings)
- [Set Proxy Settings](#set-proxy-settings)
- [Attributes](#attributes)
- [Options](#options)
- [Limitations](#limitations)
- [Display Current Proxy Settings](#display-current-proxy-settings)
- [Clear Proxy Settings](#clear-proxy-settings)
- [Quick Start](#quick-start)
- [The Commands](#the-commands)
- [Create Project](#create-project)
- [Develop Your Project](#develop-your-project)
- [Development with NativeScript](#development-with-nativescript)
- [Development in `app`](#development-in-app)
- [Development in `platforms`](#development-in-platforms)
- [Modifying Configuration Files](#modifying-configuration-files)
- [Modifying Entitlements File (iOS only)](#modifying-entitlements-file-ios-only)
- [Build Your Project](#build-your-project)
- [Run Your Project](#run-your-project)
- [Extending the CLI](#extending-the-cli)
- [Troubleshooting](#troubleshooting)
- [How to Contribute](#how-to-contribute)
- [How to Build](#how-to-build)
- [Get Help](#get-help)
- [License](#license)

What is NativeScript
===

NativeScript is a cross-platform JavaScript framework that lets you develop native iOS and Android apps from a single code base. The framework provides JavaScript access to the native APIs, user interface, and rendering engines of iOS and Android. By using JavaScript or TypeScript, you can create one project that builds into an iOS or Android app with completely native user experience.
NativeScript provides platform APIs directly to the JavaScript runtime (_with strong types_) for a rich TypeScript development experience.

Some popular use cases:

- Building Web, iOS, Android and Vision Pro apps with a shared codebase (aka, cross platform apps)
- Building native platform apps with portable JavaScript skills
- Augmenting JavaScript projects with platform API capabilities
- AndroidTV and Watch development
- watchOS development
- Learning native platforms through JavaScript understanding
- Exploring platform API documentation by trying APIs [directly from a web browser](https://preview.nativescript.org/) without requiring a platform development machine setup.

To learn more about NativeScript, you can check the following resources:

Expand Down
8 changes: 8 additions & 0 deletions lib/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,24 +180,32 @@ injector.requireCommand("platform|update", "./commands/update-platform");
injector.requireCommand("run|*all", "./commands/run");
injector.requireCommand("run|ios", "./commands/run");
injector.requireCommand("run|android", "./commands/run");
injector.requireCommand("run|vision", "./commands/run");
injector.requireCommand("run|visionos", "./commands/run");
injector.requireCommand("typings", "./commands/typings");

injector.requireCommand("preview", "./commands/preview");

injector.requireCommand("debug|ios", "./commands/debug");
injector.requireCommand("debug|android", "./commands/debug");
injector.requireCommand("debug|vision", "./commands/debug");
injector.requireCommand("debug|visionos", "./commands/debug");
injector.requireCommand("fonts", "./commands/fonts");

injector.requireCommand("prepare", "./commands/prepare");
injector.requireCommand("build|ios", "./commands/build");
injector.requireCommand("build|android", "./commands/build");
injector.requireCommand("build|vision", "./commands/build");
injector.requireCommand("build|visionos", "./commands/build");
injector.requireCommand("deploy", "./commands/deploy");

injector.require("testExecutionService", "./services/test-execution-service");
injector.requireCommand("dev-test|android", "./commands/test");
injector.requireCommand("dev-test|ios", "./commands/test");
injector.requireCommand("test|android", "./commands/test");
injector.requireCommand("test|ios", "./commands/test");
// injector.requireCommand("test|vision", "./commands/test");
// injector.requireCommand("test|visionos", "./commands/test");
injector.requireCommand("test|init", "./commands/test-init");
injector.requireCommand("dev-generate-help", "./commands/generate-help");

Expand Down
40 changes: 39 additions & 1 deletion lib/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {
$platformValidationService: IPlatformValidationService,
$logger: ILogger,
$buildDataService: IBuildDataService,
private $migrateController: IMigrateController
protected $migrateController: IMigrateController
) {
super(
$options,
Expand Down Expand Up @@ -221,3 +221,41 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
}

injector.registerCommand("build|android", BuildAndroidCommand);

export class BuildVisionOsCommand extends BuildIosCommand implements ICommand {
constructor(
protected $options: IOptions,
$errors: IErrors,
$projectData: IProjectData,
$platformsDataService: IPlatformsDataService,
$devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
$buildController: IBuildController,
$platformValidationService: IPlatformValidationService,
$logger: ILogger,
$buildDataService: IBuildDataService,
protected $migrateController: IMigrateController
) {
super(
$options,
$errors,
$projectData,
$platformsDataService,
$devicePlatformsConstants,
$buildController,
$platformValidationService,
$logger,
$buildDataService,
$migrateController
);
}

public async canExecute(args: string[]): Promise<boolean> {
this.$errors.fail(
'Building for "visionOS" platform is not supported via the CLI. Please open the project in Xcode and build it from there.'
);
return false;
}
}

injector.registerCommand("build|vision", BuildVisionOsCommand);
injector.registerCommand("build|visionos", BuildVisionOsCommand);
100 changes: 87 additions & 13 deletions lib/commands/create-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export class CreateProjectCommand implements ICommand {
private static BlankTemplateDescription = "A blank app";
private static BlankTsTemplateKey = "Blank Typescript";
private static BlankTsTemplateDescription = "A blank typescript app";
private static BlankVisionTemplateKey = "visionOS";
private static BlankVisionTemplateDescription = "A visionOS app";
private static HelloWorldTemplateKey = "Hello World";
private static HelloWorldTemplateDescription = "A Hello World app";
private static DrawerTemplateKey = "SideDrawer";
Expand Down Expand Up @@ -58,15 +60,43 @@ export class CreateProjectCommand implements ICommand {

let projectName = args[0];
let selectedTemplate: string;
if (this.$options.js) {
selectedTemplate = constants.JAVASCRIPT_NAME;
} else if (this.$options.vue && this.$options.tsc) {
if (
this.$options["vision-ng"] ||
(this.$options.vision && this.$options.ng)
) {
selectedTemplate = constants.RESERVED_TEMPLATE_NAMES["vision-ng"];
} else if (
this.$options["vision-react"] ||
(this.$options.vision && this.$options.react)
) {
selectedTemplate = constants.RESERVED_TEMPLATE_NAMES["vision-react"];
} else if (this.$options["vision-solid"]) {
// note: we don't have solid templates or --solid
selectedTemplate = constants.RESERVED_TEMPLATE_NAMES["vision-solid"];
} else if (
this.$options["vision-svelte"] ||
(this.$options.vision && this.$options.svelte)
) {
selectedTemplate = constants.RESERVED_TEMPLATE_NAMES["vision-svelte"];
} else if (
this.$options["vision-vue"] ||
(this.$options.vision && (this.$options.vue || this.$options.vuejs))
) {
selectedTemplate = constants.RESERVED_TEMPLATE_NAMES["vision-vue"];
} else if (
(this.$options.vue || this.$options.vuejs) &&
this.$options.tsc
) {
selectedTemplate = "@nativescript/template-blank-vue-ts";
} else if (this.$options.vision) {
selectedTemplate = constants.RESERVED_TEMPLATE_NAMES["vision"];
} else if (this.$options.js) {
selectedTemplate = constants.JAVASCRIPT_NAME;
} else if (this.$options.tsc) {
selectedTemplate = constants.TYPESCRIPT_NAME;
} else if (this.$options.ng) {
selectedTemplate = constants.ANGULAR_NAME;
} else if (this.$options.vue) {
} else if (this.$options.vue || this.$options.vuejs) {
selectedTemplate = constants.VUE_NAME;
} else if (this.$options.react) {
selectedTemplate = constants.REACT_NAME;
Expand Down Expand Up @@ -262,6 +292,11 @@ can skip this prompt next time using the --template option, or the --ng, --react
value: "@nativescript/template-tab-navigation-ts",
description: CreateProjectCommand.TabsTemplateDescription,
},
{
key: CreateProjectCommand.BlankVisionTemplateKey,
value: "@nativescript/template-hello-world-ts-vision",
description: CreateProjectCommand.BlankVisionTemplateDescription,
},
];

return templates;
Expand All @@ -284,6 +319,11 @@ can skip this prompt next time using the --template option, or the --ng, --react
value: "@nativescript/template-tab-navigation-ng",
description: CreateProjectCommand.TabsTemplateDescription,
},
{
key: CreateProjectCommand.BlankVisionTemplateKey,
value: "@nativescript/template-hello-world-ng-vision",
description: CreateProjectCommand.BlankVisionTemplateDescription,
},
];

return templates;
Expand All @@ -296,6 +336,11 @@ can skip this prompt next time using the --template option, or the --ng, --react
value: constants.RESERVED_TEMPLATE_NAMES.react,
description: CreateProjectCommand.HelloWorldTemplateDescription,
},
{
key: CreateProjectCommand.BlankVisionTemplateKey,
value: "@nativescript/template-blank-react-vision",
description: CreateProjectCommand.BlankVisionTemplateDescription,
},
];

return templates;
Expand All @@ -308,6 +353,11 @@ can skip this prompt next time using the --template option, or the --ng, --react
value: constants.RESERVED_TEMPLATE_NAMES.svelte,
description: CreateProjectCommand.HelloWorldTemplateDescription,
},
{
key: CreateProjectCommand.BlankVisionTemplateKey,
value: "@nativescript/template-blank-svelte-vision",
description: CreateProjectCommand.BlankVisionTemplateDescription,
},
];

return templates;
Expand Down Expand Up @@ -335,6 +385,11 @@ can skip this prompt next time using the --template option, or the --ng, --react
value: "@nativescript/template-tab-navigation-vue",
description: CreateProjectCommand.TabsTemplateDescription,
},
{
key: CreateProjectCommand.BlankVisionTemplateKey,
value: "@nativescript/template-blank-vue-vision",
description: CreateProjectCommand.BlankVisionTemplateDescription,
},
];

return templates;
Expand All @@ -346,6 +401,33 @@ can skip this prompt next time using the --template option, or the --ng, --react

const greyDollarSign = color.grey("$");
this.$logger.clearScreen();
let runDebugNotes: Array<string> = [];
if (
this.$options.vision ||
this.$options["vision-ng"] ||
this.$options["vision-react"] ||
this.$options["vision-solid"] ||
this.$options["vision-svelte"] ||
this.$options["vision-vue"]
) {
runDebugNotes = [
`Run the project on Vision Pro with:`,
"",
` ${greyDollarSign} ${color.green("ns run visionos --no-hmr")}`,
];
} else {
runDebugNotes = [
`Run the project on multiple devices:`,
"",
` ${greyDollarSign} ${color.green("ns run ios")}`,
` ${greyDollarSign} ${color.green("ns run android")}`,
"",
"Debug the project with Chrome DevTools:",
"",
` ${greyDollarSign} ${color.green("ns debug ios")}`,
` ${greyDollarSign} ${color.green("ns debug android")}`,
];
}
this.$logger.info(
[
[
Expand All @@ -358,15 +440,7 @@ can skip this prompt next time using the --template option, or the --ng, --react
`cd ${relativePath}`
)} and then:`,
"",
`Run the project on multiple devices:`,
"",
` ${greyDollarSign} ${color.green("ns run ios")}`,
` ${greyDollarSign} ${color.green("ns run android")}`,
"",
"Debug the project with Chrome DevTools:",
"",
` ${greyDollarSign} ${color.green("ns debug ios")}`,
` ${greyDollarSign} ${color.green("ns debug android")}`,
...runDebugNotes,
``,
`For more options consult the docs or run ${color.green("ns --help")}`,
"",
Expand Down
Loading