create-analog 2.0.0-alpha.19 → 2.0.0-alpha.20

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
@@ -65,7 +65,6 @@ async function init() {
65
65
  let targetDir = formatTargetDir(argv._[0]);
66
66
  let template = argv.template || argv.t;
67
67
  let skipTailwind = fromBoolArg(argv.skipTailwind);
68
- let useAnalogSFC = fromBoolArg(argv.analogSFC);
69
68
 
70
69
  const defaultTargetDir = 'analog-project';
71
70
  const getProjectName = () =>
@@ -158,7 +157,6 @@ async function init() {
158
157
  overwrite,
159
158
  packageName,
160
159
  variant,
161
- analogSFC,
162
160
  tailwind,
163
161
  syntaxHighlighter,
164
162
  } = result;
@@ -176,7 +174,6 @@ async function init() {
176
174
  // determine syntax highlighter
177
175
  let highlighter = syntaxHighlighter ?? (template === 'blog' ? 'prism' : null);
178
176
  skipTailwind = skipTailwind ?? !tailwind;
179
- useAnalogSFC = useAnalogSFC ?? analogSFC;
180
177
 
181
178
  console.log(`\nScaffolding project in ${root}...`);
182
179
 
@@ -243,7 +240,6 @@ async function init() {
243
240
  write('package.json', JSON.stringify(pkg, null, 2));
244
241
 
245
242
  setProjectTitle(root, getProjectName());
246
- setComponentFormat(root, filesDir, write, template, useAnalogSFC);
247
243
 
248
244
  console.log(`\nInitializing git repository:`);
249
245
  execSync(`git init ${targetDir} && cd ${targetDir} && git add .`);
@@ -419,47 +415,6 @@ function setProjectTitle(root, title) {
419
415
  });
420
416
  }
421
417
 
422
- function setComponentFormat(root, filesDir, write, template, useAnalogSFC) {
423
- const getSFCConfig = () => {
424
- const sfcConfigOption =
425
- 'vite: { experimental: { supportAnalogFormat: true } }';
426
-
427
- return template === 'latest'
428
- ? `{ ${sfcConfigOption} }`
429
- : `\n ${sfcConfigOption},`;
430
- };
431
-
432
- replacePlaceholders(root, 'vite.config.ts', {
433
- __ANALOG_SFC_CONFIG__: useAnalogSFC ? getSFCConfig() : '',
434
- });
435
- replacePlaceholders(root, ['src/main.ts', 'src/main.server.ts'], {
436
- __APP_COMPONENT__: useAnalogSFC ? 'App' : 'AppComponent',
437
- __APP_COMPONENT_IMPORT__: useAnalogSFC
438
- ? "import App from './app/app-root.ag';"
439
- : "import { AppComponent } from './app/app';",
440
- });
441
-
442
- const cmpForDelete = useAnalogSFC ? 'app' : 'app-root';
443
- const deleteExt = useAnalogSFC ? 'ts' : 'ag';
444
- deleteFiles(root, [
445
- useAnalogSFC ? `src/app/${cmpForDelete}.ts` : `src/app/${cmpForDelete}.ag`,
446
- template === 'blog'
447
- ? [
448
- `src/app/pages/blog/index.page.${deleteExt}`,
449
- `src/app/pages/blog/[slug].page.${deleteExt}`,
450
- ]
451
- : `src/app/pages/index.page.${deleteExt}`,
452
- template !== 'minimal' && `src/app/${cmpForDelete}.spec.ts`,
453
- ]);
454
-
455
- if (useAnalogSFC) {
456
- write(
457
- 'src/analog-env.d.ts',
458
- fs.readFileSync(path.join(filesDir, 'analog-env.d.ts'), 'utf-8'),
459
- );
460
- }
461
- }
462
-
463
418
  function replacePlaceholders(root, files, config) {
464
419
  for (const file of toFlatArray(files)) {
465
420
  const filePath = path.join(root, file);
@@ -473,12 +428,6 @@ function replacePlaceholders(root, files, config) {
473
428
  }
474
429
  }
475
430
 
476
- function deleteFiles(root, files) {
477
- for (const file of toFlatArray(files)) {
478
- fs.unlinkSync(path.join(root, file));
479
- }
480
- }
481
-
482
431
  function toFlatArray(value) {
483
432
  return (Array.isArray(value) ? value : [value]).filter(Boolean).flat();
484
433
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-analog",
3
- "version": "2.0.0-alpha.19",
3
+ "version": "2.0.0-alpha.20",
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": "^2.0.0-alpha.19",
19
- "@analogjs/router": "^2.0.0-alpha.19",
18
+ "@analogjs/content": "^2.0.0-alpha.20",
19
+ "@analogjs/router": "^2.0.0-alpha.20",
20
20
  "@angular/animations": "^17.2.0",
21
21
  "@angular/common": "^17.2.0",
22
22
  "@angular/compiler": "^17.2.0",
@@ -38,9 +38,9 @@
38
38
  "zone.js": "~0.14.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@analogjs/platform": "^2.0.0-alpha.19",
42
- "@analogjs/vite-plugin-angular": "^2.0.0-alpha.19",
43
- "@analogjs/vitest-angular": "^2.0.0-alpha.19",
41
+ "@analogjs/platform": "^2.0.0-alpha.20",
42
+ "@analogjs/vite-plugin-angular": "^2.0.0-alpha.20",
43
+ "@analogjs/vitest-angular": "^2.0.0-alpha.20",
44
44
  "@angular-devkit/build-angular": "^17.2.0",
45
45
  "@angular/cli": "^17.2.0",
46
46
  "@angular/compiler-cli": "^17.2.0",
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "private": true,
17
17
  "dependencies": {
18
- "@analogjs/content": "^2.0.0-alpha.19",
19
- "@analogjs/router": "^2.0.0-alpha.19",
18
+ "@analogjs/content": "^2.0.0-alpha.20",
19
+ "@analogjs/router": "^2.0.0-alpha.20",
20
20
  "@angular/animations": "^18.0.0",
21
21
  "@angular/build": "^18.0.0",
22
22
  "@angular/common": "^18.0.0",
@@ -38,9 +38,9 @@
38
38
  "zone.js": "~0.14.3"
39
39
  },
40
40
  "devDependencies": {
41
- "@analogjs/platform": "^2.0.0-alpha.19",
42
- "@analogjs/vite-plugin-angular": "^2.0.0-alpha.19",
43
- "@analogjs/vitest-angular": "^2.0.0-alpha.19",
41
+ "@analogjs/platform": "^2.0.0-alpha.20",
42
+ "@analogjs/vite-plugin-angular": "^2.0.0-alpha.20",
43
+ "@analogjs/vitest-angular": "^2.0.0-alpha.20",
44
44
  "@angular/cli": "^18.0.0",
45
45
  "@angular/compiler-cli": "^18.0.0",
46
46
  "jsdom": "^22.0.0",
@@ -11,7 +11,7 @@ export default defineConfig(({ mode }) => ({
11
11
  resolve: {
12
12
  mainFields: ['module'],
13
13
  },
14
- plugins: [analog(__ANALOG_SFC_CONFIG__)],
14
+ plugins: [analog()],
15
15
  test: {
16
16
  globals: true,
17
17
  environment: 'jsdom',
@@ -12,7 +12,7 @@ export default defineConfig(({ mode }) => ({
12
12
  mainFields: ['module'],
13
13
  },
14
14
  plugins: [
15
- analog(__ANALOG_SFC_CONFIG__),__TAILWIND_PLUGIN__
15
+ analog(),__TAILWIND_PLUGIN__
16
16
  ],
17
17
  test: {
18
18
  globals: true,
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "private": true,
18
18
  "dependencies": {
19
- "@analogjs/content": "^2.0.0-alpha.19",
20
- "@analogjs/router": "^2.0.0-alpha.19",
19
+ "@analogjs/content": "^2.0.0-alpha.20",
20
+ "@analogjs/router": "^2.0.0-alpha.20",
21
21
  "@angular/animations": "^19.0.0",
22
22
  "@angular/common": "^19.0.0",
23
23
  "@angular/compiler": "^19.0.0",
@@ -37,9 +37,9 @@
37
37
  "zone.js": "~0.15.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@analogjs/platform": "^2.0.0-alpha.19",
41
- "@analogjs/vite-plugin-angular": "^2.0.0-alpha.19",
42
- "@analogjs/vitest-angular": "^2.0.0-alpha.19",
40
+ "@analogjs/platform": "^2.0.0-alpha.20",
41
+ "@analogjs/vite-plugin-angular": "^2.0.0-alpha.20",
42
+ "@analogjs/vitest-angular": "^2.0.0-alpha.20",
43
43
  "@angular-devkit/build-angular": "^19.0.0",
44
44
  "@angular/build": "^19.0.0",
45
45
  "@angular/cli": "^19.0.0",
@@ -18,7 +18,7 @@ export default defineConfig(({ mode }) => ({
18
18
  },
19
19
  prerender: {
20
20
  routes: ['/blog', '/blog/2022-12-27-my-first-post'],
21
- },__ANALOG_SFC_CONFIG__
21
+ },
22
22
  }),__TAILWIND_PLUGIN__
23
23
  ],
24
24
  test: {
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "private": true,
18
18
  "dependencies": {
19
- "@analogjs/content": "^2.0.0-alpha.19",
20
- "@analogjs/router": "^2.0.0-alpha.19",
19
+ "@analogjs/content": "^2.0.0-alpha.20",
20
+ "@analogjs/router": "^2.0.0-alpha.20",
21
21
  "@angular/animations": "^19.0.0",
22
22
  "@angular/common": "^19.0.0",
23
23
  "@angular/compiler": "^19.0.0",
@@ -38,9 +38,9 @@
38
38
  "zone.js": "~0.15.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@analogjs/platform": "^2.0.0-alpha.19",
42
- "@analogjs/vite-plugin-angular": "^2.0.0-alpha.19",
43
- "@analogjs/vitest-angular": "^2.0.0-alpha.19",
41
+ "@analogjs/platform": "^2.0.0-alpha.20",
42
+ "@analogjs/vite-plugin-angular": "^2.0.0-alpha.20",
43
+ "@analogjs/vitest-angular": "^2.0.0-alpha.20",
44
44
  "@angular-devkit/build-angular": "^19.0.0",
45
45
  "@angular/build": "^19.0.0",
46
46
  "@angular/cli": "^19.0.0",
@@ -12,7 +12,7 @@ export default defineConfig(({ mode }) => ({
12
12
  mainFields: ['module'],
13
13
  },
14
14
  plugins: [
15
- analog(__ANALOG_SFC_CONFIG__),__TAILWIND_PLUGIN__
15
+ analog(),__TAILWIND_PLUGIN__
16
16
  ],
17
17
  test: {
18
18
  globals: true,
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "private": true,
18
18
  "dependencies": {
19
- "@analogjs/content": "^2.0.0-alpha.19",
20
- "@analogjs/router": "^2.0.0-alpha.19",
19
+ "@analogjs/content": "^2.0.0-alpha.20",
20
+ "@analogjs/router": "^2.0.0-alpha.20",
21
21
  "@angular/animations": "^19.0.0",
22
22
  "@angular/common": "^19.0.0",
23
23
  "@angular/compiler": "^19.0.0",
@@ -38,9 +38,9 @@
38
38
  "zone.js": "~0.15.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@analogjs/platform": "^2.0.0-alpha.19",
42
- "@analogjs/vite-plugin-angular": "^2.0.0-alpha.19",
43
- "@analogjs/vitest-angular": "^2.0.0-alpha.19",
41
+ "@analogjs/platform": "^2.0.0-alpha.20",
42
+ "@analogjs/vite-plugin-angular": "^2.0.0-alpha.20",
43
+ "@analogjs/vitest-angular": "^2.0.0-alpha.20",
44
44
  "@angular-devkit/build-angular": "^19.0.0",
45
45
  "@angular/build": "^19.0.0",
46
46
  "@angular/cli": "^19.0.0",
@@ -17,7 +17,7 @@ export default defineConfig(({ mode }) => ({
17
17
  static: true,
18
18
  prerender: {
19
19
  routes: [],
20
- },__ANALOG_SFC_CONFIG__
20
+ },
21
21
  }),__TAILWIND_PLUGIN__
22
22
  ],
23
23
  }));
@@ -1,6 +0,0 @@
1
- declare module '*.ag' {
2
- import { Type } from '@angular/core';
3
-
4
- const cmp: Type<unknown>;
5
- export default cmp;
6
- }
@@ -1,16 +0,0 @@
1
- <script lang="ts">
2
- import { RouterOutlet } from '@angular/router' with { analog: 'imports' };
3
- </script>
4
-
5
- <template>
6
- <router-outlet />
7
- </template>
8
-
9
- <style>
10
- :host {
11
- max-width: 1280px;
12
- margin: 0 auto;
13
- padding: 2rem;
14
- text-align: center;
15
- }
16
- </style>
@@ -1,20 +0,0 @@
1
- import { TestBed } from '@angular/core/testing';
2
- import { provideRouter } from '@angular/router';
3
- import { provideLocationMocks } from '@angular/common/testing';
4
-
5
- import App from './app-root.ag';
6
-
7
- describe('App', () => {
8
- beforeEach(async () => {
9
- await TestBed.configureTestingModule({
10
- imports: [App],
11
- providers: [provideRouter([]), provideLocationMocks()],
12
- }).compileComponents();
13
- });
14
-
15
- it('should create the app', () => {
16
- const fixture = TestBed.createComponent(App);
17
- const app = fixture.componentInstance;
18
- expect(app).toBeTruthy();
19
- });
20
- });
@@ -1,53 +0,0 @@
1
- <script lang="ts">
2
- import { signal } from '@angular/core';
3
-
4
- const count = signal(0);
5
-
6
- function increment() {
7
- this.count.update((count) => count + 1);
8
- }
9
- </script>
10
-
11
- <template>
12
- <div>
13
- <a href="https://analogjs.org/" target="_blank">
14
- <img alt="Analog Logo" class="logo analog" src="/analog.svg" />
15
- </a>
16
- </div>
17
-
18
- <h2>Analog</h2>
19
-
20
- <h3>The fullstack meta-framework for Angular!</h3>
21
-
22
- <div class="card">
23
- <button type="button" (click)="increment()">Count {{ count() }}</button>
24
- </div>
25
-
26
- <p class="read-the-docs">
27
- <a href="https://analogjs.org" target="_blank">Docs</a> |
28
- <a href="https://github.com/analogjs/analog" target="_blank">GitHub</a> |
29
- <a href="https://github.com/sponsors/brandonroberts" target="_blank">
30
- Sponsor
31
- </a>
32
- </p>
33
- </template>
34
-
35
- <style>
36
- .logo {
37
- will-change: filter;
38
- }
39
-
40
- .logo:hover {
41
- filter: drop-shadow(0 0 2em #646cffaa);
42
- }
43
-
44
- .read-the-docs > * {
45
- color: #fff;
46
- }
47
-
48
- @media (prefers-color-scheme: light) {
49
- .read-the-docs > * {
50
- color: #213547;
51
- }
52
- }
53
- </style>
@@ -1,16 +0,0 @@
1
- <script lang="ts">
2
- import { RouterOutlet } from '@angular/router' with { analog: 'imports' };
3
- </script>
4
-
5
- <template>
6
- <router-outlet />
7
- </template>
8
-
9
- <style>
10
- :host {
11
- max-width: 1280px;
12
- margin: 0 auto;
13
- padding: 2rem;
14
- text-align: center;
15
- }
16
- </style>
@@ -1,20 +0,0 @@
1
- import { TestBed } from '@angular/core/testing';
2
- import { provideRouter } from '@angular/router';
3
- import { provideLocationMocks } from '@angular/common/testing';
4
-
5
- import App from './app-root.ag';
6
-
7
- describe('App', () => {
8
- beforeEach(async () => {
9
- await TestBed.configureTestingModule({
10
- imports: [App],
11
- providers: [provideRouter([]), provideLocationMocks()],
12
- }).compileComponents();
13
- });
14
-
15
- it('should create the app', () => {
16
- const fixture = TestBed.createComponent(App);
17
- const app = fixture.componentInstance;
18
- expect(app).toBeTruthy();
19
- });
20
- });
@@ -1,53 +0,0 @@
1
- <script lang="ts">
2
- import { signal } from '@angular/core';
3
-
4
- const count = signal(0);
5
-
6
- function increment() {
7
- this.count.update((count) => count + 1);
8
- }
9
- </script>
10
-
11
- <template>
12
- <div>
13
- <a href="https://analogjs.org/" target="_blank">
14
- <img alt="Analog Logo" class="logo analog" src="/analog.svg" />
15
- </a>
16
- </div>
17
-
18
- <h2>Analog</h2>
19
-
20
- <h3>The fullstack meta-framework for Angular!</h3>
21
-
22
- <div class="card">
23
- <button type="button" (click)="increment()">Count {{ count() }}</button>
24
- </div>
25
-
26
- <p class="read-the-docs">
27
- <a href="https://analogjs.org" target="_blank">Docs</a> |
28
- <a href="https://github.com/analogjs/analog" target="_blank">GitHub</a> |
29
- <a href="https://github.com/sponsors/brandonroberts" target="_blank">
30
- Sponsor
31
- </a>
32
- </p>
33
- </template>
34
-
35
- <style>
36
- .logo {
37
- will-change: filter;
38
- }
39
-
40
- .logo:hover {
41
- filter: drop-shadow(0 0 2em #646cffaa);
42
- }
43
-
44
- .read-the-docs > * {
45
- color: #fff;
46
- }
47
-
48
- @media (prefers-color-scheme: light) {
49
- .read-the-docs > * {
50
- color: #213547;
51
- }
52
- }
53
- </style>
@@ -1,25 +0,0 @@
1
- <script lang="ts">
2
- import { RouterLink, RouterOutlet } from '@angular/router' with { analog: 'imports' };
3
- </script>
4
-
5
- <template>
6
- <nav>
7
- <a routerLink="/">Home</a>
8
- </nav>
9
-
10
- <router-outlet />
11
- </template>
12
-
13
- <style>
14
- :host {
15
- max-width: 1280px;
16
- margin: 0 auto;
17
- padding: 2rem;
18
- text-align: center;
19
- }
20
-
21
- nav {
22
- text-align: left;
23
- padding: 0 0 2rem 0;
24
- }
25
- </style>
@@ -1,20 +0,0 @@
1
- import { TestBed } from '@angular/core/testing';
2
- import { provideRouter } from '@angular/router';
3
- import { provideLocationMocks } from '@angular/common/testing';
4
-
5
- import App from './app-root.ag';
6
-
7
- describe('App', () => {
8
- beforeEach(async () => {
9
- await TestBed.configureTestingModule({
10
- imports: [App],
11
- providers: [provideRouter([]), provideLocationMocks()],
12
- }).compileComponents();
13
- });
14
-
15
- it('should create the app', () => {
16
- const fixture = TestBed.createComponent(App);
17
- const app = fixture.componentInstance;
18
- expect(app).toBeTruthy();
19
- });
20
- });
@@ -1,24 +0,0 @@
1
- <script lang="ts">
2
- import { AsyncPipe } from '@angular/common' with { analog: 'imports' };
3
- import { MarkdownComponent } from '@analogjs/content' with { analog: 'imports' };
4
- import { injectContent } from '@analogjs/content';
5
-
6
- import PostAttributes from '../../post-attributes';
7
-
8
- const post$ = injectContent<PostAttributes>('slug');
9
- </script>
10
-
11
- <template>
12
- @if (post$ | async; as post) {
13
- <article>
14
- <img class="post__image" [src]="post.attributes.coverImage" />
15
- <analog-markdown [content]="post.content" />
16
- </article>
17
- }
18
- </template>
19
-
20
- <style>
21
- .post__image {
22
- max-height: 40vh;
23
- }
24
- </style>
@@ -1,32 +0,0 @@
1
- <script lang="ts">
2
- import { RouterLink } from '@angular/router' with { analog: 'imports' };
3
- import { injectContentFiles } from '@analogjs/content';
4
-
5
- import PostAttributes from '../../post-attributes';
6
-
7
- const posts = injectContentFiles<PostAttributes>();
8
- </script>
9
-
10
- <template>
11
- <h1>Blog Archive</h1>
12
-
13
- @for (post of posts; track post.attributes.slug) {
14
- <a [routerLink]="['/blog/', post.attributes.slug]">
15
- <h2 class="post__title">{{ post.attributes.title }}</h2>
16
- <p class="post__desc">{{ post.attributes.description }}</p>
17
- </a>
18
- }
19
- </template>
20
-
21
- <style>
22
- a {
23
- text-align: left;
24
- display: block;
25
- margin-bottom: 2rem;
26
- }
27
-
28
- .post__title,
29
- .post__desc {
30
- margin: 0;
31
- }
32
- </style>
@@ -1,16 +0,0 @@
1
- <script lang="ts">
2
- import { RouterOutlet } from '@angular/router' with { analog: 'imports' };
3
- </script>
4
-
5
- <template>
6
- <router-outlet />
7
- </template>
8
-
9
- <style>
10
- :host {
11
- max-width: 1280px;
12
- margin: 0 auto;
13
- padding: 2rem;
14
- text-align: center;
15
- }
16
- </style>
@@ -1,20 +0,0 @@
1
- import { TestBed } from '@angular/core/testing';
2
- import { provideRouter } from '@angular/router';
3
- import { provideLocationMocks } from '@angular/common/testing';
4
-
5
- import App from './app-root.ag';
6
-
7
- describe('App', () => {
8
- beforeEach(async () => {
9
- await TestBed.configureTestingModule({
10
- imports: [App],
11
- providers: [provideRouter([]), provideLocationMocks()],
12
- }).compileComponents();
13
- });
14
-
15
- it('should create the app', () => {
16
- const fixture = TestBed.createComponent(App);
17
- const app = fixture.componentInstance;
18
- expect(app).toBeTruthy();
19
- });
20
- });
@@ -1,11 +0,0 @@
1
- <script lang="ts">
2
- import { AnalogWelcome } from './analog-welcome';
3
-
4
- defineMetadata({
5
- imports: [AnalogWelcome]
6
- });
7
- </script>
8
-
9
- <template>
10
- <app-analog-welcome />
11
- </template>
@@ -1,7 +0,0 @@
1
- <script lang="ts">
2
- import { RouterOutlet } from '@angular/router' with { analog: 'imports' };
3
- </script>
4
-
5
- <template>
6
- <router-outlet />
7
- </template>
@@ -1,32 +0,0 @@
1
- <template>
2
- <h2>Analog</h2>
3
-
4
- <h3>The fullstack meta-framework for Angular!</h3>
5
-
6
- <p class="read-the-docs">
7
- <a href="https://analogjs.org" target="_blank">Docs</a> |
8
- <a href="https://github.com/analogjs/analog" target="_blank">GitHub</a> |
9
- <a href="https://github.com/sponsors/brandonroberts" target="_blank">
10
- Sponsor
11
- </a>
12
- </p>
13
- </template>
14
-
15
- <style>
16
- :host {
17
- display: flex;
18
- flex-direction: column;
19
- justify-content: center;
20
- align-items: center;
21
- }
22
-
23
- .read-the-docs > * {
24
- color: #fff;
25
- }
26
-
27
- @media (prefers-color-scheme: light) {
28
- .read-the-docs > * {
29
- color: #213547;
30
- }
31
- }
32
- </style>