Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 'latest' for typing versions. #83

Merged
merged 4 commits into from
Nov 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
/libpeerconnection.log
npm-debug.log*
testem.log
yarn.lock

# TypeScript
jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ declare namespace config {
export var environment: any;
export var modulePrefix: string;
export var podModulePrefix: string;
export var locationType: string;
export var locationType: string;
export var rootURL: string;
}
10 changes: 5 additions & 5 deletions blueprints/ember-cli-typescript/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = {

locals() {
return {
inRepoAddons: (this.project.pkg['ember-addon'] || {}).paths || []
inRepoAddons: (this.project.pkg['ember-addon'] || {}).paths || [],
};
},

Expand All @@ -38,10 +38,10 @@ module.exports = {

afterInstall() {
return this.addPackagesToProject([
{ name: 'typescript', target: '^2.4.2' },
{ name: '@types/ember', target: '^2.7.43' },
{ name: '@types/rsvp', target: '^3.3.0' },
{ name: '@types/ember-testing-helpers' },
{ name: 'typescript', target: 'latest' },
{ name: '@types/ember', target: 'latest' },
{ name: '@types/rsvp', target: 'latest' },
{ name: '@types/ember-testing-helpers', target: 'latest' },
]);
},
};
68 changes: 34 additions & 34 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,87 +5,87 @@ module.exports = {
name: 'ember-lts-2.4',
bower: {
dependencies: {
'ember': 'components/ember#lts-2-4'
ember: 'components/ember#lts-2-4',
},
resolutions: {
'ember': 'lts-2-4'
}
ember: 'lts-2-4',
},
},
npm: {
devDependencies: {
'ember-source': null
}
}
'ember-source': null,
},
},
},
{
name: 'ember-lts-2.8',
bower: {
dependencies: {
'ember': 'components/ember#lts-2-8'
ember: 'components/ember#lts-2-8',
},
resolutions: {
'ember': 'lts-2-8'
}
ember: 'lts-2-8',
},
},
npm: {
devDependencies: {
'ember-source': null
}
}
'ember-source': null,
},
},
},
{
name: 'ember-release',
bower: {
dependencies: {
'ember': 'components/ember#release'
ember: 'components/ember#release',
},
resolutions: {
'ember': 'release'
}
ember: 'release',
},
},
npm: {
devDependencies: {
'ember-source': null
}
}
'ember-source': null,
},
},
},
{
name: 'ember-beta',
bower: {
dependencies: {
'ember': 'components/ember#beta'
ember: 'components/ember#beta',
},
resolutions: {
'ember': 'beta'
}
ember: 'beta',
},
},
npm: {
devDependencies: {
'ember-source': null
}
}
'ember-source': null,
},
},
},
{
name: 'ember-canary',
bower: {
dependencies: {
'ember': 'components/ember#canary'
ember: 'components/ember#canary',
},
resolutions: {
'ember': 'canary'
}
ember: 'canary',
},
},
npm: {
devDependencies: {
'ember-source': null
}
}
'ember-source': null,
},
},
},
{
name: 'ember-default',
npm: {
devDependencies: {}
}
}
]
devDependencies: {},
},
},
],
};
2 changes: 1 addition & 1 deletion config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
'use strict';

module.exports = function(/* environment, appConfig */) {
return { };
return {};
};
18 changes: 11 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const path = require('path');
const SilentError = require('silent-error');
const TsPreprocessor = require('./lib/typescript-preprocessor');


module.exports = {
name: 'ember-cli-typescript',

Expand All @@ -18,18 +17,23 @@ module.exports = {

this.ui.writeInfoLine(
'Skipping TypeScript preprocessing as there is no tsconfig.json. ' +
'(If this is during installation of the add-on, this is as expected. If it is ' +
'while building, serving, or testing the application, this is an error.)'
'(If this is during installation of the add-on, this is as expected. If it is ' +
'while building, serving, or testing the application, this is an error.)'
);
return;
}

try {
registry.add('js', new TsPreprocessor({
ui: this.ui
}));
registry.add(
'js',
new TsPreprocessor({
ui: this.ui,
})
);
} catch (ex) {
throw new SilentError(`Failed to instantiate TypeScript preprocessor, probably due to an invalid tsconfig.json. Please fix or run \`ember generate ember-cli-typescript\`.\n${ex}`);
throw new SilentError(
`Failed to instantiate TypeScript preprocessor, probably due to an invalid tsconfig.json. Please fix or run \`ember generate ember-cli-typescript\`.\n${ex}`
);
}
},
};
5 changes: 1 addition & 4 deletions lib/typescript-preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ class TypeScriptPreprocessor {
});
tsc.setDiagnosticWriter(this.ui.writeWarnLine.bind(this.ui));

const ts = debugTree(
tsc,
`${this._tag}`
);
const ts = debugTree(tsc, `${this._tag}`);

// Put everything together.
return mergeTrees([js, ts], {
Expand Down
22 changes: 7 additions & 15 deletions node-tests/blueprints/ember-cli-typescript-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const path = require('path');
const {
setupTestHooks,
emberNew,
emberGenerate
emberGenerate,
} = require('ember-cli-blueprint-test-helpers/helpers');
const { expect, file } = require('ember-cli-blueprint-test-helpers/chai');

Expand All @@ -23,10 +23,10 @@ describe('Acceptance: ember-cli-typescript generator', function() {

const json = JSON.parse(tsconfig.content);
expect(json.compilerOptions.paths).to.deep.equal({
'my-app/tests/*': [ 'tests/*' ],
'my-app/*': [ 'app/*' ]
'my-app/tests/*': ['tests/*'],
'my-app/*': ['app/*'],
});
});
});
});

