0.0.2 • Published 3 years ago

@openrewrite/webpack-environment v0.0.2

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
3 years ago

🚧 Under Construction 🚧

  • Webpack environment for authoring recipes.

Install

npm i -D @openrewrite/webpack-environment

Setup Checklist

  1. Use the provided webpack configuration directly or merge it into your custom configuration:
const openRewriteWebpackConfig = require('@openrewrite/webpack-environment');
const webpackConfig = () => openRewriteWebpackConfig({ sourceDir: 'ts', outputDir: 'js' });
module.exports = webpackConfig;
  1. Make sure you tsconfig.json is extending the provided tsconfig:
{
  "extends": "@openrewrite/webpack-environment/tsconfig.recipe.json",
  "include": [
    "ts/*.ts",
    "test/*.ts",
    "node_modules/@openrewrite/types/**/*.ts",
    "node_modules/@openrewrite/**/jest.d.ts"
  ]
}
  1. Run webpack

How To Use

Running webpack will compile your typescript recipes into a specific target javascript compatible with the OpenRewrite polyglot layer.

Additionally, some extra files will be generated:

index.ts

This file is used to generate a final index.js file which contains your recipes. The index.js is what your package.json's main property should point to.

categories.ts

This is generated from a .openrewriterc file. We use Cosmic Config so you can supply the categories config multiple ways. A category should be defined for your recipes to identify with.