build(docs-infra): always specify a landing file for StackBlitz projects (#34553)

The StackBlitz API (which we use to generate StackBlitz projects on the
fly, when a user clicks on a live example link in the docs) allows
specifying the file to open in the editor by passing a query param. If
no file is specified, StackBlitz opens a default one. In the past, it
used to be `main.ts` and nowadays it seems to be `app.component.ts`.

StackBlitz builder, the tool that we use to generate the StackBlitz
projects, allows specifying the primary file by setting the `file`
property in the corresponding `stackblitz.json`.

Previously, if the `file` property was not set, StackBlitz builder would
not specify a file, thus falling back on StackBlitz's default behavior.
This was not great, because the default behavior may change unexpectedly
is the future to something that is less useful for our users.

This commit change StackBlitz builder to always specify a primary file.
If no file is specified in `stackblitz.json`, the builder will look
for the first file that exists in the example from a list of predefined
files.

Partially addresses #22357.

PR Close #34553
This commit is contained in:
Sonu Kapoor 2019-12-23 22:29:59 -05:00 committed by Andrew Kushnir
parent 77c53559d0
commit f49b45832c
34 changed files with 39 additions and 10 deletions

View File

@ -5,6 +5,5 @@
"!**/*.js",
"!**/*.[1,2].*"
],
"file": "src/app/app.component.ts",
"tags": ["Accessibility"]
}

View File

@ -5,5 +5,6 @@
"!**/*.js",
"!**/*.[1,2,3].*"
],
"file": "src/app/app.component.ts",
"tags": ["animations"]
}

View File

@ -5,5 +5,5 @@
"!**/*.js",
"!**/*.[1].*"
],
"file": "src/app/app.module.ts"
"file": "src/app/hero-list.component.html"
}

View File

@ -5,5 +5,6 @@
"!**/*.js",
"!**/*.[1,2,3].*"
],
"file": "src/app/highlight.directive.ts",
"tags": ["attribute", "directive"]
}

View File

@ -6,5 +6,6 @@
"!**/*.native.*",
"!**/*.[1].*"
],
"file": "src/app/hero-app.component.ts",
"tags": ["CSS"]
}

View File

@ -5,5 +5,6 @@
"!**/*.js",
"!**/*.[1].*"
],
"file": "src/app/app.component.ts",
"tags":["cookbook"]
}

View File

@ -6,5 +6,6 @@
"!**/*.[0,1,2,3,4].*",
"!**/dummy.module.ts"
],
"file": "src/app/app.component.ts",
"tags": ["dependency", "di"]
}

View File

@ -6,5 +6,6 @@
"!**/app-ctor.component.ts",
"!**/*.[1,2,3].*"
],
"file": "src/app/app.component.ts",
"tags": ["Template"]
}

View File

@ -1,8 +1,11 @@
{
"description": "Second authors style guide stackblitz (non-executing)",
"files": [
"src/index.2.html"
"src/main.2.ts",
"src/index.2.html",
"src/styles.css"
],
"main": "src/index.2.html",
"file": "src/index.html",
"tags": ["author", "style guide"]
}

View File

@ -4,5 +4,6 @@
"!**/*.d.ts",
"!**/*.js"
],
"file": "src/app/app.component.ts",
"tags":["cookbook component"]
}

View File

@ -5,5 +5,6 @@
"!**/*.js",
"!**/*.[1].*"
],
"file": "src/app/app.component.ts",
"tags":["cookbook"]
}

View File

@ -5,5 +5,6 @@
"!**/*.js",
"!**/*.[1].*"
],
"file": "src/app/popup.service.ts",
"tags":["cookbook"]
}

View File

@ -4,5 +4,6 @@
"!**/*.d.ts",
"!**/*.js",
"!**/*.[1].*"
]
],
"file": "src/app/app.component.ts"
}

View File

@ -3,5 +3,6 @@
"files":[
"!**/*.d.ts",
"!**/*.js"
]
],
"file": "src/app/app.component.ts"
}

View File

