Skip to content

Commit

Permalink
Merge pull request #496 from ember-cli/drop-ember-lt-3-8
Browse files Browse the repository at this point in the history
Drop support for Ember < 3.8.
  • Loading branch information
rwjblue authored Apr 10, 2020
2 parents e61c9b2 + d6c9f6b commit 0d06440
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 94 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,13 @@ jobs:
strategy:
matrix:
ember-try-scenario:
- ember-lts-2.12
- ember-lts-2.16
- ember-lts-2.18
- ember-lts-3.4
- ember-lts-3.8
- ember-lts-3.12
- ember-lts-3.16
- ember-release
- ember-octane
- ember-beta
- ember-canary
- ember-default
- ember-default-with-jquery
- with-ember-cli-htmlbars-inline-precompile

Expand Down
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

<a href="https://github.com/ember-cli/ember-cli-htmlbars/actions"><img alt="Build Status" src="https://github.com/ember-cli/ember-cli-htmlbars/workflows/ci/badge.svg"></a>

### Registering a Plugin
## Compatibility

* Ember.js v3.8 or above
* Ember CLI v3.8 or above
* Node.js v10 or above

## Registering a Plugin

```javascript
var SomeTransform = require('./some-path/transform');
Expand All @@ -22,15 +28,15 @@ module.exports = {
};
```

#### Options for registering a `htmlbars-ast-plugin`
### Options for registering a `htmlbars-ast-plugin`

