Giter Club home page Giter Club logo

nberlette / type Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 128 KB

TypeScript tools with a focus on modular runtime utilities with type-level counterparts. Distributed on JSR under the `@type/*` scope, and NPM under `@type2/*`.

Home Page: https://jsr.io/@type

License: MIT License

Dockerfile 30.33% Shell 9.74% TypeScript 59.92%
deno typescript utilities string-manipulation compile-time-reflection denoland jsr npm strongly-typed type-safety

type's Introduction

deno911/typedefs - Type Guards and Utilities for Deno and Deno Deploy


Schemas

Note: You can also import any type from the default module, ./mod.ts

deno.json

import { type DenoJson } from "https://deno.land/x/[email protected]/deno-json.d.ts";

DenoJson

interface DenoJson {
  $schema: "https://denopkg.com/denoland/deno/cli/schemas/config-file.v1.json";
  compilerOptions: {
    allowJs: boolean;
    allowUnreachableCode: boolean;
    allowUnusedLabels: boolean;
    checkJs: boolean;
    experimentalDecorators: boolean;
    ... 22 more ...;
    suppressImplicitAnyIndexErrors?: boolean;
  };
  importMap: string;
  fmt: DenoJson.Fmt;
  lint: DenoJson.Lint;
  tasks: DenoJson.Tasks;
  test: DenoJson.Test;
}

import_map.json

Type for deno's import_map.json file.

import { type ImportMapJson } from "https://deno.land/x/[email protected]/import-map-json.d.ts";

ImportMapJson

interface ImportMap {
  $schema:
    "https://denopkg.com/denoland/vscode_deno/schemas/import_map.schema.json";
  imports: {
    [specifier: string]: string;
  };
  scopes: {
    [scope: string]: {
      [specifier: string]: string;
    };
  };
}

egg.json (or egg.yaml)

Type for nest.land's egg.json file used by the eggs CLI.

import { type EggJson } from "https://deno.land/x/[email protected]/egg-json.d.ts";

EggJson

interface EggJson {
  $schema: "https://x.nest.land/[email protected]/src/schema.json";
  name: string;
  description: string;
  repository: string;
  homepage: string;
  ... 12 more ...;
  checkTests: boolean | string;
}

package.json

Type for npm's package.json file. Also includes types for fields used by other popular projects, like TypeScript, PNPM, Yarn. Based on the type-fest package.json definition by Sindre Sorhus, with some added support for PNPM.

import { type PackageJson } from "https://deno.land/x/[email protected]/package-json.d.ts";

PackageJson

interface PackageJson {
  name?: string | undefined;
  version?: string | undefined;
  description?: string | undefined;
  keywords?: string[] | undefined;
  homepage?: "." | {} | undefined;
  bugs?: string | {
      url?: string | undefined;
      email?: string | undefined;
  } | undefined;
  ... 44 more ...;
  pnpm?: {
      ...;
  } | undefined;
}

tsconfig.json

Type for TypeScript's tsconfig.json file (TypeScript 3.7).

import { type TsConfigJson } from "https://deno.land/x/[email protected]/tsconfig-json.d.ts";

Note: Taken from the type-fest project by Sindre Sorhus.

TsConfigJson

interface TsConfigJson {
  compilerOptions?: {
      charset?: string | undefined;
      composite?: boolean | undefined;
      declaration?: boolean | undefined;
      declarationDir?: string | undefined;
      diagnostics?: boolean | undefined;
      ... 97 more ...;
      explainFiles?: boolean | undefined;
  } | undefined;
  ... 7 more ...;
  references?: {
      ...;
  }[] | undefined;
}

Contributing

This section assumes you have the GitHub CLI.

Open in GitHub Codespaces

Create a new instance with the GitHub CLI, or just create one from your repository homepage on github.com.

gh codespace create --repo deno911/typedefs

Open a new workspace by prepending https://gitpod.io/# to your repository URL and visiting it in your browser:

https://gitpod.io/#https://github.com/deno911/typedefs

Fork and clone the repository locally

gh repo fork deno911/typedefs --clone

Create a new branch for your changes

git checkout -b fix/typo-in-readme

Make small changes and concise commits

# hack hack hack...

git commit README.md -m "fix: typos in README.md" && git push

