-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split JS and TS files so they're easier to grok
- Loading branch information
1 parent
8edb4e5
commit 5af9afc
Showing
24 changed files
with
311 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
overrides: [ | ||
{ | ||
files: ['*.{js,mjs,cjs}'], | ||
plugins: ['ember'], | ||
parser: '@babel/eslint-parser', | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
requireConfigFile: false, | ||
babelOptions: { | ||
plugins: [ | ||
[ | ||
'@babel/plugin-proposal-decorators', | ||
{ decoratorsBeforeExport: true }, | ||
], | ||
], | ||
}, | ||
}, | ||
extends: ['eslint:recommended', 'plugin:ember/recommended'], | ||
}, | ||
{ | ||
files: ['*.gjs'], | ||
parser: 'ember-eslint-parser', | ||
plugins: ['ember'], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:ember/recommended', | ||
'plugin:ember/recommended-gjs', | ||
], | ||
}, | ||
{ | ||
files: ['tests/**/*-test.js'], | ||
plugins: ['ember'], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:qunit/recommended', | ||
'plugin:ember/recommended', | ||
], | ||
}, | ||
{ | ||
files: ['tests/**/*-test.gjs'], | ||
parser: 'ember-eslint-parser', | ||
plugins: ['ember'], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:ember/recommended', | ||
'plugin:ember/recommended-gjs', | ||
], | ||
}, | ||
// node files | ||
{ | ||
files: [ | ||
'./.eslintrc.{js,cjs}', | ||
'./.prettierrc.{js,cjs}', | ||
'./.stylelintrc.{js,cjs}', | ||
'./.template-lintrc.{js,cjs}', | ||
'./ember-cli-build.js', | ||
'./testem.js', | ||
'./config/**/*.js', | ||
'*.mjs', | ||
'*.cjs', | ||
], | ||
env: { | ||
browser: false, | ||
node: true, | ||
}, | ||
extends: ['plugin:n/recommended'], | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Application from '@ember/application'; | ||
import compatModules from '@embroider/core/entrypoint'; | ||
import Resolver from 'ember-resolver'; | ||
import loadInitializers from 'ember-load-initializers'; | ||
import config from './config/environment'; | ||
|
||
const d = window.define; | ||
|
||
for (const [name, module] of Object.entries(compatModules)) { | ||
d(name, function () { | ||
return module; | ||
}); | ||
} | ||
|
||
export default class App extends Application { | ||
modulePrefix = config.modulePrefix; | ||
podModulePrefix = config.podModulePrefix; | ||
Resolver = Resolver; | ||
} | ||
|
||
loadInitializers(App, config.modulePrefix); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Application from '<%= name %>/app'; | ||
import config from '<%= name %>/config/environment'; | ||
import * as QUnit from 'qunit'; | ||
import { setApplication } from '@ember/test-helpers'; | ||
import { setup } from 'qunit-dom'; | ||
import { start as qunitStart } from 'ember-qunit'; | ||
|
||
export function start() { | ||
setApplication(Application.create(config.APP)); | ||
|
||
setup(QUnit.assert); | ||
|
||
qunitStart(); | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}, | ||
}; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import loadConfigFromMeta from '@embroider/config-meta-loader'; | ||
|
||
export default loadConfigFromMeta('<%= name %>'); |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>AppTemplate</title> | ||
<meta name="description" content=""> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
{{content-for "head"}} | ||
|
||
<link integrity="" rel="stylesheet" href="/@embroider/core/vendor.css"> | ||
<link integrity="" rel="stylesheet" href="/assets/<%= name %>.css"> | ||
|
||
{{content-for "head-footer"}} | ||
</head> | ||
<body> | ||
{{content-for "body"}} | ||
|
||
<script src="/@embroider/core/vendor.js"></script> | ||
<script type="module"> | ||
import Application from './app/app'; | ||
import environment from './app/config/environment'; | ||
|
||
Application.create(environment.APP); | ||
</script> | ||
|
||
{{content-for "body-footer"}} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { defineConfig } from 'vite'; | ||
import { | ||
resolver, | ||
hbs, | ||
scripts, | ||
templateTag, | ||
optimizeDeps, | ||
compatPrebuild, | ||
assets, | ||
contentFor, | ||
} from '@embroider/vite'; | ||
import { babel } from '@rollup/plugin-babel'; | ||
|
||
const extensions = [ | ||
'.mjs', | ||
'.gjs', | ||
'.js', | ||
'.mts', | ||
'.gts', | ||
'.ts', | ||
'.hbs', | ||
'.json', | ||
]; | ||
|
||
export default defineConfig(({ mode }) => { | ||
return { | ||
resolve: { | ||
extensions, | ||
}, | ||
plugins: [ | ||
hbs(), | ||
templateTag(), | ||
scripts(), | ||
resolver(), | ||
compatPrebuild(), | ||
assets(), | ||
contentFor(), | ||
|
||
babel({ | ||
babelHelpers: 'runtime', | ||
extensions, | ||
}), | ||
], | ||
optimizeDeps: optimizeDeps(), | ||
server: { | ||
port: 4200, | ||
}, | ||
build: { | ||
outDir: 'dist', | ||
rollupOptions: { | ||
input: { | ||
main: 'index.html', | ||
...(shouldBuildTests(mode) | ||
? { tests: 'tests/index.html' } | ||
: undefined), | ||
}, | ||
}, | ||
}, | ||
}; | ||
}); | ||
|
||
function shouldBuildTests(mode) { | ||
return mode !== 'production' || process.env.FORCE_BUILD_TESTS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.