0.1.1 • Published 1 year ago
npmwally v0.1.1
npmwally
npmwally is a command-line tool that automates the conversion of a Lua/Luau npm package into a Wally package.
Features
- Package Detection: Scans the
package.jsonand identifies Lua/Luau dependencies. - Dependency Translation: Maps npm package names to their wally equivalents.
- Module Requires Conversion: Runs darklua to convert the string/path requires into Roblox requires.
- Generate a Wally Package: Generate a
wally.tomland adefault.project.json. Remove files as specified in the.npmignoreconfiguration file.
Requirements
When converting packages, npmwally will run Rojo and darklua. Make sure to have those installed.
Usage
You can install npmwally with npm or yarn:
npm install npmwally --save-dev
yarn add npmwally -DConvert a Package
To convert an npm package to a Wally package, use the convert command:
npmwally convert --output <output-directory>For more information about the available options, use the --help argument:
npmwally convert --helpExample
npmwally convert --use-find-first-childThis command will:
- convert the Lua/Luau code the current working directory to a Wally package in './wally`.
- convert requires using
FindFirstChildindexing.
Options
--project <project>: The folder where thepackage.jsonfile exists (default is the current directory).--output <output>: The folder where the Wally package will be generated (default iswally).--modules-folder <module-folder>: The folder where npm packages are installed (default isnode_modules).--translate-package <translate-package>: A package name to translate from npm to Wally format (npm-package=wally-package).--copy <copy>: Additional files or directories to copy into the Wally package.--darklua-config <darklua-config>: Path to a custom Darklua configuration file.--use-find-first-child: UseFindFirstChildinstead of direct indexing in generated requires.
License
This project is licensed under the MIT License. See the LICENSE file for details.