Skip to content

Commit a77bf48

Browse files
authored
Merge pull request #89 from ember-cli/docs-app
add a "Demo App"
2 parents 547833e + c8bb5f7 commit a77bf48

9 files changed

Lines changed: 297 additions & 1 deletion

File tree

.prettierrc.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module.exports = {
44
printWidth: 100,
5+
plugins: ['prettier-plugin-ember-template-tag'],
56
overrides: [
67
{
78
files: '*.{js,ts,mjs,mts,cjs,cts}',

files/demo-app/app.gts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import EmberApp from 'ember-strict-application-resolver';
2+
import EmberRouter from '@ember/routing/router';
3+
import PageTitleService from 'ember-page-title/services/page-title';
4+
5+
class Router extends EmberRouter {
6+
location = 'history';
7+
rootURL = '/';
8+
}
9+
10+
export class App extends EmberApp {
11+
/**
12+
* Any services or anything from the addon that needs to be in the app-tree registry
13+
* will need to be manually specified here.
14+
*
15+
* Techniques to avoid needing this:
16+
* - private services
17+
* - require the consuming app import and configure themselves
18+
* (which is what we're emulating here)
19+
*/
20+
modules = {
21+
'./router': Router,
22+
'./services/page-title': PageTitleService,
23+
/**
24+
* NOTE: this glob will import everything matching the glob,
25+
* and includes non-services in the services directory.
26+
*/
27+
...import.meta.glob('./services/**/*', { eager: true }),
28+
/**
29+
* These imports are not magic, but we do require that all entries in the
30+
* modules object match a ./[type]/[name] pattern.
31+
*
32+
* See: https://rfcs.emberjs.com/id/1132-default-strict-resolver
33+
*/
34+
...import.meta.glob('./templates/**/*', { eager: true }),
35+
};
36+
}
37+
38+
Router.map(function () {});

files/demo-app/styles.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* See: https://vite.dev/guide/features.html#css
3+
* for features beyond normal CSS that are available to you.
4+
*
5+
* This CSS is meant for the demo-app only, and will not be included in the published assets for this library.
6+
*/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const greeting = 'hello';
2+
3+
<template>
4+
<h1>Welcome to ember!</h1>
5+
6+
{{greeting}}, world!
7+
</template>

files/index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!doctype html>
2+
<html lang="en-us">
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
7+
<title>Docs App</title>
8+
<meta name="description" content="" />
9+
<meta name="viewport" content="width=device-width, initial-scale=1" />
10+
11+
<link rel="stylesheet" href="./docs-app/styles.css" />
12+
13+
</head>
14+
15+
<body>
16+
17+
<script type="module">
18+
import App from './demo-app/app';
19+
20+
App.create({})
21+
</script>
22+
</body>
23+
24+
</html>

files/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"ember-source": "^6.7.0",
6060
"ember-strict-application-resolver": "^0.1.0",
6161
"ember-template-lint": "^7.9.0",
62+
"ember-page-title": "^8.2.0",
6263
"eslint": "^9.17.0",
6364
"eslint-config-prettier": "^10.1.5",
6465
"eslint-plugin-ember": "^12.3.3",

files/tsconfig.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
*/
66
{
77
"extends": "@ember/app-tsconfig",
8-
"include": ["src/**/*", "tests/**/*", "unpublished-development-types/**/*"],
8+
"include": [
9+
"src/**/*",
10+
"tests/**/*",
11+
"unpublished-development-types/**/*",
12+
"demo-app/**/*"
13+
],
914
"compilerOptions": {
1015
"rootDir": ".",
1116
"types": [

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
},
1818
"devDependencies": {
1919
"prettier": "^3.5.3",
20+
"prettier-plugin-ember-template-tag": "2.1.0",
2021
"release-plan": "^0.16.0"
2122
},
2223
"dependencies": {

0 commit comments

Comments
 (0)