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

feat: add support for configuring additional page/content route sources #1228

Merged
merged 13 commits into from
Jul 26, 2024

Conversation

brandonroberts
Copy link
Member

@brandonroberts brandonroberts commented Jul 24, 2024

PR Checklist

Related to #904

What is the new behavior?

  • Page and content routes can be sourced from directories outside the main src/app/pages and src/content directories
  • Adds support for discovering page routes and content from projects in a monorepo
  • Adds support to the Vite plugin for Angular to include additional files in compilation
  • Allows the createRoutes function to be used with the Angular application builder without overrides
/// <reference types="vitest" />

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

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
  build: {
    target: ['es2020'],
  },
  resolve: {
    mainFields: ['module'],
  },
  plugins: [
    analog({
      // scans for `**/*.page.{ts,analog}`. Must be inside a `pages` directory
      additionalPagesDirs: ['/libs/shared/feature'],

      // scans for `**/*.{md,agx}`. Must be inside a `content` directory
      additionalContentDirs: ['/libs/shared/feature'],

      // scans for `**/*.{ts}`. Must be inside a `routes` directory
      additionalAPIDirs: ['/libs/shared/feature/src/api']

    })
  ],
  test: {
    globals: true,
    environment: 'jsdom',
    setupFiles: ['src/test-setup.ts'],
    include: ['**/*.spec.ts'],
    reporters: ['default'],
  },
  define: {
    'import.meta.vitest': mode !== 'production',
  },
}));

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

[optional] What gif best describes this PR or how it makes you feel?

Copy link

netlify bot commented Jul 24, 2024

Deploy Preview for analog-ng-app ready!

Name Link
🔨 Latest commit abb4ab7
🔍 Latest deploy log https://app.netlify.com/sites/analog-ng-app/deploys/66a315d8e3fc1e0008155d56
😎 Deploy Preview https://deploy-preview-1228--analog-ng-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jul 24, 2024

Deploy Preview for analog-app ready!

Name Link
🔨 Latest commit abb4ab7
🔍 Latest deploy log https://app.netlify.com/sites/analog-app/deploys/66a315d867850e0008ea11d7
😎 Deploy Preview https://deploy-preview-1228--analog-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jul 24, 2024

Deploy Preview for analog-blog ready!

Name Link
🔨 Latest commit abb4ab7
🔍 Latest deploy log https://app.netlify.com/sites/analog-blog/deploys/66a315d89403750008e20f06
😎 Deploy Preview https://deploy-preview-1228--analog-blog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jul 24, 2024

Deploy Preview for analog-docs ready!

Name Link
🔨 Latest commit abb4ab7
🔍 Latest deploy log https://app.netlify.com/sites/analog-docs/deploys/66a315d80868c80008f794f9
😎 Deploy Preview https://deploy-preview-1228--analog-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@brandonroberts brandonroberts changed the title feat: add support for configuring of additional page/content route sources feat: add support for configuring additional page/content route sources Jul 24, 2024
@nckirik
Copy link
Contributor

nckirik commented Jul 24, 2024

we can also add a config option for API route dirs. this is currently available through nitro.scanDirs config. just an alias would be enough I think

@brandonroberts
Copy link
Member Author

we can also add a config option for API route dirs. this is currently available through nitro.scanDirs config. just an alias would be enough I think

Added the additionalAPIDirs option for scanning API routes

@brandonroberts brandonroberts merged commit 869cfb5 into beta Jul 26, 2024
24 checks passed
@brandonroberts brandonroberts deleted the feat-routes-plugin branch July 26, 2024 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants