Skip to content

feat: add ember-vite example #108

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 1 commit into from
Jul 2, 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
19 changes: 19 additions & 0 deletions examples/ember-vite/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

[*.hbs]
insert_final_newline = false

[*.{diff,md}]
trim_trailing_whitespace = false
19 changes: 19 additions & 0 deletions examples/ember-vite/.ember-cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
/**
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
*/
"isTypeScriptProject": false,

/**
Setting `componentAuthoringFormat` to "strict" will force the blueprint generators to generate GJS
or GTS files for the component and the component rendering test. "loose" is the default.
*/
"componentAuthoringFormat": "strict",

/**
Setting `routeAuthoringFormat` to "strict" will force the blueprint generators to generate GJS
or GTS templates for routes. "loose" is the default
*/
"routeAuthoringFormat": "strict"
}
47 changes: 47 additions & 0 deletions examples/ember-vite/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

on:
push:
branches:
- main
- master
pull_request: {}

concurrency:
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
lint:
name: "Lint"
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- name: Install Dependencies
run: npm ci
- name: Lint
run: npm run lint

test:
name: "Test"
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- name: Install Dependencies
run: npm ci
- name: Run Tests
run: npm test
26 changes: 26 additions & 0 deletions examples/ember-vite/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# compiled output
/dist/
/declarations/
/tmp/

# 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/
13 changes: 13 additions & 0 deletions examples/ember-vite/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# unconventional js
/blueprints/*/files/

# compiled output
/dist/

# misc
/coverage/
!.*
.*/
/pnpm-lock.yaml
ember-cli-update.json
*.html
39 changes: 39 additions & 0 deletions examples/ember-vite/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
'use strict';

