create-analog 3.0.0-alpha.95 → 3.0.0-alpha.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -10,7 +10,8 @@ import { fileURLToPath } from 'node:url';
10
10
  import prompts from 'prompts';
11
11
 
12
12
  /**
13
- * @typedef {'latest' | 'blog' | 'minimal'} Template
13
+ * @typedef {'latest' | 'blog' | 'minimal'} StarterTemplate
14
+ * @typedef {StarterTemplate | `angular-v${number}`} Template
14
15
  * @typedef {'prismjs' | 'shiki'} HighlighterId
15
16
  * @typedef {(value: string) => string} Colorizer
16
17
  *
@@ -25,8 +26,7 @@ import prompts from 'prompts';
25
26
  * @property {readonly Variant[]} variants
26
27
  *
27
28
  * @typedef {object} HighlighterConfig
28
- * @property {string} highlighter
29
- * @property {string} entryPoint
29
+ * @property {'prism' | 'shiki'} contentHighlighter
30
30
  * @property {Record<string, string>} dependencies
31
31
  *
32
32
  * @typedef {object} PackageJson
@@ -62,6 +62,7 @@ const DEFAULT_BLOG_HIGHLIGHTER = 'prismjs';
62
62
 
63
63
  /** @type {readonly Template[]} */
64
64
  const H3_TEMPLATES = ['latest', 'blog', 'minimal'];
65
+ const VERSIONED_TEMPLATE = /^angular-v\d+$/;
65
66
 
66
67
  // Avoids autoconversion to number of the project name by defining that the args
67
68
  // non associated with an option ( _ ) needs to be parsed as a string. See #4606
