Skip to content

Commit 6fa13ad

Browse files
authored
Merge branch 'master' into upgrade-b-c-ts-again
2 parents a1c0d79 + 1d0ea1d commit 6fa13ad

31 files changed

+5999
-120
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
/libpeerconnection.log
1616
npm-debug.log*
1717
testem.log
18-
yarn.lock
1918

2019
# TypeScript
2120
jsconfig.json

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ on the background and roadmap for the project.
9393

9494
[typing-your-ember]: http://www.chriskrycho.com/typing-your-ember.html
9595

96+
## Environment configuration typings
97+
98+
Along with the @types/ files mentioned above, ember-cli-typescript adds a
99+
starter interface for `config/environment.js` in `config/environment.d.ts`.
100+
This interface will likely require some changes to match your app.
101+
96102
## :construction: Using ember-cli-typescript with Ember CLI addons
97103

98104
**:warning: Warning: this is *not* currently recommended. This is a WIP part of

blueprints/ember-cli-typescript/files/app/config/environment.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ declare namespace config {
1111
export var environment: any;
1212
export var modulePrefix: string;
1313
export var podModulePrefix: string;
14-
export var locationType: string;
14+
export var locationType: string;
1515
export var rootURL: string;
1616
}

blueprints/ember-cli-typescript/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = {
2828

2929
locals() {
3030
return {
31-
inRepoAddons: (this.project.pkg['ember-addon'] || {}).paths || []
31+
inRepoAddons: (this.project.pkg['ember-addon'] || {}).paths || [],
3232
};
3333
},
3434

@@ -38,10 +38,10 @@ module.exports = {
3838

3939
afterInstall() {
4040
return this.addPackagesToProject([
41-
{ name: 'typescript', target: '^2.4.2' },
42-
{ name: '@types/ember', target: '^2.7.43' },
43-
{ name: '@types/rsvp', target: '^3.3.0' },
44-
{ name: '@types/ember-testing-helpers' },
41+
{ name: 'typescript', target: 'latest' },
42+
{ name: '@types/ember', target: 'latest' },
43+
{ name: '@types/rsvp', target: 'latest' },
44+
{ name: '@types/ember-testing-helpers', target: 'latest' },
4545
]);
4646
},
4747
};

config/ember-try.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,87 +5,87 @@ module.exports = {
55
name: 'ember-lts-2.4',
66
bower: {
77
dependencies: {
8-
'ember': 'components/ember#lts-2-4'
8+
ember: 'components/ember#lts-2-4',
99
},
1010
resolutions: {
11-
'ember': 'lts-2-4'
12-
}
11+
ember: 'lts-2-4',
12+
},
1313
},
1414
npm: {
1515
devDependencies: {
16-
'ember-source': null
17-
}
18-
}
16+
'ember-source': null,
17+
},
18+
},
1919
},
2020
{
2121
name: 'ember-lts-2.8',
2222
bower: {
2323
dependencies: {
24-
'ember': 'components/ember#lts-2-8'
24+
ember: 'components/ember#lts-2-8',
2525
},
2626
resolutions: {
27-
'ember': 'lts-2-8'
28-
}
27+
ember: 'lts-2-8',
28+
},
2929
},
3030
npm: {
3131
devDependencies: {
32-
'ember-source': null
33-
}
34-
}
32+
'ember-source': null,
33+
},
34+
},
3535
},
3636
{
3737
name: 'ember-release',
3838
bower: {
3939
dependencies: {
40-
'ember': 'components/ember#release'
40+
ember: 'components/ember#release',
4141
},
4242
resolutions: {
43-
'ember': 'release'
44-
}
43+
ember: 'release',
44+
},
4545
},
4646
npm: {
4747
devDependencies: {
48-
'ember-source': null
49-
}
50-
}
48+
'ember-source': null,
49+
},
50+
},
5151
},
5252
{
5353
name: 'ember-beta',
5454
bower: {
5555
dependencies: {
56-
'ember': 'components/ember#beta'
56+
ember: 'components/ember#beta',
5757
},
5858
resolutions: {
59-
'ember': 'beta'
60-
}
59+
ember: 'beta',
60+
},
6161
},
6262
npm: {
6363
devDependencies: {
64-
'ember-source': null
65-
}
66-
}
64+
'ember-source': null,
65+
},
66+
},
6767
},
6868
{
6969
name: 'ember-canary',
7070
bower: {
7171
dependencies: {
72-
'ember': 'components/ember#canary'
72+
ember: 'components/ember#canary',
7373
},
7474
resolutions: {
75-
'ember': 'canary'
76-
}
75+
ember: 'canary',
76+
},
7777
},
7878
npm: {
7979
devDependencies: {
80-
'ember-source': null
81-
}
82-
}
80+
'ember-source': null,
81+
},
82+
},
8383
},
8484
{
8585
name: 'ember-default',
8686
npm: {
87-
devDependencies: {}
88-
}
89-
}
90-
]
87+
devDependencies: {},
88+
},
89+
},
90+
],
9191
};

