-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DIG-185: yo @dizmo/module --typescript --upgrade
- Loading branch information
Showing
10 changed files
with
145 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
loglevel=silent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,69 @@ | ||
let child_process = require('child_process'), | ||
let ps = require('child_process'), | ||
fs = require('fs'); | ||
|
||
let run_script = function () { | ||
child_process.spawn('npx', [ | ||
'tsc' | ||
].concat(process.argv.slice(2)), { | ||
shell: true, stdio: 'inherit' | ||
}).on('close', function (code) { | ||
if (code === 0) { | ||
child_process.spawn('npx', [ | ||
'babel', 'dist', '-d', 'dist', '--presets=env', '-s' | ||
].concat(process.argv.slice(2)), { | ||
shell: true, stdio: 'inherit' | ||
}); | ||
} | ||
}); | ||
}; | ||
function argv(key, value) { | ||
let argv = require('yargs') | ||
.default('lint', true) | ||
.argv; | ||
if (argv[key] !== undefined) { | ||
return argv[key]; | ||
} else { | ||
return value; | ||
} | ||
} | ||
|
||
fs.access('./node_modules', function (error) { | ||
if (error) { | ||
let Spinner = require('./cli-spinner').Spinner, | ||
spinner = new Spinner('%s fetching dependencies: .. '); | ||
let npm_install = child_process.spawn('npm', [ | ||
'install' | ||
], { | ||
shell: true, stdio: 'ignore' | ||
function npm_install(flag) { | ||
if (flag) { | ||
ps.spawn('npm', ['install'], { | ||
shell: true, stdio: 'inherit' | ||
}).on('exit', function (code) { | ||
npm_lint(code); | ||
}); | ||
npm_install.on('close', function () { | ||
spinner.stop(true); | ||
run_script(); | ||
} else { | ||
npm_lint(0); | ||
} | ||
} | ||
|
||
function npm_lint(code) { | ||
if (code === 0 && argv('lint') === true) { | ||
ps.spawn('npm', [ | ||
'run-script', '--', 'lint' | ||
].concat(process.argv.slice(2)), { | ||
shell: true, stdio: 'inherit' | ||
}).on('exit', function (code) { | ||
npx_tsc(code); | ||
}); | ||
spinner.start(); | ||
} else { | ||
run_script(); | ||
npx_tsc(code); | ||
} | ||
}); | ||
} | ||
|
||
function npx_tsc(code) { | ||
if (code === 0) { | ||
ps.spawn('npx', [ | ||
'tsc' | ||
].concat(process.argv.slice(2)), { | ||
shell: true, stdio: 'inherit' | ||
}).on('exit', function (code) { | ||
npx_babel(code); | ||
}); | ||
} else { | ||
npx_babel(code); | ||
} | ||
}; | ||
|
||
function npx_babel(code) { | ||
if (code === 0) { | ||
ps.spawn('npx', [ | ||
'babel', 'dist', '-d', 'dist', '--presets=env', '-s' | ||
].concat(process.argv.slice(2)), { | ||
shell: true, stdio: 'inherit' | ||
}).on('exit', function (code) { | ||
process.exit(code); | ||
}); | ||
} else { | ||
process.exit(code); | ||
} | ||
}; | ||
|
||
fs.access('./node_modules', npm_install); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,30 @@ | ||
let child_process = require('child_process'), | ||
let ps = require('child_process'), | ||
fs = require('fs'); | ||
|
||
let run_script = function () { | ||
child_process.spawn('npx', [ | ||
'istanbul', 'cover', '_mocha', 'test/*.js' | ||
].concat(process.argv.slice(2)), { | ||
shell: true, stdio: 'inherit' | ||
}); | ||
}; | ||
|
||
fs.access('./node_modules', function (error) { | ||
if (error) { | ||
let Spinner = require('./cli-spinner').Spinner, | ||
spinner = new Spinner('%s fetching dependencies: .. '); | ||
let npm_install = child_process.spawn('npm', [ | ||
'install' | ||
], { | ||
shell: true, stdio: 'ignore' | ||
function npm_install(flag) { | ||
if (flag) { | ||
ps.spawn('npm', ['install'], { | ||
shell: true, stdio: 'inherit' | ||
}).on('exit', function (code) { | ||
npx_istanbul(code); | ||
}); | ||
npm_install.on('close', function () { | ||
spinner.stop(true); | ||
run_script(); | ||
} else { | ||
npx_istanbul(0); | ||
} | ||
} | ||
|
||
function npx_istanbul(code) { | ||
if (code === 0) { | ||
ps.spawn('npx', [ | ||
'istanbul', 'cover', '_mocha', 'test/*.js' | ||
].concat(process.argv.slice(2)), { | ||
shell: true, stdio: 'inherit' | ||
}).on('exit', function (code) { | ||
process.exit(code); | ||
}); | ||
spinner.start(); | ||
} else { | ||
run_script(); | ||
process.exit(code); | ||
} | ||
}); | ||
} | ||
|
||
fs.access('./node_modules', npm_install); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,30 @@ | ||
let child_process = require('child_process'), | ||
let ps = require('child_process'), | ||
fs = require('fs'); | ||
|
||
let run_script = function () { | ||
child_process.spawn('npx', [ | ||
'tslint', '--config', 'tslint.json', "'lib/**/*.ts'" | ||
].concat(process.argv.slice(2)), { | ||
shell: true, stdio: 'inherit' | ||
}); | ||
}; | ||
|
||
fs.access('./node_modules', function (error) { | ||
if (error) { | ||
let Spinner = require('./cli-spinner').Spinner, | ||
spinner = new Spinner('%s fetching dependencies: .. '); | ||
let npm_install = child_process.spawn('npm', [ | ||
'install' | ||
], { | ||
shell: true, stdio: 'ignore' | ||
function npm_install(flag) { | ||
if (flag) { | ||
ps.spawn('npm', ['install'], { | ||
shell: true, stdio: 'inherit' | ||
}).on('exit', function (code) { | ||
npx_tslint(code); | ||
}); | ||
npm_install.on('close', function () { | ||
spinner.stop(true); | ||
run_script(); | ||
} else { | ||
npx_tslint(0); | ||
} | ||
} | ||
|
||
function npx_tslint(code) { | ||
if (code === 0) { | ||
ps.spawn('npx', [ | ||
'tslint', '--config', 'tslint.json', "'lib/**/*.ts'" | ||
].concat(process.argv.slice(2)), { | ||
shell: true, stdio: 'inherit' | ||
}).on('exit', function (code) { | ||
process.exit(code); | ||
}); | ||
spinner.start(); | ||
} else { | ||
run_script(); | ||
process.exit(code); | ||
} | ||
}); | ||
} | ||
|
||
fs.access('./node_modules', npm_install); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,30 @@ | ||
let child_process = require('child_process'), | ||
let ps = require('child_process'), | ||
fs = require('fs'); | ||
|
||
let run_script = function () { | ||
child_process.spawn('npx', [ | ||
'mocha' | ||
].concat(process.argv.slice(2)), { | ||
shell: true, stdio: 'inherit' | ||
}); | ||
}; | ||
|
||
fs.access('./node_modules', function (error) { | ||
if (error) { | ||
let Spinner = require('./cli-spinner').Spinner, | ||
spinner = new Spinner('%s fetching dependencies: .. '); | ||
let npm_install = child_process.spawn('npm', [ | ||
'install' | ||
], { | ||
shell: true, stdio: 'ignore' | ||
function npm_install(flag) { | ||
if (flag) { | ||
ps.spawn('npm', ['install'], { | ||
shell: true, stdio: 'inherit' | ||
}).on('exit', function (code) { | ||
npx_mocha(code); | ||
}); | ||
npm_install.on('close', function () { | ||
spinner.stop(true); | ||
run_script(); | ||
} else { | ||
npx_mocha(0); | ||
} | ||
} | ||
|
||
function npx_mocha(code) { | ||
if (code === 0) { | ||
ps.spawn('npx', [ | ||
'mocha' | ||
].concat(process.argv.slice(2)), { | ||
shell: true, stdio: 'inherit' | ||
}).on('exit', function (code) { | ||
process.exit(code); | ||
}); | ||
spinner.start(); | ||
} else { | ||
run_script(); | ||
process.exit(code); | ||
} | ||
}); | ||
} | ||
|
||
fs.access('./node_modules', npm_install); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters