Skip to content

Commit

Permalink
add Custom.js (Grunt) example
Browse files Browse the repository at this point in the history
  • Loading branch information
olton committed Oct 25, 2023
1 parent e96f2b8 commit dff6d85
Show file tree
Hide file tree
Showing 18 changed files with 9,990 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .ftpauth
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"keycdn": {
"username": "metro4",
"password": "Gd^gfbJr867RF"
},

"keycdn_m4q": {
"username": "m4query",
"password": "Gd^gfbJr867RF"
},

"metroui": {
"username": "metrouiS",
"password": "Gd6gfbJr867RF"
},

"korzh": {
"username": "olton",
"password": "01t0nMetroU1"
}
}
56 changes: 56 additions & 0 deletions Build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
module.exports = function(grunt) {

"use strict";

require('load-grunt-tasks')(grunt);

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

buildnumber: {
options: {
field: 'build'
},
files: ['package.json']
},

replace: {
build: {
options: {
patterns: [
{
match: 'build',
replacement: "<%= pkg.build %>"
},
{
match: 'version',
replacement: "<%= pkg.version %>"
},
{
match: 'status',
replacement: "<%= pkg.version_suffix %>"
}
]
},
files: [
{
expand: true,
flatten: true,
src: ['build/js/*.js'], dest: 'build/js/'
},
{
expand: true,
flatten: true,
src: ['build/css/*.css'], dest: 'build/css/'
}
]
}
}

});

grunt.registerTask('default', [
'buildnumber', 'replace'
]);

};
38 changes: 38 additions & 0 deletions Build_dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module.exports = function(grunt) {

"use strict";

var tasks, time = new Date(), day = time.getDate(), month = time.getMonth()+1, year = time.getFullYear(), hour = time.getHours(), mins = time.getMinutes(), sec = time.getSeconds();
var timestamp = (day < 10 ? "0"+day:day) + "/" + (month < 10 ? "0"+month:month) + "/" + (year) + " " + (hour<10?"0"+hour:hour) + ":" + (mins<10?"0"+mins:mins);

require('load-grunt-tasks')(grunt);

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

"string-replace": {
build: {
files: {
'build/': 'build/js/*.js'
},
options: {
replacements: [
{
pattern: "@@version.@@build @@status",
replacement: "<%= pkg.version %>-dev " + timestamp
},
{
pattern: "@@version",
replacement: "<%= pkg.version %>-dev " + timestamp
}
]
}
}
}
});

grunt.registerTask('default', [
'string-replace'
]);

};
50 changes: 50 additions & 0 deletions CDN.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
module.exports = function(grunt) {

"use strict";

require('load-grunt-tasks')(grunt);

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

ftp_push: {
korzh: {
options: {
authKey: "korzh",
host: "crocodile.in.ua",
dest: "v4/",
port: 21,
incrementalUpdates: false
},
files: [
{
expand: true,
cwd: "build",
src: ['**/*']
}
]
},
korzh_v: {
options: {
authKey: "korzh",
host: "crocodile.in.ua",
dest: "v<%= pkg.version %>/",
port: 21,
incrementalUpdates: false
},
files: [
{
expand: true,
cwd: "build",
src: ['**/*']
}
]
}
}
});

grunt.registerTask('default', [
'ftp_push'
]);

};
34 changes: 34 additions & 0 deletions CDN_dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module.exports = function(grunt) {

"use strict";

require('load-grunt-tasks')(grunt);

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

ftp_push: {
keycdn: {
options: {
authKey: "keycdn",
host: "ftp.keycdn.com",
dest: "v4-dev/",
port: 21,
incrementalUpdates: false
},
files: [
{
expand: true,
cwd: "build",
src: ['**/*']
}
]
}
}
});

grunt.registerTask('default', [
'ftp_push'
]);

};
Loading

0 comments on commit dff6d85

Please sign in to comment.