Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

Commit

Permalink
Added install step to clear out own .git and initialize new repo
Browse files Browse the repository at this point in the history
  • Loading branch information
cloakedninjas committed Jan 24, 2016
1 parent b57c58e commit fa649b3
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.idea
.tscache
.DS_Store
src/scripts/.baseDir.ts
node_modules
bower_components
Expand Down
46 changes: 40 additions & 6 deletions bin/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ function promptForNamespace() {

function updateNamespace(namespace) {
var fileList = [
'src/scripts/entity/preload-bar.ts',
'src/scripts/state/game.ts',
'src/scripts/state/preloader.ts',
'src/scripts/game.ts'
],
'src/scripts/entity/preload-bar.ts',
'src/scripts/state/game.ts',
'src/scripts/state/preloader.ts',
'src/scripts/game.ts'
],
rewriteCount = 0;

fileList.forEach(function (path) {
Expand All @@ -55,8 +55,42 @@ function updateNamespace(namespace) {

if (rewriteCount === fileList.length) {
console.log('Updated namespace in .ts files');
console.log('Install complete!');
promptForCleanup();
}
});
});
}

function promptForCleanup() {
var prompt = require('prompt');

prompt.start();

prompt.message = '';
prompt.delimiter = '';

prompt.get([{
name: 'cleanup',
description: 'Initialize Git? (Y / N)'.green,
type: 'string',
default: 'Y',
required: true
}], function (err, result) {
if (!err && (result.cleanup === 'Y' || result.cleanup === 'y')) {
cleanup();
}
});
}

function cleanup() {
var rmrf = require('rimraf');

rmrf('.git', function (error) {
if (!error) {
exec('git init', function () {
console.log('Git initialized.');
console.log('Tip: You might want to adjust bower.json + package.json');
});
}
});
}
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phaser-typescript-boilerplate",
"version": "1.1.0",
"version": "1.2.0",
"homepage": "https://github.com/cloakedninjas/phaser-typescript-boilerplate",
"authors": [
"cloakedninjas <[email protected]>"
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phaser-typescript-boilerplate",
"version": "1.1.0",
"version": "1.2.0",
"description": "Boilerplate for Phaser using Typescript",
"main": "index.js",
"scripts": {
Expand All @@ -24,6 +24,7 @@
"grunt-ts": "^5.2.0"
},
"devDependencies": {
"prompt": "^0.2.14"
"prompt": "^0.2.14",
"rimraf": "^2.5.1"
}
}

0 comments on commit fa649b3

Please sign in to comment.