Skip to content

Commit

Permalink
initial commit.
Browse files Browse the repository at this point in the history
right now essentially a ripoff of model-builder
  • Loading branch information
reiinakano committed Sep 30, 2017
0 parents commit c563812
Show file tree
Hide file tree
Showing 27 changed files with 3,448 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .gitignore
@@ -0,0 +1,13 @@
node_modules/
src/bundle.js
src/*.js.map
build/
bower_components/
src/images/

npm-debug.log
.DS_Store
dist/
.idea/

*~
34 changes: 34 additions & 0 deletions bower.json
@@ -0,0 +1,34 @@
{
"name": "gan-playground",
"description": "",
"main": "",
"authors": [],
"license": "MIT",
"homepage": "",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"paper-dialog-scrollable": "1.*.*",
"paper-icon-button": "1.*.*",
"paper-tooltip": "1.*.*",
"paper-toggle-button": "1.*.*",
"paper-radio-group": "1.*.*",
"paper-radio-button": "1.*.*",
"paper-dialog": "1.*.*",
"paper-button": "1.*.*",
"paper-item": "1.*.*",
"paper-dropdown-menu": "1.*.*",
"paper-listbox": "1.*.*",
"iron-icons": "1.*.*",
"paper-slider": "1.*.*",
"polymer": "1.*.*",
"paper-spinner": "1.*.*",
"paper-progress": "1.*.*"
}
}
28 changes: 28 additions & 0 deletions package.json
@@ -0,0 +1,28 @@
{
"name": "gan-playground",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT",
"devDependencies": {
"@types/jasmine": "~2.5.53",
"@types/polymer": "~1.1.31",
"bower": "~1.8.0",
"browserify": "~14.4.0",
"cross-spawn": "~5.1.0",
"deeplearn": "~0.2.3",
"http-server": "~0.10.0",
"jasmine-core": "~2.6.4",
"polymer-bundler": "~3.0.1",
"tsify": "~3.0.1",
"tslint": "~5.6.0",
"typedoc": "~0.8.0",
"typescript": "2.4.2",
"uglify-js": "~3.0.28",
"watchify": "~3.9.0"
}
}
36 changes: 36 additions & 0 deletions scripts/build-demo
@@ -0,0 +1,36 @@
#!/usr/bin/env node
// Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// =============================================================================

const path = require('path');
const spawn = require('cross-spawn');

const startTsFilePath = process.argv[2];
const outDir = process.argv[3];

let outputPath;
if (outDir != null) {
outputPath = path.join(outDir, 'bundle.js');
} else {
outputPath = path.join(path.dirname(startTsFilePath), 'bundle.js')
}


const cmd = path.join('node_modules', '.bin', 'browserify');
const child = spawn(cmd, [startTsFilePath, '-p', '[tsify]', '-o' , outputPath],
{detached: false});
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
child.on('close', () => console.log(`Stored bundle in ${outputPath}`));
36 changes: 36 additions & 0 deletions scripts/deploy-demo
@@ -0,0 +1,36 @@
#!/usr/bin/env node
// Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// =============================================================================

const path = require('path');
const spawn = require('cross-spawn');

const startTsFilePath = process.argv[2];
const startHTMLFilePath = process.argv[3];
const outDir = process.argv[4];

const cmd = path.join('scripts', 'build-demo');
const child = spawn(cmd, [startTsFilePath, outDir], {detached: false});
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
child.on('close', () => {
const bundlePath = path.join(outDir, path.basename(startHTMLFilePath));
const cmd = path.join('node_modules', '.bin', 'polymer-bundler');
const child = spawn(cmd, ['--inline-scripts', '--inline-css',
'--out-html', bundlePath, startHTMLFilePath], {detached: false});
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
child.on('close', () => console.log(`Saved bundled demo at ${bundlePath}`));
});
42 changes: 42 additions & 0 deletions scripts/watch-demo
@@ -0,0 +1,42 @@
#!/usr/bin/env node
// Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// =============================================================================

const path = require('path');
const spawn = require('cross-spawn');

const startTsFilePath = process.argv[2];
const outputPath = path.join(path.dirname(startTsFilePath), 'bundle.js')

const cmd = path.join('node_modules', '.bin', 'watchify');
const watchify = spawn(cmd, [startTsFilePath, '-p', '[tsify]', '-v', '--debug',
'-o' , outputPath], {detached: false});
watchify.stdout.pipe(process.stdout);
watchify.stderr.pipe(process.stderr);

let httpServerStarted = false;

console.log('Waiting for initial compile...');
watchify.stderr.on('data', (data) => {
if (data.toString().includes(`bytes written to`)) {
if (!httpServerStarted) {
const httpCmd = path.join('node_modules', '.bin', 'http-server');
const httpServer = spawn(httpCmd, ['-c-1'], { detached: false});
httpServer.stdout.pipe(process.stdout);
httpServer.stderr.pipe(process.stderr);
httpServerStarted = true;
}
}
});

0 comments on commit c563812

Please sign in to comment.