You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blog/2024-11-11-package.md
+24-10Lines changed: 24 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -5,11 +5,11 @@ authors: [vinzbarbuto]
5
5
tags: [packages, packaging, lingua franca, docs]
6
6
---
7
7
8
-
The Lingua Franca (LF) [Package Explorer](/docs/tools/code-extension#package-explorer) is a new feature within the Lingua Franca Visual Studio Code extension, built to streamline package management for developers. Supporting both local and remote sources, the Package Explorer enables effortless listing and management of packages—whether defined locally by developers or installed through the Lingo Package Manager. This integration aligns with the Lingua Franca community’s vision for a collaborative and reusable ecosystem. Developers can create and publish their own packages, enabling others to easily incorporate these resources into their projects. This collaborative model not only enhances programmability and accelerates product development but also simplifies the design of complex Lingua Franca applications.
8
+
The Lingua Franca (LF) [Package Explorer](/docs/tools/code-extension#package-explorer) is a new feature within the Lingua Franca Visual Studio Code extension, built to streamline package management for developers. Supporting both local and remote sources, the Package Explorer enables effortless listing and management of packages—whether defined locally by developers or installed through the Lingo Package Manager. This integration aligns with the Lingua Franca community's vision for a collaborative and reusable ecosystem. Developers can create and publish their own packages, enabling others to easily incorporate these resources into their projects. This collaborative model not only enhances programmability and accelerates product development but also simplifies the design of complex Lingua Franca applications.
9
9
10
10
{/* truncate */}
11
11
12
-
In this guide, we’ll walk you through the essential steps to create and publish a package to the community repository, covering:
12
+
In this guide, we'll walk you through the essential steps to create and publish a package to the community repository, covering:
13
13
14
14
1.[**Creating a New Package**](#creating-a-package)
15
15
Get started by setting up your package with the required files and directory structure to meet Lingua Franca standards.
@@ -25,7 +25,7 @@ By the end of this guide, you'll have a fully configured, shareable package read
25
25
## Creating a New Package
26
26
You can create a new [LF package](/docs/glossary/#package) either manually by creating an [LF file](/docs/glossary/#lf-file) or by using the [Lingo Package Manager](https://github.com/lf-lang/lingo).
27
27
28
-
#### Option 1: Create a Project Using the Lingo Package Manager (Recommended)
28
+
#### Option 1: Create a project using the Lingo Package Manager (recommended)
29
29
1. After [installing the Lingo Package Manager](https://www.lf-lang.org/docs/installation#lingo), create an empty directory to serve as the root of your new package.
30
30
2. Open the terminal in this folder and run the <kbd>lingo init</kbd> command.
31
31
@@ -38,7 +38,7 @@ This will set up a new LF package with the following structure:
38
38
└── └── Lingo.toml # Configuration file for current package
39
39
```
40
40
41
-
#### Option 2: Manually Create the Required Files
41
+
#### Option 2: Manually create the required files
42
42
1. Go to <kbd>File > New File...</kbd> and select `New Lingua Franca File`.
43
43
2. Save the file in a directory called `src` to ensure that generated code is placed in a parallel `src-gen` directory. For example, if your file is called `Foo.lf`, the directory structure after building will look like this:
44
44
@@ -55,7 +55,7 @@ This will set up a new LF package with the following structure:
55
55
56
56
If you manually create the `Lingo.toml` file, place it adjacent to the `src` folder in the root directory of the package. This file serves as a configuration for the package, allowing you to specify the package name, version, and other metadata, including any dependencies you want to install.
57
57
58
-
### Add `src/lib/` for Local Libraries
58
+
### Add `src/lib/` for local libraries
59
59
60
60
To include local libraries in your Lingua Franca project, create a `lib` directory within the `src/` folder and place your LF files there. These files contain reusable reactors that can be used within the same package or, if published, in other packages via the Lingo Package Manager. The `src/lib` directory is the default location for Lingua Franca files your project exports, enabling other libraries to use them. This setup simplifies managing and reusing libraries across Lingua Franca projects.
61
61
@@ -75,7 +75,7 @@ The `lib` directory should be placed alongside the `src` directory, organized as
75
75
76
76
In LF, there is no visibility control, meaning you cannot mark a reactor or file as `private` as in other programming languages. The `private` directory serves this purpose by containing files meant solely for internal package use. Files in this directory are hidden in the Package Explorer within the VS Code extension, making them inaccessible to other packages. The `private` directory is useful for implementing design patterns like the Abstract Factory Pattern, which provides an interface for creating families of related objects without specifying concrete classes. For example, a developer might define an `AbstractLibraryFile.lf` containing abstract reactors and implement them in various ways within different files under the `lib` directory.
77
77
78
-
### Must-Follow Guidelines
78
+
### Must-follow guidelines
79
79
80
80
When creating a new package, ensure that you follow these guidelines:
81
81
@@ -122,16 +122,30 @@ Publishing your package makes it accessible to other developers, enabling them t
122
122
123
123
Follow these steps to publish your package:
124
124
125
-
#### 1. Push Your Package to Your GitHub Repository
125
+
#### 1. Push your package to your GitHub repository
126
126
Upload your package to your own (public) GitHub repository. This allows you to share it immediately.
127
127
128
-
#### 2. Follow the `<name>-<target>`Naming Scheme
128
+
#### 2. Follow the `<name>-<target>`naming scheme
129
129
Name your repository using the format `<name>-<target>`. For example, `package-python`.
130
130
- Use lowercase letters and hyphens.
131
131
- Ensure `<name>` is descriptive and unique.
132
132
- Specify `<target>` as the package's target language.
133
133
134
-
#### 3. Add the Maintainer's Name to the Repository Description
135
-
This helps others know who to contact for questions or assistance.
134
+
#### 3. Add the maintainer's name to the repository description
135
+
This helps others know who to contact for questions or assistance.
136
+
137
+
#### 4. List the package in the Lingua Franca Package Registry
138
+
139
+
After publishing your package, you can make it discoverable by listing it in the [Lingua Franca Package Registry](https://github.com/lf-lang/pkgs). To add your package:
140
+
141
+
1. Fork the [pkgs](https://github.com/lf-lang/pkgs) repository
142
+
2. Find the appropriate target language section in `README.md` (e.g., C, Cpp, Python)
143
+
3. Add your package entry in alphabetical order using this format:
144
+
145
+
```
146
+
- [package-name](link-to-repository)
147
+
```
148
+
149
+
4. Submit a pull request to the `pkgs` repository for review
136
150
137
151
By following these steps, you ensure your package is properly organized and ready for community use.
0 commit comments