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

chore: repository DX improvments #437

Merged
merged 5 commits into from
May 27, 2023
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
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@ jobs:
failOnWarnings: true
helpURL: https://github.com/analogjs/analog/blob/main/CONTRIBUTING.md#-commit-message-guidelines

prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version-file: .node-version
- run: corepack enable
- run: pnpm --version
- uses: actions/setup-node@v3
with:
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
- name: Install
run: pnpm install --frozen-lockfile --prefer-offline

- name: Validate
run: pnpm exec prettier --check .

build:
runs-on: ubuntu-latest
steps:
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ name: publish to NPM
on:
push:
tags:
- "astro-angular@*"
- "content@*"
- "create-analog@*"
- "platform@*"
- "router@*"
- "vite-plugin-angular@*"
- 'astro-angular@*'
- 'content@*'
- 'create-analog@*'
- 'platform@*'
- 'router@*'
- 'vite-plugin-angular@*'
# new package here

jobs:
publish:
runs-on: ubuntu-latest
steps:

# We want to get the tag name without the @version suffix, this is our
# package name i.e. astro-angular@0.0.1 -> astro-angular, this based on
# the trigger tags above.
Expand Down Expand Up @@ -47,8 +46,8 @@ jobs:
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "dist/packages/${{ steps.get-tag-name.outputs.result }}/*.*"
bodyFile: "packages/${{ steps.get-tag-name.outputs.result }}/CHANGELOG.md"
artifacts: 'dist/packages/${{ steps.get-tag-name.outputs.result }}/*.*'
bodyFile: 'packages/${{ steps.get-tag-name.outputs.result }}/CHANGELOG.md'

- name: npm publish
run: npm publish dist/packages/${{ steps.get-tag-name.outputs.result }} --access public
Expand Down
2 changes: 1 addition & 1 deletion .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"*.{js,ts,css,scss,json,md}": "prettier --write"
"*.{js,ts,css,scss,html,json,md}": "prettier --write"
}
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/coverage
.prettierignore
.docusaurus/
pnpm-lock.yaml
22 changes: 11 additions & 11 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand Down Expand Up @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
Expand Down
64 changes: 31 additions & 33 deletions apps/analog-app/src/app/cart.service.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Product } from './products';

@Injectable({
providedIn: 'root'
})
export class CartService {
items: Product[] = [];

constructor(
private http: HttpClient
) {}

addToCart(product: Product) {
this.items.push(product);
}

getItems() {
return this.items;
}

clearCart() {
this.items = [];
return this.items;
}

getShippingPrices() {
return this.http.get<{type: string, price: number}[]>('/assets/shipping.json');
}
}


import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Product } from './products';

