Skip to content

Commit

Permalink
Sync with embroider-addon blueprint and use decorator-transforms
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeAstapov committed Mar 26, 2024
1 parent 05d3364 commit 4b01f02
Show file tree
Hide file tree
Showing 39 changed files with 1,751 additions and 1,339 deletions.
19 changes: 19 additions & 0 deletions .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
47 changes: 20 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,31 @@ jobs:
timeout-minutes: 10

steps:
- uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 18
cache: yarn

- name: Install Dependencies
run: until yarn install --frozen-lockfile; do echo "Retrying yarn"; done

- name: Lint Addon
- name: Lint
run: yarn lint
working-directory: ember-engines-router-service

- name: Lint Test App
run: yarn lint
working-directory: test-app

- name: Run Tests
run: yarn test:ember
working-directory: test-app
run: yarn test

floating:
name: "Floating Dependencies"
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 18
cache: yarn

- name: Install Dependencies
Expand All @@ -57,13 +51,13 @@ jobs:
run: until yarn install --no-lockfile; do echo "Retrying yarn"; done

- name: Run Tests
run: yarn test:ember
working-directory: test-app
run: yarn test

try-scenarios:
name: ${{ matrix.try-scenario }}
runs-on: ubuntu-latest
needs: 'test'
timeout-minutes: 10

strategy:
fail-fast: false
Expand All @@ -73,25 +67,24 @@ jobs:
- ember-lts-3.28
- ember-lts-4.4
- ember-lts-4.8
- ember-lts-4.12
- ember-lts-5.4
- ember-release
- ember-beta
- ember-canary
- ember-default-with-jquery
- ember-classic
# - embroider-safe
# - embroider-optimized
# - embroider-safe
# - embroider-optimized

steps:
- uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 18
cache: yarn

- name: Install Dependencies
run: until yarn install --frozen-lockfile; do echo "Retrying yarn"; done

- name: Run Tests
run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }}
working-directory: test-app
run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }} --skip-cleanup
working-directory: test-app
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ npm-debug.log*
yarn-error.log
/.DS_Store

# yarn
.pnp.*

# https://yarnpkg.com/getting-started/qa/#which-files-should-be-gitignored
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
Expand Down
30 changes: 18 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,30 @@

## Installation

* `git clone https://github.com/villander/ember-engines-router-service.git`
* `cd ember-engines-router-service`
* `yarn install`
- `git clone https://github.com/villander/ember-engines-router-service.git`
- `cd ember-engines-router-service`
- `yarn install`

## Linting

* `yarn lint`
* `yarn lint:fix`
- `yarn lint`
- `yarn lint:fix`

## Building the addon

- `cd ember-engines-router-service1`
- `yarn build`

## Running tests

* `ember test` – Runs the test suite on the current Ember version
* `ember test --server` – Runs the test suite in "watch mode"
* `ember try:each` – Runs the test suite against multiple Ember versions
- `cd test-app`
- `yarn test` – Runs the test suite on the current Ember version
- `yarn test:watch` – Runs the test suite in "watch mode"

## Running the test-app application
## Running the test application

* `ember serve`
* Visit the test-app application at [http://localhost:4200](http://localhost:4200).
- `cd test-app`
- `yarn start`
- Visit the test application at [http://localhost:4200](http://localhost:4200).

For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
For more information on using ember-cli, visit [https://cli.emberjs.com/release/](https://cli.emberjs.com/release/).
15 changes: 2 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,20 @@ This addon provides an API for authoring a [Router service](https://api.emberjs.


## Compatibility
------------------------------------------------------------------------------

* Ember.js v3.12 or above
* Ember CLI v3.24 or above
* Node.js v14 or above

- Ember.js v3.12 or above
- Embroider or ember-auto-import v2

## Installation
------------------------------------------------------------------------------

```
ember install ember-engines-router-service
```


## Usage

Basically you have the full [RouterService](https://api.emberjs.com/ember/release/classes/RouterService) API **inside each engine**. That means you can use APIs such as `transitionTo` and `isActive`, plus the new "external routing" APIs such as `transitionToExternal` and `isActiveExternal` which help link `externalRoutes` together.

------------------------------------------------------------------------------
```js
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
Expand Down Expand Up @@ -59,9 +53,7 @@ export default class SomeComponent extends Component {

For further documentation on this subject, view the [Engine Linking RFC](https://github.com/emberjs/rfcs/pull/122).


## TypeScript
------------------------------------------------------------------------------

The library ships types for TypeScript usage:

Expand All @@ -83,12 +75,9 @@ export default class MyService extends Service {


## Contributing
------------------------------------------------------------------------------

See the [Contributing](CONTRIBUTING.md) guide for details.


## License
------------------------------------------------------------------------------

This project is licensed under the [MIT License](LICENSE.md).
21 changes: 21 additions & 0 deletions config/ember-cli-update.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"schemaVersion": "1.0.0",
"projectName": "ember-engines-router-service",
"packages": [
{
"name": "@embroider/addon-blueprint",
"version": "2.14.0",
"blueprints": [
{
"name": "@embroider/addon-blueprint",
"isBaseBlueprint": true,
"options": [
"--ci-provider=github",
"--release-it",
"--yarn"
]
}
]
}
]
}
8 changes: 1 addition & 7 deletions ember-engines-router-service/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/

# dependencies
/node_modules/
/declarations/

# misc
/coverage/
!.*
.*/
.eslintcache
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ module.exports = {
root: true,
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 2021,
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
babelOptions: {
root: __dirname,
},
},
plugins: ['ember'],
Expand All @@ -23,16 +23,21 @@ module.exports = {
overrides: [
// node files
{
files: ['./.eslintrc.js', './.prettierrc.js', './addon-main.js'],
files: [
'./.eslintrc.cjs',
'./.prettierrc.cjs',
'./.template-lintrc.cjs',
'./addon-main.cjs',
],
parserOptions: {
sourceType: 'script',
},
env: {
browser: false,
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended'],
plugins: ['n'],
extends: ['plugin:n/recommended'],
},
],
};
22 changes: 12 additions & 10 deletions ember-engines-router-service/.gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# unconventional js
/blueprints/*/files/
/vendor/
# The authoritative copies of these live in the monorepo root (because they're
# more useful on github that way), but the build copies them into here so they
# will also appear in published NPM packages.
/README.md
/LICENSE.md

# compiled output
/dist/
dist/
declarations/

# dependencies
/node_modules/
# npm/pnpm/yarn pack output
*.tgz

# misc
/coverage/
!.*
.*/
# deps & caches
node_modules/
.eslintcache
.prettiercache
8 changes: 1 addition & 7 deletions ember-engines-router-service/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/

# dependencies
/node_modules/
/declarations/

# misc
/coverage/
!.*
.eslintcache
.lint-todo/
6 changes: 6 additions & 0 deletions ember-engines-router-service/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';

module.exports = {
plugins: ['prettier-plugin-ember-template-tag'],
singleQuote: true,
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

module.exports = {
singleQuote: true,
extends: 'recommended',
};
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
'use strict';

const { addonV1Shim } = require('@embroider/addon-shim');
module.exports = addonV1Shim(__dirname);
9 changes: 6 additions & 3 deletions ember-engines-router-service/babel.config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"plugins": [
"@embroider/addon-dev/template-colocation-plugin",
["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-proposal-class-properties"
["babel-plugin-ember-template-compilation", {
"targetFormat": "hbs",
"transforms": []
}],
["module:decorator-transforms", { "runtime": { "import": "decorator-transforms/runtime" } }]
]
}
}
Loading

0 comments on commit 4b01f02

Please sign in to comment.