module.exports = {
plugins: ['prettier-plugin-ember-template-tag'],
singleQuote: true,
overrides: [
{
files: ['*.js', '*.ts', '*.cjs', '.mjs', '.cts', '.mts', '.cts'],
options: {
trailingComma: 'es5',
},
},
{
files: ['*.html'],
options: {
singleQuote: false,
},
},
{
files: ['*.json'],
options: {
singleQuote: false,
},
},
{
files: ['*.hbs'],
options: {
singleQuote: false,
},
},
{
files: ['*.gjs', '*.gts'],
options: {
templateSingleQuote: false,
trailingComma: 'es5',
},
},
],
};
5 changes: 5 additions & 0 deletions examples/ember-vite/.stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# unconventional files
/blueprints/*/files/

# compiled output
/dist/
5 changes: 5 additions & 0 deletions examples/ember-vite/.stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
extends: ['stylelint-config-standard'],
};
5 changes: 5 additions & 0 deletions examples/ember-vite/.template-lintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
extends: 'recommended',
};
3 changes: 3 additions & 0 deletions examples/ember-vite/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignore_dirs": ["dist"]
}
56 changes: 56 additions & 0 deletions examples/ember-vite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# ember-vite

This README outlines the details of collaborating on this Ember application.
A short introduction of this app could easily go here.

## Prerequisites

You will need the following things properly installed on your computer.

- [Git](https://git-scm.com/)
- [Node.js](https://nodejs.org/) (with npm)
- [Ember CLI](https://cli.emberjs.com/release/)
- [Google Chrome](https://google.com/chrome/)

## Installation

- `git clone <repository-url>` this repository
- `cd ember-vite`
- `npm install`

## Running / Development

- `npm run start`
- Visit your app at [http://localhost:4200](http://localhost:4200).
- Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).

### Code Generators

Make use of the many generators for code, try `ember help generate` for more details

### Running Tests

- `npm run test`
- `npm run test:ember -- --server`

### Linting

- `npm run lint`
- `npm run lint:fix`

### Building

- `npm exec ember build` (development)
- `npm run build` (production)

### Deploying

Specify what it takes to deploy your app.

## Further Reading / Useful Links

- [ember.js](https://emberjs.com/)
- [ember-cli](https://cli.emberjs.com/release/)
- Development Browser Extensions
- [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
- [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)
18 changes: 18 additions & 0 deletions examples/ember-vite/app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Application from '@ember/application';
import compatModules from '@embroider/virtual/compat-modules';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from 'ember-vite/config/environment';
import { importSync, isDevelopingApp, macroCondition } from '@embroider/macros';

if (macroCondition(isDevelopingApp())) {
importSync('./deprecation-workflow');
}

export default class App extends Application {
modulePrefix = config.modulePrefix;
podModulePrefix = config.podModulePrefix;
Resolver = Resolver.withModules(compatModules);
}

loadInitializers(App, config.modulePrefix, compatModules);
Empty file.
27 changes: 27 additions & 0 deletions examples/ember-vite/app/config/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import loadConfigFromMeta from '@embroider/config-meta-loader';
import { assert } from '@ember/debug';

const config = loadConfigFromMeta('ember-vite');

assert(
'config is not an object',
typeof config === 'object' && config !== null
);
assert(
'modulePrefix was not detected on your config',
'modulePrefix' in config && typeof config.modulePrefix === 'string'
);
assert(
'locationType was not detected on your config',
'locationType' in config && typeof config.locationType === 'string'
);
assert(
'rootURL was not detected on your config',
'rootURL' in config && typeof config.rootURL === 'string'
);
assert(
'APP was not detected on your config',
'APP' in config && typeof config.APP === 'object'
);

export default config;
Empty file.
24 changes: 24 additions & 0 deletions examples/ember-vite/app/deprecation-workflow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import setupDeprecationWorkflow from 'ember-cli-deprecation-workflow';

/**
* Docs: https://github.com/ember-cli/ember-cli-deprecation-workflow
*/
setupDeprecationWorkflow({
/**
false by default, but if a developer / team wants to be more aggressive about being proactive with
handling their deprecations, this should be set to "true"
*/
throwOnUnhandled: false,
workflow: [
/* ... handlers ... */
/* to generate this list, run your app for a while (or run the test suite),
* and then run in the browser console:
*
* deprecationWorkflow.flushDeprecations()
*
* And copy the handlers here
*/
/* example: */
/* { handler: 'silence', matchId: 'template-action' }, */
],
});
Empty file.
Empty file.
9 changes: 9 additions & 0 deletions examples/ember-vite/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 'ember-vite/config/environment';

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

Router.map(function () {});
Empty file.
1 change: 1 addition & 0 deletions examples/ember-vite/app/styles/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Ember supports plain CSS out of the box. More info: https://cli.emberjs.com/release/advanced-use/stylesheets/ */
12 changes: 12 additions & 0 deletions examples/ember-vite/app/templates/application.gjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { pageTitle } from 'ember-page-title';
import { WelcomePage } from 'ember-welcome-page';

<template>
{{pageTitle "MyApp"}}

{{outlet}}

{{! The following component displays Ember's default welcome message. }}
<WelcomePage />
{{! Feel free to remove this! }}
</template>
42 changes: 42 additions & 0 deletions examples/ember-vite/babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const {
babelCompatSupport,
templateCompatSupport,
} = require('@embroider/compat/babel');

module.exports = {
plugins: [
[
'babel-plugin-ember-template-compilation',
{
compilerPath: 'ember-source/dist/ember-template-compiler.js',
enableLegacyModules: [
'ember-cli-htmlbars',
'ember-cli-htmlbars-inline-precompile',
'htmlbars-inline-precompile',
],
transforms: [...templateCompatSupport()],
},
],
[
'module:decorator-transforms',
{
runtime: {
import: require.resolve('decorator-transforms/runtime-esm'),
},
},
],
[
'@babel/plugin-transform-runtime',
{
absoluteRuntime: __dirname,
useESModules: true,
regenerator: false,
},
],
...babelCompatSupport(),
],

generatorOpts: {
compact: false,
},
};
Loading