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
16 changes: 12 additions & 4 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
types: [closed]
branches: [release]

permissions:
id-token: write
contents: read

jobs:
deploy:
if: github.event.pull_request.merged
Expand All @@ -12,8 +16,12 @@ jobs:
- uses: actions/checkout@v4
with:
ref: release
- run: npm ci
- run: npm run build
- uses: JS-DevTools/npm-publish@v3
- uses: actions/setup-node@v4
with:
token: ${{ secrets.NPM_TOKEN }}
node-version: '20'
registry-url: 'https://registry.npmjs.org'
# Ensure npm 11.5.1 or later is installed
- run: npm install -g npm@latest
- run: npm i
- run: npm run build
- run: npm publish
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ jobs:
- uses: actions/checkout@v4
- run: docker pull adminer
- run: docker pull postgres
- run: npm i -g @angular/cli@20 zibri-cli @loopback/cli@6 @nestjs/cli@11
- run: npm ci
- uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- run: npm i -g npm@latest
- run: npm i -g @angular/cli@20 zibri-cli @loopback/cli@6 @nestjs/cli@11 create-vite@6 create-storybook@9.1.16
- run: npm i
- run: npm run build
- run: npm run test
83 changes: 41 additions & 42 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
"name": "monux-cli",
"version": "2.5.2",
"version": "2.5.3",
"license": "MIT",
"main": "index.js",
"engines": {
"node": ">=20"
},
"repository": {
"url": "https://github.com/Service-Soft/monux-cli"
},
"keywords": [
"monux",
"mx",
Expand Down Expand Up @@ -33,7 +36,7 @@
"start": "npm run build && cd sandbox && node ../dist/index.js",
"build": "tsc",
"clear": "rm -rf sandbox && mkdir sandbox && npm run start i",
"test": "jest",
"test": "jest --runInBand",
"lint": "eslint . --max-warnings=0",
"lint:fix": "eslint . --max-warnings=0 --fix",
"prepublishOnly": "npm i && npm run build"
Expand Down
8 changes: 7 additions & 1 deletion src/__testing__/mock/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable jsdoc/require-jsdoc */
import { ANGULAR_JSON_FILE_NAME, ANGULAR_ROUTES_FILE_NAME, APP_CONFIG_FILE_NAME, APPS_DIRECTORY_NAME, DEV_DOCKER_COMPOSE_FILE_NAME, PROD_DOCKER_COMPOSE_FILE_NAME, ENV_FILE_NAME, ENVIRONMENT_MODEL_TS_FILE_NAME, ENVIRONMENT_TS_FILE_NAME, ESLINT_CONFIG_FILE_NAME, GLOBAL_ENVIRONMENT_MODEL_FILE_NAME, LIBS_DIRECTORY_NAME, PACKAGE_JSON_FILE_NAME, LOCAL_DOCKER_COMPOSE_FILE_NAME, WORKSPACE_FILE_NAME, BASE_TS_CONFIG_FILE_NAME, STAGE_DOCKER_COMPOSE_FILE_NAME, ENV_PUBLIC_FILE_NAME, ANGULAR_APP_COMPONENT_FILE_NAME } from '../../constants';
import { ANGULAR_JSON_FILE_NAME, ANGULAR_ROUTES_FILE_NAME, APP_CONFIG_FILE_NAME, APPS_DIRECTORY_NAME, DEV_DOCKER_COMPOSE_FILE_NAME, PROD_DOCKER_COMPOSE_FILE_NAME, ENV_FILE_NAME, ENVIRONMENT_MODEL_TS_FILE_NAME, ENVIRONMENT_TS_FILE_NAME, ESLINT_CONFIG_FILE_NAME, GLOBAL_ENVIRONMENT_MODEL_FILE_NAME, LIBS_DIRECTORY_NAME, PACKAGE_JSON_FILE_NAME, LOCAL_DOCKER_COMPOSE_FILE_NAME, WORKSPACE_FILE_NAME, BASE_TS_CONFIG_FILE_NAME, STAGE_DOCKER_COMPOSE_FILE_NAME, ENV_PUBLIC_FILE_NAME, ANGULAR_APP_COMPONENT_FILE_NAME, ANGULAR_SERVER_ROUTES_FILE_NAME, APP_CONFIG_SERVER_FILE_NAME } from '../../constants';
import { OmitStrict } from '../../types';
import { getPath, Path } from '../../utilities';

Expand Down Expand Up @@ -29,7 +29,10 @@ export type MockConstants = {
readonly ANGULAR_APP_COMPONENT_HTML: Path,
readonly ANGULAR_APP_ROUTES_TS: Path,
readonly ANGULAR_ROUTES_TS: Path,
readonly ANGULAR_APP_ROUTES_SERVER_TS: Path,
readonly ANGULAR_SERVER_ROUTES_TS: Path,
readonly ANGULAR_APP_CONFIG_TS: Path,
readonly ANGULAR_APP_CONFIG_SERVER_TS: Path,
readonly ANGULAR_JSON: Path,
readonly ANGULAR_ENVIRONMENT_MODEL: Path,
readonly ANGULAR_ENVIRONMENT: Path,
Expand Down Expand Up @@ -90,7 +93,10 @@ export function getMockConstants(projectName: string): MockConstants {
ANGULAR_APP_COMPONENT_HTML: getPath(ANGULAR_APP_DIR, 'src', 'app', 'app.html'),
ANGULAR_APP_ROUTES_TS: getPath(ANGULAR_APP_DIR, 'src', 'app', 'app.routes.ts'),
ANGULAR_ROUTES_TS: getPath(ANGULAR_APP_DIR, 'src', 'app', ANGULAR_ROUTES_FILE_NAME),
ANGULAR_APP_ROUTES_SERVER_TS: getPath(ANGULAR_APP_DIR, 'src', 'app', 'app.routes.server.ts'),
ANGULAR_SERVER_ROUTES_TS: getPath(ANGULAR_APP_DIR, 'src', 'app', ANGULAR_SERVER_ROUTES_FILE_NAME),
ANGULAR_APP_CONFIG_TS: getPath(ANGULAR_APP_DIR, 'src', 'app', APP_CONFIG_FILE_NAME),
ANGULAR_APP_CONFIG_SERVER_TS: getPath(ANGULAR_APP_DIR, 'src', 'app', APP_CONFIG_SERVER_FILE_NAME),
ANGULAR_JSON: getPath(ANGULAR_APP_DIR, ANGULAR_JSON_FILE_NAME),
ANGULAR_ENVIRONMENT: getPath(ANGULAR_APP_DIR, 'src', 'environment', ENVIRONMENT_TS_FILE_NAME),
ANGULAR_ENVIRONMENT_MODEL: getPath(ANGULAR_APP_DIR, 'src', 'environment', ENVIRONMENT_MODEL_TS_FILE_NAME),
Expand Down
32 changes: 32 additions & 0 deletions src/__testing__/mock/file-mock.utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ export abstract class FileMockUtilities {
ANGULAR_APP_COMPONENT_HTML: this.createEmptyFile,
ANGULAR_APP_ROUTES_TS: this.createAppRoutesTs,
ANGULAR_ROUTES_TS: this.createEmptyFile,
ANGULAR_APP_ROUTES_SERVER_TS: this.createAppRoutesServerTs,
ANGULAR_SERVER_ROUTES_TS: this.createEmptyFile,
ANGULAR_APP_CONFIG_TS: this.createAppConfig,
ANGULAR_APP_CONFIG_SERVER_TS: this.createAppConfigServer,
ANGULAR_JSON: this.createAngularJson,
ANGULAR_ENVIRONMENT_MODEL: this.createEmptyFile,
ANGULAR_ENVIRONMENT: this.createEmptyFile,
Expand Down Expand Up @@ -192,6 +195,19 @@ export abstract class FileMockUtilities {
], true, false);
}

private static async createAppRoutesServerTs(mockConstants: MockConstants): Promise<void> {
await FsUtilities.createFile(mockConstants.ANGULAR_APP_ROUTES_SERVER_TS, [
'import { RenderMode, ServerRoute } from \'@angular/ssr\';',
'',
'export const serverRoutes: ServerRoute[] = [',
'\t{',
'\t\tpath: \'**\',',
'\t\trenderMode: RenderMode.Prerender',
'\t}',
'];'
], true, false);
}

private static async createAppConfig(mockConstants: MockConstants): Promise<void> {
await FsUtilities.createFile(mockConstants.ANGULAR_APP_CONFIG_TS, [
'import { ApplicationConfig, provideZoneChangeDetection } from \'@angular/core\';',
Expand All @@ -210,6 +226,22 @@ export abstract class FileMockUtilities {
], true, false);
}

private static async createAppConfigServer(mockConstants: MockConstants): Promise<void> {
await FsUtilities.createFile(mockConstants.ANGULAR_APP_CONFIG_SERVER_TS, [
'import { mergeApplicationConfig, ApplicationConfig } from \'@angular/core\';',
'import { provideServerRendering, withRoutes } from \'@angular/ssr\';',
'',
'import { appConfig } from \'./app.config\';',
'import { serverRoutes } from \'./app.routes.server\';',
'',
'const serverConfig: ApplicationConfig = {',
'\tproviders: [provideServerRendering(withRoutes(serverRoutes))]',
'};',
'',
'export const config: ApplicationConfig = mergeApplicationConfig(appConfig, serverConfig);'
], true, false);
}

private static async createGlobalEnvModel(): Promise<void> {
await EnvUtilities['createGlobalEnvironmentModel']();
}
Expand Down
17 changes: 12 additions & 5 deletions src/angular/angular-utilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ describe('AngularUtilities', () => {
'ANGULAR_APP_COMPONENT_HTML',
'ANGULAR_APP_COMPONENT_TS',
'ANGULAR_APP_ROUTES_TS',
'ANGULAR_APP_ROUTES_SERVER_TS',
'ANGULAR_APP_CONFIG_TS',
'ANGULAR_APP_CONFIG_SERVER_TS',
'ANGULAR_JSON'
]
);
Expand Down Expand Up @@ -57,24 +59,29 @@ describe('AngularUtilities', () => {

const htmlLines: string[] = await FsUtilities.readFileLines(mockConstants.ANGULAR_APP_COMPONENT_HTML);
expect(htmlLines).toEqual([
'<ngx-mat-navigation-navbar [minHeight]="80" [minSidenavWidth]="\'30%\'" [minHeightOtherElements]="70" [navbarRows]="navbarRows">',
' <router-outlet></router-outlet>',
'<ngx-mat-navigation-navbar [minHeight]="80" [minSidenavWidth]="\'40%\'" [minHeightOtherElements]="150" [navbarRows]="navbarRows">',
' <div class="p-4">',
' <div class="w-full mx-auto" style="max-width: max(80%, 1200px);">',
' <ngx-mat-navigation-breadcrumbs class="-ml-4 inline-block"></ngx-mat-navigation-breadcrumbs>',
' <router-outlet></router-outlet>',
' </div>',
' </div>',
'</ngx-mat-navigation-navbar>',
'',
'<ngx-mat-navigation-footer [minHeight]="70" [footerRows]="footerRows"></ngx-mat-navigation-footer>'
'<ngx-mat-navigation-footer [minHeight]="150" [footerRows]="footerRows"></ngx-mat-navigation-footer>'
]);

const tsLines: string[] = await FsUtilities.readFileLines(mockConstants.ANGULAR_APP_COMPONENT_TS);
expect(tsLines).toEqual([
'import { navbarRows, footerRows } from \'./routes\';',
'import { FooterRow, NavbarRow, NgxMatNavigationFooterComponent, NgxMatNavigationNavbarComponent } from \'ngx-material-navigation\';',
'import { FooterRow, NavbarRow, NgxMatNavigationBreadcrumbsComponent, NgxMatNavigationFooterComponent, NgxMatNavigationNavbarComponent } from \'ngx-material-navigation\';',
'import { Component } from \'@angular/core\';',
'import { RouterOutlet } from \'@angular/router\';',
'',
'@Component({',
' selector: \'app-root\',',
' standalone: true,',
' imports: [RouterOutlet, NgxMatNavigationNavbarComponent, NgxMatNavigationFooterComponent],',
' imports: [RouterOutlet, NgxMatNavigationNavbarComponent, NgxMatNavigationFooterComponent, NgxMatNavigationBreadcrumbsComponent],',
' templateUrl: \'./app.html\',',
' styleUrl: \'./app.css\'',
'})',
Expand Down
Loading