Skip to content

Commit

Permalink
feat(create-analog): update Angular v15 template to use @nrwl/vite pa…
Browse files Browse the repository at this point in the history
…ckage (#168)
  • Loading branch information
brandonroberts committed Dec 5, 2022
1 parent 017b110 commit 73b6180
Show file tree
Hide file tree
Showing 13 changed files with 98 additions and 109 deletions.
3 changes: 1 addition & 2 deletions apps/analog-app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@
"hmr": true
},
"production": {
"buildTarget": "analog-app:build:production",
"hmr": false
"buildTarget": "analog-app:build:production"
}
}
},
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@nrwl/linter": "15.2.1",
"@nrwl/vite": "15.2.1",
"@nrwl/workspace": "15.2.1",
"@nx-plus/docusaurus": "14.1.0",
"@nx-plus/docusaurus": "15.0.0-rc.0",
"@swc/helpers": "^0.4.13",
"@types/jest": "29.1.2",
"@types/node": "18.8.4",
Expand Down Expand Up @@ -101,8 +101,8 @@
"ts-jest": "29.0.3",
"ts-node": "10.9.1",
"typescript": "4.8.4",
"vite": "^3.1.7",
"vitest": "^0.24.1",
"vite": "^3.2.3",
"vitest": "^0.25.1",
"webpack-bundle-analyzer": "^4.6.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
"configurations": [
{
"name": "ng serve",
"type": "pwa-chrome",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: start",
"url": "http://localhost:4200/"
"url": "http://localhost:5173/"
},
{
"name": "ng test",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: test",
"url": "http://localhost:9876/debug.html"
"preLaunchTask": "npm: test"
}
]
}
4 changes: 2 additions & 2 deletions packages/create-analog/template-angular-v15/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Analog App

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

## Setup

Expand All @@ -12,7 +12,7 @@ Run `yarn dev` for a dev server. Navigate to `http://localhost:5173/`. The appli

## Build

Run `yarn build` to build the project. The build artifacts will be stored in the `dist/` directory.
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

Expand Down
39 changes: 37 additions & 2 deletions packages/create-analog/template-angular-v15/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,47 @@
"projects": {
"my-app": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"targets": {}
"build": {
"builder": "@nrwl/vite:build",
"options": {
"configFile": "vite.config.ts",
"outputPath": "dist/client"
},
"defaultConfiguration": "production",
"configurations": {
"development": {},
"production": {
"sourcemap": false
}
}
},
"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"
}
}
}
}
}
Expand Down
15 changes: 8 additions & 7 deletions packages/create-analog/template-angular-v15/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"node": ">=16.0.0"
},
"scripts": {
"dev": "vite",
"dev": "ng serve",
"ng": "ng",
"start": "npm run dev",
"build": "vite build",
"watch": "vite build --watch",
"test": "vitest"
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch",
"test": "ng test"
},
"dependencies": {
"@analogjs/router": "latest",
Expand All @@ -32,9 +32,10 @@
"@angular-devkit/build-angular": "^15.0.0",
"@angular/cli": "~15.0.0",
"@angular/compiler-cli": "^15.0.0",
"@nrwl/vite": "^15.2.0",
"jsdom": "^20.0.0",
"typescript": "~4.8.4",
"vite": "^3.0.9",
"vitest": "^0.22.1"
"vite": "^3.2.3",
"vitest": "^0.25.1"
}
}
4 changes: 2 additions & 2 deletions packages/create-analog/template-angular-v15/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<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="/styles.css" />
<link rel="stylesheet" href="/src/styles.css" />
</head>
<body>
<app-root></app-root>
<script type="module" src="/main.ts"></script>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion packages/create-analog/template-angular-v15/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './polyfills';
import 'zone.js';
import { bootstrapApplication } from '@angular/platform-browser';
import { provideFileRouter } from '@analogjs/router';

