Skip to content

Commit

Permalink
fix: fixing and migrate documentation to use analog js
Browse files Browse the repository at this point in the history
  • Loading branch information
Bagusajieiswara committed Nov 27, 2024
1 parent 2bbb119 commit e9a410e
Show file tree
Hide file tree
Showing 14 changed files with 3,638 additions and 1,061 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
<title>documentations</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" href="/src/styles.scss" />
</head>
<body class="antialiased w-full h-full">
<app-root></app-root>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
22 changes: 22 additions & 0 deletions apps/documentations/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"type": "module",
"dependencies": {
"@angular/common": "~18.2.13",
"@angular/core": "~18.2.13",
"@angular/platform-browser": "~18.2.13",
"@angular/platform-server": "~18.2.13",
"@angular/router": "~18.2.13",
"@angular/ssr": "~18.2.12",
"@ngx-primer/primitive/accordion": "0.0.2-0",
"@nx/angular": "20.1.0",
"express": "~4.18.3",
"zone.js": "~0.14.10",
"jest-preset-angular": "~14.1.1",
"vite": "^5.4.11",
"@analogjs/platform": "1.10.0-beta.6",
"@nx/vite": "20.1.0",
"@analogjs/vite-plugin-angular": "^1.9.0",
"tailwindcss": "^3.4.15",
"vite-tsconfig-paths": "^4.2.0"
}
}
70 changes: 23 additions & 47 deletions apps/documentations/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,64 +7,40 @@
"tags": [],
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:application",
"outputs": ["{options.outputPath}"],
"executor": "@analogjs/platform:vite",
"options": {
"outputPath": "dist/apps/documentations",
"index": "apps/documentations/src/index.html",
"browser": "apps/documentations/src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "apps/documentations/tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
{
"glob": "**/*",
"input": "apps/documentations/public"
}
],
"styles": ["apps/documentations/src/styles.scss"],
"scripts": [],
"server": "apps/documentations/src/main.server.ts",
"prerender": true,
"ssr": {
"entry": "apps/documentations/server.ts"
}
"configFile": "apps/documentations/vite.config.ts",
"main": "apps/documentations/src/main.ts",
"outputPath": "dist/apps/documentations/client",
"tsConfig": "apps/documentations/tsconfig.app.json"
},
"defaultConfiguration": "production",
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
"mode": "development"
},
"production": {
"sourcemap": false,
"mode": "production"
}
},
"defaultConfiguration": "production"
}
},
"serve": {
"executor": "@angular-devkit/build-angular:dev-server",
"executor": "@analogjs/platform:vite-dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "documentations:build",
"port": 4200
},
"configurations": {
"development": {
"buildTarget": "documentations:build:development",
"hmr": true
},
"production": {
"buildTarget": "documentations:build:production"
},
"development": {
"buildTarget": "documentations:build:development"
}
},
"defaultConfiguration": "development"
}
},
"extract-i18n": {
"executor": "@angular-devkit/build-angular:extract-i18n",
Expand Down
11 changes: 8 additions & 3 deletions apps/documentations/src/app/app.config.server.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
import { provideServerRendering } from '@angular/platform-server';
import { ApplicationConfig, mergeApplicationConfig } from '@angular/core';

import { appConfig } from './app.config';
import { provideClientHydration } from '@angular/platform-browser';
import { provideServerRendering } from '@angular/platform-server';

const serverConfig: ApplicationConfig = {
providers: [provideServerRendering()],
providers: [
provideServerRendering(),
provideClientHydration()
],
};

export const config = mergeApplicationConfig(appConfig, serverConfig);
3 changes: 2 additions & 1 deletion apps/documentations/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
import { provideRouter } from '@angular/router';

import { appRoutes } from './app.routes';
import { provideClientHydration } from '@angular/platform-browser';
import { provideRouter } from '@angular/router';

export const appConfig: ApplicationConfig = {
providers: [
Expand Down
4 changes: 3 additions & 1 deletion apps/documentations/src/main.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { bootstrapApplication } from '@angular/platform-browser';
import 'zone.js/node';

import { AppComponent } from './app/app.component';
import { bootstrapApplication } from '@angular/platform-browser';
import { config } from './app/app.config.server';

const bootstrap = () => bootstrapApplication(AppComponent, config);
Expand Down
1 change: 1 addition & 0 deletions apps/documentations/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'zone.js';
import { bootstrapApplication } from '@angular/platform-browser';
import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component';
Expand Down
2 changes: 1 addition & 1 deletion apps/documentations/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"types": ["node"]
},
"files": ["src/main.ts", "src/main.server.ts", "server.ts"],
"include": ["src/**/*.d.ts"],
"include": ["src/**/*.d.ts", "src/app/pages/**/*.page.ts"],
"exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"]
}
53 changes: 53 additions & 0 deletions apps/documentations/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/// <reference types="vitest" />