* `name` - String. The name of the AST transform for debugging purposes.
* `plugin` - A function of type [`ASTPluginBuilder`](https://github.com/glimmerjs/glimmer-vm/blob/master/packages/%40glimmer/syntax/lib/parser/tokenizer-event-handlers.ts#L329-L341).
* `dependencyInvalidation` - Boolean. A flag that indicates the AST Plugin may, on a per-template basis, depend on other files that affect its output.
* `cacheKey` - function that returns any JSON-compatible value - The value returned is used to invalidate the persistent cache across restarts, usually in the case of a dependency or configuration change.
* `baseDir` - `() => string`. A function that returns the directory on disk of the npm module for the plugin. If provided, a basic cache invalidation is performed if any of the dependencies change (e.g. due to a npm install/upgrade).

#### Implementing Dependency Invalidation in an AST Plugin
### Implementing Dependency Invalidation in an AST Plugin

Plugins that set the `dependencyInvalidation` option to `true` can provide function for the `plugin` of type `ASTDependencyPlugin` as given below.

Expand Down Expand Up @@ -71,7 +77,7 @@ export interface ASTPluginWithDeps extends ASTPlugin {
}
```

### Precompile HTMLBars template strings within other addons
## Precompile HTMLBars template strings within other addons

```javascript
module.exports = {
Expand All @@ -93,7 +99,7 @@ module.exports = {
};
```

### Tagged Template Usage / Migrating from `htmlbars-inline-precompile`
## Tagged Template Usage / Migrating from `htmlbars-inline-precompile`

Starting with version 4.0, this addon now includes the testing helper from [ember-cli-htmlbars-inline-precompile](https://github.com/ember-cli/ember-cli-htmlbars-inline-precompile)

Expand Down Expand Up @@ -142,12 +148,7 @@ module.exports = function(defaults) {
};
```

### Handlebars 2.0 Support (Ember < 1.10)

Handlebars 2.0 support has been removed. If you are using ember-cli-htmlbars with a 1.9.x project please continue
to use [email protected].

### Using as a Broccoli Plugin
## Using as a Broccoli Plugin

```javascript
var HtmlbarsCompiler = require('ember-cli-htmlbars');
Expand Down
48 changes: 6 additions & 42 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,62 +12,26 @@ module.exports = function () {
useYarn: true,
scenarios: [
{
name: 'ember-lts-2.12',
env: {
EMBER_OPTIONAL_FEATURES: JSON.stringify({ 'jquery-integration': true }),
},
npm: {
devDependencies: {
'@ember/jquery': '^0.5.1',
'ember-source': '~2.12.0',
},
},
},
{
name: 'ember-lts-2.16',
env: {
EMBER_OPTIONAL_FEATURES: JSON.stringify({ 'jquery-integration': true }),
},
npm: {
devDependencies: {
'@ember/jquery': '^0.5.1',
'ember-source': '~2.16.0',
},
},
},
{
name: 'ember-lts-2.18',
env: {
EMBER_OPTIONAL_FEATURES: JSON.stringify({ 'jquery-integration': true }),
},
npm: {
devDependencies: {
'@ember/jquery': '^0.5.1',
'ember-source': '~2.18.0',
},
},
},
{
name: 'ember-lts-3.4',
name: 'ember-lts-3.8',
npm: {
devDependencies: {
'ember-source': '~3.4.0',
'ember-source': '~3.8.0',
},
},
},
{
name: 'ember-lts-3.8',
name: 'ember-lts-3.12',
npm: {
devDependencies: {
'ember-source': '~3.8.0',
'ember-source': '~3.12.0',
},
},
},
{
name: 'ember-lts-3.12',
name: 'ember-lts-3.16',
npm: {
devDependencies: {
'ember-source': '~3.12.0',
'ember-source': '~3.16.0',
},
},
},
Expand Down
8 changes: 1 addition & 7 deletions tests/dummy/lib/module-name-inliner/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

let VersionChecker = require('ember-cli-version-checker');

module.exports = {
name: require('./package').name,

Expand All @@ -11,11 +9,7 @@ module.exports = {

setupPreprocessorRegistry(type, registry) {
// can only add the plugin with this style on newer Ember versions
let checker = new VersionChecker(this.project);
if (checker.for('ember-source').gte('3.1.0')) {
registry.add('htmlbars-ast-plugin', this.buildPlugin());
}

registry.add('htmlbars-ast-plugin', this.buildPlugin());
registry.add('htmlbars-ast-plugin', this.buildLegacyPlugin());
},

Expand Down
4 changes: 1 addition & 3 deletions tests/dummy/lib/module-name-inliner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@
"keywords": [
"ember-addon"
],
"dependencies": {
"ember-cli-version-checker": "*"
}
"dependencies": {}
}
17 changes: 7 additions & 10 deletions tests/integration/components/ast-plugins-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import hasEmberVersion from '@ember/test-helpers/has-ember-version';

module('tests/integration/components/ast-plugins-test', function (hooks) {
setupRenderingTest(hooks);
Expand All @@ -16,14 +15,12 @@ module('tests/integration/components/ast-plugins-test', function (hooks) {
);
});

if (hasEmberVersion(3, 1)) {
test('stand alone templates have AST plugins ran', async function (assert) {
await render(hbs`{{x-module-name-inlined-component}}`);
test('stand alone templates have AST plugins ran', async function (assert) {
await render(hbs`{{x-module-name-inlined-component}}`);

assert.equal(
this.element.textContent.trim(),
'dummy/templates/components/x-module-name-inlined-component.hbs'
);
});
}
assert.equal(
this.element.textContent.trim(),
'dummy/templates/components/x-module-name-inlined-component.hbs'
);
});
});
11 changes: 4 additions & 7 deletions tests/integration/components/test-inline-precompile-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { render } from '@ember/test-helpers';
import hbsOne from 'htmlbars-inline-precompile';
import hbsTwo from 'ember-cli-htmlbars-inline-precompile';
import { hbs as hbsThree } from 'ember-cli-htmlbars';
import hasEmberVersion from '@ember/test-helpers/has-ember-version';

module('tests/integration/components/test-inline-precompile', function (hooks) {
setupRenderingTest(hooks);
Expand Down Expand Up @@ -33,11 +32,9 @@ module('tests/integration/components/test-inline-precompile', function (hooks) {
assert.equal(this.element.textContent.trim(), 'sbh.etalpmet-olleh');
});

if (hasEmberVersion(3, 1)) {
test('inline templates have AST plugins ran', async function (assert) {
await render(hbsThree('{{module-name-inliner}}', { moduleName: 'hello-template.hbs' }));
test('inline templates have AST plugins ran', async function (assert) {
await render(hbsThree('{{module-name-inliner}}', { moduleName: 'hello-template.hbs' }));

assert.equal(this.element.textContent.trim(), 'hello-template.hbs');
});
}
assert.equal(this.element.textContent.trim(), 'hello-template.hbs');
});
});
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4028,15 +4028,6 @@ ember-cli-typescript@^2.0.2:
stagehand "^1.0.0"
walk-sync "^1.0.0"

ember-cli-version-checker@*, ember-cli-version-checker@^5.0.2:
version "5.0.2"
resolved "https://registry.yarnpkg.com/ember-cli-version-checker/-/ember-cli-version-checker-5.0.2.tgz#7e96157be4b13b083a68078b188820193275d8c4"
integrity sha512-cqFrIg9++GKdpMv2DP8pryAhTcmCYUL2hzHatLwkcJe23s+ioZ0JQWte0avxZ5lJnwn5e3kzUKkLkDfHDFBMUw==
dependencies:
resolve-package-path "^2.0.0"
semver "^7.1.3"
silent-error "^1.1.1"

ember-cli-version-checker@^2.0.0, ember-cli-version-checker@^2.1.2:
version "2.2.0"
resolved "https://registry.yarnpkg.com/ember-cli-version-checker/-/ember-cli-version-checker-2.2.0.tgz#47771b731fe0962705e27c8199a9e3825709f3b3"
Expand All @@ -4062,6 +4053,15 @@ ember-cli-version-checker@^4.1.0:
semver "^6.3.0"
silent-error "^1.1.1"

ember-cli-version-checker@^5.0.2:
version "5.0.2"
resolved "https://registry.yarnpkg.com/ember-cli-version-checker/-/ember-cli-version-checker-5.0.2.tgz#7e96157be4b13b083a68078b188820193275d8c4"
integrity sha512-cqFrIg9++GKdpMv2DP8pryAhTcmCYUL2hzHatLwkcJe23s+ioZ0JQWte0avxZ5lJnwn5e3kzUKkLkDfHDFBMUw==
dependencies:
resolve-package-path "^2.0.0"
semver "^7.1.3"
silent-error "^1.1.1"

ember-cli@~3.16.1:
version "3.16.1"
resolved "https://registry.yarnpkg.com/ember-cli/-/ember-cli-3.16.1.tgz#9c7333b5c939488b41820c4b59e6e00dc3e25a7b"
Expand Down

0 comments on commit 0d06440

Please sign in to comment.