Skip to content

Commit

Permalink
Basic 3DOM (google#992)
Browse files Browse the repository at this point in the history
* WIP

* Start building it up from scratch

* Context initializer

* Add ThreeDOMElement and test

* Add Material, Model and PBRMetallicRoughness

* Add in context chunks

* Add Three.js facade

* Add Github Actions to run tests

* Update package-lock.json

* Disable IE11, add EventTarget polyfill

* Add package-lock updating script

* Fix polyfill location, use 'latest'/'latest-1' browsers

* Add linting and pre-commit hook

* Fix grep

* Fix conflict between lint and clang-format

* Unbreak pre-commit.sh

* Add an integrated demo

* End-to-end and context tests

* Add a README for 3DOM

* Add scene graph mixin and example

* Respond to review feedback

* Fix example title

* Fix EventTarget test in Firefox

* Add model-change test

* Add issue numbers to TODO comments

* Add Scene Graph test suite

* Do another release of 3dom

* Update scene-graph-spec.ts

* Add caching to Github Actions

* Remove caching for glTF Sample Models

* Increase Mocha timeout

* Fix typo in test suite

* slightly safer usage of MO

* Fix 1006/1007 early

* Skip most of suite for now

* Add TODO back in
  • Loading branch information
Christopher Joel authored Feb 11, 2020
1 parent b2f28f4 commit 539295d
Show file tree
Hide file tree
Showing 76 changed files with 14,111 additions and 2,302 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
BinPackArguments: false
ColumnLimit: 80
# This breaks async functions sometimes, see
# https://github.com/Polymer/polymer-analyzer/pull/393
# BinPackParameters: false
11 changes: 11 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
**/node_modules
packages/*/dist
packages/**/*.d.ts
packages/*/src/*-css.ts

packages/*/karma.*.js

packages/model-viewer/**/*
packages/modelviewer.dev/**/*
packages/render-fidelity-tools/**/*
packages/shared-assets/**/*
65 changes: 65 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
extends:
- eslint:recommended
- google
- plugin:@typescript-eslint/eslint-recommended
- plugin:@typescript-eslint/recommended
- plugin:wc/recommended
globals:
goog: false
env:
browser: true
parser: "@typescript-eslint/parser"
plugins:
- "@typescript-eslint"
- mocha
- wc
parserOptions:
ecmaVersion: 2017
sourceType: module
settings:
wc:
elementBaseClasses: ["BaseElement", "LitElement", "FormElement"]
rules:
# Rules temporally disabled
"@typescript-eslint/explicit-function-return-type": off

# Rules disabled in favor of clang-format
"@typescript-eslint/indent": off
indent: off
max-len: off
block-spacing: off
# Remove if we switch away from clang-format:
keyword-spacing: off

"@typescript-eslint/explicit-member-accessibility": [error, {"accessibility": "no-public"}]

no-new: warn
quotes: [error, single, {"avoidEscape": true}]
no-var: error
curly: error
no-floating-decimal: error
# tsc handles this for us, and eslint has false positives
no-unused-vars: error
"@typescript-eslint/no-unused-vars": off

require-jsdoc: off
valid-jsdoc: off

prefer-const: error
comma-dangle: off

mocha/handle-done-callback: error
mocha/no-exclusive-tests: error
mocha/no-identical-title: error
mocha/no-nested-tests: error
mocha/no-pending-tests: error
mocha/no-skipped-tests: error
overrides:
- files: ["packages/**/*.ts"]
rules:
no-unused-vars: off
no-invalid-this: off
new-cap: off
- files: ["packages/**/*-spec.ts"]
rules:
"@typescript-eslint/no-non-null-assertion": off
53 changes: 53 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: tests

on: [push, pull_request]

jobs:
tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '12.x'

- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm packages
uses: actions/cache@v1
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: NPM install
run: npm ci

- name: Lint TypeScript sources
run: npm run lint

- name: Bootstrap packages
run: npm run bootstrap

- name: Build packages
run: npm run build

- name: Unit tests
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
run: |
# Don't run Sauce from a forked repo, since the code may not be trusted
# and therefore secrets like the Sauce password are not available.
# GITHUB_HEAD_REF is only defined when building a fork.
if [ ! "$GITHUB_HEAD_REF" ]; then
export USE_SAUCE=true
export SAUCE_BUILD_ID=model-viewer-tests-${GITHUB_EVENT_NAME}-${GITHUB_ACTION}-${GITHUB_SHA}
export SAUCE_TUNNEL_ID=${SAUCE_BUILD_ID}-tunnel
fi
npm run test:ci
2 changes: 1 addition & 1 deletion model-viewer.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
],
"settings": {
"git.ignoreLimitWarning": true,
"typescript.tsdk": "render-fidelity-tools/node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib"
}
}
Loading

0 comments on commit 539295d

Please sign in to comment.