mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix node/no-path-concat issues (#9669)
Refs #9663 See [`node/no-path-concat`][1] for more information. This change enables `node/no-path-concat` and fixes the issues raised by the rule. [1]:https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-path-concat.md
This commit is contained in:
parent
e5688c024e
commit
b704eaeb66
@ -95,7 +95,6 @@ module.exports = {
|
|||||||
'node/no-unpublished-import': 'off',
|
'node/no-unpublished-import': 'off',
|
||||||
'node/no-unpublished-require': 'off',
|
'node/no-unpublished-require': 'off',
|
||||||
'node/no-unsupported-features/node-builtins': 'off',
|
'node/no-unsupported-features/node-builtins': 'off',
|
||||||
'node/no-path-concat': 'off',
|
|
||||||
'dot-notation': 'off',
|
'dot-notation': 'off',
|
||||||
'mocha/max-top-level-suites': 'off',
|
'mocha/max-top-level-suites': 'off',
|
||||||
},
|
},
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const { promises: fs } = require('fs')
|
const { promises: fs } = require('fs')
|
||||||
|
const path = require('path')
|
||||||
const { merge, cloneDeep } = require('lodash')
|
const { merge, cloneDeep } = require('lodash')
|
||||||
|
|
||||||
const baseManifest = require('../../app/manifest/_base.json')
|
const baseManifest = require('../../app/manifest/_base.json')
|
||||||
@ -16,11 +17,11 @@ function createManifestTasks ({ browserPlatforms }) {
|
|||||||
// merge base manifest with per-platform manifests
|
// merge base manifest with per-platform manifests
|
||||||
const prepPlatforms = async () => {
|
const prepPlatforms = async () => {
|
||||||
return Promise.all(browserPlatforms.map(async (platform) => {
|
return Promise.all(browserPlatforms.map(async (platform) => {
|
||||||
const platformModifications = await readJson(`${__dirname}/../../app/manifest/${platform}.json`)
|
const platformModifications = await readJson(path.join(__dirname, '..', '..', 'app', 'manifest', `${platform}.json`))
|
||||||
const result = merge(cloneDeep(baseManifest), platformModifications)
|
const result = merge(cloneDeep(baseManifest), platformModifications)
|
||||||
const dir = `./dist/${platform}`
|
const dir = path.join('.', 'dist', platform)
|
||||||
await fs.mkdir(dir, { recursive: true })
|
await fs.mkdir(dir, { recursive: true })
|
||||||
await writeJson(result, `${dir}/manifest.json`)
|
await writeJson(result, path.join(dir, 'manifest.json'))
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,10 +76,10 @@ function createManifestTasks ({ browserPlatforms }) {
|
|||||||
function createTaskForModifyManifestForEnvironment (transformFn) {
|
function createTaskForModifyManifestForEnvironment (transformFn) {
|
||||||
return () => {
|
return () => {
|
||||||
return Promise.all(browserPlatforms.map(async (platform) => {
|
return Promise.all(browserPlatforms.map(async (platform) => {
|
||||||
const path = `./dist/${platform}/manifest.json`
|
const manifestPath = path.join('.', 'dist', platform, 'manifest.json')
|
||||||
const manifest = await readJson(path)
|
const manifest = await readJson(manifestPath)
|
||||||
transformFn(manifest)
|
transformFn(manifest)
|
||||||
await writeJson(manifest, path)
|
await writeJson(manifest, manifestPath)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,11 +87,11 @@ function createManifestTasks ({ browserPlatforms }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// helper for reading and deserializing json from fs
|
// helper for reading and deserializing json from fs
|
||||||
async function readJson (path) {
|
async function readJson (file) {
|
||||||
return JSON.parse(await fs.readFile(path, 'utf8'))
|
return JSON.parse(await fs.readFile(file, 'utf8'))
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper for serializing and writing json to fs
|
// helper for serializing and writing json to fs
|
||||||
async function writeJson (obj, path) {
|
async function writeJson (obj, file) {
|
||||||
return fs.writeFile(path, JSON.stringify(obj, null, 2))
|
return fs.writeFile(file, JSON.stringify(obj, null, 2))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user