Creating a New Project
After installing the Poly CLI, you can now create a new Poly project:
this generates a new Poly application called “MyNewApp” under the package identifier “org.my”. The package identifier corresponds to:
- the organization identifier in Xcode when creating a new app; and
- the application ID in GTK when creating a new GTK application, minus the application name.
Creating the Project In a Separate Directory
You can pass the --output
flag to generate the project in a different directory:
This outputs the MyNewApp
directory in the project
directory that is in the parent directory of the current working directory.
Project Structure
The command generates a directory named MyNewApp
in the current working directory that has the following structure:
gtk
: the entry point to the GTK layer of the application. It contains all the necessary components to build the application as a GTK application that can run on Linux.packaging
: this directory contains files that is required when packaging the GTK application.launch.sh
: this is the launch script for the application when it is installed. It sets up the correct environment for the application. When running the installed application,launch.sh
will be invoked.rpm
: this directory contains files that are required to package the application as a.rpm
package.
macOS
: the entry point to the AppKit layer of the application. It contains all the necessary components to build the application as an AppKit application that can run on macOS.project.yml
: Thexcodegen
spec for the XCode project. When the project is created in macOS,xcodegen generate
will be run automatically, which will generateMyNewApp.xcodeproj
. The AppKit project can then be opened in XCode.
app
: the directory that contains code for the portable layer. Poly only supports TypeScript for now, soapp
will contain a TypeScript project. All application logic will go in this directory.
Running the Project
In order to run the project, change into the app
directory, and then run the build
NPM script:
MacOS
If the .xcodeproj
file is not present, generate it by changing into the macOS
directory and running xcodegen:
Open the .xcodeproj
in XCode, and then run the project.