+
Skip to content

fix(create-analog): add minimal template option #1293

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

Merged
merged 1 commit into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion packages/create-analog/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

// @ts-check
import { green, red, reset, yellow } from 'kolorist';
import { blue, green, red, reset, yellow } from 'kolorist';
import minimist from 'minimist';
import { execSync } from 'node:child_process';
import fs, { readdirSync } from 'node:fs';
Expand Down Expand Up @@ -29,6 +29,11 @@ const APPS = [
template: 'blog',
color: yellow,
},
{
name: 'Minimal',
template: 'minimal',
color: blue,
},
],
},
];
Expand Down
1 change: 1 addition & 0 deletions packages/create-analog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"template-angular-v17",
"template-blog",
"template-latest",
"template-minimal",
"files"
],
"main": "index.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
"recommendations": ["angular.ng-template"]
"recommendations": ["angular.ng-template", "analogjs.vscode-analog"]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
"recommendations": ["angular.ng-template"]
"recommendations": ["angular.ng-template", "analogjs.vscode-analog"]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
"recommendations": ["angular.ng-template"]
"recommendations": ["angular.ng-template", "analogjs.vscode-analog"]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
"recommendations": ["angular.ng-template"]
"recommendations": ["angular.ng-template", "analogjs.vscode-analog"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ import { Component, signal } from '@angular/core';
</div>

<p class="read-the-docs">
For guides on how to customize this project, visit the
<a href="https://analogjs.org" target="_blank">Analog documentation</a>
<a href="https://analogjs.org" target="_blank">Docs</a> |
<a href="https://github.com/analogjs/analog" target="_blank">GitHub</a> |
<a href="https://github.com/sponsors/brandonroberts" target="_blank"
>Sponsor</a
>
</p>
`,
styles: [
Expand All @@ -31,8 +34,8 @@ import { Component, signal } from '@angular/core';
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.read-the-docs {
color: #888;
.read-the-docs > * {
color: #fff;
}
`,
],
Expand Down
16 changes: 16 additions & 0 deletions packages/create-analog/template-minimal/.editorconfig
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", "analogjs.vscode-analog"]
}
13 changes: 13 additions & 0 deletions packages/create-analog/template-minimal/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
// 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/"
}
]
}
24 changes: 24 additions & 0 deletions packages/create-analog/template-minimal/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
// 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"
}
}
}
}
]
}
22 changes: 22 additions & 0 deletions packages/create-analog/template-minimal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Analog App

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

## Setup

Run `npm install` to install the application dependencies.

## Development

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

## Build

Run `npm run build` to build the client/server project. The client build artifacts are located in the `dist/analog/public` directory. The server for the API build artifacts are located in the `dist/analog/server` directory.

## Community

- Visit and Star the [GitHub Repo](https://github.com/analogjs/analog)
- Join the [Discord](https://chat.analogjs.org)
- Follow us on [Twitter](https://twitter.com/analogjs)
- Become a [Sponsor](https://github.com/sponsors/brandonroberts)
44 changes: 44 additions & 0 deletions packages/create-analog/template-minimal/_gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 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
/.nx/cache
/.nx/workspace-data
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db
51 changes: 51 additions & 0 deletions packages/create-analog/template-minimal/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$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": "@analogjs/platform:vite",
"options": {
"configFile": "vite.config.ts",
"main": "src/main.ts",
"outputPath": "dist/client",
"tsConfig": "tsconfig.app.json"
},
"defaultConfiguration": "production",
"configurations": {
"development": {
"mode": "development"
},
"production": {
"sourcemap": false,
"mode": "production"
}
}
},
"serve": {
"builder": "@analogjs/platform: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"
}
}
}
}
}
}
}
15 changes: 15 additions & 0 deletions packages/create-analog/template-minimal/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>My App</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="stylesheet" href="/src/styles.css" />
</head>
<body>
<app-root></app-root>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
49 changes: 49 additions & 0 deletions packages/create-analog/template-minimal/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "my-app",
"version": "0.0.0",
"type": "module",
"engines": {
"node": ">=18.19.1"
},
"scripts": {
"ng": "ng",
"dev": "ng serve",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@analogjs/content": "^1.7.3-beta.1",
"@analogjs/router": "^1.7.3-beta.1",
"@angular/animations": "^18.0.0",
"@angular/common": "^18.0.0",
"@angular/compiler": "^18.0.0",
"@angular/core": "^18.0.0",
"@angular/forms": "^18.0.0",
"@angular/platform-browser": "^18.0.0",
"@angular/platform-browser-dynamic": "^18.0.0",
"@angular/platform-server": "^18.0.0",
"@angular/router": "^18.0.0",
"front-matter": "^4.0.2",
"marked": "^5.0.2",
"marked-gfm-heading-id": "^3.1.0",
"marked-highlight": "^2.0.1",
"marked-mangle": "^1.1.7",
"prismjs": "^1.29.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.3"
},
"devDependencies": {
"@analogjs/platform": "^1.7.3-beta.1",
"@analogjs/vite-plugin-angular": "^1.7.3-beta.1",
"@analogjs/vitest-angular": "^1.7.3-beta.1",
"@angular-devkit/build-angular": "^18.0.0",
"@angular/cli": "^18.0.0",
"@angular/compiler-cli": "^18.0.0",
"typescript": "~5.4.2",
"vite": "^5.0.0"
}
}
Empty file.
Binary file not shown.
10 changes: 10 additions & 0 deletions packages/create-analog/template-minimal/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';

@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet],
template: `<router-outlet></router-outlet>`,
})
export class AppComponent {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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);
20 changes: 20 additions & 0 deletions packages/create-analog/template-minimal/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {
provideHttpClient,
withFetch,
withInterceptors,
} from '@angular/common/http';
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
import { provideClientHydration } from '@angular/platform-browser';
import { provideFileRouter, requestContextInterceptor } from '@analogjs/router';

export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({ eventCoalescing: true }),
provideFileRouter(),
provideHttpClient(
withFetch(),
withInterceptors([requestContextInterceptor])
),
provideClientHydration(),
],
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-home',
standalone: true,
template: `
<h2>Analog</h2>

<h3>The fullstack meta-framework for Angular!</h3>

<p>
<a href="https://analogjs.org" target="_blank">Docs</a> |
<a href="https://github.com/analogjs/analog" target="_blank">GitHub</a> |
<a href="https://github.com/sponsors/brandonroberts" target="_blank"
>Sponsor</a
>
</p>
`,
styles: `
:host {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
`,
})
export default class HomeComponent {}
Loading
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载