The content on this page is written in Chinese, and then traslated into English by machine. More accurate traslations are welcome at: https://github.com/wa-lang/man/tree/master/en

Ending's law: "Any application that can be compiled to WebAssembly, will be compiled to WebAssembly eventually."

1.4. Project directory structure

The project directory structure is the basis for the work of the entire peripheral tools. For example, init generates projects based on this structure, and the package management tool manages dependencies in turn.

1.4.1 Project directory structure

Wa-lang programs organize code in packages. A package can be a single file or a directory. The waroot/examples/hello case that comes with Wa-lang is a more complete project, and its directory structure is as follows:

examples/hello/
├── LICENSE
├── README.md
├── src
│   ├── main.wa
│   └── mymath
│       └── math.wa
├── vendor
│   └── 3rdparty
│       └── pkg
│           └── pkg.wa
└── wa.mod

In addition to copyright files and description files, the most important thing is the wa.mod package project file, which defines the package path of the current application. In addition, the code in the src directory is the code under the current package path, which is the default main entry package.

The contents of the wa.mod file are as follows:

name = "hello"
pkgpath = "myapp"
version = "0.0.1"

Among them, pkgpath represents the path of the current package, so it can be deduced that the package path corresponding to the mymath subdirectory is "myapp/mymath". The vendor directory is the dependent third-party code, where the package path corresponding to vendor/3rdparty/pkg is "3rdparty/pkg".

1.4.2 Package management tool

Wa-lang currently does not have a package management tool. If you rely on third-party packages, you need to manually synchronize the vendor directory. The development team hopes to start developing package management tool after the MVP version.