Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/rename #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion inc/theme-version.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
* with a REGEX expression from root/index.js file.
*/
if ( ! defined( 'DX_ASSETS_VERSION' ) ) {
define( 'DX_ASSETS_VERSION', '00000000-0' );
define( 'DX_ASSETS_VERSION', '20190525-11' );
}
99 changes: 99 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"gulp-babel": "^8.0.0",
"gulp-clean-css": "^4.2.0",
"gulp-concat": "^2.6.1",
"gulp-filter": "^5.1.0",
"gulp-imagemin": "^5.0.3",
"gulp-livereload": "^4.0.1",
"gulp-newer": "^1.4.0",
Expand All @@ -29,16 +30,17 @@
"gulp-uglify": "^3.0.2",
"moment": "^2.24.0",
"replace-in-file": "^4.1.0",
"replace-in-files": "^1.1.4",
"sass-lint": "^1.13.1",
"gulp-filter": "^5.1.0"
"v": "^0.3.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"gulp": "./node_modules/.bin/gulp",
"ziptheme": "bash zip.sh",
"ver": "node assets-version.js",
"hello": "echo \"Hello\" ",
"projectConf": "sudo npm i -g gulp-cli gulp && echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p"
"ziptheme": "bash tools/zip.sh",
"ver": "node tools/assets-version.js",
"projectConf": "sudo npm i -g gulp-cli gulp && echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p",
"rename": "node tools/initial-setup.js"
},
"author": "DevriX",
"license": "ISC",
Expand Down
5 changes: 4 additions & 1 deletion assets-version.js → tools/assets-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,8 @@ fs.readFile(someFile, 'utf8', function (err,data) {
if (err) return console.log(err);
});

console.log("Assets version has been updated!");
console.log("--------------------------------------------------------------")
console.log("Assets version has been updated: \x1b[33m%s\x1b[0m", time + '-' + currentVersion);
console.log("To update them again, make sure to run \x1b[33mgulp\x1b[0m again.");
console.log("--------------------------------------------------------------\n")
});
49 changes: 49 additions & 0 deletions tools/initial-setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env node
const replaceInFiles = require('replace-in-files');
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
})

let options = {
files: './**',
from: /dxstarter/g,
to: 'dxstarter',
optionsForFiles: {
"ignore": [
"./node_modules/**",
"./tools/**"
]
}
};

readline.question(`How would you want to be your text domain called (dxstarter)? `, function (textDomain) {
rename('dxstarter', textDomain, renameProject)

})

function renameProject() {
readline.question(`How would you want to be your project called (DevriX Starter)? `, function (project) {
rename('DevriX Starter', project, renamePackage)

})
}

function renamePackage() {
readline.question(`How would you want to be your package called (DevriX_Starter)? `, function (packageName) {
rename('DevriX_Starter', packageName)
readline.close()
})
}

function rename(toRenameFrom, toRenameTo, callback) {
options.from = new RegExp(toRenameFrom, "g")
options.to = toRenameTo
replaceInFiles(options).then(() => {
if (callback) {
callback()
}
}).catch(error => {
console.error('Error occurred:', error);
});
}
File renamed without changes.