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

CLI: Add Server template generator #13979

Merged
merged 6 commits into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/cli/src/generators/SERVER/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { baseGenerator, Generator } from '../baseGenerator';

const generator: Generator = async (packageManager, npmOptions, options) => {
const stories = ['../stories/**/*.stories.json'];

baseGenerator(packageManager, npmOptions, options, 'server', {
addComponents: false,
extraMain: { stories },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to leverage the recently added extraMain params.

});
};

export default generator;
6 changes: 6 additions & 0 deletions lib/cli/src/initiate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import riotGenerator from './generators/RIOT';
import preactGenerator from './generators/PREACT';
import svelteGenerator from './generators/SVELTE';
import raxGenerator from './generators/RAX';
import serverGenerator from './generators/SERVER';
import { warn } from './warn';
import { JsPackageManagerFactory, readPackageJson } from './js-package-manager';
import { NpmOptions } from './NpmOptions';
Expand Down Expand Up @@ -231,6 +232,11 @@ const installStorybook = (projectType: ProjectType, options: CommandOptions): Pr
.then(commandLog('Adding Storybook support to your "Aurelia" app'))
.then(end);

case ProjectType.SERVER:
return serverGenerator(packageManager, npmOptions, generatorOptions)
.then(commandLog('Adding Storybook support to your "Server" app'))
.then(end);

case ProjectType.UNSUPPORTED:
paddedLog(`We detected a project type that we don't support yet.`);
paddedLog(
Expand Down
4 changes: 3 additions & 1 deletion lib/cli/src/project_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export type SupportedFrameworks =
| 'rax'
| 'aurelia'
| 'html'
| 'web-components';
| 'web-components'
| 'server';

export enum ProjectType {
UNDETECTED = 'UNDETECTED',
Expand Down Expand Up @@ -56,6 +57,7 @@ export enum ProjectType {
SVELTE = 'SVELTE',
RAX = 'RAX',
AURELIA = 'AURELIA',
SERVER = 'SERVER',
}

export const SUPPORTED_FRAMEWORKS: SupportedFrameworks[] = [
Expand Down