Skip to content

Commit

Permalink
convert addon to v2 format
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeAstapov committed Nov 9, 2022
1 parent 9774e02 commit c814a81
Show file tree
Hide file tree
Showing 58 changed files with 1,549 additions and 260 deletions.
33 changes: 25 additions & 8 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: CI

on:
pull_request:
push:
# filtering branches here prevents duplicate builds from pull_request and push
branches:
Expand All @@ -10,22 +9,37 @@ on:
# always run CI for tags
tags:
- "*"
pull_request: {}

concurrency:
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
lint:
name: "Linting"
name: "Lint"
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v3
- uses: volta-cli/action@v4
- run: yarn install --frozen-lockfile --non-interactive
- run: yarn lint

- name: Lint Addon
run: yarn lint
working-directory: ember-async-data

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

tests_linux:
needs: lint
name: "Tests: ubuntu (node@${{ matrix.node-version }})"
runs-on: ubuntu-latest
timeout-minutes: 10

strategy:
matrix:
node-version: ["14", "16", "18"]
Expand All @@ -43,6 +57,7 @@ jobs:
needs: lint
name: "Tests: ${{ matrix.os }}"
runs-on: "${{ matrix.os }}-latest"
timeout-minutes: 10

strategy:
matrix:
Expand All @@ -59,6 +74,8 @@ jobs:
needs: tests_linux
name: "Tests: Ember compatibility (ember-source@${{ matrix.ember-version }})"
runs-on: ubuntu-latest
timeout-minutes: 10

strategy:
matrix:
ember-version:
Expand All @@ -71,8 +88,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: volta-cli/action@v4
with:
node-version: ${{ matrix.node-version }}
- run: yarn install --frozen-lockfile --non-interactive
- run: "./node_modules/.bin/ember try:one ember-${{ matrix.ember-version }}"
working-directory: test-app
Expand All @@ -91,8 +106,10 @@ jobs:
- uses: volta-cli/action@v4
- run: yarn install --frozen-lockfile --non-interactive
- run: yarn add -D typescript@${{ matrix.ts-version }}
working-directory: test-app
working-directory: addon

- run: yarn tsc --noEmit
working-directory: test-app
working-directory: addon

- run: yarn tsc --noEmit --project type-tests
working-directory: test-app
working-directory: addon
22 changes: 4 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
# dependencies
/bower_components/
/node_modules/

# *.md copies from release
/addon/README.md
/addon/LICENSE.md

# misc
/.env*
/.pnp*
/.sass-cache
/.eslintcache
/connect.lock
/coverage/
/libpeerconnection.log
/npm-debug.log*
/testem.log
/yarn-error.log

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try

# broccoli-debug
/DEBUG/
34 changes: 34 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# How To Contribute

This repo is divided into multiple packages using Yarn workspaces:

- `ember-async-data` is the actual ember-async-data addon
- `test-app` is its test suite

## Installation

* `git clone https://github.com/chriskrycho/ember-async-data.git`
* `cd ember-async-data`
* `yarn install`

## Linting

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

## Running tests

* `cd ember-async-data && yarn start` – Builds the addon in "watch mode" so changes picked up by test app.
* `cd test-app && ember test` – Runs the test suite on the current Ember version
* `cd test-app && ember test --server` – Runs the test suite in "watch mode"
* `cd test-app && ember try:each` – Runs the test suite against multiple Ember versions

During development, if you'd like test app to pick up changes in the addon, make sure to run both
`cd ember-async-data && yarn start` and `cd test-app && ember test --server` in different terminals.

## Running the dummy application

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

For more information on using ember-cli, visit [https://cli.emberjs.com/release/](https://cli.emberjs.com/release/).
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions ember-async-data/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.*/
.eslintcache

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try
58 changes: 58 additions & 0 deletions ember-async-data/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
'use strict';

module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
},
},
plugins: ['@typescript-eslint', 'ember'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:ember/recommended',
'plugin:prettier/recommended',
],
env: {
browser: true,
},
rules: {
// This mostly bans `object`, which is correct in general, but we actually
// need in a couple key places for destroyables handling!
'@typescript-eslint/ban-types': 'off',
},
overrides: [
// node files
{
files: [
'./.eslintrc.js',
'./.prettierrc.js',
'./addon-main.js',
'./config/**/*.js',
'./rollup.config.js',
],
parserOptions: {
sourceType: 'script',
},
env: {
browser: false,
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended'],
rules: {
// We *want* to use traditional require statements in Node `.js` files.
'@typescript-eslint/no-var-requires': 'off',
},
},
{
// test files
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
},
],
};
34 changes: 34 additions & 0 deletions ember-async-data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/.env*
/.eslintcache
/.pnp*
/.sass-cache
/LICENSE.md
/README.md
/connect.lock
/coverage/
/libpeerconnection.log
/npm-debug.log*
/testem.log
/yarn-error.log

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try

# broccoli-debug
/DEBUG/
40 changes: 40 additions & 0 deletions ember-async-data/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# compiled output
/dist/
/tmp/

# dependencies
/bower_components/

# misc
/.bowerrc
/.editorconfig
/.ember-cli
/.env*
/.eslintcache
/.eslintignore
/.eslintrc.js
/.git/
/.github/
/.gitignore
/.prettierignore
/.prettierrc.js
/.template-lintrc.js
/.travis.yml
/.watchmanconfig
/bower.json
/config/ember-try.js
/CONTRIBUTING.md
/ember-cli-build.js
/testem.js
/tests/
/yarn-error.log
/yarn.lock
.gitkeep

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try
25 changes: 25 additions & 0 deletions ember-async-data/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.eslintcache
.lint-todo/

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try
12 changes: 12 additions & 0 deletions ember-async-data/.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,
},
},
],
};
2 changes: 2 additions & 0 deletions ember-async-data/addon-main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const { addonV1Shim } = require('@embroider/addon-shim');
module.exports = addonV1Shim(__dirname);
7 changes: 7 additions & 0 deletions ember-async-data/babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"presets": [["@babel/preset-typescript"]],
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-proposal-class-properties"
]
}
5 changes: 5 additions & 0 deletions ember-async-data/config/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = function (/* environment, appConfig */) {
return {};
};
Loading

0 comments on commit c814a81

Please sign in to comment.