Giter VIP home page Giter VIP logo

kittycad.ts's People

Contributors

dependabot[bot] avatar franknoirot avatar github-actions[bot] avatar irev-dev avatar jessfraz avatar paultag avatar zoo-github-actions-auth[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

kittycad.ts's Issues

Include "type": "module" in package.json file

When running npm install @kittycad/lib
the package.json file comes with

{
  "dependencies": {
    "@kittycad/lib": "^0.0.19"
  }
} 

but I have to manually add "type": "module"
to the package.json any time I download it. Can we have that in the file already when they run the npm command?

I haven't been able to use our API commands using require or import when the "type": "module" is missing, so it seems like it's required?

Generate JS library

We should export a JS library alongside our TS library, for JS customers who don't want to set up all the webpack/transpilation stuff locally. We're already setting this all up on our end, so we should use it.

enums with descriptions

just a heads up @Irev-Dev in the latest spec, enums with descriptions on each variant are generateed differently

here is an example:

{
  "description": "An account provider.",
  "oneOf": [
    {
      "description": "The Google account provider.",
      "enum": [
        "google"
      ],
      "type": "string"
    },
    {
      "description": "The GitHub account provider.",
      "enum": [
        "github"
      ],
      "type": "string"
    }
  ]
}

which would become the following rust type for example

#[doc = "An account provider."]
#[derive(
    serde :: Serialize,
    serde :: Deserialize,
    PartialEq,
    Hash,
    Debug,
    Clone,
    schemars :: JsonSchema,
    tabled :: Tabled,
    clap :: ValueEnum,
    parse_display :: FromStr,
    parse_display :: Display,
)]
pub enum AccountProvier {
    #[doc = "The Google account provider."]
    #[serde(rename = "google")]
    #[display("google")]
    Google,
    #[doc = "The GitHub account provider."]
    #[serde(rename = "github")]
    #[display("github")]
    Github,
}

what I am doing in the other libs is checking if its a oneof where each individual element is an enum of one.

Add env var to override endpoint url, use it to send tests to dev

This client lib is hardcoded to use kittycad.io, which is good default behaviour, but the automated tests for this lib should really go to dev.kittycad.io.

It's probably just a matter of having the template look to see if KITTYCAD_URL is defined or not.

Adam and Jess shared these example actions that use tailscale
https://github.com/KittyCAD/api-deux/blob/main/.github/workflows/waypoint.yml#L35-L38

https://github.com/KittyCAD/api-deux/blob/main/.github/workflows/cargo-test.yml#L40

ts client issues

Some issues with the ts client, I think mostly related to ES modules and how the lib is bundled. Though not 100% sure on details at this point.

Something else to note is that while this repo has tests, what it's missing is tests for installing and running after an install from npm, adding samples to the litter box repo is on the TODO list anyway, so I might as samples as way of getting this verification.

This is a pretty good round up of the issues with bundling for npm with the current ecosystem
https://www.sensedeep.com/blog/posts/2021/how-to-create-single-source-npm-module.html

Improve union types of the modelling comands

They probably need to be broken now, here's an exerpt from models.ts

xport type ModelingCmd_type =
  | 'StartPath'
  | {
      MovePathPen: {
        path: ModelingCmdId_type /* The ID of the command which created the path. */;
        to: Point3d_type /* Where the path's pen should be. */;
      };
    }
    // ...

the union of a string and an object means that user's can't be more specific like

type MoreSpecificType = ModelingCmd_type['MovePathPen'] // not possible

Here are some hacks we're already using in the app to get around this

type SketchModeCmd = Extract<
EngineCommand['cmd'],
{ DefaultCameraEnableSketchMode: any }
>['DefaultCameraEnableSketchMode'];

and

    const command: Models['ModelingCmdReq_type'] = {/*...*/}
    const cmd:  = command.cmd
    if (typeof cmd !== 'string' && "CameraDragMove" in cmd && this.lossyDataChannel) {
       // do stuff with CameraDragMove cmd
    }

These are good work around but wouldn't want other users of this lib to have to do trick typescript stuff like this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.