0.30.0 • Published 8 months ago

@greenwood/plugin-typescript v0.30.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@greenwood/plugin-typescript

Overview

A Greenwood plugin for writing TypeScript. There is still a little more work we would like to do but this plugin should be suitable for general usage.

This package assumes you already have @greenwood/cli installed.

Installation

You can use your favorite JavaScript package manager to install this package.

examples:

# npm
npm install @greenwood/plugin-typescript --save-dev

# yarn
yarn add @greenwood/plugin-typescript --dev

Usage

Add this plugin to your greenwood.config.js.

import { greenwoodPluginTypeScript } from '@greenwood/plugin-typescript';

export default {
  // ...

  plugins: [
    greenwoodPluginTypeScript()
  ]
};

Then, you can write some TypeScript!

import { html, css, LitElement, customElement, property } from 'lit-element';

@customElement('app-greeting')
export class GreetingComponent extends LitElement {
  static styles = css`p { color: blue }`;

  @property()
  name = 'Somebody';

  render() {
    return html`<p>Hello, ${this.name}!</p>`;
  }
}

And use it in your project like you would use a .js file!

<script type="module" src="/components/greeting.ts"></script>

Options

Configuration

This plugin provides the following default compilerOptions.

{
  "compilerOptions": {
    "target": "es2020",
    "module": "es2020",
    "moduleResolution": "node",
    "sourceMap": true
  }
}

If you would like to extend / override these options:

  1. Create your own tsconfig.json with your own compilerOptions
    {
      "compilerOptions": {
        "experimentalDecorators": true
      }
    }
  2. When adding greenwoodPluginTypeScript to your greenwood.config.js, enable the extendConfig option

    import { greenwoodPluginTypeScript } from '@greenwood/plugin-typescript';
    
    export default {
      // ...
    
      plugins: [
        greenwoodPluginTypeScript({
          extendConfig: true
        })
      ]
    };

This will then process your JavaScript with TypeScript with the additional configuration settings you provide. This also allows you to configure the rest of tsconfig.json to support your IDE and local development environment settings.

Custom Pages

By default, this plugin extends TypeScript support to processing SSR pages and API routes. If you would like to disable this, set the servePage option to false

import { greenwoodPluginTypeScript } from '@greenwood/plugin-typescript';

export default {
  // ...

  plugins: [
    greenwoodPluginTypeScript({
      servePage: false
    })
  ]
};
0.30.0-alpha.8

9 months ago

0.30.0

8 months ago

0.30.0-alpha.7

9 months ago

0.29.4

1 year ago

0.30.0-alpha.3

1 year ago

0.30.0-alpha.6

10 months ago

0.30.0-alpha.4

1 year ago

0.30.0-alpha.5

12 months ago

0.30.0-alpha.2

1 year ago

0.29.3

1 year ago

0.30.0-alpha.1

1 year ago

0.30.0-alpha.0

1 year ago

0.29.2

1 year ago

0.29.1

2 years ago

0.29.0

2 years ago

0.29.0-alpha.1

2 years ago

0.29.0-alpha.4

2 years ago

0.29.0-alpha.5

2 years ago

0.29.0-alpha.2

2 years ago

0.29.0-alpha.3

2 years ago

0.29.0-alpha.6

2 years ago

0.28.5

2 years ago

0.29.0-alpha.0

2 years ago

0.28.4

2 years ago

0.28.3

2 years ago

0.28.2

2 years ago

0.28.1

2 years ago

0.28.0

2 years ago

0.28.0-alpha.5

2 years ago

0.28.0-alpha.4

2 years ago

0.27.5

2 years ago

0.27.4

2 years ago

0.28.0-alpha.3

2 years ago

0.28.0-alpha.1

2 years ago

0.28.0-alpha.2

2 years ago

0.27.0-alpha.3

3 years ago

0.27.0-alpha.7

3 years ago

0.27.0-alpha.6

3 years ago

0.27.0-alpha.5

3 years ago

0.27.0-alpha.4

3 years ago

0.27.2

3 years ago

0.27.1

3 years ago

0.27.0

3 years ago

0.27.3

2 years ago

0.28.0-alpha.0

3 years ago

0.27.0-alpha.2

3 years ago

0.27.0-alpha.1

3 years ago

0.27.0-alpha.0

3 years ago

0.26.2

3 years ago

0.26.1

3 years ago

0.26.0-alpha.0

3 years ago

0.26.0-alpha.1

3 years ago

0.25.2

3 years ago

0.26.0

3 years ago

0.25.1

3 years ago

0.23.0-alpha.0

3 years ago

0.23.0-alpha.1

3 years ago

0.25.0

3 years ago

0.23.1

3 years ago

0.23.0

3 years ago

0.21.1

4 years ago

0.25.0-alpha.0

3 years ago

0.25.0-alpha.1

3 years ago

0.21.0

4 years ago

0.25.0-alpha.2

3 years ago

0.25.0-alpha.3

3 years ago

0.24.2

3 years ago

0.24.1

3 years ago

0.24.0

3 years ago

0.22.1

4 years ago

0.20.3

4 years ago

0.22.0

4 years ago

0.20.1

4 years ago

0.20.0

4 years ago

0.19.4

4 years ago

0.20.0-alpha.0

4 years ago

0.20.0-alpha.1

4 years ago

0.20.2

4 years ago

0.19.0-alpha.0

4 years ago

0.19.0-alpha.3

4 years ago

0.19.0-alpha.2

4 years ago

0.19.0-alpha.1

4 years ago

0.19.0

4 years ago

0.19.1

4 years ago

0.19.2

4 years ago

0.19.3

4 years ago

0.18.0

4 years ago

0.18.0-alpha.0

4 years ago

0.17.0-alpha.0

4 years ago

0.17.0

4 years ago

0.16.1

4 years ago

0.16.0

4 years ago

0.16.0-alpha.3

4 years ago

0.16.0-alpha.2

4 years ago

0.16.0-alpha.1

4 years ago

0.16.0-alpha.0

4 years ago

0.15.3

4 years ago

0.15.2

4 years ago

0.15.0

4 years ago

0.15.1

4 years ago

0.14.2

4 years ago

0.14.1

4 years ago

0.14.0

4 years ago