Git Product home page Git Product logo

denoify's Introduction

🦕 Release on NPM and on deno.land/x with a single codebase🦕

Home - Documentation - Demo repo

🗣️ If your project has no dependencies and is not using any Node builtins (fs, https, process ect...), you will soon be able to do without Denoify by using TypeScript compiler option moduleResolution: bundler and allowImportingTsExtensions: true.
See this comment for more infos.

🗣️ Deno now supports NPM modules.
For NPM module authors this means that you jus need to tell your users to import your module like:
import express from "npm:your-module@5";.
Knowing that why would you want to use Denoify?

  • To publish your module on deno.land/x. You have very few chances to see your module be embedded in others Deno modules if you aren't releasing a Deno specific distribution.
  • To ensure your module is retro compatible with Deno versions that do not feature NPM support.
  • If your module belong in the 10% of NPM modules that doesn't work out of the box. Denoify can help you providing Deno implementation for specific files of your module (xxx.deno.ts).

What it is

A build tool that takes as input a TypeScript codebase that was meant to target node and/or the web and spits out a modified version of the source files ready to be deployed as a Deno module.

what_denoify_does

NOTE: Denoify won't run on Deno, it is a Node module.

NOTE: Denoify is capable of recursively resolving dependencies!
It works out of the box with dependencies that uses denoify and there are many option for dealing with dependencies that won't transpile automatically. See specific documentation

This tool is mainly for NPM module maintainer, to enable them to bring first-class citizen Deno support to their modules and do so without introducing breaking changes.

Example of modules using Denoify

Some modules that have been made cross-runtime using Denoify:

Limitations

Coming up next is a detailed guide on how to set up denoify with your project and how to publish on deno.land/x but before anything here are the current limitations you need to be aware of.

  • If your module is vanilla JS it needs to be ported to TypeScript first. (1)
  • require() is not supported.
  • You can't fs.readFile() files that are part of the module ( files inside a res/ directory for example ). (2)

(1) Don't be afraid, renaming your source with .ts and dropping some any here and there will do the trick. You will be able to pull it off even if you aren't familiar with typescript. Ref

(2) In Deno the files that forms your module won’t be pre-fetched and placed in node_module like in node so you won’t be able to access files that are not on the disk.



🚀 Get started 🚀

What's new

NEW IN v1.3.1

NEW IN v1.3

  • Support for // @denoify-line-ignore special comment.

NEW IN v1

  • import express from "express"; automatically converted into:
    import express from "npm:express@5";
    (See this update)
    Most project will now transpile successfully out of the box.

NEW IN v0.10

  • Mitigate the risk of comment being accidentally modified.
  • Possibility to specify output directory in the package.json's denoify field. See doc.
  • Support module augmentation: declare module .... Example
  • Possibility to explicitly tell where the index.ts is located in the source. Doc

NEW IN v0.9

  • tsconfig.json can be absent if outputDir is specified. See @zxch3n's PR
  • Enable to configure the name of the output dir. It no longer has to be deno_dist. See @zxch3n's PR

NEW IN v0.7

  • Support for esm modules. See issue. Thanks to yandeu.

NEW IN v0.7

  • Support for workspaces where node_modules are located in a parent directory.
    Thx @hayes See issue
  • Add basic support for child_process.spawn (#785)

NEW IN v0.6

NEW IN v0.5 Breaking changes

  • All Denoify parameters are now gathered under a uniq "denoify" field.
  • Possibility to specify which files should be copied to the deno_dist directory (Previously only README.md was copied).
    Valid config example

Introduction video

NOTE: New features have been introduced since this meeting was hold

Watch the video

denoify's People

Contributors

garronej avatar gervinfung avatar renovate[bot] avatar yandeu avatar zxch3n avatar littledivy avatar domtheporcupine avatar geopic avatar ksxgithub avatar gillkyle avatar marcushultman avatar hayes avatar yusukebe avatar andreswebs avatar dependabot[bot] avatar

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.