create-analog 1.5.0-beta.5 → 1.5.0-beta.7

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
@@ -4,8 +4,8 @@
4
4
  import { green, red, reset, yellow } from 'kolorist';
5
5
  import minimist from 'minimist';
6
6
  import { execSync } from 'node:child_process';
7
- import fs from 'node:fs';
8
- import path from 'node:path';
7
+ import fs, { readdirSync } from 'node:fs';
8
+ import path, { join } from 'node:path';
9
9
  import { fileURLToPath } from 'node:url';
10
10
  import prompts from 'prompts';
11
11
 
@@ -45,6 +45,7 @@ const HIGHLIGHTERS = {
45
45
  highlighter: 'withShikiHighlighter',
46
46
  entryPoint: 'shiki-highlighter',
47
47
  dependencies: {
48
+ marked: '^7.0.0',
48
49
  'marked-shiki': '^1.1.0',
49
50
  shiki: '^1.6.1',
50
51
  },
@@ -185,10 +186,6 @@ async function init() {
185
186
  ? path.join(root, renameFiles[file])
186
187
  : path.join(root, file);
187
188
 
188
- if (file.includes('app.config.ts') && variant === 'blog' && highlighter) {
189
- content = addHighlighter(path.join(templateDir, file), highlighter);
190
- }
191
-
192
189
  if (content) {
193
190
  fs.writeFileSync(targetPath, content);
194
191
  } else {
@@ -216,11 +213,14 @@ async function init() {
216
213
  pkg.name = packageName || getProjectName();
217
214
  pkg.scripts.start = getStartCommand(pkgManager);
218
215
 
216
+ if (template === 'blog' && highlighter) {
217
+ ensureSyntaxHighlighter(root, pkg, highlighter);
218
+ }
219
+
219
220
  if (!skipTailwind) addTailwindDevDependencies(pkg);
220
- if (variant === 'blog' && highlighter)
221
- addHighlighterDependencies(pkg, highlighter);
222
- if (pkgManager === 'yarn' && variant === 'angular-v17')
223
- addYarnDevDependencies(pkg);
221
+ if (pkgManager === 'yarn') {
222
+ addYarnDevDependencies(pkg, template);
223
+ }
224
224
 
225
225
  write('package.json', JSON.stringify(pkg, null, 2));
226
226
 
@@ -372,22 +372,33 @@ function addTailwindDevDependencies(pkg) {
372
372
  );
373
373
  }
374
374
 
375
- function addYarnDevDependencies(pkg) {
376
- pkg.devDependencies['@angular-devkit/build-angular'] = ['^17.3.5'];
375
+ function addYarnDevDependencies(pkg, template) {
376
+ // v18
377
+ if (template === 'latest' || template === 'blog') {
378
+ pkg.devDependencies['@nx/angular'] = ['^19.1.0'];
379
+ pkg.devDependencies['@nx/devkit'] = ['^19.1.0'];
380
+ pkg.devDependencies['@nx/vite'] = ['^19.1.0'];
381
+ pkg.devDependencies['nx'] = ['^19.1.0'];
382
+ } else if (template === 'angular-v17') {
383
+ pkg.devDependencies['@angular-devkit/build-angular'] = ['^17.3.5'];
384
+ }
377
385
  }
378
386
 
379
- function addHighlighter(file, syntaxHighlighter) {
380
- const content = fs.readFileSync(file, 'utf-8');
381
- return content
382
- .replace('__HIGHLIGHTER__', HIGHLIGHTERS[syntaxHighlighter].highlighter)
383
- .replace(
384
- '__HIGHLIGHTER_ENTRY_POINT__',
385
- HIGHLIGHTERS[syntaxHighlighter].entryPoint
386
- );
387
- }
387
+ function ensureSyntaxHighlighter(root, pkg, highlighter) {
388
+ const appConfigPath = path.join(root, 'src/app/app.config.ts');
389
+ const appConfigContent = fs.readFileSync(appConfigPath, 'utf-8');
390
+
391
+ fs.writeFileSync(
392
+ appConfigPath,
393
+ appConfigContent
394
+ .replace(/__HIGHLIGHTER__/g, HIGHLIGHTERS[highlighter].highlighter)
395
+ .replace(
396
+ /__HIGHLIGHTER_ENTRY_POINT__/g,
397
+ HIGHLIGHTERS[highlighter].entryPoint
398
+ )
399
+ );
388
400
 
389
- function addHighlighterDependencies(pkg, syntaxHighlighter) {
390
- const dependencies = HIGHLIGHTERS[syntaxHighlighter].dependencies;
401
+ const dependencies = HIGHLIGHTERS[highlighter].dependencies;
391
402
  for (const [name, version] of Object.entries(dependencies)) {
392
403
  pkg.dependencies[name] = version;
393
404
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-analog",
3
- "version": "1.5.0-beta.5",
3
+ "version": "1.5.0-beta.7",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Brandon Roberts",
@@ -15,8 +15,8 @@
15
15
  "test": "ng test"
16
16
  },
17
17
  "dependencies": {
18
- "@analogjs/content": "^1.5.0-beta.5",
19
- "@analogjs/router": "^1.5.0-beta.5",
18
+ "@analogjs/content": "^1.5.0-beta.7",
19
+ "@analogjs/router": "^1.5.0-beta.7",
20
20
  "@angular/animations": "^17.2.0",
21
21
  "@angular/common": "^17.2.0",
22
22
  "@angular/compiler": "^17.2.0",
@@ -38,8 +38,8 @@
38
38
  "zone.js": "~0.14.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@analogjs/platform": "^1.5.0-beta.5",
42
- "@analogjs/vite-plugin-angular": "^1.5.0-beta.5",
41
+ "@analogjs/platform": "^1.5.0-beta.7",
42
+ "@analogjs/vite-plugin-angular": "^1.5.0-beta.7",
43
43
  "@angular/cli": "^17.2.0",
44
44
  "@angular/compiler-cli": "^17.2.0",
45
45
  "@nx/vite": "~18.0.0",
@@ -15,8 +15,8 @@
15
15
  "test": "ng test"
16
16
  },
17
17
  "dependencies": {
18
- "@analogjs/content": "^1.5.0-beta.5",
19
- "@analogjs/router": "^1.5.0-beta.5",
18
+ "@analogjs/content": "^1.5.0-beta.7",
19
+ "@analogjs/router": "^1.5.0-beta.7",
20
20
  "@angular/animations": "^18.0.0",
21
21
  "@angular/common": "^18.0.0",
22
22
  "@angular/compiler": "^18.0.0",
@@ -35,8 +35,8 @@
35
35
  "zone.js": "~0.14.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@analogjs/platform": "^1.5.0-beta.5",
39
- "@analogjs/vite-plugin-angular": "^1.5.0-beta.5",
38
+ "@analogjs/platform": "^1.5.0-beta.7",
39
+ "@analogjs/vite-plugin-angular": "^1.5.0-beta.7",
40
40
  "@angular-devkit/build-angular": "^18.0.0",
41
41
  "@angular/cli": "^18.0.0",
42
42
  "@angular/compiler-cli": "^18.0.0",
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "private": true,
17
17
  "dependencies": {
18
- "@analogjs/content": "^1.5.0-beta.5",
19
- "@analogjs/router": "^1.5.0-beta.5",
18
+ "@analogjs/content": "^1.5.0-beta.7",
19
+ "@analogjs/router": "^1.5.0-beta.7",
20
20
  "@angular/animations": "^18.0.0",
21
21
  "@angular/common": "^18.0.0",
22
22
  "@angular/compiler": "^18.0.0",
@@ -37,8 +37,8 @@
37
37
  "zone.js": "~0.14.3"
38
38
  },
39
39
  "devDependencies": {
40
- "@analogjs/platform": "^1.5.0-beta.5",
41
- "@analogjs/vite-plugin-angular": "^1.5.0-beta.5",
40
+ "@analogjs/platform": "^1.5.0-beta.7",
41
+ "@analogjs/vite-plugin-angular": "^1.5.0-beta.7",
42
42
  "@angular-devkit/build-angular": "^18.0.0",
43
43
  "@angular/cli": "^18.0.0",
44
44
  "@angular/compiler-cli": "^18.0.0",