config/environment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
'use strict';
33

44
module.exports = function(/* environment, appConfig */) {
5-
return { };
5+
return {};
66
};

index.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const path = require('path');
55
const SilentError = require('silent-error');
66
const TsPreprocessor = require('./lib/typescript-preprocessor');
77

8-
98
module.exports = {
109
name: 'ember-cli-typescript',
1110

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

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

2726
try {
28-
registry.add('js', new TsPreprocessor({
29-
ui: this.ui
30-
}));
27+
registry.add(
28+
'js',
29+
new TsPreprocessor({
30+
ui: this.ui,
31+
})
32+
);
3133
} catch (ex) {
32-
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}`);
34+
throw new SilentError(
35+
`Failed to instantiate TypeScript preprocessor, probably due to an invalid tsconfig.json. Please fix or run \`ember generate ember-cli-typescript\`.\n${ex}`
36+
);
3337
}
3438
},
3539
};

lib/typescript-preprocessor.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ class TypeScriptPreprocessor {
5050
});
5151
tsc.setDiagnosticWriter(this.ui.writeWarnLine.bind(this.ui));
5252

53-
const ts = debugTree(
54-
tsc,
55-
`${this._tag}`
56-
);
53+
const ts = debugTree(tsc, `${this._tag}`);
5754

5855
// Put everything together.
5956
return mergeTrees([js, ts], {

node-tests/blueprints/ember-cli-typescript-test.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const path = require('path');
55
const {
66
setupTestHooks,
77
emberNew,
8-
emberGenerate
8+
emberGenerate,
99
} = require('ember-cli-blueprint-test-helpers/helpers');
1010
const { expect, file } = require('ember-cli-blueprint-test-helpers/chai');
1111

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

2424
const json = JSON.parse(tsconfig.content);
2525
expect(json.compilerOptions.paths).to.deep.equal({
26-
'my-app/tests/*': [ 'tests/*' ],
27-
'my-app/*': [ 'app/*' ]
26+
'my-app/tests/*': ['tests/*'],
27+
'my-app/*': ['app/*'],
2828
});
29-
});
29+
});
3030
});
3131

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

5249
const json = JSON.parse(tsconfig.content);
5350
expect(json.compilerOptions.paths).to.deep.equal({
54-
'my-app/tests/*': [ 'tests/*' ],
55-
'my-app/*': [
56-
'app/*',
57-
'lib/my-addon-1/app/*',
58-
'lib/my-addon-2/app/*',
59-
]
51+
'my-app/tests/*': ['tests/*'],
52+
'my-app/*': ['app/*', 'lib/my-addon-1/app/*', 'lib/my-addon-2/app/*'],
6053
});
6154
});
6255
});
63-
6456
});

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"broccoli-asset-rev": "^2.4.5",
4646
"ember-cli": "^2.13.3",
4747
"ember-cli-app-version": "^2.0.0",
48-
"ember-cli-blueprint-test-helpers": "^0.17.2",
48+
"ember-cli-blueprint-test-helpers": "^0.18.3",
4949
"ember-cli-dependency-checker": "^1.3.0",
5050
"ember-cli-eslint": "^3.0.0",
5151
"ember-cli-htmlbars": "^1.1.1",
@@ -76,5 +76,12 @@
7676
"before": [
7777
"ember-cli-babel"
7878
]
79+
},
80+
"prettier": {
81+
"printWidth": 100,
82+
"semi": true,
83+
"singleQuote": true,
84+
"trailingComma": "es5",
85+
"tabWidth": 2
7986
}
8087
}

0 commit comments

Comments
 (0)