Expand Down
52 changes: 0 additions & 52 deletions packages/create-analog/template-angular-v15/src/polyfills.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"outDir": "./out-tsc/app",
"types": []
},
"files": ["src/main.ts", "src/polyfills.ts"],
"files": ["src/main.ts"],
"include": ["src/**/*.d.ts", "src/app/routes/**/*.ts"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"outDir": "./out-tsc/spec",
"types": ["node", "vitest/globals"]
},
"files": ["src/test.ts", "src/polyfills.ts"],
"files": ["src/test.ts"],
"include": ["src/**/*.spec.ts", "src/**/*.ts"]
}
15 changes: 3 additions & 12 deletions packages/create-analog/template-angular-v15/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@ import analog from '@analogjs/platform';

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
root: 'src',
publicDir: 'assets',
optimizeDeps: {
exclude: ['@analogjs/router'],
},
publicDir: 'src/assets',
build: {
outDir: `../dist/my-app/client`,
emptyOutDir: true,
target: 'es2022',
target: ['es2020'],
},
resolve: {
mainFields: ['module'],
Expand All @@ -22,11 +16,8 @@ export default defineConfig(({ mode }) => ({
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['test.ts'],
setupFiles: ['src/test.ts'],
include: ['**/*.spec.ts'],
cache: {
dir: `../node_modules/.vitest`,
},
},
define: {
'import.meta.vitest': mode !== 'production',
Expand Down
56 changes: 36 additions & 20 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3343,14 +3343,15 @@
semver "7.3.4"
tslib "^2.3.0"

"@nrwl/devkit@^14.3.6":
version "14.8.3"
resolved "https://registry.yarnpkg.com/@nrwl/devkit/-/devkit-14.8.3.tgz#c73230d48970f34257e59c820a86920d66380d82"
integrity sha512-jEH+oKS4F4MJvoIe0Zw6zUODO2j2ib7f+62D4lMDKl5qopcgnKyU9rVnSCDolqCH81j326dfr8b7FfE6Z7p71A==
"@nrwl/devkit@^15.0.0":
version "15.2.4"
resolved "https://registry.yarnpkg.com/@nrwl/devkit/-/devkit-15.2.4.tgz#ffcb69f462df19d3d282cf25bf346926ee23f141"
integrity sha512-5JZWB4ydnu+NKNIfj958nML8AWwhareQ+Q1hLXoOIS/7brqfALNP3y/Ef1ljrLIo1f3xc484TPclqwSH7aRdvQ==
dependencies:
"@phenomnomnominal/tsquery" "4.1.1"
ejs "^3.1.7"
ignore "^5.0.4"
semver "7.3.4"
tslib "^2.3.0"

"@nrwl/eslint-plugin-nx@15.2.1":
Expand Down Expand Up @@ -3529,12 +3530,12 @@
yargs "^17.6.2"
yargs-parser "21.1.1"

"@nx-plus/docusaurus@14.1.0":
version "14.1.0"
resolved "https://registry.yarnpkg.com/@nx-plus/docusaurus/-/docusaurus-14.1.0.tgz#0d919aada8cd94b986fc74e8dc604ba06491dbdc"
integrity sha512-EjzaOm8GCpyADKn4G19AgZk/l8F5eyNCVN1oFki7KUPaig9N9IjRCEmUQtHuomGbCQRqHtpovEPJldCLRz4glw==
"@nx-plus/docusaurus@15.0.0-rc.0":
version "15.0.0-rc.0"
resolved "https://registry.yarnpkg.com/@nx-plus/docusaurus/-/docusaurus-15.0.0-rc.0.tgz#3233637ed3678d7be491ee3c2f9fb3c6ca407f25"
integrity sha512-GmoYHKljQJvJLSYhWBe+huStwJbm+RbK+lC2j2sA+ZCUdkUo+P2Yv5oQGbqWU4jXclYe8pOP/qVFJs3j3Zjw/Q==
dependencies:
"@nrwl/devkit" "^14.3.6"
"@nrwl/devkit" "^15.0.0"

"@parcel/watcher@2.0.4":
version "2.0.4"
Expand Down Expand Up @@ -4677,7 +4678,7 @@ acorn-jsx@^5.3.2:
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937"
integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==

acorn-walk@^8.0.0, acorn-walk@^8.0.2, acorn-walk@^8.1.1:
acorn-walk@^8.0.0, acorn-walk@^8.0.2, acorn-walk@^8.1.1, acorn-walk@^8.2.0:
version "8.2.0"
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1"
integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==
Expand Down Expand Up @@ -16721,10 +16722,10 @@ tiny-warning@^1.0.0:
resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754"
integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==

tinybench@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/tinybench/-/tinybench-2.3.0.tgz#febb2e697c735c0cdb8eb1e43cb1d2fa1821f983"
integrity sha512-zs1gMVBwyyG2QbVchYIbnabRhMOCGvrwZz/q+SV+LIMa9q5YDQZi2kkI6ZRqV2Bz7ba1uvrc7ieUoE4KWnGeKg==
tinybench@^2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/tinybench/-/tinybench-2.3.1.tgz#14f64e6b77d7ef0b1f6ab850c7a808c6760b414d"
integrity sha512-hGYWYBMPr7p4g5IarQE7XhlyWveh1EKhy4wUBS1LrHXCKYgvz+4/jCqgmJqZxxldesn05vccrtME2RLLZNW7iA==

tinypool@^0.3.0:
version "0.3.0"
Expand Down Expand Up @@ -17642,7 +17643,7 @@ vfile@^5.0.0, vfile@^5.3.2:
unist-util-stringify-position "^3.0.0"
vfile-message "^3.0.0"

vite@^3.0.0, vite@^3.1.7:
vite@^3.0.0:
version "3.1.7"
resolved "https://registry.yarnpkg.com/vite/-/vite-3.1.7.tgz#9fc2b57a395f79175d38fa3cffd15080b0d9cbfc"
integrity sha512-5vCAmU4S8lyVdFCInu9M54f/g8qbOMakVw5xJ4pjoaDy5wgy9sLLZkGdSLN52dlsBqh0tBqxjaqqa8LgPqwRAA==
Expand All @@ -17654,6 +17655,18 @@ vite@^3.0.0, vite@^3.1.7:
optionalDependencies:
fsevents "~2.3.2"

vite@^3.2.3:
version "3.2.5"
resolved "https://registry.yarnpkg.com/vite/-/vite-3.2.5.tgz#dee5678172a8a0ab3e547ad4148c3d547f90e86a"
integrity sha512-4mVEpXpSOgrssFZAOmGIr85wPHKvaDAcXqxVxVRZhljkJOMZi1ibLibzjLHzJvcok8BMguLc7g1W6W/GqZbLdQ==
dependencies:
esbuild "^0.15.9"
postcss "^8.4.18"
resolve "^1.22.1"
rollup "^2.79.1"
optionalDependencies:
fsevents "~2.3.2"

vite@~3.2.4:
version "3.2.4"
resolved "https://registry.yarnpkg.com/vite/-/vite-3.2.4.tgz#d8c7892dd4268064e04fffbe7d866207dd24166e"
Expand All @@ -17671,19 +17684,22 @@ vitefu@^0.2.1:
resolved "https://registry.yarnpkg.com/vitefu/-/vitefu-0.2.2.tgz#d03215f351a1fd65f6c277d546f2d30956b970f9"
integrity sha512-8CKEIWPm4B4DUDN+h+hVJa9pyNi7rzc5MYmbxhs1wcMakueGFNWB5/DL30USm9qU3xUPnL4/rrLEAwwFiD1tag==

vitest@^0.24.1:
version "0.24.1"
resolved "https://registry.yarnpkg.com/vitest/-/vitest-0.24.1.tgz#4b4ceb3d9c6710e8fb7a3b936b740f9c9f9cde10"
integrity sha512-NKkK1xnDIOOr42pKBfGQQl6b6IWdFVBpG6ZS1T+nUlJuqcOiZ7lxjVwHy9wrtTYpJ0BWww9y6bSGYXubD29Nag==
vitest@^0.25.1:
version "0.25.3"
resolved "https://registry.yarnpkg.com/vitest/-/vitest-0.25.3.tgz#4e5ed481e4da6a0ce014bdb71dfc9661fd62b722"
integrity sha512-/UzHfXIKsELZhL7OaM2xFlRF8HRZgAHtPctacvNK8H4vOcbJJAMEgbWNGSAK7Y9b1NBe5SeM7VTuz2RsTHFJJA==
dependencies:
"@types/chai" "^4.3.3"
"@types/chai-subset" "^1.3.3"
"@types/node" "*"
acorn "^8.8.0"
acorn-walk "^8.2.0"
chai "^4.3.6"
debug "^4.3.4"
local-pkg "^0.4.2"
source-map "^0.6.1"
strip-literal "^0.4.2"
tinybench "^2.3.0"
tinybench "^2.3.1"
tinypool "^0.3.0"
tinyspy "^1.0.2"
vite "^3.0.0"
Expand Down

0 comments on commit 73b6180

Please sign in to comment.