import analog from '@analogjs/platform';
import angular from '@analogjs/vite-plugin-angular';
import { defineConfig } from 'vite';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import tailwindcss from 'tailwindcss';
import tsconfigPaths from 'vite-tsconfig-paths';

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
return {
root: __dirname,
cacheDir: '../../node_modules/.vite',
build: {
outDir: '../../dist/apps/documentations/client',
reportCompressedSize: true,
target: ['es2020'],
},
plugins: [
analog({
ssr: false,
static: true,
prerender: {
routes: [],
},
}),
angular(),
nxViteTsPaths(),
tsconfigPaths()
],
server: {
fs: {
allow: ['.'],
},
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['src/test-setup.ts'],
include: ['**/*.spec.ts'],
reporters: ['default'],
},
define: {
'import.meta.vitest': mode !== 'production',
},
css: {
postcss: {
plugins: [tailwindcss],
},
},
};
});
107 changes: 59 additions & 48 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,38 @@
},
"private": true,
"dependencies": {
"@angular/animations": "~18.2.0",
"@angular/common": "~18.2.0",
"@angular/compiler": "~18.2.0",
"@angular/core": "~18.2.0",
"@angular/forms": "~18.2.0",
"@angular/platform-browser": "~18.2.0",
"@angular/platform-browser-dynamic": "~18.2.0",
"@angular/platform-server": "~18.2.0",
"@angular/router": "~18.2.0",
"@angular/ssr": "~18.2.0",
"express": "~4.18.2",
"rxjs": "~7.8.0",
"zone.js": "~0.14.3"
"@analogjs/content": "^1.7.0",
"@analogjs/router": "^1.7.0",
"@angular/animations": "~18.2.13",
"@angular/common": "~18.2.13",
"@angular/compiler": "~18.2.13",
"@angular/core": "~18.2.13",
"@angular/forms": "~18.2.13",
"@angular/platform-browser": "~18.2.13",
"@angular/platform-browser-dynamic": "~18.2.13",
"@angular/platform-server": "~18.2.13",
"@angular/router": "~18.2.13",
"@angular/ssr": "~18.2.12",
"express": "~4.18.3",
"marked": "^5.0.2",
"marked-gfm-heading-id": "^3.0.4",
"marked-highlight": "^2.0.1",
"marked-mangle": "^1.1.7",
"prismjs": "^1.29.0",
"rxjs": "~7.8.1",
"zone.js": "~0.14.10"
},
"devDependencies": {
"@angular-devkit/build-angular": "~18.2.0",
"@angular-devkit/core": "~18.2.0",
"@angular-devkit/schematics": "~18.2.0",
"@angular/cli": "~18.2.0",
"@angular/compiler-cli": "~18.2.0",
"@angular/language-service": "~18.2.0",
"@eslint/js": "^9.8.0",
"@analogjs/platform": "1.10.0-beta.6",
"@analogjs/vite-plugin-angular": "^1.9.0",
"@analogjs/vitest-angular": "^1.9.0",
"@angular-devkit/build-angular": "~18.2.12",
"@angular-devkit/core": "~18.2.12",
"@angular-devkit/schematics": "~18.2.12",
"@angular/cli": "~18.2.12",
"@angular/compiler-cli": "~18.2.13",
"@angular/language-service": "~18.2.13",
"@eslint/js": "^9.15.0",
"@nx/angular": "20.1.0",
"@nx/devkit": "20.1.0",
"@nx/eslint": "20.1.0",
Expand All @@ -44,44 +54,45 @@
"@nx/vite": "20.1.0",
"@nx/web": "20.1.0",
"@nx/workspace": "20.1.0",
"@playwright/test": "^1.36.0",
"@schematics/angular": "~18.2.0",
"@swc-node/register": "~1.9.1",
"@swc/core": "~1.5.7",
"@swc/helpers": "~0.5.11",
"@playwright/test": "^1.49.0",
"@schematics/angular": "~18.2.12",
"@swc-node/register": "~1.9.2",
"@swc/core": "~1.5.29",
"@swc/helpers": "~0.5.15",
"@types/express": "4.17.14",
"@types/jest": "^29.5.12",
"@types/jest": "^29.5.14",
"@types/node": "18.16.9",
"@typescript-eslint/utils": "^8.0.0",
"@vitest/coverage-v8": "^1.0.4",
"@vitest/ui": "^1.3.1",
"angular-eslint": "^18.3.0",
"autoprefixer": "^10.4.0",
"@typescript-eslint/utils": "^8.16.0",
"@vitest/coverage-v8": "^1.6.0",
"@vitest/ui": "^1.6.0",
"angular-eslint": "^18.4.2",
"autoprefixer": "^10.4.20",
"class-variance-authority": "0.7.1-canary.2",
"eslint": "^9.8.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-playwright": "^1.6.2",
"eslint": "^9.15.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-playwright": "^1.8.3",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-preset-angular": "~14.1.0",
"jest-preset-angular": "~14.1.1",
"jsdom": "~22.1.0",
"jsonc-eslint-parser": "^2.1.0",
"jsonc-eslint-parser": "^2.4.0",
"nanoid": "5.0.8",
"ng-packagr": "~18.2.0",
"ng-packagr": "~18.2.1",
"nx": "20.1.0",
"postcss": "^8.4.5",
"postcss": "^8.4.49",
"postcss-url": "~10.1.3",
"prettier": "^2.6.2",
"tailwindcss": "^3.0.2",
"ts-jest": "^29.1.0",
"prettier": "^2.8.8",
"tailwindcss": "^3.4.15",
"ts-jest": "^29.2.5",
"ts-node": "10.9.1",
"tslib": "^2.3.0",
"typescript": "~5.5.2",
"typescript-eslint": "^8.0.0",
"verdaccio": "^5.0.4",
"vite": "^5.0.0",
"vite-plugin-dts": "~3.8.1",
"vitest": "^1.3.1"
"tslib": "^2.8.1",
"typescript": "~5.5.4",
"typescript-eslint": "^8.16.0",
"verdaccio": "^5.33.0",
"vite": "^5.4.11",
"vite-plugin-dts": "~3.8.3",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^2.0.0"
},
"nx": {
"includedScripts": []
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @angular-eslint/no-input-rename */
/* eslint-disable @nx/enforce-module-boundaries */
/**
* Copyright [2024] [ElhakimDev]
Expand All @@ -20,7 +21,7 @@ import { CommonModule } from '@angular/common';
import { NgxPrimerAccordionItemComponent } from '../accordion-item/accordion-item.component';
import { NgxPrimerAccordionRootThemeVariantDirective } from '../../directives';
import { injectAccordionConfig } from '../../configs/accordion-config';
import { useIdGenerator } from 'packages/primitives/utilities/src/providers/id-generator/id-generator.provider';
import { useIdGenerator } from '@ngx-primer/utilities';

const { injectIdGenerator, provideIdGenerator } = useIdGenerator();

Expand Down
3 changes: 2 additions & 1 deletion packages/primitives/utilities/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './directives/id-generator/id-generator.directive';
export * from './directives/id-generator/id-generator.directive';
export * from './providers/id-generator/id-generator.provider';
Loading

0 comments on commit e9a410e

Please sign in to comment.