Skip to content

Commit

Permalink
Merge pull request #346 from ember-cli/convert-to-v2-format
Browse files Browse the repository at this point in the history
Convert to v2 format
  • Loading branch information
ef4 authored Oct 11, 2021
2 parents eba9403 + 81660d7 commit 3b39cd8
Show file tree
Hide file tree
Showing 61 changed files with 4,637 additions and 4,347 deletions.
16 changes: 5 additions & 11 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/
/test-app/dist/
/test-app/tmp/
/scenario
/dist

# dependencies
/bower_components/
/node_modules/
/test-app/node_modules

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

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
18 changes: 4 additions & 14 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,10 @@ module.exports = {
// node files
{
files: [
'./.eslintrc.js',
'./.prettierrc.js',
'./.template-lintrc.js',
'./ember-cli-build.js',
'./index.js',
'./testem.js',
'./blueprints/*/index.js',
'./config/**/*.js',
'./tests/dummy/config/**/*.js',
'.eslintrc.js',
'.template-lintrc.js',
'addon-main.js',
'.prettierrc.js',
],
parserOptions: {
sourceType: 'script',
Expand All @@ -44,10 +39,5 @@ module.exports = {
plugins: ['node'],
extends: ['plugin:node/recommended'],
},
{
// Test files:
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
},
],
};
130 changes: 44 additions & 86 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,104 +1,62 @@
name: CI
name: Node CI

on:
push:
branches:
- main
- master
- 'v*' # prior release branches (e.g. `v0.30.x` branch)
tags:
- v*
pull_request: { }

env:
CI: true
- 'v*'
pull_request:

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

outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v2
- uses: actions/checkout@v1
- uses: volta-cli/action@v1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
node-version: 14.x
- name: Install Dependencies
run: yarn install --frozen-lockfile --non-interactive
- name: Lint
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn --frozen-lockfile
- name: lint
run: yarn lint

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

steps:
- uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v2
with:
node-version: 14.x
- name: Install Dependencies
run: yarn install --no-lockfile
- run: yarn test:ember

try-scenarios:
timeout-minutes: 10
name: "Try: ${{ matrix.ember-try-scenario }}"

- name: test
run: yarn test:ember
- id: set-matrix
run: echo "::set-output name=matrix::$(yarn --silent scenario-tester list --files ./scenarios.js --matrix 'yarn qunit ./scenarios.js --filter %s:')"
working-directory: test-app

compat-scenarios:
needs: test
name: ${{ matrix.name }}
runs-on: ubuntu-latest

needs: floating-dependencies

strategy:
fail-fast: false
matrix:
ember-try-scenario:
- ember-lts-3.20
- ember-lts-3.24
- ember-release
- ember-beta
- ember-canary
- ember-default-with-jquery
- ember-classic
- embroider-safe
- embroider-optimized

matrix: ${{fromJson(needs.test.outputs.matrix)}}
steps:
- uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v2
- uses: actions/checkout@v1
- uses: volta-cli/action@v1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
node-version: 12.x
- name: Install Dependencies
run: yarn install --frozen-lockfile
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install --no-lockfile
- name: test
run: node_modules/.bin/ember try:one ${{ matrix.ember-try-scenario }} --skip-cleanup

publish:
name: Publish to npm
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: [floating-dependencies, try-scenarios]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install node
uses: actions/setup-node@v2
with:
node-version: 14.x
registry-url: 'https://registry.npmjs.org'

- name: install dependencies
run: yarn install --frozen-lockfile

- name: auto-dist-tag
run: npx auto-dist-tag@1 --write

- name: publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: ${{ matrix.command }}
working-directory: test-app
16 changes: 11 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist/
/tmp/
/test-app/dist/
/test-app/tmp/
/scenario
/dist

# dependencies
/bower_components/
/node_modules/
/test-app/node_modules/

# misc
/.env*
Expand All @@ -19,8 +22,11 @@
/npm-debug.log*
/testem.log
/yarn-error.log
/test-app/yarn-error.log

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
/test-app/.node_modules.ember-try/
/test-app/yarn.lock.ember-try

/test-app/bower.json.ember-try
/test-app/package.json.ember-try
36 changes: 0 additions & 36 deletions .npmignore

This file was deleted.

5 changes: 3 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
/vendor/

# compiled output
/dist/
/tmp/
/test-app/dist/
/test-app/tmp/

# dependencies
/bower_components/
/node_modules/
/test-app/node_modules

# misc
/coverage/
Expand Down
3 changes: 2 additions & 1 deletion .template-lintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module.exports = {
extends: 'recommended',
rules: {
'no-unbalanced-curlies': false,
'no-implicit-this': false,
},
ignore: ['scenario/**', 'test-app/node_modules/**', 'test-app/dist/**'],
};
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Build",
"program": "${workspaceFolder}/test-app/node_modules/ember-cli/bin/ember",
"args": ["build"],
"cwd": "${workspaceFolder}/test-app",
"outputCapture": "std",
}
]
}
44 changes: 31 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,42 @@

