Skip to content

Commit

Permalink
feat: update template application to use platform and router packages (
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts committed Nov 16, 2022
1 parent cbc0264 commit c4f1619
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 22 deletions.
3 changes: 2 additions & 1 deletion packages/create-analog/template-angular-v14/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"test": "vitest"
},
"dependencies": {
"@analogjs/router": "latest",
"@angular/animations": "^14.0.0",
"@angular/common": "^14.0.0",
"@angular/compiler": "^14.0.0",
Expand All @@ -27,7 +28,7 @@
"zone.js": "~0.11.8"
},
"devDependencies": {
"@analogjs/vite-plugin-angular": "latest",
"@analogjs/platform": "latest",
"@angular-devkit/build-angular": "^14.0.3",
"@angular/cli": "~14.0.3",
"@angular/compiler-cli": "^14.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"types": []
},
"files": ["src/main.ts", "src/polyfills.ts"],
"include": ["src/**/*.d.ts"]
"include": ["src/**/*.d.ts", "src/app/routes/**/*.ts"]
}
6 changes: 3 additions & 3 deletions packages/create-analog/template-angular-v14/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/// <reference types="vitest" />

import { defineConfig } from 'vite';
import angular from '@analogjs/vite-plugin-angular';
import analog from '@analogjs/platform';

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
root: 'src',
publicDir: 'assets',
build: {
outDir: `../dist/my-app`,
outDir: `../dist/my-app/client`,
emptyOutDir: true,
target: 'es2020',
},
resolve: {
mainFields: ['module'],
},
plugins: [angular()],
plugins: [analog()],
test: {
globals: true,
environment: 'jsdom',
Expand Down
12 changes: 3 additions & 9 deletions packages/platform/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# analog-platform
# Analog

This library was generated with [Nx](https://nx.dev).
The fullstack meta-framework for Angular

## Building

Run `nx build analog-platform` to build the library.

## Running unit tests

Run `nx test analog-platform` to execute the unit tests via [Jest](https://jestjs.io).
Learn more at [analogjs.org](https://analogjs.org)
28 changes: 26 additions & 2 deletions packages/platform/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
{
"name": "@analogjs/platform",
"version": "0.1.0-alpha.0",
"version": "0.1.0-beta.0",
"type": "commonjs",
"description": "The fullstack meta-framework for Angular",
"author": "Brandon Roberts <robertsbt@gmail.com>",
"exports": {
".": "./src/index.js",
"./package.json": "./package.json"
},
"keywords": [
"angular",
"vite",
"plugin-vite",
"meta-framework"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/analogjs/analog/issues"
},
"homepage": "https://analogjs.org",
"repository": {
"type": "git",
"url": "https://github.com/analogjs/analog.git"
},
"dependencies": {
"nitropack": "^0.6.1"
},
"peerDependencies": {
"nitropack": "^0.5.4"
"@analogjs/vite-plugin-angular": "latest"
}
}
3 changes: 2 additions & 1 deletion packages/platform/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"outputPath": "node_modules/@analogjs/platform",
"main": "packages/platform/src/index.ts",
"tsConfig": "packages/platform/tsconfig.lib.json",
"assets": ["packages/platform/*.md"]
"assets": ["packages/platform/*.md"],
"updateBuildableProjectDepsInPackageJson": false
},
"configurations": {
"production": {
Expand Down
1 change: 1 addition & 0 deletions packages/platform/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { platformPlugin } from './lib/platform-plugin';

export { Options } from './lib/options';
export default platformPlugin;
8 changes: 6 additions & 2 deletions packages/platform/src/lib/platform-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { Plugin } from 'vite';
import angular from '@analogjs/vite-plugin-angular';

import { Options } from './options';
import { viteNitroPlugin } from './vite-nitro-plugin';
import { routerPlugin } from './router-plugin';

export function platformPlugin(opts?: Options): Plugin[] {
return [viteNitroPlugin(opts?.nitro), ...angular(opts?.vite)];
return [
viteNitroPlugin(opts?.nitro),
...angular(opts?.vite),
...routerPlugin(),
];
}
File renamed without changes.
9 changes: 8 additions & 1 deletion packages/platform/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
"compilerOptions": {
"module": "commonjs",
"outDir": "../../dist/out-tsc",
"inlineSourceMap": true,
"sourceMap": false,
"declaration": true,
"types": []
},
"include": ["**/*.ts"],
"exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"]
"exclude": [
"vite.config.ts",
"**/*.spec.ts",
"**/*.test.ts",
"src/test-setup.ts"
]
}
2 changes: 0 additions & 2 deletions packages/vite-plugin-angular/src/lib/angular-vite-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
resolveTemplateUrl,
} from './component-resolvers';
import { componentAssetsPlugin } from './component-assets-plugin';
import { routerPlugin } from './router-plugin';

export interface PluginOptions {
tsconfig?: string;
Expand Down Expand Up @@ -361,7 +360,6 @@ export function angular(options?: PluginOptions): Plugin[] {
},
},
...componentAssetsPlugin(pluginOptions.inlineStylesExtension),
...routerPlugin(),
];

function setupCompilation() {
Expand Down

0 comments on commit c4f1619

Please sign in to comment.