diff --git a/CHANGES.md b/CHANGES.md index 4d261004..aa468663 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,12 @@ videojs-record changelog ======================== +2.0.3 - unreleased +------------------ + +- Fix Windows build (#186) + + 2.0.2 - 2017/11/15 ------------------ diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..fa8b49a9 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,20 @@ +environment: + matrix: + - nodejs_version: '8' + - nodejs_version: '6' +install: + - ps: Install-Product node $env:nodejs_version + - set CI=true + - npm install --global npm@latest + - set PATH=%APPDATA%\npm;%PATH% + - npm install +matrix: + fast_finish: true +build: off +shallow_clone: true +test_script: + - node --version + - npm --version + - npm test +cache: + - '%APPDATA%\npm-cache' diff --git a/package.json b/package.json index 80715992..a916816f 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "build:css:sass": "node-sass --include-path src/css src/css/videojs.record.scss dist/css/videojs.record.css", "build:css:comb": "csscomb dist/css/videojs.record.css", "build:css:compress": "cleancss -o dist/css/videojs.record.min.css dist/css/videojs.record.css", - "build:css:banner": "node scripts/add-banner.js dist/css/videojs.record*.css", + "build:css:banner": "node scripts/add-banner.js 'dist/css/videojs.record*.css'", "build:js": "npm-run-all build:js:babel build:js:browserify build:js:version build:js:collapse build:js:uglify build:js:banner build:js:plugins build:js:language", "build:js:babel": "babel src/js --out-dir es5", "build:js:version": "node scripts/update-version.js", diff --git a/scripts/add-banner.js b/scripts/add-banner.js index 46358e6e..30a72120 100755 --- a/scripts/add-banner.js +++ b/scripts/add-banner.js @@ -6,6 +6,8 @@ */ var fs = require('fs'); +var path = require('path'); +var glob = require('glob') var moment = require('moment'); var banner = require('add-banner'); @@ -15,34 +17,33 @@ var infile, fpath, result; var pjson = JSON.parse(fs.readFileSync('package.json', 'utf8')); // check command-line arguments -if (process.argv.length < 3) { +if (process.argv.length != 3) { console.error("Error: no input file(s) specified"); process.exit(); } // process multiple files -process.argv.forEach(function (fpath, index, array) { - if (index > 1) { +glob(process.argv[2], function (er, files) { + files.forEach(function(fpath) { + infile = fs.readFileSync(fpath, 'utf8'); if (fpath.endsWith(CSS)) { // CSS result = banner(infile, { - banner: 'scripts/banner.css', + banner: path.resolve('scripts', 'banner.css'), pkg: pjson }); fs.writeFile(fpath, result); - + } else if (fpath.endsWith(JS)) { // javascript result = banner(infile, { - banner: 'scripts/banner.ejs', + banner: path.resolve('scripts', 'banner.ejs'), pkg: pjson, moment: moment }); fs.writeFile(fpath, result); } console.info('Added banner to ' + fpath); - } + }); }); - - diff --git a/scripts/build-plugins.js b/scripts/build-plugins.js index e0277ad7..7a759dc3 100644 --- a/scripts/build-plugins.js +++ b/scripts/build-plugins.js @@ -21,8 +21,8 @@ var collapse = require('bundle-collapser/plugin'); var color = require('colour'); var mkdirp = require('mkdirp'); -var pluginsDestDir = 'dist/plugins/'; -var bannerPath = 'scripts/banner.ejs'; +var pluginsDestDir = path.join('dist', 'plugins'); +var bannerPath = path.join('scripts', 'banner.ejs'); var fileName, dirName, pluginName, minifiedName, pluginDestPath, pluginDestPathMinified, browserify_opts, pjson, bundler; @@ -34,12 +34,12 @@ mkdirp(pluginsDestDir, function(err) { console.log(color.green('OK') + ': Build ' + files.length + ' plugins'); files.forEach(function(pluginPath) { - fileName = pluginPath.substr(pluginPath.lastIndexOf('/') + 1); - dirName = pluginPath.split(fileName)[0]; + fileName = path.basename(pluginPath); + dirName = path.dirname(pluginPath); pluginName = fileName.replace('-plugin.js', ''); minifiedName = fileName.replace('-plugin.js', '.min.js'); - pluginDestPath = pluginsDestDir + 'videojs.record.' + pluginName + '.js'; - pluginDestPathMinified = pluginsDestDir + 'videojs.record.' + minifiedName; + pluginDestPath = path.join(pluginsDestDir, 'videojs.record.' + pluginName + '.js'); + pluginDestPathMinified = path.join(pluginsDestDir, 'videojs.record.' + minifiedName); browserify_opts = { standalone: pluginName, plugin: [ diff --git a/scripts/update-version.js b/scripts/update-version.js index 5d14947e..a1ec243c 100644 --- a/scripts/update-version.js +++ b/scripts/update-version.js @@ -6,6 +6,8 @@ */ var fs = require('fs'); +var path = require('path'); +var color = require('colour'); var replace = require('replace'); var pjson = JSON.parse(fs.readFileSync('package.json', 'utf8')); var version = pjson.version; @@ -13,6 +15,8 @@ var version = pjson.version; replace({ regex: "Record.VERSION = 'dev';", replacement: "Record.VERSION = '" + version + "';", - paths: ['./dist/videojs.record.js'], + paths: [path.resolve('dist', 'videojs.record.js')], silent: true }); + +console.log(color.green('OK') + ': Version updated to ' + version);