@ -3,5 +3,6 @@
"files":[
"!**/*.d.ts",
"!**/*.js"
]
],
"file": "src/app/hero-form/hero-form.component.html"
}

View File

@ -5,5 +5,6 @@
"!**/*.js",
"!**/*.[0-9].*"
],
"file": "src/app/app.component.ts",
"tags": ["Angular", "getting started", "tutorial"]
}

View File

@ -5,5 +5,6 @@
"!**/*.js",
"!**/*.[0-9].*"
],
"file": "src/app/product-list/product-list.component.html",
"tags": ["Angular", "getting started", "tutorial"]
}

View File

@ -4,5 +4,6 @@
"!**/*.d.ts",
"!**/*.js"
],
"file": "src/app/app.component.ts",
"tags": ["dependency", "injection"]
}

View File

@ -3,10 +3,10 @@
"files":[
"!**/*.d.ts",
"!**/*.js",
"!src/testing/*.*",
"!src/index-specs.html",
"!src/main-specs.ts"
],
"file": "src/app/app.component.ts",
"tags": ["http"]
}

View File

@ -5,6 +5,6 @@
"!**/*.js",
"!**/*.[1,2].*"
],
"file": "src/app/app.component.ts",
"file": "src/app/app-routing.module.ts",
"tags": ["lazy loading"]
}

View File

@ -5,6 +5,6 @@
"!**/*.js",
"!**/*.[1,2].*"
],
"file": "src/app/app.component.ts",
"file": "src/app/app.module.ts",
"tags": ["NgModules"]
}

View File

@ -11,5 +11,6 @@
"!src/app/main-final.ts",
"!src/index-final.html"
],
"file": "src/app/app.component.ts",
"tags": ["reactive", "forms"]
}

View File

@ -7,5 +7,6 @@
"!src/app/crisis-list/*.*",
"!src/app/hero-list/*.*"
],
"tags": ["router"]
"tags": ["router"],
"file": "src/app/app-routing.module.ts"
}

View File

@ -4,5 +4,6 @@
"!**/*.d.ts",
"!**/*.js"
],
"file": "src/app/app.component.ts",
"tags": ["security"]
}

View File

@ -5,5 +5,6 @@
"!**/*.js",
"!**/*.[1].*"
],
"file": "src/app/app.component.ts",
"tags": [ "cookbook" ]
}

View File

@ -5,6 +5,7 @@
"!**/*.js",
"!src/app/scrap.txt"
],
"file": "src/app/app.component.ts",
"tags": [
"structural", "directives", "template", "ngIf",
"ngSwitch", "ngFor"

View File

@ -5,5 +5,6 @@
"!**/*.js",
"!**/*.[1].*"
],
"file": "src/app/app.component.ts",
"tags": ["tutorial", "tour", "heroes"]
}

View File

@ -6,5 +6,6 @@
"!**/*.[1].*",
"!**/dummy.module.ts"
],
"file": "src/app/heroes/heroes.component.html",
"tags": ["tutorial", "tour", "heroes"]
}

View File

@ -5,5 +5,6 @@
"!**/*.js",
"!**/*.[1].*"
],
"file": "src/app/heroes/heroes.component.html",
"tags": ["tutorial", "tour", "heroes"]
}

View File

@ -5,5 +5,6 @@
"!**/*.js",
"!**/*.[1].*"
],
"file": "src/app/heroes/heroes.component.html",
"tags": ["tutorial", "tour", "heroes"]
}

View File

@ -5,5 +5,6 @@
"!**/*.js",
"!**/*.[1,2].*"
],
"file": "src/app/hero.service.ts",
"tags": ["tutorial", "tour", "heroes"]
}

View File

@ -5,5 +5,6 @@
"!**/*.js",
"!**/*.[0,1,2,3].*"
],
"file": "src/app/app-routing.module.ts",
"tags": ["tutorial", "tour", "heroes", "router"]
}

View File

@ -5,5 +5,6 @@
"!**/*.js",
"!**/*.[1,2].*"
],
"file": "src/app/hero.service.ts",
"tags": ["tutorial", "tour", "heroes", "http"]
}