Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisj committed Nov 7, 2019
0 parents commit e42a226
Show file tree
Hide file tree
Showing 19 changed files with 6,275 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "third_party/neuroglancer"]
path = third_party/neuroglancer
url = https://github.com/seung-lab/neuroglancer.git
branch = cj_expose_auth_token
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Based on https://github.com/google/neuroglancer/tree/master/examples/dependent-project
but using git submodule instead of npm because of https://github.com/google/neuroglancer/issues/172

Installation Instructions

```console
$ git submodule init && git submodule update
$ npm i
$ cd third_party/neuroglancer/ && npm i && cd ../..
$ npm run dev-server
```
25 changes: 25 additions & 0 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @license
* Copyright 2016 Google Inc.
* 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.
*/

'use strict';

const path = require('path');
const webpack_helpers = require('./webpack_helpers');
module.exports = env => {
env = env || 'dev';
return webpack_helpers.getViewerConfigFromEnv(
{outputPath: path.resolve(__dirname, '../dist/' + env)}, env);
};
67 changes: 67 additions & 0 deletions config/webpack_helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* @license
* Copyright 2016 Google Inc.
* 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.
*/

'use strict';

const path = require('path');
const originalWebpackHelpers = require('../third_party/neuroglancer/config/webpack_helpers');
const resolveReal = require('../third_party/neuroglancer/config/resolve_real');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin')

function modifyViewerOptions(options) {
options = options || {};
options.resolveLoaderRoots = [
...(options.resolveLoaderRoots || []),

// Allow loader modules to be resolved from node_modules directory of this
// project in addition to the node_modules directory of neuroglancer.
resolveReal(__dirname, '../node_modules')
];

// This references the tsconfig.json file of this project, rather than of
// neuroglancer.
options.tsconfigPath = resolveReal(__dirname, '../tsconfig.json');

// This references the main.ts of this project, rather than of
// neuroglancer.
options.frontendModules = [resolveReal(__dirname, '../src/main.ts')];

options.frontendPlugins = [new VueLoaderPlugin()];

options.htmlPlugin = new HtmlWebpackPlugin({template: resolveReal(__dirname, '../src/index.html')});

options.resolveAliases = {
'vue': resolveReal(__dirname, '../node_modules/vue/dist/vue.esm.js'),
};

return options;
}

exports.getViewerConfigFromEnv = function(options, env) {
const res = originalWebpackHelpers.getViewerConfigFromEnv(modifyViewerOptions(options), env);

const frontEndModule = res[0].module;
const frontEndTsLoader = frontEndModule.rules[0].loader[0];
frontEndTsLoader.options['appendTsSuffixTo'] = [/\.vue$/];

frontEndModule.rules.push({
test: /\.vue$/,
loader: 'vue-loader'
});

return res;
};
Loading

0 comments on commit e42a226

Please sign in to comment.