Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(create-analog): add template for Angular v17 pre-release #736

Merged
merged 2 commits into from
Oct 30, 2023
Merged
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
8 changes: 4 additions & 4 deletions packages/create-analog/__tests__/cli.spec.ts
Original file line number Diff line number Diff line change
@@ -26,8 +26,8 @@ const createNonEmptyDir = () => {
writeFileSync(pkgJson, '{ "foo": "bar" }');
};

// Angular 15 starter template
let templateFiles = readdirSync(join(CLI_PATH, 'template-angular-v15'));
// Angular v16 starter template
let templateFiles = readdirSync(join(CLI_PATH, 'template-angular-v16'));
templateFiles.push('.git');
// _gitignore is renamed to .gitignore
templateFiles = templateFiles
@@ -84,7 +84,7 @@ test('asks to overwrite non-empty current directory', () => {

test('successfully scaffolds a project based on angular starter template', () => {
const { stdout } = run(
[projectName, '--template', 'angular-v15', '--skipTailwind'],
[projectName, '--template', 'angular-v16', '--skipTailwind'],
{
cwd: __dirname,
}
@@ -97,7 +97,7 @@ test('successfully scaffolds a project based on angular starter template', () =>
});

test('works with the -t alias', () => {
const { stdout } = run([projectName, '-t', 'angular-v15', '--skipTailwind'], {
const { stdout } = run([projectName, '-t', 'angular-v16', '--skipTailwind'], {
cwd: __dirname,
});
const generatedFiles = readdirSync(genPath).sort();
4 changes: 2 additions & 2 deletions packages/create-analog/index.js
Original file line number Diff line number Diff line change
@@ -20,12 +20,12 @@ const APPS = [
color: yellow,
variants: [
{
name: 'angular-v16',
name: 'angular-v17-prerelease',
display: 'TypeScript',
color: green,
},
{
name: 'angular-v15',
name: 'angular-v16',
display: 'TypeScript',
color: green,
},
49 changes: 0 additions & 49 deletions packages/create-analog/template-angular-v15/package.json

This file was deleted.

This file was deleted.

26 changes: 0 additions & 26 deletions packages/create-analog/template-angular-v15/src/main.server.ts

This file was deleted.

10 changes: 0 additions & 10 deletions packages/create-analog/template-angular-v15/src/main.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -20,8 +20,7 @@ Run `npm run test` to run unit tests with [Vitest](https://vitest.dev).

## Community

- Join the [Discord](https://discord.gg/mKC2Ec48U5)
- Visit and Star the [GitHub Repo](https://github.com/analogjs/analog)
- Visit the [Website](https://analogjs.org/)
- Join the [Discord](https://chat.analogjs.org)
- Follow us on [Twitter](https://twitter.com/analogjs)
- Become a [Sponsor](https://github.com/sponsors/brandonroberts)
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@ yarn-error.log

# Miscellaneous
/.angular/cache
/.nx/cache
.sass-cache/
/connect.lock
/coverage
Original file line number Diff line number Diff line change
@@ -10,11 +10,12 @@
"prefix": "app",
"architect": {
"build": {
"builder": "@nrwl/vite:build",
"builder": "@analogjs/platform:vite",
"options": {
"configFile": "vite.config.ts",
"main": "src/main.ts",
"outputPath": "dist/client"
"outputPath": "dist/client",
"tsConfig": "tsconfig.app.json"
},
"defaultConfiguration": "production",
"configurations": {
@@ -28,7 +29,7 @@
}
},
"serve": {
"builder": "@nrwl/vite:dev-server",
"builder": "@analogjs/platform:vite-dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "my-app:build",
@@ -45,7 +46,7 @@
}
},
"test": {
"builder": "@nrwl/vite:test"
"builder": "@analogjs/platform:vitest"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "my-app",
"version": "0.0.0",
"private": true,
"engines": {
"node": ">=18.13.0"
},
"scripts": {
"dev": "ng serve",
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch",
"test": "ng test"
},
"dependencies": {
"@analogjs/content": "^0.2.0",
"@analogjs/router": "^0.2.0",
"@angular/animations": "^17.0.0-rc.0",
"@angular/common": "^17.0.0-rc.0",
"@angular/compiler": "^17.0.0-rc.0",
"@angular/core": "^17.0.0-rc.0",
"@angular/forms": "^17.0.0-rc.0",
"@angular/platform-browser": "^17.0.0-rc.0",
"@angular/platform-browser-dynamic": "^17.0.0-rc.0",
"@angular/platform-server": "^17.0.0-rc.0",
"@angular/router": "^17.0.0-rc.0",
"@nx/angular": "^17.0.0",
"front-matter": "^4.0.2",
"marked": "^5.0.2",
"marked-gfm-heading-id": "^3.1.0",
"marked-highlight": "^2.0.1",
"mermaid": "^10.2.4",
"prismjs": "^1.29.0",
"rxjs": "~7.5.6",
"tslib": "^2.4.0",
"zone.js": "~0.14.0"
},
"devDependencies": {
"@analogjs/platform": "^0.2.0",
"@angular-devkit/build-angular": "^17.0.0-rc.0",
"@angular/cli": "^17.0.0-rc.0",
"@angular/compiler-cli": "^17.0.0-rc.0",
"@nx/vite": "~16.8.1",
"nx": "^17.0.0",
"jsdom": "^22.1.0",
"typescript": "~5.2.0",
"vite": "^4.4.8",
"vitest": "^0.32.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';

import { AppComponent } from './app.component';

describe('AppComponent', () => {
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
import {
provideServerRendering,
ɵSERVER_CONTEXT as SERVER_CONTEXT,
} from '@angular/platform-server';

import { appConfig } from './app.config';

const serverConfig: ApplicationConfig = {
providers: [
provideServerRendering(),
{ provide: SERVER_CONTEXT, useValue: 'ssr-analog' },
],
};

export const config = mergeApplicationConfig(appConfig, serverConfig);
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { provideHttpClient, withFetch } from '@angular/common/http';
import { ApplicationConfig } from '@angular/core';
import { provideClientHydration } from '@angular/platform-browser';
import { provideFileRouter } from '@analogjs/router';

export const appConfig: ApplicationConfig = {
providers: [
provideFileRouter(),
provideHttpClient(withFetch()),
provideClientHydration(),
],
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import 'zone.js/node';
import { enableProdMode } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import { renderApplication } from '@angular/platform-server';

import { config } from './app/app.config.server';
import { AppComponent } from './app/app.component';

if (import.meta.env.PROD) {
enableProdMode();
}

export function bootstrap() {
return bootstrapApplication(AppComponent, config);
}

export default async function render(url: string, document: string) {
const html = await renderApplication(bootstrap, {
document,
url,
});

return html;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import 'zone.js';
import { bootstrapApplication } from '@angular/platform-browser';

import { AppComponent } from './app/app.component';
import { appConfig } from './app/app.config';

bootstrapApplication(AppComponent, appConfig);