Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aleksrutins/mhpm
MunchkinHalfling's Package Manager
https://github.com/aleksrutins/mhpm
Last synced: about 22 hours ago
JSON representation
MunchkinHalfling's Package Manager
- Host: GitHub
- URL: https://github.com/aleksrutins/mhpm
- Owner: aleksrutins
- Created: 2018-12-21T15:57:28.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-15T22:57:15.000Z (about 5 years ago)
- Last Synced: 2024-04-23T02:59:02.714Z (7 months ago)
- Language: JavaScript
- Size: 18.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mhpm
## MunchkinHalfling's Package Manager
This is a package manager for client-side JavaScript.
### Getting Started
To include MHPM, put the following into your ``:
```html```
Then, you need to set up your script as asynchronous, like so: (this is so you can use `await` to load packages)
```html(async () => {
// code...
})();```
Then, in a script, you can import any package in the [repository file](https://github.com/munchkinhalfling/mhpm/blob/master/repository.json) with the following:
```js
// ...
const MyModule = await Package.load("Package Name");
// ...
```
You can also load packages from specific configuration files (described below) not listed in the repository file with the following:
```js
const MyUnlistedModule = await Package.loadFromConfig("https://path/to/mhpm-config.json");
```
### Creating Packages
First, create a GitHub repo or something else for your package. Then, create an `mhpm-config.json` file that has the following syntax:
```json
{
"name": "package name goes here",
"version": "(optional) package version",
"dependencies": ["Required, even if it's an empty list"],
"pkgfile": "(REQUIRED) javascript file of the package (see below)"
}
```
Then, create a JavaScript file (the path/URL goes in the `pkgfile` field) that follows the following syntax:
```js
(function(/* dependencies (in order) */) {
// code/private variables
return {
// exported variables go here
};
}) //NOTICE: NO SEMICOLON (it must be an anonymous function)
```
After that, go into the repository file and add an entry in the `pkgs` array that has the following format:
```json
{
"name": "package name (REQUIRED)",
"conf-file": "path to the configuration file made in the first step"
}
```
Then send me a pull request!