## Installation

* `git clone <repository-url>`
* `cd ember-welcome-page`
* `yarn install`
- `git clone <repository-url>`
- `cd ember-welcome-page`
- `yarn install`

## Linting

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

## Running tests
## Running & Testing

* `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
- `yarn start` - Run the test-app for interactive development
- view the app at [http://localhost:4200](http://localhost:4200).
- run the test suite at [http://localhost:4200/tests](http://localhost:4200/tests)
- `yarn test:ember` – Run the test suite (with its default dependencies) and then exit.
- `yarn test` – Run the test suite under each tested scenario and then exit.
- `yarn scenario:list` - List the names of all tested scenarios.
- `yarn scenario:run $SCENARIO_NAME` - Run only one scenario and then exit.
- `yarn scenario:output $SCENARIO_NAME` - Create a copy of the test-app in the `./scenario` directory that is configured for the named scenario. Useful to interactively run and debug individual scenarios. (Caution: due to https://github.com/stefanpenner/node-fixturify-project/issues/56 you may need to invoke commands like "ember" as `./node_modules/ember-cli/bin/ember` because executables are not linked automatically into the scenario yet.)

## Running the dummy application
We use [scenario-tester](https://github.com/ef4/scenario-tester) to reconfigure the test-app with different dependencies to ensure that the addon works with all the intended Ember versions and build system variations.

* `ember serve`
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).
`./test-app/scenarios.js` defines the scenarios, which link to dependencies that all appear in `package.json`. We can test multiple versions of the same package without multiple NPM installs by using NPM aliasing.

For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
## The test-app

The directory `./test-app` contains a complete Ember app intended for testing the addon. It has its own `package.json` to declare its dependencies, but **you should not need to run a separate `npm` or `yarn` install** within it, because everything it needs is included in the top-level `package.json` `devDependencies`.

After you make changes to dependencies in the test-app, you can run `yarn sync-dev-deps` to ensure they are properly synchronized with the top-level package.json.

### Upgrading the test app

To upgrade the test app:

1. `cd test-app`
2. `npx ember-cli-update`
3. `cd ..`
4. `yarn sync-dev-deps`
5. `yarn install`
14 changes: 14 additions & 0 deletions addon-main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

const { addonV1Shim } = require('@embroider/addon-shim');

module.exports = addonV1Shim(__dirname, {
// this is a backward-compatibility feature that only works when this v2 addon
// is consumed in a non-embroider build. Under embroider, you don't need this
// because you can just delete <WelcomePage /> from your template and that
// will cause it to be dropped from the build.
disabled(options) {
let welcomeConfig = options['ember-welcome-page'] || {};
return process.env.EMBER_ENV === 'production' && !welcomeConfig.enabled;
},
});
1 change: 0 additions & 1 deletion app/components/welcome-page.js

This file was deleted.

Loading

0 comments on commit 3b39cd8

Please sign in to comment.