Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add angualr wrapper generation to CLI #4583

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/labs/cli/src/lib/generate/generate.ts
Expand Up @@ -16,6 +16,14 @@ import {Package} from '@lit-labs/analyzer/lib/model.js';
import {EOL} from 'os';
import * as ts from 'typescript';

const angularCommand: Command = {
name: 'angular',
description: 'Generate Angular wrapper for a LitElement',
kind: 'reference',
installFrom: '@lit-labs/gen-wrapper-angular',
importSpecifier: '@lit-labs/gen-wrapper-angular/index.js',
};

const reactCommand: Command = {
name: 'react',
description: 'Generate React wrapper for a LitElement',
Expand Down Expand Up @@ -46,6 +54,7 @@ interface GenerateCommand extends Omit<ResolvedCommand, 'run'> {
}

const frameworkCommands = {
angular: angularCommand,
react: reactCommand,
vue: vueCommand,
};
Expand Down
16 changes: 16 additions & 0 deletions packages/labs/gen-wrapper-angular/src/index.ts
Expand Up @@ -15,6 +15,22 @@ import {tsconfigTemplate} from './lib/tsconfig-template.js';
import {wrapperModuleTemplate} from './lib/wrapper-module-template.js';
import * as path from 'path';

/**
* Our command for the Lit CLI.
*
* See ../../cli/src/lib/generate/generate.ts
*/
export const getCommand = () => {
return {
name: 'angular',
description: 'Generate Angular wrapper components from Lit elements',
kind: 'resolved',
async generate(options: {package: Package}): Promise<FileTree> {
return await generateAngularWrapper(options.package);
},
};
};

export const generateAngularWrapper = async (
pkg: Package
): Promise<FileTree> => {
Expand Down