Skip to content

Commit

Permalink
Add *.js files to ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Oct 26, 2016
2 parents d764928 + ecc582f commit 10b12a4
Show file tree
Hide file tree
Showing 39 changed files with 3,895 additions and 3,747 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ wwwroot/*
*.cs
project.lock.json
*.cmd
.idea
*.cmd
/package
*.js
/src/template_question.html.ts
/src/template_page.html.ts
/src/templateEditor.ko.html.ts
/src/templateEditor.ko.html.ts
187 changes: 95 additions & 92 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ var gulp = require('gulp'),
sequence = require("gulp-sequence"),
html2ts = require("gulp-html-to-ts"),
jsonTransform = require('gulp-json-transform'),
project = require("./project.json");
project = require("./project.json"),
webpackStream = require('webpack-stream'),
getWebpackConfig = require('./webpack.config');

var Server = require("karma").Server;
var editorVersion = "0.9.12";
Expand Down Expand Up @@ -50,6 +52,15 @@ var copyright = ["/*!",
"* Github - https://github.com/andrewtelnov/survey.js.editor",
"*/", "", ""].join("\n");

var webpack_params = {
bundleName: "surveyeditor",
entryPoint: "./src/entries/index"
};

var webpack_params_test = {
bundleName: "surveyeditor.test",
entryPoint: "./tests/entries/index"
};

