@yarnpkg/pnpify
Advanced tools
Comparing version 2.0.0-rc.3 to 2.0.0-rc.4
@@ -53,7 +53,29 @@ "use strict"; | ||
}; | ||
const isPackageInstalled = (name) => { | ||
try { | ||
dynamicRequire_1.dynamicRequire.resolve(name); | ||
return true; | ||
} | ||
catch (e) { | ||
if (e.code && e.code === 'MODULE_NOT_FOUND') { | ||
return false; | ||
} | ||
else { | ||
throw e; | ||
} | ||
} | ||
}; | ||
exports.generateSdk = async (projectRoot) => { | ||
const hasTypescript = isPackageInstalled('typescript'); | ||
const hasEslint = isPackageInstalled('eslint'); | ||
const targetFolder = fslib_1.ppath.join(projectRoot, `.vscode/pnpify`); | ||
await fslib_1.xfs.removePromise(targetFolder); | ||
await generateTypescriptWrapper(projectRoot, targetFolder); | ||
await exports.generateEslintWrapper(projectRoot, targetFolder); | ||
if (!hasTypescript && !hasEslint) | ||
console.warn(`Neither 'typescript' nor 'eslint' are installed. Nothing to do.`); | ||
else | ||
await fslib_1.xfs.removePromise(targetFolder); | ||
if (hasTypescript) | ||
await generateTypescriptWrapper(projectRoot, targetFolder); | ||
if (hasEslint) { | ||
await exports.generateEslintWrapper(projectRoot, targetFolder); | ||
} | ||
}; |
@@ -145,6 +145,6 @@ "use strict"; | ||
createReadStream(p, opts) { | ||
return this.baseFs.createReadStream(this.resolveFilePath(p), opts); | ||
return this.baseFs.createReadStream(p !== null ? this.resolveFilePath(p) : p, opts); | ||
} | ||
createWriteStream(p, opts) { | ||
return this.baseFs.createWriteStream(this.throwIfPathReadonly('createWriteStream', p), opts); | ||
return this.baseFs.createWriteStream(p !== null ? this.throwIfPathReadonly('createWriteStream', p) : p, opts); | ||
} | ||
@@ -151,0 +151,0 @@ async realpathPromise(p) { |
{ | ||
"name": "@yarnpkg/pnpify", | ||
"version": "2.0.0-rc.3", | ||
"version": "2.0.0-rc.4", | ||
"main": "./lib/index.js", | ||
@@ -31,3 +31,3 @@ "bin": "./lib/cli.js", | ||
"postpack": "rm -rf lib", | ||
"prepack": "pnpify tsc", | ||
"prepack": "run build:compile packages/yarnpkg-pnpify", | ||
"release": "yarn npm publish" | ||
@@ -34,0 +34,0 @@ }, |
34017
782