Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Nov 5, 2023
0 parents commit 82631a3
Show file tree
Hide file tree
Showing 30 changed files with 33,246 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
ij_typescript_spaces_within_imports = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
23 changes: 23 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 🚀 Deploy
on:
push:
branches: [main]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: taiga-family/ci/actions/setup/[email protected]
- uses: taiga-family/ci/actions/setup/[email protected]
- uses: taiga-family/ci/actions/setup/[email protected]
- run: npm run lint
- run: npm run prettier -- --check
- run: npx nx build-gh-pages demo
- uses: taiga-family/ci/actions/deploy/[email protected]
with:
token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }}
folder: dist/demo/browser

concurrency:
group: deploy-${{ github.head_ref }}
cancel-in-progress: true
43 changes: 43 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc

# dependencies
/node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.angular
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db

.nx
.angular
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy-peer-deps=true
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Preview
100 changes: 100 additions & 0 deletions apps/demo/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"name": "demo",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/demo/src",
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/demo",
"index": "apps/demo/src/index.html",
"main": "apps/demo/src/main.ts",
"polyfills": "apps/demo/src/polyfills.ts",
"tsConfig": "apps/demo/tsconfig.app.json",
"baseHref": "/",
"assets": [
"apps/demo/src/favicon.ico",
"apps/demo/src/assets",
{
"glob": "**/*",
"input": "node_modules/@taiga-ui/icons/src",
"output": "assets/taiga-ui/icons"
}
],
"styles": ["apps/demo/src/styles.less", "node_modules/@taiga-ui/core/styles/taiga-ui-theme.less"],
"scripts": [],
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "apps/demo/src/environments/environment.ts",
"with": "apps/demo/src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
}
},
"defaultConfiguration": ""
},
"serve": {
"executor": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "demo:build"
},
"configurations": {
"production": {
"browserTarget": "demo:build:production"
}
}
},
"build-gh-pages": {
"executor": "nx:run-commands",
"options": {
"parallel": false,
"commands": [
"echo 'Github pages require special 404.html'",
"echo 'Read more: https://angular.io/guide/deployment#deploy-to-github-pages'",
"echo ------",
"nx run demo:build:production",
"cp dist/demo/index.html dist/demo/404.html",
"nx run demo:prerender:production"
]
}
},
"prerender": {
"executor": "@nguniversal/builders:prerender",
"options": {
"browserTarget": "demo:build",
"serverTarget": "demo:server:production",
"routesFile": "./apps/demo/routesFile.txt",
"guessRoutes": false
}
},
"server": {
"executor": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/demo/server",
"main": "apps/demo/server.ts",
"tsConfig": "apps/demo/tsconfig.server.json"
},
"configurations": {
"production": {
"outputHashing": "media"
}
},
"defaultConfiguration": "production"
}
}
}
1 change: 1 addition & 0 deletions apps/demo/routesFile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/
74 changes: 74 additions & 0 deletions apps/demo/server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import 'zone.js/node';

Check failure on line 1 in apps/demo/server.ts

View workflow job for this annotation

GitHub Actions / deploy

Run autofix to sort these imports!

import {APP_BASE_HREF} from '@angular/common';
import {ngExpressEngine} from '@nguniversal/express-engine';
import express from 'express';
import {existsSync} from 'node:fs';
import {join} from 'node:path';
import bootstrap from './src/main.server';

// 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/demo');

Check failure on line 13 in apps/demo/server.ts

View workflow job for this annotation

GitHub Actions / deploy

Strings must use backtick
const indexHtml = existsSync(join(distFolder, 'index.original.html'))

Check failure on line 14 in apps/demo/server.ts

View workflow job for this annotation

GitHub Actions / deploy

Strings must use backtick
? 'index.original.html'

Check failure on line 15 in apps/demo/server.ts

View workflow job for this annotation

GitHub Actions / deploy

Strings must use backtick
: 'index';

Check failure on line 16 in apps/demo/server.ts

View workflow job for this annotation

GitHub Actions / deploy

Strings must use backtick

// Our Universal express-engine (found @ https://github.com/angular/universal/tree/main/modules/express-engine)
server.engine(
'html',

Check failure on line 20 in apps/demo/server.ts

View workflow job for this annotation

GitHub Actions / deploy

Strings must use backtick
ngExpressEngine({
bootstrap,
}),
);

server.set('view engine', 'html');

Check failure on line 26 in apps/demo/server.ts

View workflow job for this annotation

GitHub Actions / deploy

Strings must use backtick

Check failure on line 26 in apps/demo/server.ts

View workflow job for this annotation

GitHub Actions / deploy

Strings must use backtick
server.set('views', distFolder);

Check failure on line 27 in apps/demo/server.ts

View workflow job for this annotation

GitHub Actions / deploy

Strings must use backtick

// Example Express Rest API endpoints
// server.get('/api/**', (req, res) => { });

// Serve static files from /browser
server.get(
'*.*',

Check failure on line 34 in apps/demo/server.ts

View workflow job for this annotation

GitHub Actions / deploy

Strings must use backtick
express.static(distFolder, {
maxAge: '1y',
}),
);

// All regular routes use the Universal engine
server.get('*', (req, res) => {
res.render(indexHtml, {
req,
providers: [{provide: APP_BASE_HREF, useValue: req.baseUrl}],
});
});

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}`);
});
}

// Webpack will replace 'require' with '__webpack_require__'
// '__non_webpack_require__' is a proxy to Node 'require'
// The below code is to ensure that the server is run only when not requiring the bundle.
declare const __non_webpack_require__: NodeRequire;
const mainModule = __non_webpack_require__.main;
const moduleFilename = (mainModule && mainModule.filename) || '';
if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
run();
}

export * from './src/main.server';

// fixes prerendering
export default bootstrap;
12 changes: 12 additions & 0 deletions apps/demo/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {CommonModule} from '@angular/common';
import {ChangeDetectionStrategy, Component} from '@angular/core';
import {RouterOutlet} from '@angular/router';

@Component({
standalone: true,
selector: 'app',
template: '<router-outlet></router-outlet>',
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [CommonModule, RouterOutlet],
})
export class AppComponent {}
17 changes: 17 additions & 0 deletions apps/demo/src/app/app.config.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {mergeApplicationConfig, ApplicationConfig} from '@angular/core';
import {provideServerRendering} from '@angular/platform-server';
import {appConfig} from './app.config';

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

export const config = mergeApplicationConfig(appConfig, serverConfig);
17 changes: 17 additions & 0 deletions apps/demo/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {ApplicationConfig, importProvidersFrom} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {
BrowserAnimationsModule,
provideAnimations,
} from '@angular/platform-browser/animations';
import {TuiRootModule} from '@taiga-ui/core';
import {routes} from './app.routes';
import {provideRouter} from '@angular/router';

export const appConfig: ApplicationConfig = {
providers: [
provideAnimations(),
provideRouter(routes),
importProvidersFrom(BrowserModule, BrowserAnimationsModule, TuiRootModule),
],
};
8 changes: 8 additions & 0 deletions apps/demo/src/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {Routes} from '@angular/router';

export const routes: Routes = [
{
path: '',
loadComponent: async () => (await import('./home/home.component')).HomeComponent,
},
];
Loading

0 comments on commit 82631a3

Please sign in to comment.