From 6deebee63c6bf608876f943d451fbfa31ba21b7c Mon Sep 17 00:00:00 2001 From: Guilherme Correia Date: Fri, 9 Jun 2023 00:44:55 -0300 Subject: [PATCH] :fire: Babel: Remove `ajv` npm dep fix Remove `ajv` npm dep fix for [this](https://github.com/ajv-validator/ajv-keywords/issues/385) applied today because of TurboCLI used by StackBlitz. Reason: exactly today they deprecated it and opted in using native npm :clown_face: --- nullstack-adapt-babel/index.js | 3 --- nullstack-adapt-babel/package.json | 2 +- nullstack-adapt-babel/utils/fix-deps.js | 30 ------------------------- 3 files changed, 1 insertion(+), 34 deletions(-) delete mode 100644 nullstack-adapt-babel/utils/fix-deps.js diff --git a/nullstack-adapt-babel/index.js b/nullstack-adapt-babel/index.js index 76998e9..f3d48ba 100644 --- a/nullstack-adapt-babel/index.js +++ b/nullstack-adapt-babel/index.js @@ -2,7 +2,6 @@ const path = require('path') const { readdirSync } = require('fs') const getOptions = require('./utils/getOptions') -const fixDeps = require('./utils/fix-deps') function runtime(options) { return { @@ -234,8 +233,6 @@ function newConfig(options) { ] } -fixDeps() - /** * * @param {Array<(...[]) => {module: {rules: Array<{}>}}>} configs diff --git a/nullstack-adapt-babel/package.json b/nullstack-adapt-babel/package.json index 2598156..9a41148 100644 --- a/nullstack-adapt-babel/package.json +++ b/nullstack-adapt-babel/package.json @@ -1,6 +1,6 @@ { "name": "nullstack-adapt-babel", - "version": "0.0.6", + "version": "0.0.7", "description": "Adapt Nullstack to Babel", "author": "GuiDevloper", "license": "MIT", diff --git a/nullstack-adapt-babel/utils/fix-deps.js b/nullstack-adapt-babel/utils/fix-deps.js deleted file mode 100644 index d1c0d00..0000000 --- a/nullstack-adapt-babel/utils/fix-deps.js +++ /dev/null @@ -1,30 +0,0 @@ -const fs = require('fs') -const path = require('path') -const atCWD = fullPath => path.join(process.cwd(), fullPath) - -/** - * Try to fix dependencies issues at virtual NPM environments (e.g: ajv) - * @see https://github.com/ajv-validator/ajv-keywords/issues/385 - **/ -function fixDeps() { - try { - const isVirtualNPM = - process.env.PKG_MANAGER === 'npm' && !process.env.npm_config_registry - if (isVirtualNPM && !process.env.DISABLE_AJV_FIX) { - const ajvJSON = require(atCWD('node_modules/ajv/package.json')) - if (ajvJSON.version !== '7.2.4') { - console.log('Fixing npm deps...') - const cprocess = require('child_process') - const npmCLI = process.platform === 'win32' ? 'npm.cmd' : 'npm' - cprocess.spawnSync(npmCLI, 'install ajv@7.2.4'.split(' ')) - const pkgJSON = fs.readFileSync(atCWD('package.json'), 'utf8') - fs.writeFileSync( - atCWD('package.json'), - pkgJSON.replace(/[ ]+"ajv": "(\^|)7.2.4"(,|)\n/, '') - ) - } - } - } catch {} -} - -module.exports = fixDeps