Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ tmpanalogapp*
vite.config.*.timestamp*
.vite-inspect
vitest.config.*.timestamp*
gradle.properties
15 changes: 12 additions & 3 deletions apps/analog-app-e2e-playwright/tests/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,17 @@ afterEach(async () => {
describe('My Store', () => {
test(`Given the user has navigated to the home page
Then the app title is visible`, async () => {
await expect(
page.locator('role=heading[level=1] >> text=My Store'),
).toContain(/My Store/i);
// Wait for the page to be fully loaded and Angular to be ready
await page.waitForLoadState('networkidle');

// Wait for the Angular app to be fully rendered
await page.waitForSelector('analogjs-root');

// Wait for the top bar component to be rendered
await page.waitForSelector('analogjs-top-bar');

// Now check for the heading - use a simpler selector that should work
const heading = page.locator('h1:has-text("My Store")');
await expect(await heading.textContent()).toContain('My Store');
});
});
22 changes: 22 additions & 0 deletions apps/analog-app-e2e-playwright/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"sourceMap": false,
"outDir": "../../dist/out-tsc",
"allowJs": true,
"types": ["node", "vitest/globals"],
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"include": ["tests/**/*.ts", "src/**/*.js"],
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
1 change: 0 additions & 1 deletion apps/analog-app/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": [],
"target": "ES2022",
"useDefineForClassFields": false
},
"files": ["src/main.ts", "src/main.server.ts"],
Expand Down
8 changes: 1 addition & 7 deletions apps/analog-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@
}
],
"compilerOptions": {
"target": "es2020",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"resolveJsonModule": true
"noImplicitReturns": true
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
Expand Down
1 change: 0 additions & 1 deletion apps/astro-app/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"importHelpers": true,
"noEmit": false,
"target": "es2020",
"module": "es2020",
"lib": ["es2020", "dom"],
"skipLibCheck": true,
"ignoreDeprecations": "5.0"
Expand Down
7 changes: 1 addition & 6 deletions apps/blog-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
{
"compilerOptions": {
"target": "es2022",
"useDefineForClassFields": false,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
"noImplicitReturns": true
},
"files": [],
"include": [],
Expand Down
7 changes: 1 addition & 6 deletions apps/ng-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
{
"compilerOptions": {
"target": "es2022",
"useDefineForClassFields": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
"noImplicitReturns": true
},
"files": [],
"include": [],
Expand Down
14 changes: 10 additions & 4 deletions apps/trpc-app-e2e-playwright/tests/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,18 @@ afterEach(async () => {
await page.close();
});

describe.skip('tRPC Demo App', () => {
describe('tRPC Demo App', () => {
test(`Given the user has navigated to the home page
Then the app title is visible`, async () => {
await expect(
page.locator('role=heading[level=1] >> text=Analog + tRPC'),
).toContain(/Analog + tRPC/i);
// Wait for the page to be fully loaded and Angular to be ready
await page.waitForLoadState('networkidle');

// Wait for the Angular app to be fully rendered
await page.waitForSelector('trpc-app-home');

// Now check for the heading - use a simpler selector that should work
const heading = page.locator('h1:has-text("Analog + tRPC")');
await expect(await heading.textContent()).toContain('Analog + tRPC');
});

test<TRPCTestContext>(`
Expand Down
5 changes: 2 additions & 3 deletions apps/trpc-app-e2e-playwright/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import { defineConfig } from 'vite';
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
return {
root: 'tests',
test: {
reporters: ['default'],
globals: true,
environment: 'node',
include: ['**/*.spec.ts'],
environment: 'jsdom',
include: ['tests/**/*.spec.ts'],
cache: {
dir: `../../node_modules/.vitest`,
},
Expand Down
7 changes: 1 addition & 6 deletions apps/trpc-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,8 @@
}
],
"compilerOptions": {
"target": "es2020",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
"noImplicitReturns": true
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rxjs": "7.8.2",
"semver": "^7.5.1",
"semver": "^7.7.2",
"superjson": "^2.2.1",
"tslib": "^2.7.0",
"ufo": "^1.5.4",
Expand Down Expand Up @@ -132,6 +132,7 @@
"@types/prismjs": "^1.26.5",
"@types/react": "^18.3.23",
"@types/react-dom": "^18.3.7",
"@types/semver": "^7.7.0",
"@typescript-eslint/eslint-plugin": "7.18.0",
"@typescript-eslint/parser": "7.18.0",
"@typescript-eslint/utils": "^8.13.0",
Expand Down
11 changes: 10 additions & 1 deletion packages/astro-angular/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import viteAngular, { PluginOptions } from '@analogjs/vite-plugin-angular';
import { enableProdMode } from '@angular/core';
import type { AstroIntegration, AstroRenderer, ViteUserConfig } from 'astro';
import type { DeepPartial } from 'astro/dist/type-utils';

// Define DeepPartial locally using Astro's implementation instead of importing from astro/dist/type-utils
// Source: https://raw.githubusercontent.com/withastro/astro/92881331d1138ae146bbc4b0bfb9c675ca3f3d55/packages/astro/src/type-utils.ts
type DeepPartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[]
? DeepPartial<U>[]
: T[P] extends object | undefined
? DeepPartial<T[P]>
: T[P];
};

interface AngularOptions {
vite?: PluginOptions;
Expand Down
1 change: 0 additions & 1 deletion packages/astro-angular/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["node", "vitest/globals"]
},
"files": ["src/test-setup.ts"],
Expand Down
4 changes: 1 addition & 3 deletions packages/content-plugin/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "CommonJS"
},
"compilerOptions": {},
"files": [],
"include": [],
"references": [
Expand Down
1 change: 0 additions & 1 deletion packages/content-plugin/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"],
Expand Down
1 change: 0 additions & 1 deletion packages/content/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["node", "vitest/globals"]
},
"files": ["src/test-setup.ts"],
Expand Down
5 changes: 4 additions & 1 deletion packages/create-analog/template-blog/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
"importHelpers": true,
"target": "ES2022",
"module": "ES2022",
"moduleDetection": "force",
"allowJs": true,
"lib": ["ES2022", "dom"],
"useDefineForClassFields": false,
"skipLibCheck": true
"skipLibCheck": true,
"noUncheckedIndexedAccess": true,
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
Expand Down
5 changes: 4 additions & 1 deletion packages/create-analog/template-latest/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
"importHelpers": true,
"target": "ES2022",
"module": "ES2022",
"moduleDetection": "force",
"allowJs": true,
"lib": ["ES2022", "dom"],
"useDefineForClassFields": false,
"skipLibCheck": true
"skipLibCheck": true,
"noUncheckedIndexedAccess": true,
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
Expand Down
5 changes: 4 additions & 1 deletion packages/create-analog/template-minimal/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
"importHelpers": true,
"target": "ES2022",
"module": "ES2022",
"moduleDetection": "force",
"allowJs": true,
"lib": ["ES2022", "dom"],
"useDefineForClassFields": false,
"skipLibCheck": true
"skipLibCheck": true,
"noUncheckedIndexedAccess": true,
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
Expand Down
1 change: 0 additions & 1 deletion packages/create-analog/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "../../dist/out-tsc",
"inlineSourceMap": true,
"sourceMap": false,
Expand Down
1 change: 0 additions & 1 deletion packages/create-analog/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["vitest/globals", "node"]
},
"include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
Expand Down
22 changes: 22 additions & 0 deletions packages/nx-plugin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion packages/nx-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"name": "@analogjs/nx",
"version": "0.0.1",
"main": "src/index.js"
"main": "src/index.js",
"dependencies": {
"semver": "^7.7.2"
},
"devDependencies": {
"@types/semver": "^7.7.0"
}
}
27 changes: 21 additions & 6 deletions packages/nx-plugin/src/generators/app/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,18 @@ export async function appGenerator(
});

const angularVersion = getInstalledPackageVersion(tree, '@angular/core');
const majorAngularVersion = major(coerce(angularVersion));

if (!angularVersion) {
throw new Error('@angular/core version not found in package.json');
}

const coercedAngularVersion = coerce(angularVersion);

if (!coercedAngularVersion) {
throw new Error(`Invalid Angular version: ${angularVersion}`);
}

const majorAngularVersion = major(coercedAngularVersion);
addFiles(tree, normalizedOptions, majorAngularVersion);
addDependenciesToPackageJson(
tree,
Expand All @@ -140,19 +151,23 @@ export async function appGenerator(
{},
);

updateJson<{ dependencies: object }>(tree, '/package.json', (json) => {
json.dependencies['@angular/platform-server'] = `~${angularVersion}`;
updateJson<{ dependencies: Record<string, string> }>(
tree,
'/package.json',
(json) => {
json.dependencies['@angular/platform-server'] = `~${angularVersion}`;

return json;
});
return json;
},
);

updateIndex(tree, normalizedOptions.analogAppName);

if (normalizedOptions.addTailwind) {
await addTailwindConfig(tree, normalizedOptions.projectName);
}

if (normalizedOptions.addTRPC) {
if (normalizedOptions.addTRPC && nxVersion) {
await addTrpc(
tree,
normalizedOptions.projectRoot,
Expand Down
Loading
Loading