Skip to content

Commit

Permalink
feat(create-analog): add template for Angular v16 pre-release (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts authored Mar 17, 2023
1 parent 4a1f2b3 commit f7748b1
Show file tree
Hide file tree
Showing 29 changed files with 596 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/create-analog/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Credit for riginal source code adapted from Vite:
Credit for original source code adapted from Vite:

https://github.com/brandonroberts/vite/tree/main/packages/create-vite
5 changes: 5 additions & 0 deletions packages/create-analog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ const APPS = [
name: 'Analog',
color: yellow,
variants: [
{
name: 'angular-v16-prerelease',
display: 'TypeScript',
color: green,
},
{
name: 'angular-v15',
display: 'TypeScript',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true

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

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
"recommendations": ["angular.ng-template"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "ng serve",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: start",
"url": "http://localhost:5173/"
},
{
"name": "ng test",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: test"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "start",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
},
{
"type": "npm",
"script": "test",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
}
]
}
26 changes: 26 additions & 0 deletions packages/create-analog/template-angular-v16-prerelease/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Analog App

This project was generated with [Analog](https://analogjs.org), the fullstack meta-framework for Angular.

## Setup

Run `yarn` to install the application dependencies.

## Development

Run `yarn dev` for a dev server. Navigate to `http://localhost:5173/`. The application will automatically reload if you change any of the source files.

## Build

Run `yarn build` to build the client/server project. The client build artifacts are located in the `dist/client` directory. The server for the API build artifacts are located in the `dist/server` directory.

## Test

Run `yarn 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/)
- Follow us on [Twitter](https://twitter.com/analogjs)
42 changes: 42 additions & 0 deletions packages/create-analog/template-angular-v16-prerelease/_gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

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

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"my-app": {
"projectType": "application",
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@nrwl/vite:build",
"options": {
"configFile": "vite.config.ts",
"outputPath": "dist/client"
},
"defaultConfiguration": "production",
"configurations": {
"development": {
"mode": "development"
},
"production": {
"sourcemap": false,
"mode": "production"
}
}
},
"serve": {
"builder": "@nrwl/vite:dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "my-app:build",
"port": 5173
},
"configurations": {
"development": {
"buildTarget": "my-app:build:development",
"hmr": true
},
"production": {
"buildTarget": "my-app:build:production"
}
}
},
"test": {
"builder": "@nrwl/vite:test",
"options": {
"config": "vite.config.ts"
}
}
}
}
}
}
15 changes: 15 additions & 0 deletions packages/create-analog/template-angular-v16-prerelease/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>MyApp</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="/src/favicon.ico">
<link rel="stylesheet" href="/src/styles.css" />
</head>
<body>
<app-root></app-root>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "my-app",
"version": "0.0.0",
"private": true,
"engines": {
"node": ">=16.0.0"
},
"scripts": {
"dev": "ng serve",
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch",
"test": "ng test"
},
"dependencies": {
"@analogjs/content": "latest",
"@analogjs/router": "latest",
"@angular/animations": "^16.0.0-next.0",
"@angular/common": "^16.0.0-next.0",
"@angular/compiler": "^16.0.0-next.0",
"@angular/core": "^16.0.0-next.0",
"@angular/forms": "^16.0.0-next.0",
"@angular/platform-browser": "^16.0.0-next.0",
"@angular/platform-browser-dynamic": "^16.0.0-next.0",
"@angular/platform-server": "^16.0.0-next.0",
"@angular/router": "^16.0.0-next.0",
"@nrwl/angular": "^15.7.0",
"front-matter": "^4.0.2",
"marked": "^4.2.12",
"prismjs": "^1.29.0",
"rxjs": "~7.5.6",
"tslib": "^2.4.0",
"zone.js": "~0.13.0"
},
"devDependencies": {
"@analogjs/platform": "latest",
"@angular-devkit/build-angular": "^16.0.0-next.0",
"@angular/cli": "~16.0.0-next.0",
"@angular/compiler-cli": "^16.0.0-next.0",
"@nrwl/vite": "^15.7.0",
"nx": "^15.7.0",
"jsdom": "^20.0.0",
"typescript": "~5.0.2",
"vite": "^4.0.3",
"vitest": "^0.25.8"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';

describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [RouterTestingModule, AppComponent],
}).compileComponents();
});

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';

@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet],
template: ` <router-outlet></router-outlet> `,
styles: [
`
:host {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
`,
],
})
export class AppComponent {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-home',
standalone: true,
template: `
<div>
<a href="https://vitejs.dev" target="_blank">
<img src="/vite.svg" class="logo" alt="Vite logo" />
</a>
<a href="https://angular.io/" target="_blank">
<img
alt="Angular Logo"
class="logo angular"
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg=="
/>
</a>
</div>
<h1>Vite + Angular</h1>
<div class="card">
<button type="button" (click)="increment()">Count {{ count }}</button>
</div>
<p>
Check out
<a href="https://github.com/analogjs/analog#readme" target="_blank"
>Analog</a
>, the fullstack meta-framework for Angular powered by Vite!
</p>
<p class="read-the-docs">
Click on the Vite and Angular logos to learn more.
</p>
`,
styles: [
`
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.angular:hover {
filter: drop-shadow(0 0 2em #42b883aa);
}
.read-the-docs {
color: #888;
}
`,
],
})
export default class HomeComponent {
count = 0;

increment() {
this.count++;
}
}
Empty file.
Loading

0 comments on commit f7748b1

Please sign in to comment.