it('in-repo addons', function() {
Expand All @@ -37,10 +37,7 @@ describe('Acceptance: ember-cli-typescript generator', function() {
const packagePath = path.resolve(process.cwd(), 'package.json');
const contents = JSON.parse(fs.readFileSync(packagePath, { encoding: 'utf8' }));
contents['ember-addon'] = {
paths: [
'lib/my-addon-1',
'lib/my-addon-2'
]
paths: ['lib/my-addon-1', 'lib/my-addon-2'],
};
fs.writeFileSync(packagePath, JSON.stringify(contents, null, 2));
})
Expand All @@ -51,14 +48,9 @@ describe('Acceptance: ember-cli-typescript generator', function() {

const json = JSON.parse(tsconfig.content);
expect(json.compilerOptions.paths).to.deep.equal({
'my-app/tests/*': [ 'tests/*' ],
'my-app/*': [
'app/*',
'lib/my-addon-1/app/*',
'lib/my-addon-2/app/*',
]
'my-app/tests/*': ['tests/*'],
'my-app/*': ['app/*', 'lib/my-addon-1/app/*', 'lib/my-addon-2/app/*'],
});
});
});

});
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"broccoli-asset-rev": "^2.4.5",
"ember-cli": "^2.13.3",
"ember-cli-app-version": "^2.0.0",
"ember-cli-blueprint-test-helpers": "^0.17.2",
"ember-cli-blueprint-test-helpers": "^0.18.3",
"ember-cli-dependency-checker": "^1.3.0",
"ember-cli-eslint": "^3.0.0",
"ember-cli-htmlbars": "^1.1.1",
Expand Down Expand Up @@ -76,5 +76,12 @@
"before": [
"ember-cli-babel"
]
},
"prettier": {
"printWidth": 100,
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"tabWidth": 2
}
}
13 changes: 4 additions & 9 deletions testem.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
/* eslint-env node */
module.exports = {
"test_page": "tests/index.html?hidepassed",
"disable_watching": true,
"launch_in_ci": [
"PhantomJS"
],
"launch_in_dev": [
"PhantomJS",
"Chrome"
]
test_page: 'tests/index.html?hidepassed',
disable_watching: true,
launch_in_ci: ['PhantomJS'],
launch_in_dev: ['PhantomJS', 'Chrome'],
};
4 changes: 2 additions & 2 deletions tests/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
env: {
embertest: true
}
embertest: true,
},
};
2 changes: 1 addition & 1 deletion tests/dummy/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Ember.MODEL_FACTORY_INJECTIONS = true;
App = Ember.Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver
Resolver,
});

loadInitializers(App, config.modulePrefix);
Expand Down
2 changes: 1 addition & 1 deletion tests/dummy/app/components/js-importing-ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import Ember from 'ember';
import * as constants from '../lib/some-const';

export default Ember.Component.extend({
poke: Ember.computed.equal('ha', constants.CHANGE)
poke: Ember.computed.equal('ha', constants.CHANGE),
});
3 changes: 1 addition & 2 deletions tests/dummy/app/components/test-one.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

import Ember from 'ember';

export default Ember.Component.extend({
someValue: 'from component'
someValue: 'from component',
});
6 changes: 3 additions & 3 deletions tests/dummy/app/components/ts-component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Ember from 'ember';

function compute() : {value:string} {
return {value: 'from component'};
function compute(): { value: string } {
return { value: 'from component' };
}

export default Ember.Component.extend({
someValue: compute().value
someValue: compute().value,
});
4 changes: 2 additions & 2 deletions tests/dummy/app/controllers/application.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Ember from 'ember';

export default Ember.Controller.extend({
// Just a very roundabout way of using some ES6 features
value: ((test = 'Test') => `${test} ${'Value'}`)()
// Just a very roundabout way of using some ES6 features
value: ((test = 'Test') => `${test} ${'Value'}`)(),
});
2 changes: 1 addition & 1 deletion tests/dummy/app/helpers/js-help.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Ember from 'ember';

export function jsHelp(/*params, hash*/) {
return "js please help me";
return 'js please help me';
}

export default Ember.Helper.helper(jsHelp);
2 changes: 1 addition & 1 deletion tests/dummy/app/helpers/typed-help.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Ember from 'ember';
export function typedHelp(/*params, hash*/) {
return "my type of help";
return 'my type of help';
}

export default Ember.Helper.helper(typedHelp);
4 changes: 2 additions & 2 deletions tests/dummy/app/lib/some-const.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const SPEED_OF_LIGHT=299792458;
export const CHANGE=true;
export const SPEED_OF_LIGHT = 299792458;
export const CHANGE = true;
5 changes: 2 additions & 3 deletions tests/dummy/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import config from './config/environment';

const Router = Ember.Router.extend({
location: config.locationType,
rootURL: config.rootURL
rootURL: config.rootURL,
});

Router.map(function() {
});
Router.map(function() {});

export default Router;
Loading