gulp mysql_Gulp:生成typescript项目会产生权限问题

但是,它似乎用奇怪的权限创建它。当我做

ls -l

,我对使用删除的目录具有以下权限

rimraf

,然后用typescript创建。

$ ls -l

drwxrwxrwx 1 rnaddy rnaddy 512 Apr 1 10:48 src

d????????? ? ? ? ? ? types

为什么会有问号?我觉得这破坏了我的构建,因为当我构建时,我会遇到错误,我认为这可能是问题所在。

$ gulp build:watch

[11:07:18] Using gulpfile ~\Documents\vscode\projects\red5\framework\gulpfile.js

[11:07:18] Starting 'build:watch'...

[11:07:18] Starting 'router'...

rimraf: EPERM: operation not permitted, unlink 'C:\Users\rnaddy\Documents\vscode\projects\red5\framework\router\types'

[11:07:20] 'router' errored after 1.99 s

[11:07:20] Error: EPERM: operation not permitted, mkdir 'C:\Users\rnaddy\Documents\vscode\projects\red5\framework\router\types'

[11:07:20] 'build:watch' errored after 2 s

const path = require('path')

const gulp = require('gulp')

const ts = require('gulp-typescript')

const sourcemaps = require('gulp-sourcemaps')

const rimraf = require('rimraf')

const projects = {

router: './router',

server: './server',

storage: './storage',

session: './session',

template: './template',

middleware: './middleware',

// Optional dependencies

mysql: './mysql'

}

const tasks = [

'router', 'middleware', 'template', 'storage', 'session', 'server',

// Optional dependencies

'mysql'

]

/**

* Builds the project

* @param {string} projectRoot

* @returns {Promise}

*/

async function makeProject(projectRoot) {

let err = await new Promise(resolve => rimraf(path.join(projectRoot, 'types'), (err) => resolve(err)))

if (err) {

console.error('rimraf:', err.message)

// return resolve(false)

}

let tsResult = await new Promise(async resolve => {

let tsProject = ts.createProject(path.join(projectRoot, 'tsconfig.json'))

let tsResult = tsProject.src()

.pipe(sourcemaps.init())

.pipe(tsProject())

.on('finish', () => resolve(tsResult))

})

return await new Promise(resolve => {

tsResult.js

.pipe(sourcemaps.write())

.pipe(gulp.dest(path.join(projectRoot, 'lib')).on('end', () => {

tsResult.dts.pipe(gulp.dest(path.join(projectRoot, 'types'))).on('finish', () => resolve())

// gulp.src(path.join(projectRoot,'src/**/*.ts')).pipe(sourcemaps.init())

}))

})

}

gulp.task('router', () => makeProject(path.join(__dirname, projects.router)))

gulp.task('server', () => makeProject(path.join(__dirname, projects.server)))

gulp.task('storage', () => makeProject(path.join(__dirname, projects.storage)))

gulp.task('session', () => makeProject(path.join(__dirname, projects.session)))

gulp.task('template', () => makeProject(path.join(__dirname, projects.template)))

gulp.task('middleware', () => makeProject(path.join(__dirname, projects.middleware)))

// Optional dependencies

gulp.task('mysql', () => makeProject(path.join(__dirname, projects.mysql)))

gulp.task('build:watch', gulp.series([...tasks, () => {

gulp.watch('./router/src/**/*.ts', gulp.series('router'))

gulp.watch('./server/src/**/*.ts', gulp.series('server'))

gulp.watch('./storage/src/**/*.ts', gulp.series('storage'))

gulp.watch('./session/src/**/*.ts', gulp.series('session'))

gulp.watch('./template/src/**/*.ts', gulp.series('template'))

gulp.watch('./middleware/src/**/*.ts', gulp.series('middleware'))

// Optional dependencies

gulp.watch('./mysql/src/**', gulp.series('mysql'))

}]))

gulp.task('build', gulp.series(...tasks))

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值