@Injectable({
providedIn: 'root',
})
export class CartService {
items: Product[] = [];

constructor(private http: HttpClient) {}

addToCart(product: Product) {
this.items.push(product);
}

getItems() {
return this.items;
}

clearCart() {
this.items = [];
return this.items;
}

getShippingPrices() {
return this.http.get<{ type: string; price: number }[]>(
'/assets/shipping.json'
);
}
}
2 changes: 1 addition & 1 deletion apps/analog-app/src/app/routes/shipping/shipping.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ <h3>Shipping Prices</h3>
<div class="shipping-item" *ngFor="let shipping of shippingCosts | async">
<span>{{ shipping.type }}</span>
<span>{{ shipping.price | currency }}</span>
</div>
</div>
4 changes: 1 addition & 3 deletions apps/analog-app/src/public/assets/shipping.json
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
[

]
[]
10 changes: 2 additions & 8 deletions apps/analog-app/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
"outDir": "../../dist/out-tsc",
"types": ["node", "vitest/globals"]
},
"files": [
"src/test-setup.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.spec.ts",
"**/*.d.ts"
]
"files": ["src/test-setup.ts", "src/polyfills.ts"],
"include": ["src/**/*.spec.ts", "**/*.d.ts"]
}
7 changes: 3 additions & 4 deletions apps/blog-app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="/src/favicon.ico" />
<link
href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet"
href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet"
/>
<link href="/src/styles.css"
rel="stylesheet" />
<link href="/src/styles.css" rel="stylesheet" />
</head>
<body>
<blog-root></blog-root>
Expand Down
12 changes: 6 additions & 6 deletions apps/docs-app/docs/features/server/server-side-rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export default defineConfig(({ mode }) => ({

## Prerendering routes

With SSR, the `"/"` route is prerendered by default.
With SSR, the `"/"` route is prerendered by default.

It is a necessary step to return a rendered HTML when the user visits the root of the application. The prerendered routes can be customized, but keep in mind to include the `"/"` route also.
It is a necessary step to return a rendered HTML when the user visits the root of the application. The prerendered routes can be customized, but keep in mind to include the `"/"` route also.

```js
import { defineConfig } from 'vite';
Expand All @@ -55,11 +55,11 @@ import analog from '@analogjs/platform';
export default defineConfig(({ mode }) => ({
// ...other config
plugins: [
analog({
analog({
prerender: {
routes: ['/', '/about']
}
})
routes: ['/', '/about'],
},
}),
],
}));
```
Expand Down
2 changes: 0 additions & 2 deletions apps/docs-app/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ By default, Analog comes with [Server-Side Rendering](/docs/features/server/serv
Client artifacts are located in the `dist/analog/public` directory.
The server for the API/SSR build artifacts is located in the `dist/analog/server` directory.


</TabItem>
</Tabs>

Expand Down Expand Up @@ -164,6 +163,5 @@ By default, Analog comes with [Server-Side Rendering](/docs/features/server/serv
In the common apps/libs workspace layout, the `analog-app`'s client artifacts are located in the `dist/apps/analog-app/analog/public` directory.
The server for the API/SSR build artifacts is located in the `dist/apps/analog-app/analog/server` directory.


</TabItem>
</Tabs>
4 changes: 2 additions & 2 deletions apps/docs-app/src/components/HomepageFeatures/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const FeatureList: FeatureItem[] = [
Svg: require('@site/static/img/logos/analog-logo.svg').default,
description: (
<>
Analog uses file-based routing and supports API (server)
routes for Angular applications.
Analog uses file-based routing and supports API (server) routes for
Angular applications.
</>
),
},
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"contributors:add": "all-contributors add",
"contributors:generate": "all-contributors generate",
"hook:commit-msg": "npx --no -- commitlint --edit $1",
"hook:pre-commit": "lint-staged"
"hook:pre-commit": "lint-staged",
"prettify": "prettier --write ."
},
"engines": {
"node": "^16.14.0 || >=18.10.0",
Expand Down
7 changes: 2 additions & 5 deletions packages/create-analog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<a name="0.0.1"></a>
## 0.0.1 (2022-06-25)

## 0.0.1 (2022-06-25)

### Features

* add v14 templates, README, docs updates ([300de6e](https://github.com/brandonroberts/create-vite/commit/300de6e))



- add v14 templates, README, docs updates ([300de6e](https://github.com/brandonroberts/create-vite/commit/300de6e))
4 changes: 1 addition & 3 deletions packages/create-analog/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
"targets": {
"build": {
"executor": "nx:run-commands",
"outputs": [
"{options.outputPath}"
],
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/create-analog",
"command": "cpy packages/create-analog/* !packages/create-analog/node_modules/ !packages/create-analog/project.json !packages/create-analog/__tests__/ !packages/create-analog/yarn.lock dist/"
Expand Down
26 changes: 13 additions & 13 deletions packages/create-analog/template-angular-v15/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<!doctype html>
<!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="/favicon.ico">
<link rel="stylesheet" href="/src/styles.css" />
</head>
<body>
<app-root></app-root>
<script type="module" src="/src/main.ts"></script>
</body>
<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="/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
Expand Up @@ -16,7 +16,10 @@ export default async function render(url: string, document: string) {
appId: 'analog-app',
document,
url,
providers: [provideFileRouter(withEnabledBlockingInitialNavigation()), ...mainProviders],
providers: [
provideFileRouter(withEnabledBlockingInitialNavigation()),
...mainProviders,
],
});

return html;
Expand Down
26 changes: 13 additions & 13 deletions packages/create-analog/template-angular-v16/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<!doctype html>
<!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="/favicon.ico">
<link rel="stylesheet" href="/src/styles.css" />
</head>
<body>
<app-root></app-root>
<script type="module" src="/src/main.ts"></script>
</body>
<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="/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>
2 changes: 1 addition & 1 deletion packages/vite-plugin-angular/setup-vitest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,4 @@ const bindTest = (originalVitestFn: {

return originalvitestFn.apply(this, args);
};
});
});
2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
packages:
- 'apps/**'
- 'libs/**'
- 'libs/**'
Loading