Skip to content

Commit

Permalink
Generate typings for Polymer 3.
Browse files Browse the repository at this point in the history
- Publishing (actually packing) will now generate the typings and fail
  if they don't compile.
- Travis will now generate the typings and fail if they don't compile.
- Some minor tweaks to get typings compiling.
  • Loading branch information
aomarks committed Jul 27, 2018
1 parent 8f6a962 commit 536030a
Show file tree
Hide file tree
Showing 10 changed files with 1,909 additions and 2,686 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ npm-debug.log

# Analyzer output used in the docs
analysis.json

# NPM artifact
polymer-polymer-*.tgz

# Typings are generated upon publish to NPM
*.d.ts
20 changes: 20 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# dependencies
bower_components
node_modules

# compiled output
dist

# IDEs
.idea
.vscode

# misc
.DS_Store
npm-debug.log

# Analyzer output used in the docs
analysis.json

# NPM artifact
polymer-polymer-*.tgz
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ before_script:
- npm install -g gulp-cli@1
- gulp lint-eslint
script:
- npm run generate-types
- node ./node_modules/.bin/polymer test --npm --module-resolution=node -l chrome
- node ./node_modules/.bin/polymer test --npm --module-resolution=node -l firefox
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then travis_wait 30 ./util/travis-sauce-test.sh; fi
Expand Down
2 changes: 1 addition & 1 deletion externs/closure-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ Polymer_TemplateStamp.prototype._addMethodEventListenerToNode = function(node, e
*/
Polymer_TemplateStamp.prototype._addEventListenerToNode = function(node, eventName, handler){};
/**
* @param {Node} node Node to remove event listener from
* @param {!Node} node Node to remove event listener from
* @param {string} eventName Name of event
* @param {function (!Event): void} handler Listener function to remove
* @return {void}
Expand Down
8 changes: 4 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ gulp.task('generate-externs', gulp.series('clean', async () => {

gulp.task('generate-typescript', async () => {
let genTs = require('@polymer/gen-typescript-declarations').generateDeclarations;
await del(['types/**/*.d.ts', '!types/extra-types.d.ts']);
const config = await fs.readJson('gen-tsd.json');
const files = await genTs('.', config);
await del(['**/*.d.ts', '!interfaces.d.ts', '!node_modules/**']);
const config = await fs.readJson(path.join(__dirname, 'gen-tsd.json'));
const files = await genTs(__dirname, config);
for (const [filePath, contents] of files) {
await fs.outputFile(path.join('types', filePath), contents);
await fs.outputFile(path.join(__dirname, filePath), contents);
}
});

Expand Down
4 changes: 2 additions & 2 deletions lib/mixins/property-effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -1678,9 +1678,9 @@ export const PropertyEffects = dedupingMixin(superClass => {
* a specific order (compute, propagate, reflect, observe, notify).
*
* @param {!Object} currentProps Bag of all current accessor values
* @param {!Object} changedProps Bag of properties changed since the last
* @param {?Object} changedProps Bag of properties changed since the last
* call to `_propertiesChanged`
* @param {!Object} oldProps Bag of previous values for each property
* @param {?Object} oldProps Bag of previous values for each property
* in `changedProps`
* @return {void}
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/mixins/template-stamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ export const TemplateStamp = dedupingMixin(
/**
* Override point for adding custom or simulated event handling.
*
* @param {Node} node Node to remove event listener from
* @param {!Node} node Node to remove event listener from
* @param {string} eventName Name of event
* @param {function(!Event):void} handler Listener function to remove
* @return {void}
Expand Down
Loading

0 comments on commit 536030a

Please sign in to comment.