Skip to content

Commit

Permalink
Sync with embroider-addon blueprint and use decorator-transforms (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeAstapov authored Nov 2, 2024
1 parent 6f8e522 commit 16410c3
Show file tree
Hide file tree
Showing 43 changed files with 3,164 additions and 2,046 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
48 changes: 21 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,25 @@ jobs:
- ember-lts-3.28
- ember-lts-4.4
- ember-lts-4.8
- ember-lts-4.12
- ember-lts-5.4
- ember-lts-5.8
- 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
32 changes: 32 additions & 0 deletions .github/workflows/push-dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Because this library needs to be built,
# we can't easily point package.json files at the git repo for easy cross-repo testing.
#
# This workflow brings back that capability by placing the compiled assets on a "dist" branch
# (configurable via the "branch" option below)
name: Push dist

on:
push:
branches:
- main
- master

jobs:
push-dist:
name: Push dist
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
- name: Install Dependencies
run: yarn install --frozen-lockfile
- uses: kategengler/[email protected]
with:
branch: dist
token: ${{ secrets.GITHUB_TOKEN }}
working-directory: 'ember-engines-router-service'
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-service`
- `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.24 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 @@ -81,12 +73,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.17.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
70 changes: 70 additions & 0 deletions ember-engines-router-service/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
'use strict';

module.exports = {
root: true,
// Only use overrides
// https://github.com/ember-cli/eslint-plugin-ember?tab=readme-ov-file#gtsgjs
overrides: [
{
files: ['**/*.js'],
env: { browser: true },
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
babelOptions: {
root: __dirname,
},
},
plugins: ['ember', 'import'],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:prettier/recommended',
],
rules: {
// require relative imports use full extensions
'import/extensions': ['error', 'always', { ignorePackages: true }],
// Add any custom rules here
},
},
{
files: ['**/*.gjs'],
parser: 'ember-eslint-parser',
plugins: ['ember', 'import'],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:ember/recommended-gjs',
'plugin:prettier/recommended',
],
rules: {
// require relative imports use full extensions
'import/extensions': ['error', 'always', { ignorePackages: true }],
// Add any custom rules here
},
},
// node files
{
files: [
'./.eslintrc.cjs',
'./.prettierrc.cjs',
'./.template-lintrc.cjs',
'./addon-main.cjs',
],
parserOptions: {
sourceType: 'script',
},
env: {
browser: false,
node: true,
},
plugins: ['n'],
extends: [
'eslint:recommended',
'plugin:n/recommended',
'plugin:prettier/recommended',
],
},
],
};
Loading

0 comments on commit 16410c3

Please sign in to comment.