Note: keep the scope of your changes relevant and concise.

If fixing a bug, create an Issue

Unless, of course, you're fixing a bug for which an issue already exists!

This allows the issue to be connected to your Pull Request, creating a permanent record of your contribution to the project. It also makes it easier for maintainers to track project progression.

Creating an issue also ensures you're given proper credit for fixing that bug ;)

Open a Pull Request

gh pr create --title "fix: typos in README.md"

Or just open your repo on GitHub.com and follow the prompts.

Warning: make sure you select the upstream repo for your PR!



type's People

Contributors

nberlette avatar

Stargazers

 avatar  avatar

Watchers

 avatar

type's Issues

TODO: create publish/release workflow for JSR and NPM

The new monorepo will need a publishing workflow for both NPM and JSR.

  • Run CI/CD workflow to ensure code is formatted / linted / tested well

I'm creating a custom fork of the @deno/bump-workspaces tool, which will do the following:

  • Assess all new commits to determine each package's release type from the commit messages.
  • Increment the root deno.json file version with the highest release type found across all of the workspace packages.
  • Increment all workspace versions to match the root deno.json
  • Commit the changes to a release branch
  • Draft a new pull request for the release with auto-generated details

At this point, the pull request must be manually reviewed and merged.

Once it is merged, another workflow (or a another job in the same workflow) will...

  • Tag/commit/push to main. (this publishes to deno.land/x/typedefs)
  • Run deno publish or npx jsr publish (for each package)
  • Build each package with dnt for NPM
  • Upload an artifact of the results from the build
  • Authenticate and publish to NPM (under the @type2 org)
  • Authenticate and publish to GPR (GitHub Package Registry)

feat: create the `@type/math` package

This issue and milestone are for the @type/math package that will be featured in the monorepo (see #1 et al).

@type/math will include several submodules that allow you to perform standard arithmetic operations including addition, subtraction, multiplication, division, etc. It will also feature some relational comparisons like greater than, etc.

The key feature of this package, which is also an underlying objective of most all of the packages in this repository, will be that the runtime utilities will be accompanied by a compile-time implementation. This means performing arithmetic operations at a purely type-level, with equivalent types for each runtime function.

This will allow you to do cool shit like this:

import { add, subtract, multiply } from "jsr:@type/math";

const sum = add(400, 20);
//    ^? const sum: 420

const diff = subtract(420, 351);
//    ^? const diff: 69

const product = multiply(42, 100);
//    ^? const product: 4200

Yup, hovering over any of those variable names will show you a preview of the expected runtime output of each function, without ever leaving your editor (and without running any code!)

Create a social media preview image

  • Simple 1280x640 or 2560x1280 graphic
  • .svg
  • .png
  • .png @ 2x
  • Upload png to the repository settings
  • Add it to the GitHub Pages site as an OpenGraph Image / Twitter Card (ref: #5)

feat(is): create the `@type/is` package

This package already exists (see here) but has not yet been open sourced. This issue will be followed by a PR to change that. This issue is just for reference.

  • Create ./packages/is
  • Add all of the existing modules as currently published on JSR
  • Add new modules I've created in the interim
  • Add experimental chainable API, but not as the default export
  • Release it into the wild

I might break this issue off into its own milestone and then break off the above tasks into individual issues. We'll see.

feat(monorepo): migrate to a monorepo format

This is a companion issue for an upcoming PR that will nuke this project as it currently exists.

Following this PR, the repository will consist of a monorepo that will house all of the projects published under the @type scope on JSR and aliased under the @type2 organization on NPM.

This choice was made for a couple reasons:

  1. The current project is dead, with the last commit being 18 months ago.
  2. The @type scope needs a permanent location, and it's name/purpose is similar enough to the original name and purpose of this project.
  3. This repo is already configured with the deno.land/x registry, to publish new tags to the typedefs module. The new project will continue to publish to that module's spot on that registry.
  4. One less repository to create, and one less to archive.

I will also be renaming this repo to simply type, since that's more in line with the new trajectory it's going to be on.

If you're reading this and you'd like to contribute to this project, please feel free to comment, email me, or reach out via discord @nberlette. I could really use some help with the minimal amount of free time I have these days. Thanks!

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.