-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fix support for --typescript
#80
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
190890e
Add `--typescript` support to this blueprint
NullVoxPopuli 88170cd
Remove all 'latest' tags
NullVoxPopuli da52634
Only remove TS deps when they are expected to need to be removed
NullVoxPopuli affe428
Reduce blueprint diff by perpetuating old patterns (the problem with …
NullVoxPopuli a122c2b
Fix typo in qunit-dom version
NullVoxPopuli 33c618f
Remove colors, as ember-cli now shipped them... sorta, will be in 6 o…
NullVoxPopuli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
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 './config/environment'; | ||
|
||
export default class App extends Application { | ||
modulePrefix = config.modulePrefix; | ||
podModulePrefix = config.podModulePrefix; | ||
Resolver = Resolver.withModules(compatModules); | ||
} | ||
|
||
loadInitializers(App, config.modulePrefix, compatModules); |
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,146 @@ | ||
import globals from 'globals'; | ||
import js from '@eslint/js'; | ||
|
||
import ts from 'typescript-eslint'; | ||
|
||
import ember from 'eslint-plugin-ember'; | ||
import emberRecommended from 'eslint-plugin-ember/configs/recommended'; | ||
import gjsRecommended from 'eslint-plugin-ember/configs/recommended-gjs'; | ||
import gtsRecommended from 'eslint-plugin-ember/configs/recommended-gts'; | ||
|
||
import prettier from 'eslint-plugin-prettier/recommended'; | ||
import qunit from 'eslint-plugin-qunit'; | ||
import n from 'eslint-plugin-n'; | ||
|
||
import emberParser from 'ember-eslint-parser'; | ||
import babelParser from '@babel/eslint-parser'; | ||
|
||
const parserOptions = { | ||
esm: { | ||
js: { | ||
ecmaFeatures: { modules: true }, | ||
ecmaVersion: 'latest', | ||
}, | ||
ts: { | ||
projectService: true, | ||
tsconfigRootDir: import.meta.dirname, | ||
}, | ||
}, | ||
}; | ||
|
||
export default ts.config( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this utility is neat -- it re-adds some basic support for |
||
js.configs.recommended, | ||
prettier, | ||
{ | ||
files: ['**/*.js'], | ||
languageOptions: { | ||
parser: babelParser, | ||
parserOptions: parserOptions.esm.js, | ||
globals: { | ||
...globals.browser, | ||
}, | ||
}, | ||
plugins: { | ||
ember, | ||
}, | ||
rules: { | ||
...emberRecommended.rules, | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.ts'], | ||
plugins: { ember }, | ||
languageOptions: { | ||
parserOptions: parserOptions.esm.ts, | ||
}, | ||
extends: [...ts.configs.strictTypeChecked, ...emberRecommended], | ||
}, | ||
{ | ||
files: ['**/*.gjs'], | ||
languageOptions: { | ||
parser: emberParser, | ||
parserOptions: parserOptions.esm.js, | ||
globals: { | ||
...globals.browser, | ||
}, | ||
}, | ||
plugins: { | ||
ember, | ||
}, | ||
rules: { | ||
...emberRecommended.rules, | ||
...gjsRecommended.rules, | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.gts'], | ||
plugins: { ember }, | ||
languageOptions: { | ||
parserOptions: parserOptions.esm.ts, | ||
}, | ||
extends: [ | ||
...ts.configs.strictTypeChecked, | ||
...emberRecommended, | ||
...gtsRecommended, | ||
], | ||
}, | ||
{ | ||
files: ['tests/**/*-test.{js,gjs}'], | ||
plugins: { | ||
qunit, | ||
}, | ||
}, | ||
/** | ||
* CJS node files | ||
*/ | ||
{ | ||
files: [ | ||
'**/*.cjs', | ||
'config/**/*.js', | ||
'testem.js', | ||
'testem*.js', | ||
'.prettierrc.js', | ||
'.stylelintrc.js', | ||
'.template-lintrc.js', | ||
'ember-cli-build.js', | ||
], | ||
plugins: { | ||
n, | ||
}, | ||
|
||
languageOptions: { | ||
sourceType: 'script', | ||
ecmaVersion: 'latest', | ||
globals: { | ||
...globals.node, | ||
}, | ||
}, | ||
}, | ||
/** | ||
* ESM node files | ||
*/ | ||
{ | ||
files: ['*.mjs'], | ||
plugins: { | ||
n, | ||
}, | ||
|
||
languageOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 'latest', | ||
parserOptions: parserOptions.esm.js, | ||
globals: { | ||
...globals.node, | ||
}, | ||
}, | ||
}, | ||
/** | ||
* Settings | ||
*/ | ||
{ | ||
ignores: ['dist/', 'node_modules/', 'coverage/', '!**/.*'], | ||
linterOptions: { | ||
reportUnusedDisableDirectives: 'error', | ||
}, | ||
}, | ||
); |
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(); | ||
} | ||
NullVoxPopuli marked this conversation as resolved.
Show resolved
Hide resolved
|
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,45 @@ | ||
{ | ||
"extends": "@tsconfig/ember/tsconfig.json", | ||
"include": [ | ||
"app", "tests", "types" | ||
], | ||
"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 @@ | ||
/// <reference types="@embroider/core/virtual" /> |
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'; | ||
NullVoxPopuli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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, | ||
}, | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.cts
is in here twice, and it seems some entries are missing the*
character?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to point out that overrides are overriding what is already being set as the default on line 4 so this whole block is pointless (I think) 🙈
this PR had too much back and forth I just let that one slide
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iteration is easier
Ye