From 736e09543e5b23833e9851f2618f519e4b05382a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87etin?= <69278826+cetincakiroglu@users.noreply.github.com> Date: Wed, 17 Apr 2024 19:02:49 +0300 Subject: [PATCH 1/6] Remove module --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 151f872fd23..5a0b0e9d8ec 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "type": "git", "url": "https://github.com/primefaces/primeng.git" }, - "type": "module", "devDependencies": { "@angular-devkit/build-angular": "^17.3.1", "@angular-eslint/eslint-plugin": "17.3.0", From fd3b4ab3545b52e028c217a77124e253430270a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87etin?= <69278826+cetincakiroglu@users.noreply.github.com> Date: Wed, 17 Apr 2024 19:41:08 +0300 Subject: [PATCH 2/6] update package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 5a0b0e9d8ec..151f872fd23 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "type": "git", "url": "https://github.com/primefaces/primeng.git" }, + "type": "module", "devDependencies": { "@angular-devkit/build-angular": "^17.3.1", "@angular-eslint/eslint-plugin": "17.3.0", From b611ea8284847a9356ed778924f6440a1122e876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87etin?= <69278826+cetincakiroglu@users.noreply.github.com> Date: Wed, 17 Apr 2024 19:41:08 +0300 Subject: [PATCH 3/6] update package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index cdd8f3a0c7f..b8d04a384e3 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "type": "git", "url": "https://github.com/primefaces/primeng.git" }, + "type": "module", "devDependencies": { "@angular-devkit/build-angular": "^17.3.1", "@angular-eslint/eslint-plugin": "17.3.0", From 1ce00aa4bb88841b9096442289ff1ee8d2acd19e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87etin?= <69278826+cetincakiroglu@users.noreply.github.com> Date: Wed, 17 Apr 2024 19:41:08 +0300 Subject: [PATCH 4/6] update package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 9866c562398..cf1e4668c04 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "type": "git", "url": "https://github.com/primefaces/primeng.git" }, + "type": "module", "devDependencies": { "@angular-devkit/build-angular": "^17.3.1", "@angular-eslint/eslint-plugin": "17.3.0", From 60ef303d0904ac4d3d4fdcafeae6334c2423bdbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87etin?= <69278826+cetincakiroglu@users.noreply.github.com> Date: Wed, 24 Apr 2024 12:13:28 +0300 Subject: [PATCH 5/6] Update for ssg --- angular.json | 4 + package.json | 5 +- routes.txt | 130 +++++++++++++++++++++++ server.ts | 28 +++-- src/app/showcase/doc/icons/listdoc.ts | 28 ++--- src/app/showcase/layout/app.component.ts | 3 +- src/app/showcase/service/iconservice.ts | 30 ------ vercel.json | 16 --- 8 files changed, 165 insertions(+), 79 deletions(-) create mode 100644 routes.txt delete mode 100755 src/app/showcase/service/iconservice.ts delete mode 100644 vercel.json diff --git a/angular.json b/angular.json index 7673791eebf..c67b15de71b 100644 --- a/angular.json +++ b/angular.json @@ -63,6 +63,10 @@ "rgbcolor" ], "server": "src/main.server.ts", + "prerender": { + "discoverRoutes": false, + "routesFile": "routes.txt" + }, "ssr": { "entry": "server.ts" } diff --git a/package.json b/package.json index cf1e4668c04..0b9720d198e 100644 --- a/package.json +++ b/package.json @@ -10,19 +10,18 @@ "e2e": "ng e2e", "lint": "ng lint", "format": "prettier --write \"**/*.{js,ts,d.ts}\"", + "build": "ng build", "format:check": "prettier --check \"**/*.{js,ts,d.ts}\"", "build:lib": "npm run build:check && npm run build:package", "build:package": "BROWSERSLIST_ENV=library ng build primeng-library && gulp build-assets", "build:check": "npm run format:check && npm run security:check", "security:check": "npm audit --production --audit-level high", - "apidoc": "node ./api-generator/build-apidoc.ts", - "vercel-build": "ng build" + "apidoc": "node ./api-generator/build-apidoc.ts" }, "repository": { "type": "git", "url": "https://github.com/primefaces/primeng.git" }, - "type": "module", "devDependencies": { "@angular-devkit/build-angular": "^17.3.1", "@angular-eslint/eslint-plugin": "17.3.0", diff --git a/routes.txt b/routes.txt new file mode 100644 index 00000000000..3f3eac8186f --- /dev/null +++ b/routes.txt @@ -0,0 +1,130 @@ +/ +/accordion +/animateonscroll +/autocomplete +/autofocus +/avatar +/badge +/blockui +/breadcrumb +/button +/calendar +/card +/carousel +/cascadeselect +/chart +/checkbox +/chip +/chips +/colorpicker +/colors +/configuration +/confirmdialog +/confirmpopup +/contextmenu +/customicons +/dataview +/defer +/dialog +/divider +/dock +/dragdrop +/dropdown +/dynamicdialog +/editor +/fieldset +/fileupload +/filterservice +/floatlabel +/focustrap +/galleria +/guides +/guides/accessibility +/guides/csslayer +/guides/templateupdate +/iconfield +/icons +/image +/inplace +/inputgroup +/inputmask +/inputnumber +/inputotp +/inputswitch +/inputtext +/inputtextarea +/installation +/keyfilter +/knob +/listbox +/lts +/megamenu +/menu +/menubar +/messages +/metergroup +/multiselect +/notfound +/orderlist +/organizationchart +/overlay +/overlaypanel +/paginator +/panel +/panelmenu +/partners +/password +/picklist +/playground +/progressbar +/progressspinner +/radiobutton +/rating +/ripple +/roadmap +/scroller +/scrollpanel +/scrolltop +/selectbutton +/sidebar +/skeleton +/slider +/speeddial +/splitbutton +/splitter +/stepper +/steps +/steps/confirmation +/steps/payment +/steps/personal +/steps/seat +/styleclass +/support +/table +/tabmenu +/tabview +/tag +/team +/templates +/templates/apollo +/templates/atlantis +/templates/avalon +/templates/diamond +/templates/freya +/templates/poseidon +/templates/sakai +/templates/ultima +/templates/verona +/terminal +/theming +/tieredmenu +/timeline +/toast +/togglebutton +/toolbar +/tooltip +/tree +/treeselect +/treetable +/tristatecheckbox +/uikit \ No newline at end of file diff --git a/server.ts b/server.ts index d5e8374acef..4382faf534d 100644 --- a/server.ts +++ b/server.ts @@ -1,27 +1,27 @@ import { APP_BASE_HREF } from '@angular/common'; import { CommonEngine } from '@angular/ssr'; import express from 'express'; -import { join } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { dirname, join, resolve } from 'node:path'; import bootstrap from './src/main.server'; -import { environment } from 'src/environments/environment'; - // The Express app is exported so that it can be used by serverless Functions. export function app(): express.Express { const server = express(); - const distFolder = join(process.cwd(), 'dist/primeng/browser'); - const indexHtml = join(distFolder, 'index.html'); + const serverDistFolder = dirname(fileURLToPath(import.meta.url)); + const browserDistFolder = resolve(serverDistFolder, '../browser'); + const indexHtml = join(serverDistFolder, 'index.server.html'); const commonEngine = new CommonEngine(); server.set('view engine', 'html'); - server.set('views', distFolder); + server.set('views', browserDistFolder); // Example Express Rest API endpoints // server.get('/api/**', (req, res) => { }); // Serve static files from /browser server.get( '*.*', - express.static(distFolder, { + express.static(browserDistFolder, { maxAge: '1y' }) ); @@ -35,7 +35,7 @@ export function app(): express.Express { bootstrap, documentFilePath: indexHtml, url: `${protocol}://${headers.host}${originalUrl}`, - publicPath: distFolder, + publicPath: browserDistFolder, providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }] }) .then((html) => res.send(html)) @@ -44,3 +44,15 @@ export function app(): express.Express { return server; } + +function run(): void { + const port = process.env['PORT'] || 4000; + + // Start up the Node server + const server = app(); + server.listen(port, () => { + console.log(`Node Express server listening on http://localhost:${port}`); + }); +} + +run(); diff --git a/src/app/showcase/doc/icons/listdoc.ts b/src/app/showcase/doc/icons/listdoc.ts index b7320fdd727..d3662298b22 100644 --- a/src/app/showcase/doc/icons/listdoc.ts +++ b/src/app/showcase/doc/icons/listdoc.ts @@ -1,5 +1,5 @@ -import { ChangeDetectorRef, Component } from '@angular/core'; -import { IconService } from '../../service/iconservice'; +import { Component } from '@angular/core'; +import { default as IconData } from 'src/assets/showcase/data/icons.json'; @Component({ selector: 'list-doc', @@ -21,31 +21,19 @@ import { IconService } from '../../service/iconservice'; ` }) export class ListDoc { - icons: any[]; + icons: any; filteredIcons: any[]; selectedIcon: any; - constructor(private iconService: IconService, private cd: ChangeDetectorRef) {} - ngOnInit() { - this.iconService.getIcons().subscribe((data) => { - data = data.filter((value) => { - return value.icon.tags.indexOf('deprecate') === -1; - }); - - let icons = data; - icons.sort((icon1, icon2) => { - if (icon1.properties.name < icon2.properties.name) return -1; - else if (icon1.properties.name < icon2.properties.name) return 1; - else return 0; - }); - - this.icons = icons; - this.filteredIcons = data; - this.cd.markForCheck(); + this.icons = IconData.icons.sort((icon1, icon2) => { + if (icon1.properties.name < icon2.properties.name) return -1; + else if (icon1.properties.name < icon2.properties.name) return 1; + else return 0; }); + this.filteredIcons = IconData.icons; } onFilter(event: KeyboardEvent): void { diff --git a/src/app/showcase/layout/app.component.ts b/src/app/showcase/layout/app.component.ts index 0bd454b220c..342b029717d 100644 --- a/src/app/showcase/layout/app.component.ts +++ b/src/app/showcase/layout/app.component.ts @@ -10,7 +10,6 @@ import { CarService } from '../service/carservice'; import { CountryService } from '../service/countryservice'; import { CustomerService } from '../service/customerservice'; import { EventService } from '../service/eventservice'; -import { IconService } from '../service/iconservice'; import { NodeService } from '../service/nodeservice'; import { PhotoService } from '../service/photoservice'; import { ProductService } from '../service/productservice'; @@ -25,7 +24,7 @@ import { AppTopBarComponent } from './topbar/app.topbar.component'; templateUrl: './app.component.html', standalone: true, imports: [RouterOutlet, FormsModule, ReactiveFormsModule, HttpClientModule, AppMainComponent, LandingComponent, AppNewsComponent, AppConfigComponent, AppTopBarComponent, AppMenuComponent], - providers: [CarService, CountryService, EventService, NodeService, IconService, CustomerService, PhotoService, AppConfigService, ProductService] + providers: [CarService, CountryService, EventService, NodeService, CustomerService, PhotoService, AppConfigService, ProductService] }) export class AppComponent implements OnInit { constructor(@Inject(DOCUMENT) private document: Document, private renderer: Renderer2, private primeng: PrimeNGConfig, private configService: AppConfigService, private router: Router, @Inject(PLATFORM_ID) private platformId: any) { diff --git a/src/app/showcase/service/iconservice.ts b/src/app/showcase/service/iconservice.ts deleted file mode 100755 index 8ac282f12c5..00000000000 --- a/src/app/showcase/service/iconservice.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Injectable, Inject } from '@angular/core'; -import { HttpClient, HttpHeaders } from '@angular/common/http'; -import { map } from 'rxjs/operators'; -import { DOCUMENT } from '@angular/common'; - -@Injectable() -export class IconService { - constructor(private http: HttpClient, @Inject(DOCUMENT) private document: Document) {} - - icons: any[]; - - selectedIcon: any; - - apiUrl = 'assets/showcase/data/icons.json'; - - getBaseUrl() { - return `${this.document.location.protocol}//${this.document.location.host}/`; - } - - getIcons() { - const apiUrl = this.getBaseUrl() + this.apiUrl; - - return this.http.get(apiUrl).pipe( - map((response: any) => { - this.icons = response.icons; - return this.icons; - }) - ); - } -} diff --git a/vercel.json b/vercel.json deleted file mode 100644 index bc666d9d0ba..00000000000 --- a/vercel.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": 2, - "public": true, - "name": "primeng", - "rewrites": [ - { - "source": "/(.*)", - "destination": "/api" - } - ], - "functions": { - "api/index.js": { - "includeFiles": "./dist/primeng/browser/**" - } - } -} \ No newline at end of file From a1110cdd016086134fcf3b31fbccb35f940aaf76 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Wed, 24 Apr 2024 12:48:13 +0300 Subject: [PATCH 6/6] Update year --- LICENSE.md | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index c6d6640d34c..999fb85bfeb 100755 --- a/LICENSE.md +++ b/LICENSE.md @@ -2,7 +2,7 @@ The MIT License (MIT) -Copyright (c) 2016-2022 PrimeTek +Copyright (c) 2016-2024 PrimeTek Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -30,59 +30,46 @@ The term “Software” includes all source and object code, in whole and/or par ## Summary -* Can be used on unlimited sites and servers -* Source-code cannot be resold or distributed -* Commercial use allowed -* Can modify source-code but cannot distribute modifications (derivative works) +- Can be used on unlimited sites and servers +- Source-code cannot be resold or distributed +- Commercial use allowed +- Can modify source-code but cannot distribute modifications (derivative works) ## Terms and Conditions 1. **License Grant:** Licensor hereby grants Licensee a Personal, Non-assignable and non-transferable, Commercial, Royalty free, Including the rights to create but not distribute derivative works, Non-exclusive license identified with a unique key stated in section 3, all with accordance with the terms set forth and other legal restrictions set forth in 3rd party software used while running Software. - + 1. **Limited:** Licensee may use Software for the purpose of: - + 1. Running Software on Licensee’s Website\[s\] and Server\[s\]; 2. Allowing 3rd Parties to run Software on Licensee’s Website\[s\] and Server\[s\]; 3. Publishing Software’s output to Licensee and 3rd Parties; 4. Distribute verbatim copies of Software’s output (including compiled binaries); 5. Modify Software to suit Licensee’s needs and specifications. + 2. **Non Assignable and Non-Transferable:** Licensee may not assign or transfer his rights and duties under this license. - 3. **Commercial, Royalty Free:** Licensee may use Software for any purpose, including paid-services, without any royalties - 4. **Including the Right to Create Derivative Works:** Licensee may create derivative works based on Software, including amending Software’s source code, modifying it, integrating it into a larger work or removing portions of Software, as long as no distribution of the derivative works is made - + 2. **Term & Termination:** The Term of this license shall be until terminated. Licensor may terminate this Agreement, including Licensee’s license in the case where Licensee : 1. became insolvent or otherwise entered into any liquidation process; or - 2. exported The Software to any jurisdiction where licensor may not enforce his rights under this agreements in; or - 3. Licensee was in breach of any of this license's terms and conditions and such breach was not cured, immediately upon notification; or - 4. Licensee in breach of any of the terms of clause 2 to this license; or - 5. Licensee otherwise entered into any arrangement which caused Licensor to be unable to enforce his rights under this License. - 3. **Payment:** In consideration of the License granted under clause 2, Licensee shall pay Licensor a fee, via credit card or any other mean which Licensor may deem adequate. Failure to perform payment shall construe as material breach of this Agreement. Transaction id of the payment is the unique license key granted to Licensee. 4. **Upgrades, Updates and Fixes:** . - + 1. **Fix:** for the purpose of this license, a fix shall be a minor amendment in The Software, intended to remove bugs or alter minor features which impair the The Software's functionality. A fix shall be marked as a new sub-sub-version number. For example, should Licensee purchase Software under version 1.1.1, an upgrade shall commence under number 1.1.2. - + 5. **Support:** Software is provided under an AS-IS basis and without any support, updates or maintenance. Nothing in this Agreement shall require Licensor to provide Licensee with support or fixes to any bug, failure, mis-performance or other defect in The Software. - 6. **Liability:** To the extent permitted under Law, The Software is provided under an AS-IS basis. Licensor shall never, and without any limit, be liable for any damage, cost, expense or any other payment incurred by Licesee as a result of Software’s actions, failure, bugs and/or any other interaction between The Software and Licesee’s end-equipment, computers, other software or any 3rd party, end-equipment, computer or services. Moreover, Licensor shall never be liable for any defect in source code written by Licensee when relying on The Software or using The Software’s source code. - 7. **Warranty:** - + 1. **Intellectual Property:** Licensor hereby warrants that The Software does not violate or infringe any 3rd party claims in regards to intellectual property, patents and/or trademarks and that to the best of its knowledge no legal action has been taken against it for any infringement or violation of any 3rd party intellectual property rights. - 2. **No-Warranty:** The Software is provided without any warranty; Licensor hereby disclaims any warranty that The Software shall be error free, without defects or code which may cause damage to Licensee’s computers or to Licensee, and that Software shall be functional. Licensee shall be solely liable to any damage, defect or loss incurred as a result of operating software and undertake the risks contained in running The Software on License’s Server\[s\] and Website\[s\]. - 3. **Prior Inspection:** Licensee hereby states that he inspected The Software thoroughly and found it satisfactory and adequate to his needs, that it does not interfere with his regular operation and that it does meet the standards and scope of his computer systems and architecture. Licensee found that The Software interacts with his development, website and server environment and that it does not infringe any of End User License Agreement of any software Licensee may use in performing his services. Licensee hereby waives any claims regarding The Software's incompatibility, performance, results and features, and warrants that he inspected the The Software. - + 8. **No Refunds:** Licensee warrants that he inspected The Software according to clause 7(c) and that it is adequate to his needs. Accordingly, as The Software is intangible goods, Licensee shall not be, ever, entitled to any refund, rebate, compensation or restitution for any reason whatsoever, even if The Software contains material flaws. - 9. **Indemnification:** Licensee hereby warrants to hold Licensor harmless and indemnify Licensor for any lawsuit brought against it in regards to Licensee’s use of The Software in means that violate, breach or otherwise circumvent this license, Licensor's intellectual property rights or Licensor's title in The Software. Licensor shall promptly notify Licensee in case of such legal action and request Licensee’s consent prior to any settlement in relation to such lawsuit or claim. - -10. **Governing Law, Jurisdiction:** Licensee hereby agrees not to initiate class-action lawsuits against Licensor in relation to this license and to compensate Licensor for any legal fees, cost or attorney fees should any claim brought by Licensee against Licensor be denied, in part or in full. - +10. **Governing Law, Jurisdiction:** Licensee hereby agrees not to initiate class-action lawsuits against Licensor in relation to this license and to compensate Licensor for any legal fees, cost or attorney fees should any claim brought by Licensee against Licensor be denied, in part or in full.