Ver código fonte

Allow website updater to be ran from any dir

Kevin van Zonneveld 9 anos atrás
pai
commit
296857edc9
2 arquivos alterados com 15 adições e 9 exclusões
  1. 1 0
      src/plugins/Dropbox.js
  2. 14 9
      website/update.js

+ 1 - 0
src/plugins/Dropbox.js

@@ -2,6 +2,7 @@ import request from 'superagent';
 
 
 class DropboxPlugin {
 class DropboxPlugin {
   constructor() {
   constructor() {
+    this.name = 'DropboxPlugin';
     this.authenticate = this.authenticate.bind(this);
     this.authenticate = this.authenticate.bind(this);
     this.connect = this.connect.bind(this);
     this.connect = this.connect.bind(this);
     this.render = this.render.bind(this);
     this.render = this.render.bind(this);

+ 14 - 9
website/update.js

@@ -1,14 +1,19 @@
-var fs            = require('fs')
-var version       = require('../package.json').version
-var configPath    = '_config.yml'
-var config        = fs.readFileSync(configPath, 'utf-8')
+var fs         = require('fs')
+var path       = require('path')
+
+var webRoot  = __dirname;
+var uppyRoot = path.dirname(__dirname);
+
+var configPath = webRoot + '/_config.yml'
+var config     = fs.readFileSync(configPath, 'utf-8')
+var version    = require(uppyRoot + '/package.json').version
 
 
 // Inject current Uppy version and sizes in website's _config.yml
 // Inject current Uppy version and sizes in website's _config.yml
-var sizes = {};
+var sizes     = {};
 var locations = {
 var locations = {
-  min: '../dist/uppy.js',
-  gz : '../dist/uppy.js',
-  dev: '../dist/uppy.js'
+  min: uppyRoot + '/dist/uppy.js',
+  gz : uppyRoot + '/dist/uppy.js',
+  dev: uppyRoot + '/dist/uppy.js'
 }
 }
 // @todo: ^-- Refer to actual minified builds in dist:
 // @todo: ^-- Refer to actual minified builds in dist:
 
 
@@ -28,6 +33,6 @@ fs.writeFileSync(
 
 
 // Copy latest uppy version into website so the CDN example can use it
 // Copy latest uppy version into website so the CDN example can use it
 fs.writeFileSync(
 fs.writeFileSync(
-  './themes/uppy/source/js/uppy.js',
+  webRoot + '/themes/uppy/source/js/uppy.js',
   fs.readFileSync(locations.dev, 'utf-8')
   fs.readFileSync(locations.dev, 'utf-8')
 );
 );