Skip to content
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 .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
7 changes: 7 additions & 0 deletions .ember-cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
/**
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
}
47 changes: 47 additions & 0 deletions .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
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# compiled output
/dist/
/declarations/

# dependencies
/node_modules/

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

# broccoli-debug
/DEBUG/
13 changes: 13 additions & 0 deletions .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
14 changes: 14 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

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

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

module.exports = {
extends: ['stylelint-config-standard'],
rules: {
'at-rule-no-unknown': [
true,
{
ignoreAtRules: [
'tailwind',
'apply',
'variants',
'responsive',
'screen',
'layer',
],
},
],
},
};
5 changes: 5 additions & 0 deletions .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 .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignore_dirs": ["dist"]
}
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,44 @@
# -ember-react
# shadcn/ui + Ember demo

This project reproduces the [ui.shadcn.com](https://ui.shadcn.com) landing page inside an Ember 6.4 application. The React
components from shadcn/ui are rendered through [`@universal-ember/react`](https://github.com/universal-ember/react), allowing us
to embed modern React component libraries in classic Ember routes without losing reactivity or DX.

## 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

```bash
git clone <repository-url>
cd -ember-react
npm install
```

## Running / Development

```bash
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).

## Available scripts

- `npm run start` – start the local development server with live reload.
- `npm run build` – create a production build (`dist/`).
- `npm run lint` – run the configured lint tasks.
- `npm run test` – execute linting and Ember tests in CI mode.

## Further Reading

- [@universal-ember/react documentation](https://github.com/universal-ember/react)
- [shadcn/ui documentation](https://ui.shadcn.com)
- [Ember CLI guide](https://cli.emberjs.com/release/)
17 changes: 17 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Application from '@ember/application';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from '-ember-react/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;
}

loadInitializers(App, config.modulePrefix);
Empty file added app/components/.gitkeep
Empty file.
6 changes: 6 additions & 0 deletions app/components/shadcn-home.gjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { makeRenderable } from '@universal-ember/react';
import { ShadcnHome as ReactShadcnHome } from '../react-components/shadcn-home';

const ShadcnHome = makeRenderable(ReactShadcnHome);

<template><ShadcnHome /></template>
Empty file added app/controllers/.gitkeep
Empty file.
24 changes: 24 additions & 0 deletions 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 added app/helpers/.gitkeep
Empty file.
31 changes: 31 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>EmberReact</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{content-for "head"}}

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Cal+Sans:wght@400;600&family=Inter:wght@400;500;600;700&display=swap"
rel="stylesheet"
>

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

{{content-for "head-footer"}}
</head>
<body class="dark">
{{content-for "body"}}

<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/-ember-react.js"></script>

{{content-for "body-footer"}}
</body>
</html>
Empty file added app/models/.gitkeep
Empty file.
6 changes: 6 additions & 0 deletions app/react-components/lib/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';

export function cn(...inputs) {
return twMerge(clsx(inputs));
}
Loading