1- import { type Path , join , strings } from "@angular-devkit/core" ;
1+ import { type Path , join , normalize , strings } from "@angular-devkit/core" ;
22import {
33 type Rule ,
44 type Source ,
@@ -14,20 +14,24 @@ import {
1414
1515import { ConfigDeclarator } from "@utils/config/config.declarator" ;
1616import { ConfigFinder } from "@utils/config/config.finder" ;
17- import { toKebabCase } from "@utils/formatting" ;
18- import { resolvePackageName } from "@utils/name" ;
19-
20- import { DEFAULT_APP_NAME } from "~/defaults" ;
2117
2218import { type ConfigurationOptions } from "./configuration.options" ;
2319import { type ConfigurationSchema } from "./configuration.schema" ;
2420
2521const transform = ( schema : ConfigurationSchema ) : ConfigurationOptions => {
26- return {
22+ const res : ConfigurationOptions = {
2723 server : {
2824 enable : schema . server ?? false ,
2925 } ,
3026 } ;
27+
28+ if ( schema . language === "js" ) {
29+ res [ "client" ] = { build : { entryFile : "client/main.js" } } ;
30+ if ( schema . server && "server" in res && res . server )
31+ res . server [ "build" ] = { entryFile : "server/main.js" } ;
32+ }
33+
34+ return res ;
3135} ;
3236
3337const generate = ( options : ConfigurationOptions , path : string ) : Source => {
@@ -36,7 +40,7 @@ const generate = (options: ConfigurationOptions, path: string): Source => {
3640 ...strings ,
3741 ...options ,
3842 } ) ,
39- move ( path ) ,
43+ move ( normalize ( path ) ) ,
4044 ] ) ;
4145} ;
4246
@@ -57,9 +61,7 @@ const addConfiguration = (options: ConfigurationOptions, path: Path) => {
5761
5862export const main = ( schema : ConfigurationSchema ) : Rule => {
5963 const options = transform ( schema ) ;
60- const directory =
61- schema . directory ??
62- resolvePackageName ( toKebabCase ( schema . name ?. toString ( ) ?? DEFAULT_APP_NAME ) ) ;
64+ const directory = schema . directory ?? schema . name ;
6365
6466 return branchAndMerge (
6567 chain ( [ mergeWith ( generate ( options , directory ) ) , addConfiguration ( options , directory as Path ) ] ) ,
0 commit comments