Skip to content

Commit

Permalink
polyfill ts blueprint support
Browse files Browse the repository at this point in the history
  • Loading branch information
cafreeman committed Feb 10, 2022
1 parent 1a8d84f commit 6afcd72
Show file tree
Hide file tree
Showing 24 changed files with 438 additions and 85 deletions.
6 changes: 6 additions & 0 deletions blueprints/-addon-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
const stringUtil = require('ember-cli-string-utils');
const path = require('path');
const inflector = require('inflection');
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

module.exports = {
description: 'Generates an import wrapper.',

shouldTransformTypeScript: true,

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},

fileMapTokens: function () {
return {
__name__: function (options) {
Expand Down
6 changes: 6 additions & 0 deletions blueprints/acceptance-test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ const pathUtil = require('ember-cli-path-utils');
const stringUtils = require('ember-cli-string-utils');

const useTestFrameworkDetector = require('../test-framework-detector');
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

module.exports = useTestFrameworkDetector({
description: 'Generates an acceptance test for a feature.',

shouldTransformTypeScript: true,

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},

locals: function (options) {
let testFolderRoot = stringUtils.dasherize(options.project.name());

Expand Down
6 changes: 6 additions & 0 deletions blueprints/component-addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ const path = require('path');
const stringUtil = require('ember-cli-string-utils');
const getPathOption = require('ember-cli-get-component-path-option');
const normalizeEntityName = require('ember-cli-normalize-entity-name');
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

module.exports = {
description: 'Generates a component.',

shouldTransformTypeScript: true,

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},

fileMapTokens: function () {
return {
__path__: function (options) {
Expand Down
6 changes: 6 additions & 0 deletions blueprints/component-class-addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ const path = require('path');
const stringUtil = require('ember-cli-string-utils');
const getPathOption = require('ember-cli-get-component-path-option');
const normalizeEntityName = require('ember-cli-normalize-entity-name');
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

module.exports = {
description: 'Generates a component class.',

shouldTransformTypeScript: true,

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},

fileMapTokens: function () {
return {
__path__: function (options) {
Expand Down
2 changes: 2 additions & 0 deletions blueprints/component-class/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const getPathOption = require('ember-cli-get-component-path-option');
const normalizeEntityName = require('ember-cli-normalize-entity-name');
const { EOL } = require('os');
const { has } = require('@ember/edition-utils');
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

const OCTANE = has('octane');

Expand Down Expand Up @@ -49,6 +50,7 @@ module.exports = {

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
let isOctane = has('octane');

this.availableOptions.forEach((option) => {
Expand Down
6 changes: 6 additions & 0 deletions blueprints/component-test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const stringUtil = require('ember-cli-string-utils');
const isPackageMissing = require('ember-cli-is-package-missing');
const getPathOption = require('ember-cli-get-component-path-option');
const semver = require('semver');
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

const useTestFrameworkDetector = require('../test-framework-detector');

Expand All @@ -18,6 +19,11 @@ module.exports = useTestFrameworkDetector({

shouldTransformTypeScript: true,

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},

availableOptions: [
{
name: 'test-type',
Expand Down
2 changes: 2 additions & 0 deletions blueprints/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const getPathOption = require('ember-cli-get-component-path-option');
const normalizeEntityName = require('ember-cli-normalize-entity-name');
const { EOL } = require('os');
const { has } = require('@ember/edition-utils');
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

const OCTANE = has('octane');

Expand Down Expand Up @@ -53,6 +54,7 @@ module.exports = {

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
let isOctane = has('octane');

this.availableOptions.forEach((option) => {
Expand Down
6 changes: 6 additions & 0 deletions blueprints/controller-test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ const stringUtil = require('ember-cli-string-utils');

const useTestFrameworkDetector = require('../test-framework-detector');
const path = require('path');
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

module.exports = useTestFrameworkDetector({
description: 'Generates a controller unit test.',

shouldTransformTypeScript: true,

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},

locals: function (options) {
let dasherizedModuleName = stringUtil.dasherize(options.entity.name);
let controllerPathName = dasherizedModuleName;
Expand Down
7 changes: 7 additions & 0 deletions blueprints/controller/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
'use strict';

const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

module.exports = {
description: 'Generates a controller.',

shouldTransformTypeScript: true,

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},

normalizeEntityName: function (entityName) {
return entityName.replace(/\.js$/, ''); //Prevent generation of ".js.js" files
},
Expand Down
6 changes: 6 additions & 0 deletions blueprints/helper-test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const stringUtils = require('ember-cli-string-utils');
const isPackageMissing = require('ember-cli-is-package-missing');
const semver = require('semver');
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

const useTestFrameworkDetector = require('../test-framework-detector');

Expand All @@ -11,6 +12,11 @@ module.exports = useTestFrameworkDetector({

shouldTransformTypeScript: true,

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},

fileMapTokens: function () {
return {
__root__() {
Expand Down
6 changes: 6 additions & 0 deletions blueprints/helper/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const normalizeEntityName = require('ember-cli-normalize-entity-name');
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

const path = require('path');

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

shouldTransformTypeScript: true,

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},

filesPath() {
let rootPath = 'files';
return path.join(this.path, rootPath);
Expand Down
6 changes: 6 additions & 0 deletions blueprints/initializer-test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const fs = require('fs');
const path = require('path');
const stringUtils = require('ember-cli-string-utils');
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

const useTestFrameworkDetector = require('../test-framework-detector');

Expand All @@ -11,6 +12,11 @@ module.exports = useTestFrameworkDetector({

shouldTransformTypeScript: true,

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},

fileMapTokens: function () {
return {
__root__() {
Expand Down
6 changes: 6 additions & 0 deletions blueprints/initializer/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
'use strict';

const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');
module.exports = {
description: 'Generates an initializer.',

shouldTransformTypeScript: true,

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},
};
6 changes: 6 additions & 0 deletions blueprints/instance-initializer-test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const fs = require('fs');
const path = require('path');
const stringUtils = require('ember-cli-string-utils');
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

const useTestFrameworkDetector = require('../test-framework-detector');

Expand All @@ -11,6 +12,11 @@ module.exports = useTestFrameworkDetector({

shouldTransformTypeScript: true,

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},

fileMapTokens: function () {
return {
__root__() {
Expand Down
7 changes: 7 additions & 0 deletions blueprints/instance-initializer/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
'use strict';

const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

module.exports = {
shouldTransformTypeScript: true,

description: 'Generates an instance initializer.',

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},
};
6 changes: 6 additions & 0 deletions blueprints/route-addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
const path = require('path');
const stringUtil = require('ember-cli-string-utils');
const inflector = require('inflection');
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

module.exports = {
description: 'Generates import wrappers for a route and its template.',

shouldTransformTypeScript: true,

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},

fileMapTokens: function () {
return {
__templatepath__: function (options) {
Expand Down
6 changes: 6 additions & 0 deletions blueprints/route-test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
const path = require('path');
const stringUtil = require('ember-cli-string-utils');
const useTestFrameworkDetector = require('../test-framework-detector');
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

module.exports = useTestFrameworkDetector({
description: 'Generates a route unit test.',

shouldTransformTypeScript: true,

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},

availableOptions: [
{
name: 'reset-namespace',
Expand Down
6 changes: 6 additions & 0 deletions blueprints/route/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const path = require('path');
const chalk = require('chalk');
const stringUtil = require('ember-cli-string-utils');
const EmberRouterGenerator = require('ember-router-generator');
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

module.exports = {
description: 'Generates a route and a template, and registers the route with the router.',
Expand All @@ -28,6 +29,11 @@ module.exports = {
},
],

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},

fileMapTokens: function () {
return {
__name__(options) {
Expand Down
7 changes: 7 additions & 0 deletions blueprints/service-test/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
'use strict';

const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

const useTestFrameworkDetector = require('../test-framework-detector');

module.exports = useTestFrameworkDetector({
description: 'Generates a service unit test.',

shouldTransformTypeScript: true,

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},

fileMapTokens() {
return {
__root__() {
Expand Down
7 changes: 7 additions & 0 deletions blueprints/service/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
'use strict';

const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

module.exports = {
description: 'Generates a service.',

shouldTransformTypeScript: true,

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},

normalizeEntityName: function (entityName) {
return entityName.replace(/\.js$/, ''); //Prevent generation of ".js.js" files
},
Expand Down
6 changes: 6 additions & 0 deletions blueprints/util-test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const stringUtils = require('ember-cli-string-utils');
const path = require('path');
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');

const useTestFrameworkDetector = require('../test-framework-detector');

Expand All @@ -10,6 +11,11 @@ module.exports = useTestFrameworkDetector({

shouldTransformTypeScript: true,

init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},

fileMapTokens() {
return {
__root__() {
Expand Down
Loading

0 comments on commit 6afcd72

Please sign in to comment.