dts-generator icon indicating copy to clipboard operation
dts-generator copied to clipboard

"package-name" after generating is incorrect

Open lovedota opened this issue 8 years ago • 5 comments

Hi guys I have a case. After generated the module name is raven/index which I suppose to be raven

  • index.ts
export {default as Button} from './app/Button';
export {default as Icon} from './app/Icon';
  • After running this command dts-generator --name raven --project ./ --out ./dist/raven.d.ts

It is become

declare module 'raven/app/Button' {
	/// <reference types="react" />
	import * as React from 'react';
	export interface ButtonPropsType {
	    size: 'medium' | 'small' | 'large';
	    className: string;
	    children: React.ReactElement<any>;
	} class Button extends React.Component<ButtonPropsType, any> {
	    render(): JSX.Element;
	}
	export default Button;

}
declare module 'raven/app/Icon' {
	/// <reference types="react" />
	import * as React from 'react';
	export type GlyphType = 'action-collapseall' | 'action-expandall' | 'action-archive';
	export interface IconPropsType {
	    type: GlyphType;
	    className: string;
	    children: React.ReactElement<any>;
	} class Icon extends React.Component<IconPropsType, any> {
	    render(): JSX.Element;
	}
	export default Icon;

}
declare module 'raven/index' {
	export { default as Button } from 'raven/app/Button';
	export { default as Icon } from 'raven/app/Icon';

}

  • How can I change the package-name to not contain index.

lovedota avatar Mar 09 '17 04:03 lovedota

same issue here

aight8 avatar Mar 12 '17 22:03 aight8

any news on this ?

thib3113 avatar Sep 24 '18 12:09 thib3113

@thib3113 unfortunately no... it's probably not a particularly difficult issue to resolve. I'm happy to review/land PRs for things like this, but we've not spent a lot of time on this package over the past year in part because most of the things we create no longer need it. The package is still useful to many so we do what we can to maintain it, but we're mostly relying on the community for enhancements and PRs currently.

dylans avatar Sep 24 '18 19:09 dylans

@dylans thanks for answer . In my case, the documentation options of typescript is enough for my need, but I discover this tool, before the documentation options .

thib3113 avatar Sep 24 '18 20:09 thib3113

Tool is capable of creating alias (map raven to raven/index). In addition to --name you need to use --main and --prefix.

vytenisu avatar Feb 27 '19 18:02 vytenisu