-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update dependency manipulation use npx, because I don't have globally installed things Use a separate fixture directory for the TS output Silly linting More gts -- compat with hbs and TS can be later TS tests pass Split JS and TS files so they're easier to grok Update files-override lints Another test port 0
- Loading branch information
1 parent
1743eb5
commit d28f119
Showing
32 changed files
with
732 additions
and
7 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
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
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,25 @@ | ||
import Application from '@ember/application'; | ||
// This can be removed if you have no need for compatModules | ||
// @ts-expect-error TODO: add types to @embroider/core/entrypoint | ||
import compatModules from '@embroider/core/entrypoint'; | ||
import Resolver from 'ember-resolver'; | ||
import loadInitializers from 'ember-load-initializers'; | ||
import config from './config/environment'; | ||
|
||
// This can be removed if you have no need for compatModules | ||
// @ts-expect-error window does not have define | ||
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); |
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(); | ||
} |
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,46 @@ | ||
{ | ||
"extends": "@tsconfig/ember/tsconfig.json", | ||
"include": [ | ||
"app/**/*", | ||
"tests/**/*", | ||
], | ||
"glint": { | ||
"environment": [ | ||
"ember-loose", | ||
"ember-template-imports" | ||
] | ||
}, | ||
"compilerOptions": { | ||
"allowJs": true, | ||
/** | ||
https://www.typescriptlang.org/tsconfig#noEmitOnError | ||
Do not block emit on TS errors. | ||
*/ | ||
"noEmitOnError": false, | ||
|
||
"declaration": false, | ||
"declarationMap": false, | ||
|
||
/** | ||
https://www.typescriptlang.org/tsconfig#allowImportingTsExtensions | ||
We want our tooling to know how to resolve our custom files so the appropriate plugins | ||
can do the proper transformations on those files. | ||
*/ | ||
"allowImportingTsExtensions": true, | ||
"paths": { | ||
"<%= name %>/tests/*": [ | ||
"./tests/*" | ||
], | ||
"<%= name %>/*": [ | ||
"./app/*" | ||
], | ||
"*": [ | ||
"./types/*" | ||
] | ||
}, | ||
"types": [ | ||
"ember-source/types" | ||
] | ||
}, | ||
} |
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 %>'); |
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,18 @@ | ||
import Route from 'ember-route-template'; | ||
import { pageTitle } from 'ember-page-title'; | ||
<% if (welcome) {%>import { WelcomePage } from 'ember-welcome-page';<% } %> | ||
|
||
export default Route( | ||
<template> | ||
{{pageTitle "<%= namespace %>"}} | ||
<% if (welcome) { %> | ||
{{outlet}} | ||
|
||
{{! The following component displays Ember's default welcome message. }} | ||
<WelcomePage /> | ||
{{! Feel free to remove this! }}<% } else { %> | ||
<h2 id="title">Welcome to Ember</h2> | ||
|
||
{{outlet}}<% } %> | ||
</template> | ||
); |
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,50 @@ | ||
const { | ||
babelCompatSupport, | ||
templateCompatSupport, | ||
} = require('@embroider/compat/babel'); | ||
|
||
module.exports = { | ||
plugins: [ | ||
[ | ||
'@babel/plugin-transform-typescript', | ||
{ | ||
allExtensions: true, | ||
onlyRemoveTypeImports: true, | ||
allowDeclareFields: true, | ||
}, | ||
], | ||
[ | ||
'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, | ||
}, | ||
}; |
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; | ||
} |
Oops, something went wrong.