Trying to fix front end resources to be agnostic.
This commit is contained in:
parent
b95b321c3d
commit
e790b7af12
|
@ -11,7 +11,6 @@ const transformInferno = require('ts-transform-inferno').default;
|
|||
const transformClasscat = require('ts-transform-classcat').default;
|
||||
let fuse, app;
|
||||
let isProduction = false;
|
||||
var setEnv = require('./set_env.js').setEnv;
|
||||
|
||||
Sparky.task('config', _ => {
|
||||
fuse = new FuseBox({
|
||||
|
@ -44,16 +43,13 @@ Sparky.task('config', _ => {
|
|||
});
|
||||
Sparky.task('clean', _ => Sparky.src('dist/').clean('dist/'));
|
||||
Sparky.task('env', _ => (isProduction = true));
|
||||
Sparky.task('set_env', _ => {
|
||||
setEnv();
|
||||
});
|
||||
Sparky.task('copy-assets', () => Sparky.src('assets/*.ico').dest('dist/'));
|
||||
Sparky.task('dev', ['clean', 'set_env', 'config', 'copy-assets'], _ => {
|
||||
Sparky.task('dev', ['clean', 'config', 'copy-assets'], _ => {
|
||||
fuse.dev();
|
||||
app.hmr().watch();
|
||||
return fuse.run();
|
||||
});
|
||||
Sparky.task('prod', ['clean', 'set_env', 'env', 'config', 'copy-assets'], _ => {
|
||||
Sparky.task('prod', ['clean', 'env', 'config', 'copy-assets'], _ => {
|
||||
// fuse.dev({ reload: true }); // remove after demo
|
||||
return fuse.run();
|
||||
});
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
require('dotenv').config();
|
||||
const fs = require('fs');
|
||||
|
||||
exports.setEnv = function() {
|
||||
let endpoint = (process.env.TORRENTS_CSV_ENDPOINT) ? process.env.TORRENTS_CSV_ENDPOINT : "http://0.0.0.0:8080";
|
||||
let env_line = `export const endpoint = '${endpoint}';`;
|
||||
fs.writeFile("src/env.ts", env_line, function (err) {
|
||||
console.log("Wrote src/env.ts:");
|
||||
console.log("\t" + env_line);
|
||||
});
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
export const endpoint = window.location.origin;
|
Loading…
Reference in New Issue