Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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: 0 additions & 12 deletions cspell.words.txt
Original file line number Diff line number Diff line change
@@ -1,45 +1,33 @@
WORKDIR
stringifying
codepaths
urlset
outdir
TRAEFIK
websecure
certresolver
myresolver
letsencrypt
certificatesresolvers
exposedbydefault
httpchallenge
placeholderresolver
loadbalancer
adminer
initdb
rolname
plpgsql
datname
psql
packagr
Monux
redirections
redirectregex
wwwredirect
sslresolver
stringstring
monux
postgresql
postgres
TRAEFIK
traefik
mariadb
MARIADB
dts
nestjs
cloudflare
cldr
cldrjs
htpasswd
basicauth
usersfile
zibri
autodocs
5,474 changes: 2,955 additions & 2,519 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monux-cli",
"version": "2.5.1",
"version": "2.5.2",
"license": "MIT",
"main": "index.js",
"engines": {
Expand Down Expand Up @@ -39,26 +39,26 @@
"prepublishOnly": "npm i && npm run build"
},
"dependencies": {
"chalk": "^4.1.2",
"chalk": "4.1.2",
"cli-table3": "^0.6.5",
"death": "^1.1.0",
"figlet": "^1.7.0",
"figlet": "^1.8.2",
"inquirer": "^10.2.2",
"js-yaml": "^4.1.0",
"json5": "^2.2.3"
},
"devDependencies": {
"@angular/common": "^18.2.13",
"@angular/common": "^20.2.1",
"@faker-js/faker": "^9.0.3",
"@jest/globals": "^29.7.0",
"@nestjs/common": "^11.0.20",
"@jest/globals": "^30.0.5",
"@nestjs/common": "^11.1.6",
"@types/death": "^1.1.5",
"@types/figlet": "^1.5.8",
"@types/figlet": "^1.7.0",
"@types/js-yaml": "^4.0.9",
"eslint": "^9.24.0",
"eslint-config-service-soft": "^2.0.8",
"jest": "^29.7.0",
"ngx-material-navigation": "^18.1.2",
"ts-jest": "^29.2.5"
"eslint": "^9.34.0",
"eslint-config-service-soft": "^2.1.0",
"jest": "^30.0.5",
"ngx-material-navigation": "^20.0.0",
"ts-jest": "^29.4.1"
}
}
50 changes: 25 additions & 25 deletions src/__testing__/mock/file-mock.utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,30 @@ export abstract class FileMockUtilities {

private static readonly mockMethodForFile: Record<
keyof FileMockConstants,
(mockConstants: MockConstants, entry: keyof MockConstants) => (void | Promise<void>)
(mockConstants: MockConstants, entry: keyof MockConstants) => void | Promise<void>
> = {
DOCKER_COMPOSE_YAML: this.createEmptyFile,
DEV_DOCKER_COMPOSE_YAML: this.createEmptyFile,
LOCAL_DOCKER_COMPOSE_YAML: this.createEmptyFile,
STAGE_DOCKER_COMPOSE_YAML: this.createEmptyFile,
ANGULAR_ESLINT_CONFIG_MJS: this.createEmptyFile,
ANGULAR_PACKAGE_JSON: this.createAngularPackageJson,
ANGULAR_APP_COMPONENT_TS: this.createAppComponentTsFile,
ANGULAR_APP_COMPONENT_HTML: this.createEmptyFile,
ANGULAR_APP_ROUTES_TS: this.createAppRoutesTs,
ANGULAR_ROUTES_TS: this.createEmptyFile,
ANGULAR_APP_CONFIG_TS: this.createAppConfig,
ANGULAR_JSON: this.createAngularJson,
ANGULAR_ENVIRONMENT_MODEL: this.createEmptyFile,
ANGULAR_ENVIRONMENT: this.createEmptyFile,
TS_LIBRARY_PACKAGE_JSON: this.createEmptyFile,
ROOT_PACKAGE_JSON: this.createRootPackageJson,
ENV: this.createEnv,
ENV_PUBLIC: this.createEnvPublic,
GLOBAL_ENV_MODEL: this.createGlobalEnvModel,
WORKSPACE_JSON: WorkspaceUtilities.createConfig,
BASE_TS_CONFIG_JSON: TsConfigUtilities.createBaseTsConfig
};
DOCKER_COMPOSE_YAML: this.createEmptyFile,
DEV_DOCKER_COMPOSE_YAML: this.createEmptyFile,
LOCAL_DOCKER_COMPOSE_YAML: this.createEmptyFile,
STAGE_DOCKER_COMPOSE_YAML: this.createEmptyFile,
ANGULAR_ESLINT_CONFIG_MJS: this.createEmptyFile,
ANGULAR_PACKAGE_JSON: this.createAngularPackageJson,
ANGULAR_APP_COMPONENT_TS: this.createAppComponentTsFile,
ANGULAR_APP_COMPONENT_HTML: this.createEmptyFile,
ANGULAR_APP_ROUTES_TS: this.createAppRoutesTs,
ANGULAR_ROUTES_TS: this.createEmptyFile,
ANGULAR_APP_CONFIG_TS: this.createAppConfig,
ANGULAR_JSON: this.createAngularJson,
ANGULAR_ENVIRONMENT_MODEL: this.createEmptyFile,
ANGULAR_ENVIRONMENT: this.createEmptyFile,
TS_LIBRARY_PACKAGE_JSON: this.createEmptyFile,
ROOT_PACKAGE_JSON: this.createRootPackageJson,
ENV: this.createEnv,
ENV_PUBLIC: this.createEnvPublic,
GLOBAL_ENV_MODEL: this.createGlobalEnvModel,
WORKSPACE_JSON: WorkspaceUtilities.createConfig,
BASE_TS_CONFIG_JSON: TsConfigUtilities.createBaseTsConfig
};

