A bundler/packer for scripts in a template form so it's easy for anyone to use. Streamlined and currently pending a rewrite. Originally this was an internal tool used at NW.
Using ASP for the first time can be pretty jarring if you're a novice. I've broken everything down to be easy to understand even for the noobiest of people. :p
Preparing to use ASP is simple, this is the only part you are required to do if it's your first time. If you already have Bun/Node, an IDE and Rokit installed, you can move on to the next part below this.
- Install your IDE of choice, for the sake of standards Visual Studio Code is used.
- Go to Rokit and download the latest release. (Restart may be required)
- Go to bun.sh and install bun. (Alternative: Node.js)
- Run
bun install
to install the package required (fs-extra
) - Run
rokit install
to install the package required (darklua
) - Now you are ready to use ASP.
Press CTRL + SHIFT + B
or head to the top bar, press Terminal
and Run Build Task
.
Notice: If you are not using VSC a build script is provided (
build.ps1
)
Macros are the foundation of ASP, and the reason you are using it. Macros can be modified in any way, such as changing the name if you'd like. This is just base documentation for each and what it does.
Note that Macros are not created in the lua environment.
Imports the file at the designated path. If the file is in src/myfile.luau
, you would write: IMPORT("src/myfile.luau")
.
IMPORT(path: string);
The same as import, but does not wrap the import in an anonymous function.
IMPORT_RAW(path: string);
Imports all the files in the path. If the path is src/modules
, you would write: IMPORT_DIR("src/modules")
.
IMPORT_DIR(path: string);
Adds each file into a single import. IMPORT_MULTI("src/test.luau", "src/other.luau")
IMPORT_MULTI(path...: string);
Adds a UNIX timestamp of the date on build. Added this as a personal function since I use it a lot. Has a weird kink in some instances by the way, for anyone that may use this depending on how you use it, it will delete a ) next to it. So you'll have to add an extra one to prevent errors on build, so your LSP will freak out:
table.freeze({
create_window = IMPORT("src/window.luau"),
build_date = os.date("%c", BUILD_TIMESTAMP())) --> Extra ), doesn't error on build
});
If you can find a fix for this (most likely the shit regex topit wrote <3), please feel free to make a pull request to fix it. May be fixed in the rewrite when I get to that eventually. If you do not want errors just use it as the following:
local __TIMESTAMP = BUILD_TIMESTAMP();
local BUILD_DATE = os.date("%c", __TIMESTAMP);
Oh right, back to documentation.
BUILD_TIMESTAMP();