Skip to content

Embroider: Port to v2 format: part 2: separate docs-app #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,24 @@ jobs:
- name: Lint Test App
working-directory: test-app
run: yarn run lint
- name: Lint Docs App
working-directory: docs-app
run: yarn run lint

test-docs:
name: Test Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: volta-cli/action@v4
- uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-ci-yarn-${{ hashFiles('**/yarn.lock') }}
- run: yarn --frozen-lockfile
- name: Run Tests
working-directory: docs-app
run: yarn run test

test:
name: Run Ember Tests
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules

# and you can put in anything else that tends to accumulate in your environment:
.pnpm-debug.log
.DS_Store
.DS_Store
.eslintcache
9 changes: 9 additions & 0 deletions addon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
"ember-cli-htmlbars": "^6.3.0",
"ember-test-selectors": "^7.0.0"
},
"devDependencies": {
"@babel/eslint-parser": "^7.25.9",
"eslint": "^8.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-ember": "^12.3.3",
"eslint-plugin-n": "^17.15.1",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-qunit": "^8.1.2"
},
"engines": {
"node": ">= 20"
},
Expand Down
9 changes: 9 additions & 0 deletions docs-app/.ember-cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.

Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false
}
25 changes: 25 additions & 0 deletions docs-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# compiled output
/dist/
/declarations/

# dependencies
/node_modules/

# misc
/.env*
/.pnp*
/.eslintcache
/coverage/
/npm-debug.log*
/testem.log
/yarn-error.log

# ember-try
/.node_modules.ember-try/
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try

# broccoli-debug
/DEBUG/
3 changes: 1 addition & 2 deletions test-app/.eslintignore → docs-app/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/blueprints/*/files/

# compiled output
/declarations/
/dist/

# misc
Expand All @@ -11,4 +10,4 @@
.*/

# ember-try
/.node_modules.ember-try/
/.node_modules.ember-try/
20 changes: 20 additions & 0 deletions docs-app/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

module.exports = {
plugins: ['prettier-plugin-ember-template-tag'],
overrides: [
{
files: '*.{js,gjs,ts,gts,mjs,mts,cjs,cts}',
options: {
singleQuote: true,
},
},
{
files: '*.{gjs,gts}',
options: {
singleQuote: true,
templateSingleQuote: false,
},
},
],
};
9 changes: 9 additions & 0 deletions docs-app/.template-lintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

module.exports = {
extends: 'recommended',
rules: {
'no-triple-curlies': false,
'no-invalid-interactive': false,
},
};
3 changes: 3 additions & 0 deletions docs-app/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignore_dirs": ["tmp", "dist"]
}
12 changes: 12 additions & 0 deletions docs-app/app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Application from '@ember/application';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from 'docs-app/config/environment';

export default class App extends Application {
modulePrefix = config.modulePrefix;
podModulePrefix = config.podModulePrefix;
Resolver = Resolver;
}

loadInitializers(App, config.modulePrefix);
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function isParseable(json) {
try {
JSON.parse(json);
return true;
} catch (e) {
} catch {
return false;
}
}
Expand Down
Empty file added docs-app/app/helpers/.gitkeep
Empty file.
28 changes: 28 additions & 0 deletions docs-app/app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Ember JSON Viewer</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{content-for "head"}}

<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css">
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/docs-app.css">

{{content-for "head-footer"}}
</head>

<body>
{{content-for "body"}}

<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/docs-app.js"></script>

{{content-for "body-footer"}}
</body>

</html>
Empty file added docs-app/app/models/.gitkeep
Empty file.
9 changes: 9 additions & 0 deletions docs-app/app/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import EmberRouter from '@ember/routing/router';
import config from 'docs-app/config/environment';

export default class Router extends EmberRouter {
location = config.locationType;
rootURL = config.rootURL;
}

Router.map(function () {});
Empty file added docs-app/app/routes/.gitkeep
Empty file.
File renamed without changes.
19 changes: 19 additions & 0 deletions docs-app/app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<main>
<h2 id="title">Ember-JSON-Viewer</h2>

<div class="viewer-wrapper">
<JsonViewer
@json={{this.viewJSON}}
@options={{hash expandedIcon=">" collapsedIcon="<" collapseDepth=1}}
/>
</div>
<div class="input-wrapper {{if this.isJSONValid 'valid' 'invalid'}}">
<h2>Paste JSON below:</h2>
<textarea
aria-label="json"
{{on "keyup" this.updateJSON}}
{{on "blur" this.formatSourceJSONStr}}
value={{this.sourceJSONStr}}
/>
</div>
</main>
File renamed without changes.
50 changes: 50 additions & 0 deletions docs-app/config/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
'use strict';

module.exports = function (environment) {
let ENV = {
modulePrefix: 'docs-app',
environment,
rootURL: '/',
locationType: 'history',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true
},
EXTEND_PROTOTYPES: false,
},

APP: {
// Here you can pass flags/options to your application instance
// when it is created
},
};

if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
}

if (environment === 'test') {
// Testem prefers this...
ENV.locationType = 'none';

// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;

ENV.APP.rootElement = '#ember-testing';
ENV.APP.autoboot = false;
}

if (environment === 'production') {
ENV.rootURL = '/ember-json-viewer';
ENV.locationType = 'hash';
// here you can enable a production-specific feature
}

return ENV;
};
7 changes: 7 additions & 0 deletions docs-app/config/optional-features.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"application-template-wrapper": false,
"default-async-observers": true,
"jquery-integration": false,
"template-only-glimmer-components": true,
"no-implicit-route-model": true
}
File renamed without changes.
11 changes: 11 additions & 0 deletions docs-app/ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';

const EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function (defaults) {
const app = new EmberApp(defaults, {
// Add options here
});

return app.toTree();
};
Loading
Loading