Skip to content

Commit d047135

Browse files
authored
Merge pull request #3 from ember-cli/addon-implementation
Import addon implementation (without testing) from @embroider/addon-blueprint
2 parents c458ef9 + b4af746 commit d047135

31 files changed

Lines changed: 2764 additions & 4 deletions

.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# super strict mode
2+
auto-install-peers=false
3+
resolve-peers-from-workspace-root=false

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Simon Ihmig
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# @ember/addon-blueprint
2+
3+
Blueprint for scaffolding ember v2 addons
4+
5+
For migrating a v1 addon to a v2 addon, you may follow _[Porting Addons to V2](https://github.com/embroider-build/embroider/blob/main/PORTING-ADDONS-TO-V2.md)_ and
6+
this blog post [Migrating an Ember addon to the next-gen v2 format
7+
](https://www.kaliber5.de/de/blog/v2-addon_en).
8+
9+
## WIP
10+
11+
This is still work in progress but we are aiming for this to be the new default for when someone generates an addon with `ember addon super-addon-name`. This will need an RFC to change the default but if you notice anything that you would like to be imporoved with this blueprint please open an issue to discuss, you don't need to wait for the RFC process to give us feedback.
12+
13+
## Usage
14+
15+
```bash
16+
pnpm dlx ember-cli@latest addon my-addon -b @ember/addon-blueprint --pnpm
17+
```
18+
19+
### Options
20+
21+
For all these options, you'll see a warning printed from `ember-cli` about unsupported options.
22+
`ember-cli` doesn't have a way to detect if flags are used by a blueprint.
23+
24+
#### `--pnpm`
25+
26+
Sets up the new addon with [`pnpm`](https://pnpm.io/) as a default package manager.
27+
28+
Example:
29+
30+
```bash
31+
npx ember-cli@latest addon my-addon -b @embroider/addon-blueprint --pnpm
32+
cd my-addon
33+
```
34+
35+
#### `--npm`
36+
37+
Sets up the new addon with `npm` as a default.
38+
39+
Example:
40+
41+
```bash
42+
npx ember-cli@latest addon my-addon -b @embroider/addon-blueprint --npm
43+
cd my-addon
44+
```
45+
46+
#### `--typescript`
47+
48+
Sets up the new addon with [`typescript`](https://www.typescriptlang.org/) support.
49+
50+
Example:
51+
52+
```bash
53+
npx ember-cli@latest addon my-addon -b @embroider/addon-blueprint --typescript
54+
```
55+
56+
### Updating the addon
57+
58+
The blueprint supports `ember-cli-update` to update your addon with any changes that occurred in the blueprint since you created the addon. So to update your addons boilerplate, simply run `ember-cli-update` (or `npx ember-cli-update` if you haven't installed it globally).
59+
60+
For additional instructions, please consult its [documentation](https://github.com/ember-cli/ember-cli-update).
61+
62+
## License
63+
64+
This project is licensed under the [MIT License](LICENSE.md).

additional-test-app-package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"devDependencies": {
3+
"@embroider/test-setup": "^3.0.1",
4+
"ember-try": "^3.0.0",
5+
"ember-source-channel-url": "^3.0.0"
6+
}
7+
}

files/.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.hbs]
16+
insert_final_newline = false
17+
18+
[*.{diff,md}]
19+
trim_trailing_whitespace = false

files/.github/workflows/ci.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
pull_request: {}
9+
10+
concurrency:
11+
group: ci-${{ github.head_ref || github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
test:
16+
name: "Tests"
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 10
19+
20+
steps:
21+
- uses: actions/checkout@v4<% if (pnpm) { %>
22+
- uses: pnpm/action-setup@v4<% } %>
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: 18
26+
cache: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm' %>
27+
- name: Install Dependencies
28+
run: <%= pnpm ? 'pnpm install --frozen-lockfile' : yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %>
29+
- name: Lint
30+
run: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm run' %> lint
31+
- name: Run Tests
32+
run: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm run' %> test
33+
34+
floating:
35+
name: "Floating Dependencies"
36+
runs-on: ubuntu-latest
37+
timeout-minutes: 10
38+
39+
steps:
40+
- uses: actions/checkout@v4<% if (pnpm) { %>
41+
- uses: pnpm/action-setup@v4<% } %>
42+
- uses: actions/setup-node@v4
43+
with:
44+
node-version: 18
45+
cache: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm' %>
46+
- name: Install Dependencies
47+
run: <%= pnpm ? 'pnpm install --no-lockfile' : yarn ? 'yarn install --no-lockfile' : 'npm install --no-package-lock' %>
48+
- name: Run Tests
49+
run: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm run' %> test
50+
51+
try-scenarios:
52+
name: ${{ matrix.try-scenario }}
53+
runs-on: ubuntu-latest
54+
needs: "test"
55+
timeout-minutes: 10
56+
57+
strategy:
58+
fail-fast: false
59+
matrix:
60+
try-scenario:
61+
- ember-lts-4.12
62+
- ember-lts-5.4
63+
- ember-release
64+
- ember-beta
65+
- ember-canary
66+
- embroider-safe
67+
- embroider-optimized
68+
69+
steps:
70+
- uses: actions/checkout@v4<% if (pnpm) { %>
71+
- uses: pnpm/action-setup@v4<% } %>
72+
- uses: actions/setup-node@v4
73+
with:
74+
node-version: 18
75+
cache: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm' %>
76+
- name: Install Dependencies
77+
run: <%= pnpm ? 'pnpm install --frozen-lockfile' : yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %>
78+
- name: Run Tests
79+
run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }} --skip-cleanup
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Because this library needs to be built,
2+
# we can't easily point package.json files at the git repo for easy cross-repo testing.
3+
#
4+
# This workflow brings back that capability by placing the compiled assets on a "dist" branch
5+
# (configurable via the "branch" option below)
6+
name: Push dist
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
- master
13+
14+
jobs:
15+
push-dist:
16+
name: Push dist
17+
permissions:
18+
contents: write
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 10
21+
22+
steps:
23+
- uses: actions/checkout@v4<% if (pnpm) { %>
24+
- uses: pnpm/action-setup@v4<% } %>
25+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: 18
28+
cache: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm' %>
29+
- name: Install Dependencies
30+
run: <%= pnpm ? 'pnpm install --frozen-lockfile' : yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %>
31+
- uses: kategengler/[email protected]
32+
with:
33+
branch: dist
34+
token: ${{ secrets.GITHUB_TOKEN }}

files/.npmrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Docs: https://pnpm.io/npmrc
2+
# https://github.com/emberjs/rfcs/pull/907
3+
4+
# we don't want addons to be bad citizens of the ecosystem
5+
auto-install-peers=false
6+
7+
# we want true isolation,
8+
# if a dependency is not declared, we want an error
9+
resolve-peers-from-workspace-root=false

files/.prettierignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# unconventional js
2+
/blueprints/*/files/
3+
4+
# compiled output
5+
/dist/
6+
/declarations/
7+
8+
# misc
9+
/coverage/
10+
pnpm-lock.yaml

files/.prettierrc.cjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict';
2+
3+
module.exports = {
4+
plugins: ['prettier-plugin-ember-template-tag'],
5+
overrides: [
6+
{
7+
files: '*.{js,gjs,ts,gts,mjs,mts,cjs,cts}',
8+
options: {
9+
singleQuote: true,
10+
templateSingleQuote: false,
11+
},
12+
},
13+
],
14+
};

0 commit comments

Comments
 (0)