Skip to content

Commit a480641

Browse files
author
李燚
committed
fix: PT-4696 add catch(e)
1 parent 542a8b4 commit a480641

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

lib/commands/init.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@ exports.run = function (options) {
177177
function createTmpl(callback) {
178178
fs.copySync(sysPath.resolve(initTmplPath, './index.html'), sysPath.resolve(cwd, './index.html'));
179179
fs.copySync(sysPath.resolve(initTmplPath, './src'), sysPath.resolve(cwd, './src'));
180+
181+
// fix: PT-4696
182+
try {
183+
shell.mkdir('-p', '' + sysPath.resolve(process.cwd(), YKIT_CACHE_DIR));
184+
} catch (e) {
185+
warn('Create folder failed ! you need run \'mkdir -p ' + sysPath.resolve(process.cwd(), YKIT_CACHE_DIR) + '\'');
186+
}
187+
180188
callback(null);
181189
}
182190
};

lib/commands/pack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ exports.setOptions = function (optimist) {
4343

4444
exports.run = function (options) {
4545
var start = function () {
46-
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
46+
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee() {
4747
return _regenerator2.default.wrap(function _callee$(_context) {
4848
while (1) {
4949
switch (_context.prev = _context.next) {

src/commands/init.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,14 @@ exports.run = function(options) {
178178
function createTmpl(callback) {
179179
fs.copySync(sysPath.resolve(initTmplPath, './index.html'), sysPath.resolve(cwd, './index.html'));
180180
fs.copySync(sysPath.resolve(initTmplPath, './src'), sysPath.resolve(cwd, './src'));
181+
182+
// fix: PT-4696
183+
try {
184+
shell.mkdir('-p', `${sysPath.resolve(process.cwd(), YKIT_CACHE_DIR)}`);
185+
} catch (e) {
186+
warn(`Create folder failed ! you need run 'mkdir -p ${sysPath.resolve(process.cwd(), YKIT_CACHE_DIR)}'`);
187+
}
188+
181189
callback(null);
182190
}
183191
};

0 commit comments

Comments
 (0)