Skip to content
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

WIP: Become our own blueprint #79

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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 files/.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 files/.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": <%= typescript ? 'true' : 'false' %>
}
14 changes: 14 additions & 0 deletions files/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# unconventional js
/blueprints/*/files/

# compiled output
/declarations/
/dist/

# misc
/coverage/
!.*
.*/

# ember-try
/.node_modules.ember-try/
67 changes: 67 additions & 0 deletions files/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
'use strict';

module.exports = {
root: true,
parser: '<%= typescript ? '@typescript-eslint/parser' : '@babel/eslint-parser' %>',
parserOptions: {
ecmaVersion: 'latest',<% if (!typescript) { %>
sourceType: 'module',
requireConfigFile: false,
babelOptions: {
plugins: [
['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }],
],
},<% } %>
},
plugins: ['ember'<% if (typescript) { %>, '@typescript-eslint'<% } %>],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:prettier/recommended',
],
env: {
browser: true,
},
rules: {},
overrides: [
<% if (typescript) { %> // ts files
{
files: ['**/*.ts'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {},
},
<% } %> // node files
{
files: [
'./.eslintrc.js',
'./.prettierrc.js',
'./.stylelintrc.js',
'./.template-lintrc.js',
'./ember-cli-build.js',<% if (blueprint !== 'app') { %>
'./index.js',<% } %>
'./testem.js',
'./blueprints/*/index.js',
'./config/**/*.js',<% if (blueprint === 'app') { %>
'./lib/*/index.js',
'./server/**/*.js',<% } else { %>
'./tests/dummy/config/**/*.js',<% } %>
],
<% if (!typescript) { %> parserOptions: {
sourceType: 'script',
},
<% } %> env: {
browser: false,
node: true,
},
extends: ['plugin:n/recommended'],
},
{
// test files
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
},
],
};
53 changes: 53 additions & 0 deletions files/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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<% if (pnpm) { %>
- uses: pnpm/action-setup@v2
with:
version: 8<% } %>
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm' %>
- name: Install Dependencies
run: <%= pnpm ? 'pnpm install --frozen-lockfile' : yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %>
- name: Lint
run: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm run' %> lint

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

steps:
- uses: actions/checkout@v3<% if (pnpm) { %>
- uses: pnpm/action-setup@v2
with:
version: 8<% } %>
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm' %>
- name: Install Dependencies
run: <%= pnpm ? 'pnpm install --frozen-lockfile' : yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %>
- name: Run Tests
run: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm' %> test
13 changes: 13 additions & 0 deletions files/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# unconventional js
/blueprints/*/files/

# compiled output
/dist/

# misc
/coverage/
!.*
.*/

# ember-try
/.node_modules.ember-try/
12 changes: 12 additions & 0 deletions files/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

module.exports = {
overrides: [
{
files: '*.{js,ts}',
options: {
singleQuote: true,
},
},
],
};
8 changes: 8 additions & 0 deletions files/.stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# unconventional files
/blueprints/*/files/

# compiled output
/dist/

# addons
/.node_modules.ember-try/
5 changes: 5 additions & 0 deletions files/.stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

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

module.exports = {
extends: 'recommended',
};
58 changes: 58 additions & 0 deletions files/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# <%= name %>

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/)<% if (pnpm) { %>
- [pnpm](https://pnpm.io/)<% } else if (yarn) { %>
- [Yarn](https://yarnpkg.com/)<% } else { %> (with npm)<% } %>
- [Ember CLI](https://cli.emberjs.com/release/)
- [Google Chrome](https://google.com/chrome/)

## Installation

- `git clone <repository-url>` this repository
- `cd <%= appDirectory %>`
- `<% if (pnpm) { %>pnpm<% } else if (yarn) { %>yarn<% } else { %>npm<% } %> install`

## Running / Development

- `<%= invokeScriptPrefix %> 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

- `<%= invokeScriptPrefix %> test`
- `<%= invokeScriptPrefix %> test:ember <% if (npm) { %>-- <% } %>--server`

### Linting

- `<%= invokeScriptPrefix %> lint`
- `<%= invokeScriptPrefix %> lint:fix`

### Building

- `<%= execBinPrefix %> ember build` (development)
- `<%= invokeScriptPrefix %> 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/)
2 changes: 1 addition & 1 deletion files-override/app/app.js → files/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import config from './config/environment';
let d = window.define;

for (const [name, module] of Object.entries(compatModules)) {
d(name, function () {
d(name, function() {
return module;
});
}
Expand Down
Empty file added files/app/components/.gitkeep
Empty file.
File renamed without changes.
11 changes: 11 additions & 0 deletions files/app/router.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import EmberRouter from '@ember/routing/router';
import config from '<%= modulePrefix %>/config/environment';

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

Router.map(function () {<% if (typescript) { %>
// Add route declarations here
<% } %>});
Empty file added files/app/routes/.gitkeep
Empty file.
17 changes: 17 additions & 0 deletions files/app/templates/application.gts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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>
);
18 changes: 18 additions & 0 deletions files/config/ember-cli-update.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"schemaVersion": "1.0.0",
"packages": [
{
"name": "ember-cli",
"version": "<%= emberCLIVersion %>",
"blueprints": [
{
"name": "<%= blueprint %>",
"outputRepo": "https://github.com/ember-cli/ember-<%= blueprint === 'app' ? 'new' : 'addon' %>-output",
"codemodsSource": "ember-<%= blueprint %>-codemods-manifest@1",
"isBaseBlueprint": true,
"options": [<%= blueprintOptions %>]
}
]
}
]
}
48 changes: 48 additions & 0 deletions files/config/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
'use strict';

module.exports = function (environment) {
const ENV = {
modulePrefix: '<%= modulePrefix %>',
environment,
rootURL: '/',
locationType: 'history',
EmberENV: {
EXTEND_PROTOTYPES: false,
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true
},
},

APP: {
// Here you can pass flags/options to your application instance
// when it is created
},
};

if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
}

if (environment === 'test') {
// Testem prefers this...
ENV.locationType = 'none';

// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;

ENV.APP.rootElement = '#ember-testing';
ENV.APP.autoboot = false;
}

if (environment === 'production') {
// here you can enable a production-specific feature
}

return ENV;
};
7 changes: 7 additions & 0 deletions files/config/optional-features.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"application-template-wrapper": false,
"default-async-observers": true,
"jquery-integration": false,
"template-only-glimmer-components": true,
"no-implicit-route-model": true
}
11 changes: 11 additions & 0 deletions files/config/targets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';

const browsers = [
'last 1 Chrome versions',
'last 1 Firefox versions',
'last 1 Safari versions',
];

module.exports = {
browsers,
};
Loading
Loading