mirror of https://github.com/rancher/api-ui.git
Merge pull request #29 from rancher/update-dependencies
Update dependencies
This commit is contained in:
commit
62b0a49988
119
gulpfile.js
119
gulpfile.js
|
|
@ -3,53 +3,46 @@ var gulpConcat = require('gulp-concat');
|
||||||
var gulpConnect = require('gulp-connect');
|
var gulpConnect = require('gulp-connect');
|
||||||
var gulpExec = require('gulp-exec');
|
var gulpExec = require('gulp-exec');
|
||||||
var gulpGzip = require('gulp-gzip');
|
var gulpGzip = require('gulp-gzip');
|
||||||
var gulpHint = require('gulp-jshint');
|
|
||||||
var gulpMap = require('gulp-sourcemaps');
|
var gulpMap = require('gulp-sourcemaps');
|
||||||
var gulpRename = require('gulp-rename');
|
var gulpRename = require('gulp-rename');
|
||||||
var gulpReplace = require('gulp-replace');
|
var gulpReplace = require('gulp-replace');
|
||||||
var gulpSass = require('gulp-sass');
|
var gulpSass = require('gulp-sass')(require('sass'));
|
||||||
var gulpTar = require('gulp-tar');
|
var gulpTar = require('gulp-tar');
|
||||||
var gulpUglify = require('gulp-uglify');
|
var gulpUglify = require('gulp-uglify');
|
||||||
var del = require('del');
|
var fs = require('fs-extra');
|
||||||
|
|
||||||
var pkg = require('./package.json');
|
var pkg = require('./package.json');
|
||||||
|
|
||||||
var DIST = 'dist/';
|
var DIST = 'dist/';
|
||||||
var VERSION_DIST = DIST+pkg.version+'/';
|
var VERSION_DIST = DIST+pkg.version+'/';
|
||||||
var CDN = 'cdn.rancher.io/api-ui';
|
var CDN = 'cdn.rancher.io/api-ui';
|
||||||
|
|
||||||
gulp.task('default', ['build']);
|
|
||||||
gulp.task('build', ['src','tarball']);
|
|
||||||
|
|
||||||
gulp.task('src', ['js','minjs','css','mincss','bootstrap']);
|
|
||||||
|
|
||||||
gulp.task('clean', function() {
|
gulp.task('clean', function() {
|
||||||
return del([
|
return fs.emptyDir('./tmp').then(() => fs.emptyDir('./dist'));
|
||||||
'tmp/**',
|
|
||||||
'dist/**'
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('server', ['build','livereload'], function() {
|
|
||||||
var cors = function(req, res, next) {
|
|
||||||
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
||||||
next();
|
|
||||||
};
|
|
||||||
|
|
||||||
return gulpConnect.server({
|
|
||||||
root: [VERSION_DIST],
|
|
||||||
port: process.env.PORT || 3000,
|
|
||||||
middleware: function() {
|
|
||||||
return [cors];
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('server:reload', function() {
|
gulp.task('server:reload', function() {
|
||||||
return gulpConnect.reload();
|
return gulpConnect.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('js', ['templates','partials'], function() {
|
gulp.task('templates', function() {
|
||||||
|
return gulp.src('templates/*.hbs', {read: false})
|
||||||
|
.pipe(gulpExec(file => `./node_modules/.bin/handlebars "${file.path}"`, {pipeStdout: true}))
|
||||||
|
.pipe(gulpRename(function(path) {
|
||||||
|
path.extname = '.hbs.js';
|
||||||
|
}))
|
||||||
|
.pipe(gulp.dest('./tmp/tpl'));
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('partials', function() {
|
||||||
|
return gulp.src('partials/*.hbs', {read: false})
|
||||||
|
.pipe(gulpExec(file => `./node_modules/.bin/handlebars --partial "${file.path}"`, {pipeStdout: true}))
|
||||||
|
.pipe(gulpRename(function(path) {
|
||||||
|
path.extname = '.hbs.js';
|
||||||
|
}))
|
||||||
|
.pipe(gulp.dest('./tmp/tpl'));
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('js', gulp.series('templates','partials', function() {
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
'node_modules/jquery/dist/jquery.js',
|
'node_modules/jquery/dist/jquery.js',
|
||||||
'vendor/jquery.scrollintoview.js',
|
'vendor/jquery.scrollintoview.js',
|
||||||
|
|
@ -71,34 +64,16 @@ gulp.task('js', ['templates','partials'], function() {
|
||||||
.pipe(gulpConcat('ui.js',{newLine: ';\n'}))
|
.pipe(gulpConcat('ui.js',{newLine: ';\n'}))
|
||||||
.pipe(gulpMap.write('./'))
|
.pipe(gulpMap.write('./'))
|
||||||
.pipe(gulp.dest(VERSION_DIST));
|
.pipe(gulp.dest(VERSION_DIST));
|
||||||
});
|
}));
|
||||||
|
|
||||||
gulp.task('minjs', ['js'], function() {
|
gulp.task('minjs', gulp.series('js', function() {
|
||||||
return gulp.src([VERSION_DIST+'/ui.js'], {base: VERSION_DIST})
|
return gulp.src([VERSION_DIST+'/ui.js'], {base: VERSION_DIST})
|
||||||
.pipe(gulpRename({suffix: '.min'}))
|
.pipe(gulpRename({suffix: '.min'}))
|
||||||
.pipe(gulpMap.init({loadMaps: true}))
|
.pipe(gulpMap.init({loadMaps: true}))
|
||||||
.pipe(gulpUglify())
|
.pipe(gulpUglify())
|
||||||
.pipe(gulpMap.write('./'))
|
.pipe(gulpMap.write('./'))
|
||||||
.pipe(gulp.dest(VERSION_DIST));
|
.pipe(gulp.dest(VERSION_DIST));
|
||||||
});
|
}));
|
||||||
|
|
||||||
gulp.task('templates', function() {
|
|
||||||
return gulp.src('templates/*.hbs', {read: false})
|
|
||||||
.pipe(gulpExec('./node_modules/.bin/handlebars "<%= file.path %>"', {pipeStdout: true}))
|
|
||||||
.pipe(gulpRename(function(path) {
|
|
||||||
path.extname = '.hbs.js';
|
|
||||||
}))
|
|
||||||
.pipe(gulp.dest('./tmp/tpl'));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('partials', function() {
|
|
||||||
return gulp.src('partials/*.hbs', {read: false})
|
|
||||||
.pipe(gulpExec('./node_modules/.bin/handlebars --partial "<%= file.path %>"', {pipeStdout: true}))
|
|
||||||
.pipe(gulpRename(function(path) {
|
|
||||||
path.extname = '.hbs.js';
|
|
||||||
}))
|
|
||||||
.pipe(gulp.dest('./tmp/tpl'));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('css', function() {
|
gulp.task('css', function() {
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
|
|
@ -114,30 +89,52 @@ gulp.task('css', function() {
|
||||||
.pipe(gulp.dest(VERSION_DIST))
|
.pipe(gulp.dest(VERSION_DIST))
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('mincss', ['css'], function() {
|
gulp.task('mincss', gulp.series('css', function() {
|
||||||
return gulp.src([VERSION_DIST+'/ui.css'], {base: VERSION_DIST})
|
return gulp.src([VERSION_DIST+'/ui.css'], {base: VERSION_DIST})
|
||||||
.pipe(gulpRename({suffix: '.min'}))
|
.pipe(gulpRename({suffix: '.min'}))
|
||||||
.pipe(gulpMap.init({loadMaps: true}))
|
.pipe(gulpMap.init({loadMaps: true}))
|
||||||
.pipe(gulpMap.write('./'))
|
.pipe(gulpMap.write('./'))
|
||||||
.pipe(gulp.dest(VERSION_DIST));
|
.pipe(gulp.dest(VERSION_DIST));
|
||||||
});
|
}));
|
||||||
|
|
||||||
gulp.task('bootstrap', function() {
|
gulp.task('bootstrap', function() {
|
||||||
return gulp.src(['node_modules/bootstrap/dist/**'])
|
return gulp.src(['node_modules/bootstrap/dist/**'])
|
||||||
.pipe(gulp.dest(VERSION_DIST));
|
.pipe(gulp.dest(VERSION_DIST));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('tarball', ['src'], function() {
|
gulp.task('livereload', function(cb) {
|
||||||
|
gulp.watch('./gulpfile.js', gulp.series('server:reload'));
|
||||||
|
gulp.watch('styles/**', gulp.series('css'));
|
||||||
|
gulp.watch('src/**', gulp.series('js'));
|
||||||
|
gulp.watch('templates/**', gulp.series('js'));
|
||||||
|
gulp.watch('partials/**', gulp.series('js'));
|
||||||
|
cb();
|
||||||
|
})
|
||||||
|
|
||||||
|
gulp.task('src', gulp.series('minjs','mincss','bootstrap'));
|
||||||
|
|
||||||
|
gulp.task('tarball', gulp.series('src', function() {
|
||||||
return gulp.src([VERSION_DIST+'/**'], {base: DIST})
|
return gulp.src([VERSION_DIST+'/**'], {base: DIST})
|
||||||
.pipe(gulpTar(pkg.version+'.tar'))
|
.pipe(gulpTar(pkg.version+'.tar'))
|
||||||
.pipe(gulpGzip())
|
.pipe(gulpGzip())
|
||||||
.pipe(gulp.dest(DIST));
|
.pipe(gulp.dest(DIST));
|
||||||
});
|
}));
|
||||||
|
|
||||||
|
gulp.task('build', gulp.series('tarball'), () => {});
|
||||||
|
gulp.task('default', gulp.series('build'));
|
||||||
|
|
||||||
|
gulp.task('server', gulp.series('build', 'livereload', function() {
|
||||||
|
var cors = function(req, res, next) {
|
||||||
|
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||||
|
next();
|
||||||
|
};
|
||||||
|
|
||||||
|
return gulpConnect.server({
|
||||||
|
root: [VERSION_DIST],
|
||||||
|
port: process.env.PORT || 3000,
|
||||||
|
middleware: function() {
|
||||||
|
return [cors];
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
gulp.task('livereload', function() {
|
|
||||||
gulp.watch('./gulpfile.js', ['server:reload']);
|
|
||||||
gulp.watch('styles/**', ['css']);
|
|
||||||
gulp.watch('src/**', ['js']);
|
|
||||||
gulp.watch('templates/**', ['js']);
|
|
||||||
gulp.watch('partials/**', ['js']);
|
|
||||||
})
|
|
||||||
|
|
|
||||||
37
package.json
37
package.json
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "api-ui",
|
"name": "api-ui",
|
||||||
"version": "1.1.9",
|
"version": "1.1.10",
|
||||||
"description": "Embedded UI for any service that implements the Rancher API spec",
|
"description": "Embedded UI for any service that implements the Rancher API spec",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Go Daddy Operating Company, LLC. (http://godaddy.com)",
|
"Go Daddy Operating Company, LLC. (http://godaddy.com)",
|
||||||
|
|
@ -13,6 +13,9 @@
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/rancherio/api-ui.git"
|
"url": "https://github.com/rancherio/api-ui.git"
|
||||||
},
|
},
|
||||||
|
"engine": {
|
||||||
|
"node": ">= 14.14"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "./node_modules/.bin/gulp server",
|
"start": "./node_modules/.bin/gulp server",
|
||||||
"clean": "./node_modules/.bin/gulp clean",
|
"clean": "./node_modules/.bin/gulp clean",
|
||||||
|
|
@ -20,21 +23,21 @@
|
||||||
"upload": "./scripts/upload"
|
"upload": "./scripts/upload"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"bootstrap": "^3",
|
"bootstrap": "3.4.1",
|
||||||
"del": "^1.1.0",
|
"fs-extra": "11.1.0",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "4.0.2",
|
||||||
"gulp-concat": "^2.6.0",
|
"gulp-concat": "2.6.1",
|
||||||
"gulp-connect": "^5.7.0",
|
"gulp-connect": "5.7.0",
|
||||||
"gulp-exec": "^2.1.1",
|
"gulp-exec": "5.0.0",
|
||||||
"gulp-gzip": "^1.4.0",
|
"gulp-gzip": "1.4.2",
|
||||||
"gulp-jshint": "^1.9.0",
|
"gulp-rename": "2.0.0",
|
||||||
"gulp-rename": "^1.2.0",
|
"gulp-replace": "1.1.4",
|
||||||
"gulp-replace": "^0.5.4",
|
"gulp-sass": "5.1.0",
|
||||||
"gulp-sass": "^2.3.2",
|
"gulp-sourcemaps": "3.0.0",
|
||||||
"gulp-sourcemaps": "^1.6.0",
|
"gulp-tar": "3.1.0",
|
||||||
"gulp-tar": "^1.9.0",
|
"gulp-uglify": "3.0.2",
|
||||||
"gulp-uglify": "^1.0.2",
|
"handlebars": "4.7.7",
|
||||||
"handlebars": "^4",
|
"jquery": "3.6.3",
|
||||||
"jquery": "^3"
|
"sass": "1.58.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Use this script to patch the api-ui in a running container
|
||||||
|
|
||||||
|
CONTAINER=$1
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Need container ID"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d ./dist ]; then
|
||||||
|
echo "You need to build first with 'yarn build'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Patching running container with latest api-ui"
|
||||||
|
|
||||||
|
docker exec -it ${CONTAINER} bash -c "rm -rf /usr/share/rancher/ui/api-ui/*"
|
||||||
|
|
||||||
|
# Copy in the built code
|
||||||
|
|
||||||
|
VERSION=$(node -e "(function () { console.log(require('./package.json').version) })()")
|
||||||
|
|
||||||
|
docker cp ./dist/${VERSION}/ ${CONTAINER}:/usr/share/rancher
|
||||||
|
|
||||||
|
docker exec -it ${CONTAINER} bash -c "cp -R /usr/share/rancher/${VERSION}/* /usr/share/rancher/ui/api-ui/"
|
||||||
|
docker exec -it ${CONTAINER} bash -c "rm -rf /usr/share/rancher/${VERSION}"
|
||||||
Loading…
Reference in New Issue