npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

citadel-framework

v0.0.5

Published

This is a framework for FiveM/RedM that is intended to be very universal. Currently a work in progress, but expect a release candidate soon!

Downloads

5

Readme

[WIP] Citadel FiveM/RedM Framework

This is a framework for FiveM/RedM that is intended to be very universal. Currently a work in progress, but expect a release candidate soon!

Dependencies

Working example can be found in the /example directory

Project Structure

.
| main/
|     client /
|      // Call this client-entry
|      index.ts
|     server /
|       index.ts
|     modules/
|       // Call this client-module-entry
|       index.ts
|       example-module/
|        client/
|         // Call this client-module
|         index.ts
|        server/
|         index.ts

Client-entry

@Root()
class App {
    $onReady() {
        console.log(`The client app is ready!`)
    }
}

Client-module-entry

// We bootstrap here because of the way webpack loads things.
bootstrap()

Client-module


const allowJobs = (...jobs: string[]) => {
    return function() {
        for(const job of jobs) {
            return false
        }
    }
}

@Module({
  // The name of the module for referencing elsewhere
  name: "other-module",
  // Inject other modules here. This will put the one and only instance
  // in the module
  deps: [
    {
      key: 'exampleModule',
      dep: ExampleModule
    }
  ]
})
class Othermodule {

  // Declaration of dependent module for intellisense reasons
  constructor(public exampleModule: ExampleModule) { }
  $onInit() {
    console.log("Module init functionality. App is not ready yet")
  }

  /**
   * restrictors: all functions must pass for command to be allowed
   * @Arg(argname, options) - validator takes a function which the first parameter is the value of the arg. must pass
   * argument type validation based on type annotation. i.e. hello: string must be a string. (string, number, boolean)
   * default: default value for the function
   */
  @Command("example", {
    restrictors: [allowJobs("police")]
  })
  exampleCommand(source: number, @Arg("hello", {
    validator: (v: string) => v !== "hello",
    default: "cheese"
  }) hello: string, rest: any[]) {
    console.log(`You rand the example command, specified arg was ${hello}, rest of the args ${rest}`)
  }

  @Tick("someTick")
  exampleTick() {
    console.log(`This will run every frame! Woo!`)
  }

  /**
   * More on @MapSource soon. Essentiall does `ESX.GetPlayerFromId(id) and makes it available in the arg
   * */
  @NetEvent("example:event")
  exampleEvent(@MapSource("module", "function")) {
    console.log(`Client Received an example event!`)
  }

  $onReady() {
    console.log("On ready lifecycle hook")
  }
}


@Module({
  name: 'other-module'
})
export class SvOtherModule {

  @ServerCallback()
  async someCallback(@MapSource("", "") player: PlayerClass) {
    return "called back some data to client"
  }

  @Export()
  someExportedFunction() {
    console.log(`running exported function`)
  }
}

TODO

  • [x] Callback system
  • ~~[ ] NUI event wrapper~~ No longer doing this due to the nature of the framework
  • [ ] Base system modules (player, character, clothes, vehicles etc)
  • [x] Implement ORM? (will be available in actual framework. typeorm works!)