@@ -97,16 +98,14 @@ const APPS = [
97
98
  /** @type {Readonly<Record<HighlighterId, HighlighterConfig>>} */
98
99
  const HIGHLIGHTERS = {
99
100
  prismjs: {
100
- highlighter: 'withPrismHighlighter',
101
- entryPoint: 'prism-highlighter',
101
+ contentHighlighter: 'prism',
102
102
  dependencies: {
103
103
  'marked-highlight': '^2.2.1',
104
104
  prismjs: '^1.29.0',
105
105
  },
106
106
  },
107
107
  shiki: {
108
- highlighter: 'withShikiHighlighter',
109
- entryPoint: 'shiki-highlighter',
108
+ contentHighlighter: 'shiki',
110
109
  dependencies: {
111
110
  marked: '^18.0.0',
112
111
  'marked-shiki': '^1.1.0',
@@ -532,18 +531,13 @@ function addPnpmDependencies(pkg, template) {
532
531
  function ensureSyntaxHighlighter(root, pkg, highlighter) {
533
532
  const config = HIGHLIGHTERS[highlighter];
534
533
 
535
- replacePlaceholders(root, 'src/app/app.config.ts', {
536
- __HIGHLIGHTER__: config.highlighter,
537
- __HIGHLIGHTER_ENTRY_POINT__: config.entryPoint,
538
- });
539
-
540
534
  pkg.dependencies ??= {};
541
535
  for (const [name, version] of Object.entries(config.dependencies)) {
542
536
  pkg.dependencies[name] = version;
543
537
  }
544
538
 
545
539
  replacePlaceholders(root, 'vite.config.ts', {
546
- __CONTENT_HIGHLIGHTER__: highlighter,
540
+ __CONTENT_HIGHLIGHTER__: config.contentHighlighter,
547
541
  });
548
542
  }
549
543
 
@@ -631,7 +625,15 @@ function resolveTemplate(value) {
631
625
  * @returns {value is Template}
632
626
  */
633
627
  function isTemplate(value) {
634
- return value === 'latest' || value === 'blog' || value === 'minimal';
628
+ if (value === 'latest' || value === 'blog' || value === 'minimal') {
629
+ return true;
630
+ }
631
+
632
+ return (
633
+ value !== undefined &&
634
+ VERSIONED_TEMPLATE.test(value) &&
635
+ fs.existsSync(path.join(CLI_DIR, `template-${value}`))
636
+ );
635
637
  }
636
638
 
637
639
  init().catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-analog",
3
- "version": "3.0.0-alpha.95",
3
+ "version": "3.0.0-alpha.97",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Brandon Roberts",
@@ -39,9 +39,9 @@
39
39
  "prompts": "^2.4.2"
40
40
  },
41
41
  "devDependencies": {
42
- "@analogjs/platform": "3.0.0-alpha.95",
43
- "@analogjs/vite-plugin-angular": "3.0.0-alpha.95",
44
- "@analogjs/vite-plugin-nitro": "3.0.0-alpha.95",
42
+ "@analogjs/platform": "3.0.0-alpha.97",
43
+ "@analogjs/vite-plugin-angular": "3.0.0-alpha.97",
44
+ "@analogjs/vite-plugin-nitro": "3.0.0-alpha.97",
45
45
  "h3": "^1.15.11"
46
46
  },
47
47
  "publishConfig": {
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "private": true,
18
18
  "dependencies": {
19
- "@analogjs/content": "^3.0.0-alpha.95",
20
- "@analogjs/router": "^3.0.0-alpha.95",
19
+ "@analogjs/content": "^3.0.0-alpha.97",
20
+ "@analogjs/router": "^3.0.0-alpha.97",
21
21
  "@angular/animations": "^20.0.0",
22
22
  "@angular/common": "^20.0.0",
23
23
  "@angular/compiler": "^20.0.0",
@@ -37,9 +37,9 @@
37
37
  "zone.js": "~0.15.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@analogjs/platform": "^3.0.0-alpha.95",
41
- "@analogjs/vite-plugin-angular": "^3.0.0-alpha.95",
42
- "@analogjs/vitest-angular": "^3.0.0-alpha.95",
40
+ "@analogjs/platform": "^3.0.0-alpha.97",
41
+ "@analogjs/vite-plugin-angular": "^3.0.0-alpha.97",
42
+ "@analogjs/vitest-angular": "^3.0.0-alpha.97",
43
43
  "@angular-devkit/build-angular": "^20.0.0",
44
44
  "@angular/build": "^20.0.0",
45
45
  "@angular/cli": "^20.0.0",
@@ -1,25 +1,18 @@
1
- import {
2
- provideHttpClient,
3
- withFetch,
4
- withInterceptors,
5
- } from '@angular/common/http';
1
+ import { provideHttpClient, withFetch } from '@angular/common/http';
6
2
  import {
7
3
  ApplicationConfig,
8
4
  provideBrowserGlobalErrorListeners,
9
5
  provideZoneChangeDetection
10
6
  } from '@angular/core';
11
7
  import { provideClientHydration, withEventReplay } from '@angular/platform-browser';
12
- import { provideFileRouter, requestContextInterceptor } from '@analogjs/router';
8
+ import { provideFileRouter } from '@analogjs/router';
13
9
 
14
10
  export const appConfig: ApplicationConfig = {
15
11
  providers: [
16
12
  provideBrowserGlobalErrorListeners(),
17
13
  provideZoneChangeDetection({ eventCoalescing: true }),
18
14
  provideFileRouter(),
19
- provideHttpClient(
20
- withFetch(),
21
- withInterceptors([requestContextInterceptor])
22
- ),
15
+ provideHttpClient(withFetch()),
23
16
  provideClientHydration(withEventReplay()),
24
17
  ],
25
18
  };
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "private": true,
18
18
  "dependencies": {
19
- "@analogjs/content": "^3.0.0-alpha.95",
20
- "@analogjs/router": "^3.0.0-alpha.95",
19
+ "@analogjs/content": "^3.0.0-alpha.97",
20
+ "@analogjs/router": "^3.0.0-alpha.97",
21
21
  "@angular/animations": "^21.0.0",
22
22
  "@angular/common": "^21.0.0",
23
23
  "@angular/compiler": "^21.0.0",
@@ -36,9 +36,9 @@
36
36
  "tslib": "^2.3.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@analogjs/platform": "^3.0.0-alpha.95",
40
- "@analogjs/vite-plugin-angular": "^3.0.0-alpha.95",
41
- "@analogjs/vitest-angular": "^3.0.0-alpha.95",
39
+ "@analogjs/platform": "^3.0.0-alpha.97",
40
+ "@analogjs/vite-plugin-angular": "^3.0.0-alpha.97",
41
+ "@analogjs/vitest-angular": "^3.0.0-alpha.97",
42
42
  "@angular/build": "^21.0.0",
43
43
  "@angular/cli": "^21.0.0",
44
44
  "@angular/compiler-cli": "^21.0.0",
@@ -1,23 +1,16 @@
1
- import {
2
- provideHttpClient,
3
- withFetch,
4
- withInterceptors,
5
- } from '@angular/common/http';
1
+ import { provideHttpClient, withFetch } from '@angular/common/http';
6
2
  import {
7
3
  ApplicationConfig,
8
4
  provideBrowserGlobalErrorListeners,
9
5
  } from '@angular/core';
10
6
  import { provideClientHydration, withEventReplay } from '@angular/platform-browser';
11
- import { provideFileRouter, requestContextInterceptor } from '@analogjs/router';
7
+ import { provideFileRouter } from '@analogjs/router';
12
8
 
13
9
  export const appConfig: ApplicationConfig = {
14
10
  providers: [
15
11
  provideBrowserGlobalErrorListeners(),
16
12
  provideFileRouter(),
17
- provideHttpClient(
18
- withFetch(),
19
- withInterceptors([requestContextInterceptor])
20
- ),
13
+ provideHttpClient(withFetch()),
21
14
  provideClientHydration(withEventReplay()),
22
15
  ],
23
16
  };
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "private": true,
18
18
  "dependencies": {
19
- "@analogjs/content": "^3.0.0-alpha.95",
20
- "@analogjs/router": "^3.0.0-alpha.95",
19
+ "@analogjs/content": "^3.0.0-alpha.97",
20
+ "@analogjs/router": "^3.0.0-alpha.97",
21
21
  "@angular/animations": "^22.0.0",
22
22
  "@angular/common": "^22.0.0",
23
23
  "@angular/compiler": "^22.0.0",
@@ -35,10 +35,10 @@
35
35
  "tslib": "^2.3.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@analogjs/platform": "^3.0.0-alpha.95",
39
- "@analogjs/vite-plugin-angular": "^3.0.0-alpha.95",
40
- "@analogjs/vite-plugin-nitro": "^3.0.0-alpha.95",
41
- "@analogjs/vitest-angular": "^3.0.0-alpha.95",
38
+ "@analogjs/platform": "^3.0.0-alpha.97",
39
+ "@analogjs/vite-plugin-angular": "^3.0.0-alpha.97",
40
+ "@analogjs/vite-plugin-nitro": "^3.0.0-alpha.97",
41
+ "@analogjs/vitest-angular": "^3.0.0-alpha.97",
42
42
  "@angular/build": "^22.0.0",
43
43
  "@angular/cli": "^22.0.0",
44
44
  "@angular/compiler-cli": "^22.0.0",
@@ -1,28 +1,19 @@
1
- import {
2
- provideHttpClient,
3
- withInterceptors,
4
- } from '@angular/common/http';
1
+ import { provideHttpClient } from '@angular/common/http';
5
2
  import {
6
3
  ApplicationConfig,
7
4
  provideBrowserGlobalErrorListeners,
8
5
  } from '@angular/core';
9
6
  import { provideClientHydration, withEventReplay } from '@angular/platform-browser';
10
- import {
11
- provideFileRouter,
12
- requestContextInterceptor,
13
- } from '@analogjs/router';
7
+ import { provideFileRouter } from '@analogjs/router';
14
8
  import { withContentRoutes } from '@analogjs/router/content';
15
9
  import { provideContent, withMarkdownRenderer } from '@analogjs/content';
16
- import { __HIGHLIGHTER__ } from '@analogjs/content/__HIGHLIGHTER_ENTRY_POINT__';
17
10
 
18
11
  export const appConfig: ApplicationConfig = {
19
12
  providers: [
20
13
  provideBrowserGlobalErrorListeners(),
21
14
  provideFileRouter(withContentRoutes()),
22
- provideHttpClient(
23
- withInterceptors([requestContextInterceptor])
24
- ),
15
+ provideHttpClient(),
25
16
  provideClientHydration(withEventReplay()),
26
- provideContent(withMarkdownRenderer(), __HIGHLIGHTER__()),
17
+ provideContent(withMarkdownRenderer()),
27
18
  ],
28
19
  };
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "private": true,
18
18
  "dependencies": {
19
- "@analogjs/content": "^3.0.0-alpha.95",
20
- "@analogjs/router": "^3.0.0-alpha.95",
19
+ "@analogjs/content": "^3.0.0-alpha.97",
20
+ "@analogjs/router": "^3.0.0-alpha.97",
21
21
  "@angular/animations": "^22.0.0",
22
22
  "@angular/common": "^22.0.0",
23
23
  "@angular/compiler": "^22.0.0",
@@ -36,10 +36,10 @@
36
36
  "tslib": "^2.3.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@analogjs/platform": "^3.0.0-alpha.95",
40
- "@analogjs/vite-plugin-angular": "^3.0.0-alpha.95",
41
- "@analogjs/vite-plugin-nitro": "^3.0.0-alpha.95",
42
- "@analogjs/vitest-angular": "^3.0.0-alpha.95",
39
+ "@analogjs/platform": "^3.0.0-alpha.97",
40
+ "@analogjs/vite-plugin-angular": "^3.0.0-alpha.97",
41
+ "@analogjs/vite-plugin-nitro": "^3.0.0-alpha.97",
42
+ "@analogjs/vitest-angular": "^3.0.0-alpha.97",
43
43
  "@angular/build": "^22.0.0",
44
44
  "@angular/cli": "^22.0.0",
45
45
  "@angular/compiler-cli": "^22.0.0",
@@ -1,21 +1,16 @@
1
- import {
2
- provideHttpClient,
3
- withInterceptors,
4
- } from '@angular/common/http';
1
+ import { provideHttpClient } from '@angular/common/http';
5
2
  import {
6
3
  ApplicationConfig,
7
4
  provideBrowserGlobalErrorListeners,
8
5
  } from '@angular/core';
9
6
  import { provideClientHydration, withEventReplay } from '@angular/platform-browser';
10
- import { provideFileRouter, requestContextInterceptor } from '@analogjs/router';
7
+ import { provideFileRouter } from '@analogjs/router';
11
8
 
12
9
  export const appConfig: ApplicationConfig = {
13
10
  providers: [
14
11
  provideBrowserGlobalErrorListeners(),
15
12
  provideFileRouter(),
16
- provideHttpClient(
17
- withInterceptors([requestContextInterceptor])
18
- ),
13
+ provideHttpClient(),
19
14
  provideClientHydration(withEventReplay()),
20
15
  ],
21
16
  };
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "private": true,
18
18
  "dependencies": {
19
- "@analogjs/content": "^3.0.0-alpha.95",
20
- "@analogjs/router": "^3.0.0-alpha.95",
19
+ "@analogjs/content": "^3.0.0-alpha.97",
20
+ "@analogjs/router": "^3.0.0-alpha.97",
21
21
  "@angular/animations": "^22.0.0",
22
22
  "@angular/common": "^22.0.0",
23
23
  "@angular/compiler": "^22.0.0",
@@ -36,10 +36,10 @@
36
36
  "tslib": "^2.3.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@analogjs/platform": "^3.0.0-alpha.95",
40
- "@analogjs/vite-plugin-angular": "^3.0.0-alpha.95",
41
- "@analogjs/vite-plugin-nitro": "^3.0.0-alpha.95",
42
- "@analogjs/vitest-angular": "^3.0.0-alpha.95",
39
+ "@analogjs/platform": "^3.0.0-alpha.97",
40
+ "@analogjs/vite-plugin-angular": "^3.0.0-alpha.97",
41
+ "@analogjs/vite-plugin-nitro": "^3.0.0-alpha.97",
42
+ "@analogjs/vitest-angular": "^3.0.0-alpha.97",
43
43
  "@angular/build": "^22.0.0",
44
44
  "@angular/cli": "^22.0.0",
45
45
  "@angular/compiler-cli": "^22.0.0",
@@ -1,21 +1,16 @@
1
- import {
2
- provideHttpClient,
3
- withInterceptors,
4
- } from '@angular/common/http';
1
+ import { provideHttpClient } from '@angular/common/http';
5
2
  import {
6
3
  ApplicationConfig,
7
4
  provideBrowserGlobalErrorListeners,
8
5
  } from '@angular/core';
9
6
  import { provideClientHydration, withEventReplay } from '@angular/platform-browser';
10
- import { provideFileRouter, requestContextInterceptor } from '@analogjs/router';
7
+ import { provideFileRouter } from '@analogjs/router';
11
8
 
12
9
  export const appConfig: ApplicationConfig = {
13
10
  providers: [
14
11
  provideBrowserGlobalErrorListeners(),
15
12
  provideFileRouter(),
16
- provideHttpClient(
17
- withInterceptors([requestContextInterceptor])
18
- ),
13
+ provideHttpClient(),
19
14
  provideClientHydration(withEventReplay()),
20
15
  ],
21
16
  };