static async setup(
mockConstants: MockConstants,
Expand Down Expand Up @@ -195,7 +195,7 @@ export abstract class FileMockUtilities {
private static async createAppConfig(mockConstants: MockConstants): Promise<void> {
await FsUtilities.createFile(mockConstants.ANGULAR_APP_CONFIG_TS, [
'import { ApplicationConfig, provideZoneChangeDetection } from \'@angular/core\';',
'import { provideClientHydration } from \'@angular/platform-browser\';',
'import { provideClientHydration, withEventReplay } from \'@angular/platform-browser\';',
'import { provideRouter } from \'@angular/router\';',
'',
'import { routes } from \'./app.routes\';',
Expand All @@ -204,7 +204,7 @@ export abstract class FileMockUtilities {
'\tproviders: [',
'\t\tprovideZoneChangeDetection({ eventCoalescing: true }),',
'\t\tprovideRouter(routes),',
'\t\tprovideClientHydration()',
'\t\tprovideClientHydration(withEventReplay())',
'\t]',
'};'
], true, false);
Expand Down
10 changes: 5 additions & 5 deletions src/angular/angular-utilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { afterEach, beforeEach, describe, expect, jest, test } from '@jest/globa
import { AngularUtilities } from './angular.utilities';
import { fakeAddNavElementConfig, fakeTsImportDefinition, FileMockUtilities, getMockConstants, MAX_GEN_CODE_TIME, MockConstants } from '../__testing__';
import { CPUtilities, FsUtilities } from '../encapsulation';
import { NpmUtilities } from '../npm';
import { NpmPackage, NpmUtilities } from '../npm';
import { TsImportDefinition } from '../ts';
import { AddNavElementConfig } from './add-nav-element-config.model';
import { getPath } from '../utilities';
Expand Down Expand Up @@ -53,7 +53,7 @@ describe('AngularUtilities', () => {
await AngularUtilities.setupNavigation(mockConstants.ANGULAR_APP_DIR, mockConstants.ANGULAR_APP_NAME);

expect(npmInstallMock).toHaveBeenCalledTimes(1);
expect(npmInstallMock).toHaveBeenCalledWith(mockConstants.ANGULAR_APP_NAME, ['ngx-material-navigation']);
expect(npmInstallMock).toHaveBeenCalledWith(mockConstants.ANGULAR_APP_NAME, [NpmPackage.NGX_MATERIAL_NAVIGATION]);

const htmlLines: string[] = await FsUtilities.readFileLines(mockConstants.ANGULAR_APP_COMPONENT_HTML);
expect(htmlLines).toEqual([
Expand Down Expand Up @@ -327,7 +327,7 @@ describe('AngularUtilities', () => {
expect(cpExecSyncMock).toHaveBeenCalledTimes(1);
expect(cpExecSyncMock).toHaveBeenCalledWith(`cd ${mockConstants.ANGULAR_APP_DIR} && npx @angular/cli@20 add @angular/pwa@20 --skip-confirmation`);
expect(npmInstallMock).toHaveBeenCalledTimes(1);
expect(npmInstallMock).toHaveBeenCalledWith(mockConstants.ANGULAR_APP_NAME, ['ngx-pwa']);
expect(npmInstallMock).toHaveBeenCalledWith(mockConstants.ANGULAR_APP_NAME, [NpmPackage.NGX_PWA]);

const htmlLines: string[] = await FsUtilities.readFileLines(mockConstants.ANGULAR_APP_COMPONENT_HTML);
const tsLines: string[] = await FsUtilities.readFileLines(mockConstants.ANGULAR_APP_COMPONENT_TS);
Expand Down Expand Up @@ -363,7 +363,7 @@ describe('AngularUtilities', () => {

expect(tsLines).toEqual([
'import { ApplicationConfig, provideZoneChangeDetection } from \'@angular/core\';',
'import { provideClientHydration } from \'@angular/platform-browser\';',
'import { provideClientHydration, withEventReplay } from \'@angular/platform-browser\';',
'import { provideRouter } from \'@angular/router\';',
'',
'import { routes } from \'./app.routes\';',
Expand All @@ -372,7 +372,7 @@ describe('AngularUtilities', () => {
' providers: [',
' provideZoneChangeDetection({ eventCoalescing: true }),',
' provideRouter(routes),',
' provideClientHydration(),',
' provideClientHydration(withEventReplay()),',
' {',
' provide: \'test\',',
' useValue: 42',
Expand Down
11 changes: 3 additions & 8 deletions src/angular/angular.utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ type AddOptions = {
/**
* Possible angular cli options, narrowed down based on the provided command.
*/
type AngularCliOptions<T extends AngularCliCommands> =
T extends CliNew ? NewOptions
type AngularCliOptions<T extends AngularCliCommands>
= T extends CliNew ? NewOptions
: T extends CliGenerate ? GenerateOptions
: T extends CliAdd ? AddOptions
: never;
Expand Down Expand Up @@ -462,11 +462,6 @@ export abstract class AngularUtilities {
* @param root - The root of the angular project to setup material for.
*/
static async setupMaterial(root: string): Promise<void> {
await this.addProvider(
root,
'provideAnimations()',
[{ defaultImport: false, element: 'provideAnimations', path: '@angular/platform-browser/animations' }]
);
await FsUtilities.updateFile(
getPath(root, 'src', 'styles.css'),
[
Expand All @@ -486,7 +481,7 @@ export abstract class AngularUtilities {
);
await FsUtilities.updateFile(
getPath(root, 'src', 'styles.css'),
'\'@import "@angular/material/prebuilt-themes/indigo-pink.css";\'',
'@import "@angular/material/prebuilt-themes/indigo-pink.css";',
'prepend'
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const config: StorybookConfig = {
framework: {
name: getAbsolutePath('@storybook/angular'),
options: {}
},
core: {
disableTelemetry: true
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ModuleResolutionKind } from 'typescript';

import { AngularUtilities, NavElementTypes } from '../../../angular';
import { ANGULAR_APP_COMPONENT_FILE_NAME, ANGULAR_JSON_FILE_NAME, APPS_DIRECTORY_NAME, BASE_TS_CONFIG_FILE_NAME, DOCKER_FILE_NAME, GIT_IGNORE_FILE_NAME } from '../../../constants';
import { DockerUtilities } from '../../../docker';
Expand Down Expand Up @@ -113,7 +115,7 @@ export class AddAngularWebsiteCommand extends BaseAddCommand<AddAngularWebsiteCo
if (config.addTracking) {
await AngularUtilities.setupTracking(config.name);
}
await NpmUtilities.updatePackageJson(config.name, { scripts: { start: `ng serve --port ${config.port}` } });
await NpmUtilities.updatePackageJson(config.name, { scripts: { start: `ng serve --port ${config.port}` }, prettier: undefined });
const app: WorkspaceProject = await WorkspaceUtilities.findProjectOrFail(config.name, getPath('.'));
await EnvUtilities.buildEnvironmentFileForApp(app, true, 'dev.docker-compose.yaml', getPath('.'));
}
Expand Down Expand Up @@ -201,7 +203,16 @@ export class AddAngularWebsiteCommand extends BaseAddCommand<AddAngularWebsiteCo
private async setupTsConfig(root: string, projectName: string): Promise<void> {
// eslint-disable-next-line no-console
console.log('sets up tsconfig');
await TsConfigUtilities.updateTsConfig(projectName, { extends: `../../${BASE_TS_CONFIG_FILE_NAME}` });
await TsConfigUtilities.updateTsConfig(
projectName,
{
extends: `../../${BASE_TS_CONFIG_FILE_NAME}`,
compilerOptions: {
moduleResolution: 'bundler' as unknown as ModuleResolutionKind,
isolatedModules: false
}
}
);

const eslintTsconfig: TsConfig = {
compilerOptions: {
Expand Down
15 changes: 13 additions & 2 deletions src/commands/add/add-angular/add-angular.command.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* eslint-disable no-console */
import { ModuleResolutionKind } from 'typescript';

import { AngularUtilities, NavElementTypes } from '../../../angular';
import { ANGULAR_APP_COMPONENT_FILE_NAME, ANGULAR_JSON_FILE_NAME, APP_CONFIG_FILE_NAME, APPS_DIRECTORY_NAME, BASE_TS_CONFIG_FILE_NAME, DOCKER_FILE_NAME, GIT_IGNORE_FILE_NAME } from '../../../constants';
import { DockerUtilities } from '../../../docker';
Expand Down Expand Up @@ -147,7 +149,7 @@ export class AddAngularCommand extends BaseAddCommand<AddAngularConfiguration> {

await this.createDefaultPages(root, config);

await NpmUtilities.updatePackageJson(config.name, { scripts: { start: `ng serve --port ${config.port}` } });
await NpmUtilities.updatePackageJson(config.name, { scripts: { start: `ng serve --port ${config.port}` }, prettier: undefined });

const app: WorkspaceProject = await WorkspaceUtilities.findProjectOrFail(config.name, getPath('.'));
await EnvUtilities.buildEnvironmentFileForApp(app, false, 'dev.docker-compose.yaml', getPath('.'));
Expand Down Expand Up @@ -274,7 +276,16 @@ export class AddAngularCommand extends BaseAddCommand<AddAngularConfiguration> {

private async setupTsConfig(root: string, projectName: string): Promise<void> {
console.log('sets up tsconfig');
await TsConfigUtilities.updateTsConfig(projectName, { extends: `../../${BASE_TS_CONFIG_FILE_NAME}` });
await TsConfigUtilities.updateTsConfig(
projectName,
{
extends: `../../${BASE_TS_CONFIG_FILE_NAME}`,
compilerOptions: {
moduleResolution: 'bundler' as unknown as ModuleResolutionKind,
isolatedModules: false
}
}
);

const eslintTsconfig: TsConfig = {
compilerOptions: {
Expand Down
12 changes: 6 additions & 6 deletions src/encapsulation/custom-ts.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { NavElementTypes } from '../angular/nav-element-types.enum';
export type CustomTsValues = NavElementTypes
| 'provideZoneChangeDetection({ eventCoalescing: true })'
| 'provideRouter(routes)'
| 'provideClientHydration()'
| 'provideAnimations()'
| 'provideClientHydration(withEventReplay())'
| 'provideBrowserGlobalErrorListeners()'
| 'NGX_LOGGER_SERVICE'
| 'LoggerService'
| 'ErrorHandler'
Expand Down Expand Up @@ -41,8 +41,8 @@ export const customTsValueToString: Record<CustomTsValues, string> = {
titleWithInternalLink: 'NavElementTypes.TITLE_WITH_INTERNAL_LINK',
'provideZoneChangeDetection({ eventCoalescing: true })': 'provideZoneChangeDetection({ eventCoalescing: true })',
'provideRouter(routes)': 'provideRouter(routes)',
'provideClientHydration()': 'provideClientHydration()',
'provideAnimations()': 'provideAnimations()',
'provideClientHydration(withEventReplay())': 'provideClientHydration(withEventReplay())',
'provideBrowserGlobalErrorListeners()': 'provideBrowserGlobalErrorListeners()',
NGX_LOGGER_SERVICE: 'NGX_LOGGER_SERVICE',
LoggerService: 'LoggerService',
ErrorHandler: 'ErrorHandler',
Expand Down Expand Up @@ -76,8 +76,8 @@ export const customTsStringToValue: Record<string, CustomTsValues> = {
'NavElementTypes.TITLE_WITH_INTERNAL_LINK': NavElementTypes.TITLE_WITH_INTERNAL_LINK,
'provideZoneChangeDetection({ eventCoalescing: true })': 'provideZoneChangeDetection({ eventCoalescing: true })',
'provideRouter(routes)': 'provideRouter(routes)',
'provideClientHydration()': 'provideClientHydration()',
'provideAnimations()': 'provideAnimations()',
'provideClientHydration(withEventReplay())': 'provideClientHydration(withEventReplay())',
'provideBrowserGlobalErrorListeners()': 'provideBrowserGlobalErrorListeners()',
NGX_LOGGER_SERVICE: 'NGX_LOGGER_SERVICE',
LoggerService: 'LoggerService',
ErrorHandler: 'ErrorHandler',
Expand Down
1 change: 1 addition & 0 deletions src/encapsulation/fs.utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ export abstract class FsUtilities {
private static async copyEntry(entry: Dirent, destination: string): Promise<void> {
const source: Path = getPath(entry.parentPath, entry.name);
const dest: Path = getPath(destination, entry.name);
// eslint-disable-next-line angular/no-experimental
await cp(source, dest, { recursive: true, errorOnExist: true });
}
}
20 changes: 10 additions & 10 deletions src/env/environment-variable-key.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { DefaultEnvKeys } from './default-environment-keys';
/**
* Default global environment variables.
*/
export type EnvironmentVariableKey =
| typeof DefaultEnvKeys.ENV
| typeof DefaultEnvKeys.PROD_ROOT_DOMAIN
| typeof DefaultEnvKeys.STAGE_ROOT_DOMAIN
| typeof DefaultEnvKeys.ACCESS_TOKEN_SECRET
| typeof DefaultEnvKeys.REFRESH_TOKEN_SECRET
| typeof DefaultEnvKeys.WEBSERVER_MAIL_USER
| typeof DefaultEnvKeys.WEBSERVER_MAIL_PASSWORD
| typeof DefaultEnvKeys.WEBSERVER_MAIL_HOST
| typeof DefaultEnvKeys.WEBSERVER_MAIL_PORT;
export type EnvironmentVariableKey
= | typeof DefaultEnvKeys.ENV
| typeof DefaultEnvKeys.PROD_ROOT_DOMAIN
| typeof DefaultEnvKeys.STAGE_ROOT_DOMAIN
| typeof DefaultEnvKeys.ACCESS_TOKEN_SECRET
| typeof DefaultEnvKeys.REFRESH_TOKEN_SECRET
| typeof DefaultEnvKeys.WEBSERVER_MAIL_USER
| typeof DefaultEnvKeys.WEBSERVER_MAIL_PASSWORD
| typeof DefaultEnvKeys.WEBSERVER_MAIL_HOST
| typeof DefaultEnvKeys.WEBSERVER_MAIL_PORT;
4 changes: 2 additions & 2 deletions src/loopback/loopback.utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ type LoopbackCliCommands = CliGenerateDb | CliNew | CliService | CliModel | CliR
/**
* Possible angular cli options, narrowed down based on the provided command.
*/
type LoopbackCliOptions<T extends LoopbackCliCommands> =
T extends CliGenerateDb ? GenerateDbOptions
type LoopbackCliOptions<T extends LoopbackCliCommands>
= T extends CliGenerateDb ? GenerateDbOptions
: T extends CliNew ? NewOptions
: T extends CliService ? ServiceOptions
: T extends CliModel ? ModelOptions
Expand Down
Loading