gulp.task('copyfiles', function (callback) {
gulp.src(gnf(null, 'package.json'), { base: './' })
Expand Down Expand Up @@ -81,97 +92,89 @@ gulp.task('updatesurveyjsversion', function (callback) {
.pipe(gulp.dest(""));
});

(function () {
(function () {
"use strict";
gulp.task("typescript:sources", function () {
var tsResult = gulp.src([
paths.webroot + "/lib/survey/**/*.d.ts",
paths.typings
].concat(paths.ts))
.pipe(insert.prepend(copyright))
.pipe(sourcemaps.init())
.pipe(ts({
target: "ES5",
noImplicitAny: false,
declarationFiles: true
}));

return tsResult.js
.pipe(concat(paths.mainJSfile))
.pipe(sourcemaps.write({ sourceRoot: "src" }))
//Source map is a part of generated file
.pipe(gulp.dest(paths.dist))
.pipe(gulp.dest(paths.jsFolder))
.pipe(gulp.dest(paths.packageDist));
});

gulp.task("typescript:tests", function () {
var tsResult = gulp.src([
paths.webroot + "/lib/survey/**/*.d.ts",
paths.typings,
//"./src/model/*.ts",
paths.tsTests])
.pipe(sourcemaps.init())
.pipe(ts({
target: "ES5",
noImplicitAny: false
}));

return tsResult.js
.pipe(concat('surveyeditor.tests.js'))
.pipe(sourcemaps.write({ sourceRoot: "tests" }))
//Source map is a part of generated file
.pipe(gulp.dest(paths.testsFolder));
});

gulp.task('test:copy-index-html', function () {
return gulp.src('./tests/index.html')
// Perform minification tasks, etc here
.pipe(gulp.dest(paths.testsFolder));
});

gulp.task("typescript", ["typescript:sources", "typescript:tests", "test:copy-index-html"]);
})("TypeScript compilation");

gulp.task('compress', function () {
"use strict";
return gulp.src(paths.dist + paths.mainJSfile)
.pipe(uglify())
.pipe(rename({
extname: '.min.js'
}))
.pipe(concat.header(copyright))
.pipe(gulp.dest(paths.dist))
.pipe(gulp.dest(paths.packageDist));
});

gulp.task('sass', function () {
"use strict";
return gulp.src(paths.styles)
.pipe(sass.sync().on('error', sass.logError))
.pipe(concat("surveyeditor.css"))
.pipe(gulp.dest(paths.webroot + 'css'))
.pipe(gulp.dest(paths.dist + 'css'))
.pipe(gulp.dest(paths.packageDist));
});

gulp.task('templates', function () {
"use strict";
gulp.src(paths.template_page)
.pipe(html2ts())
.pipe(gulp.dest("./src/"));
gulp.src(paths.template_question)
.pipe(html2ts())
.pipe(gulp.dest("./src/"));
return gulp.src(paths.templates_ko)
.pipe(concat("templateEditor.ko.html"))
.pipe(html2ts())
.pipe(gulp.dest("./src/"));
});

gulp.task("makedist", sequence("templates", ["typescript", "sass"], "compress", "createPackage", "updatesurveyjsversion"));
})("TypeScript compilation");
gulp.task("typescript:sources", function () {
var params = webpack_params;
var tsResult = gulp.src(params.entryPoint)
.pipe(webpackStream(getWebpackConfig(params)));

return tsResult
.pipe(concat(paths.mainJSfile))
.pipe(insert.prepend(copyright))
.pipe(gulp.dest(paths.dist))
.pipe(gulp.dest(paths.jsFolder))
.pipe(gulp.dest(paths.packageDist));
});

gulp.task("typescript:tests", function () {
var params = webpack_params_test;
var tsResult = gulp.src(params.entryPoint)
.pipe(webpackStream(getWebpackConfig(params)));

return tsResult
.pipe(concat('surveyeditor.tests.js'))
.pipe(sourcemaps.write({ sourceRoot: "tests" }))
//Source map is a part of generated file
.pipe(gulp.dest(paths.testsFolder));
});

gulp.task('test:copy-index-html', function () {
return gulp.src('./tests/index.html')
// Perform minification tasks, etc here
.pipe(gulp.dest(paths.testsFolder));
});

gulp.task("typescript", ["typescript:sources", "typescript:tests", "test:copy-index-html"]);

gulp.task('compress', function () {
"use strict";
return gulp.src(paths.dist + paths.mainJSfile)
.pipe(uglify())
.pipe(rename({
extname: '.min.js'
}))
.pipe(concat.header(copyright))
.pipe(gulp.dest(paths.dist))
.pipe(gulp.dest(paths.packageDist));
});

gulp.task('sass', function () {
"use strict";
return gulp.src(paths.styles)
.pipe(sass.sync().on('error', sass.logError))
.pipe(concat("surveyeditor.css"))
.pipe(gulp.dest(paths.webroot + 'css'))
.pipe(gulp.dest(paths.dist + 'css'))
.pipe(gulp.dest(paths.packageDist));
});

gulp.task('templates', function () {
"use strict";
gulp.src(paths.template_page)
.pipe(html2ts())
.pipe(insert.transform(function(contents, file) {
contents = contents.slice(0, -1); //remove last symbol '}'
return contents.replace('module template_page { ', '');
}))
.pipe(gulp.dest("./src/"));
gulp.src(paths.template_question)
.pipe(html2ts())
.pipe(insert.transform(function(contents, file) {
contents = contents.slice(0, -1); //remove last symbol '}'
return contents.replace('module template_question { ', '');
}))
.pipe(gulp.dest("./src/"));

return gulp.src(paths.templates_ko)
.pipe(concat("templateEditor.ko.html"))
.pipe(html2ts())
.pipe(insert.transform(function(contents, file) {
contents = contents.slice(0, -1); //remove last symbol '}'
return contents.replace('module templateEditor.ko { ', '');
}))
.pipe(gulp.dest("./src/"));
});

gulp.task("makedist", sequence("templates", ["typescript", "sass"], "compress", "createPackage", "updatesurveyjsversion"));

gulp.task("test_ci", function (done) {
new Server({
Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = function (config) {
files: [
"wwwroot/js/qunit.css",
"wwwroot/js/knockout.js",
"wwwroot/js/survey.bootstrap.js",
"wwwroot/js/survey.ko.js",
"wwwroot/js/surveyeditor.js",

"wwwroot/tests/surveyeditor.tests.js",
Expand Down
39 changes: 23 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,40 @@
"version": "0.9.0",
"name": "surveyjs.editor",
"devDependencies": {
"qunit": "^0.9.1",
"rimraf": "^2.5.4",
"babel-core": "^6.17.0",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.16.0",
"babel-preset-react": "^6.16.0",
"gulp": "^3.9.1",
"gulp-typescript": "^2.13.6",
"gulp-insert": "^0.5.0",
"gulp-concat-util": "^0.5.5",
"gulp-cssmin": "^0.1.7",
"gulp-uglify": "^2.0.0",
"gulp-html-to-ts": "^0.1.3",
"gulp-insert": "^0.5.0",
"gulp-json-transform": "^0.4.2",
"gulp-load-plugins": "^1.2.4",
"gulp-npm-files": "^0.1.3",
"gulp-qunit": "^1.4.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.3.2",
"gulp-sequence": "^0.4.5",
"gulp-serve": "^1.4.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-sass": "^2.3.2",
"gulp-qunit": "^1.4.0",
"gulp-load-plugins": "^1.2.4",
"gulp-html-to-ts": "^0.1.3",
"gulp-npm-files": "^0.1.3",
"gulp-json-transform": "^0.4.2",
"gulp-typescript": "^2.13.6",
"gulp-uglify": "^2.0.0",
"karma": "^1.1.2",
"karma-qunit": "^1.1.0",
"karma-phantomjs-launcher": "^1.0.1",
"karma-junit-reporter": "^1.1.0",
"karma-coverage": "^1.1.1",
"gulp-serve": "^1.4.0"
"karma-junit-reporter": "^1.1.0",
"karma-phantomjs-launcher": "^1.0.1",
"karma-qunit": "^1.1.0",
"qunit": "^0.9.1",
"rimraf": "^2.5.4",
"ts-loader": "^0.9.4",
"typescript": "^2.0.2",
"webpack-stream": "^3.2.0"
},
"dependencies": {
"knockout": "^3.4.0",
"ace-builds": "^1.2.2",
"survey-knockout-bootstrap": "^0.9.12"
"survey-knockout": "^0.10.0"
}
}
Loading

0 comments on commit 10b12a4

Please sign in to comment.