0.0.27 • Published 1 year ago

@gmjs/js-project-generator v0.0.27

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

JS Project Generator

Contains the code to generate various types of TypeScript projects. See GenerateInput for more info.

Can be used directly, or as a dependency in a CLI tool.

Installation

npm install --save @gmjs/js-project-generator

API

generateProject

Generate the project on the file system.

Accepts a single parameter of type GenerateInput.

Returns a Promise<void>, which resolves when the project has been generated.

Examples

See examples here.

Types

GenerateInput

The is the input to the generateProject function - in other words the is the configuration object.

export interface GenerateInput {
  readonly output: string;
  readonly projectName: string;
  readonly authorData: AuthorData;
  readonly projectData: ProjectDataAny;
}
  • output - Output directory. Project directory is <output>/<project-name>.
  • projectName - Project name. Also the name of the project directory.
export interface AuthorData {
  readonly scopeName: string;
  readonly author: string;
  readonly email: string;
  readonly authorUrl: string;
  readonly githubAccount: string;
}
  • scopeName - NPM scope name.
  • author - Author name.
  • email - Author email.
  • authorUrl - URL to the homepage of the author.
  • githubAccount - GitHub account name.
export const LIST_OF_PROJECT_KINDS = [
  'app-vanilla',
  'app-react',
  'app-node',
  'app-nest',
  'app-cli',
  'lib-browser',
  'lib-node',
  'lib-shared',
] as const;

export type ProjectKind = (typeof LIST_OF_PROJECT_KINDS)[number];

export interface ProjectDataBase {
  readonly kind: ProjectKind;
}

export interface ProjectDataAppVanilla extends ProjectDataBase {
  readonly kind: 'app-vanilla';
  readonly storybook: boolean;
}

export interface ProjectDataAppReact extends ProjectDataBase {
  readonly kind: 'app-react';
  readonly storybook: boolean;
}

export interface ProjectDataAppNode extends ProjectDataBase {
  readonly kind: 'app-node';
}

export interface ProjectDataAppNest extends ProjectDataBase {
  readonly kind: 'app-nest';
}

export interface ProjectDataAppCli extends ProjectDataBase {
  readonly kind: 'app-cli';
  readonly commandName: string;
}

export interface ProjectDataLibBrowser extends ProjectDataBase {
  readonly kind: 'lib-browser';
}

export interface ProjectDataLibNode extends ProjectDataBase {
  readonly kind: 'lib-node';
}

export interface ProjectDataLibShared extends ProjectDataBase {
  readonly kind: 'lib-shared';
}

export type ProjectDataAny =
  | ProjectDataAppVanilla
  | ProjectDataAppReact
  | ProjectDataAppNode
  | ProjectDataAppNest
  | ProjectDataAppCli
  | ProjectDataLibBrowser
  | ProjectDataLibNode
  | ProjectDataLibShared;
0.0.23

1 year ago

0.0.24

1 year ago

0.0.26

1 year ago

0.0.27

1 year ago

0.0.20

2 years ago

0.0.21

2 years ago

0.0.22

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.14

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago