Skip to content

Commit 4cf8105

Browse files
authored
Merge pull request #31 from Saranya13/master
v18.3.35 Released
2 parents 868b113 + ab63fb8 commit 4cf8105

File tree

558 files changed

+16264
-808
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

558 files changed

+16264
-808
lines changed

gulpfile.js

Lines changed: 101 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,33 @@
11
var fs = require('fs');
22
var glob = require('glob');
3+
var runSequence = require('run-sequence');
4+
var build = require("@syncfusion/ej2-build");
35
var gulp = require("gulp");
6+
var webpack = require("webpack");
7+
// var webpackConfig = require("./webpack.config.js");
8+
// var clean = require("gulp-clean");
49
var shelljs = global.shelljs = global.shelljs || require('shelljs');
10+
var common = require("./node_modules/@syncfusion/ej2-build/src/utils/common.js");
11+
var isReleaseBranch = /^((release\/|hotfix\/))/g.test(process.env.BRANCH_NAME);
512

6-
gulp.task('copy-source', function (done) {
13+
gulp.task('create-locale', function () {
14+
var localeJson = glob.sync(__dirname + '/src/app/**/locale.json', {
15+
silent: true
16+
});
17+
if (localeJson.length) {
18+
// baseUtil;
19+
var obj = {};
20+
for (var i = 0; i < localeJson.length; i++) {
21+
var compentLocale = JSON.parse(fs.readFileSync(localeJson[i]));
22+
obj = common.extend({}, obj, compentLocale, true);
23+
}
24+
fs.writeFileSync(__dirname + '/src/app/common/locale-string.ts', 'export let Locale: Object=' + JSON.stringify(obj) + ';');
25+
} else {
26+
fs.writeFileSync(__dirname + '/src/app/common/locale-string.ts', 'export let Locale: Object={};');
27+
}
28+
});
29+
30+
gulp.task('copy-source', function () {
731
var localeJson = glob.sync(__dirname + '/src/app/**/*', {
832
silent: true,
933
ignore: ['/src/app/common/**/*.*', '/src/app/common']
@@ -16,14 +40,13 @@ gulp.task('copy-source', function (done) {
1640
}
1741
}
1842
}
19-
done();
2043
});
2144

2245
gulp.task('build', function (done) {
2346
shelljs.exec('npm run build:prod', function (exitCode, error) {
2447
console.log(error);
2548
done(exitCode);
26-
})
49+
});
2750
// runSequence('create-locale');
2851
});
2952

@@ -35,7 +58,7 @@ gulp.task('serve', ['copy-source', 'styles-all'], function () {
3558
gulp.task('clear-all', function () {
3659
return gulp.src(['src/**/*.js.map', 'src/**/*.json', 'src/**/*.js', 'src/**/*.d.ts', 'src/**/*.ngfactory.ts', 'src/**/*.ngstyle.ts']).pipe(clean({
3760
force: true
38-
}))
61+
}));
3962
});
4063

4164
gulp.task('move', function (done) {
@@ -49,8 +72,80 @@ gulp.task('move', function (done) {
4972
gulp.task('styles-replace', function (done) {
5073
var nos = glob.sync('node_modules/@syncfusion/ej2/*.css');
5174
for (var j = 0; j < nos.length; j++) {
52-
var htmlfile = fs.readFileSync(nos[j], 'utf8');
53-
fs.writeFileSync('./src/styles/' + nos[j].split('/')[3], htmlfile, 'utf8');
75+
var htmlfile = fs.readFileSync(nos[j], 'utf8');
76+
fs.writeFileSync('./src/styles/' + nos[j].split('/')[3], htmlfile, 'utf8');
5477
}
5578
done();
5679
});
80+
81+
gulp.task('SEO-changes', function () {
82+
var newWindowSamples = glob.sync('./OpenNewSamples/**/**/index.html');
83+
var samplsListJson = JSON.parse(fs.readFileSync('./sampleOrder.json'));
84+
var localCss = `<link href="../../styles/OpenNew.css" rel="stylesheet">`;
85+
var localCssRegex = /(.*)styles\/OpenNew.css\" rel\=\"stylesheet(.*)/g;
86+
87+
for (var i = 0; i < newWindowSamples.length; i++) {
88+
89+
var indexFile = fs.readFileSync(newWindowSamples[i], 'utf8');
90+
if (samplsListJson[newWindowSamples[i].split('/')[2]] === undefined) {
91+
console.log(`${i}------${newWindowSamples[i]}`);
92+
}
93+
var ControlName = samplsListJson[newWindowSamples[i].split('/')[2]].ControlName;
94+
var sampleName = samplsListJson[newWindowSamples[i].split('/')[2]].Samples[newWindowSamples[i].split('/')[3]];
95+
96+
indexFile= indexFile.replace(/<meta name="description"(.*)/g,'');
97+
indexFile = indexFile.replace(/<h1 class="sb-bread-crumb-text">(.*)/g,'');
98+
99+
var metaTagTemplate = `<meta name="description" content="This example demonstrates the ${sampleName} in Angular ${ControlName} Component. Explore here for more details." />`;
100+
indexFile = indexFile.replace(/<title>(.*)/g, '<title>' +'Angular ' + ControlName + ' ' + sampleName + ' Example - Syncfusion Demos</title>\n\t' + metaTagTemplate);
101+
102+
var headerDesc = '';
103+
if(newWindowSamples[i].indexOf('sidebar')>=0) {
104+
headerDesc = '';
105+
} else {
106+
headerDesc = `<h1 class="sb-bread-crumb-text">Example of ${sampleName} in Angular ${ControlName} Component</h1>`;
107+
}
108+
109+
indexFile= indexFile.replace(`<app-root></app-root>`,headerDesc + `\n\t<app-root></app-root>`);
110+
111+
if(!(localCssRegex.test(indexFile))) {
112+
indexFile = indexFile.replace(/(.*)styles\/material.css\" rel\=\"stylesheet(.*)/g,'<link href="../../styles/material.css" rel="stylesheet">\n'+ localCss)
113+
}
114+
115+
fs.writeFileSync(newWindowSamples[i], indexFile.replace('Essential JS 2','Essential Studio'), 'utf8');
116+
}
117+
}
118+
);
119+
120+
function camelCase(str) {
121+
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(word, index)
122+
{
123+
return index === 0 ?word.toUpperCase() : word.toUpperCase();
124+
}).replace(/\s+/g, '').replace(/\-/g,' ');
125+
}
126+
127+
128+
gulp.task('create-sampleList', function () {
129+
130+
var newWindowSamples = glob.sync('./src/app/**/**.module.ts', {
131+
silent: true,
132+
ignore: ['./src/app/app.module.ts', './src/app/common/shared.module.ts']
133+
});
134+
135+
var temp = `{{path}}:{{name}}`
136+
for (var i = 0; i < newWindowSamples.length; i++) {
137+
var sampleJson= '';
138+
var indexFile = fs.readFileSync(newWindowSamples[i], 'utf8');
139+
paths = indexFile.match(/path(| )\:[^,]+/g);
140+
names = indexFile.match(/name(| |'|' )\:[^,]+/g);
141+
for(var j=0; j < paths.length; j++){
142+
var template = temp;
143+
template = template.replace(`{{path}}`,`"${paths[j].replace(/path(| )\:[^theme]+theme/g,'').replace('\'','')}"`);
144+
template = template.replace(`{{name}}`,`"${names[j].replace(/name(| |'|' )\:[^']+\'/g,'').replace('\'','')}"`);
145+
sampleJson += template + `,\n`;
146+
}
147+
console.log(i +`----------` +newWindowSamples[i].replace(`.module.ts`,'').replace(`./src/app/`,''));
148+
fs.writeFileSync(newWindowSamples[i].replace(`.module.ts`,'sampleList'), sampleJson, 'utf8');
149+
}
150+
}
151+
);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ej2-angular-samples",
3-
"version": "18.2.44",
3+
"version": "18.3.35",
44
"scripts": {
55
"start": "node --max-old-space-size=4096 ./node_modules/@angular/cli/bin/ng serve",
66
"start:prod": "node --max-old-space-size=4096 ./node_modules/@angular/cli/bin/ng serve --prod",

0 commit comments

Comments
 (0)