Upgrade to node 16 (#390)

This commit is contained in:
Zenoo
2021-06-17 18:06:58 +02:00
committed by GitHub
parent 408389fcc9
commit 2afece0f84
6 changed files with 2644 additions and 5117 deletions

View File

@@ -1,5 +1,5 @@
# Base image # Base image
FROM node:15-buster-slim FROM node:16-buster-slim
# Copy repository # Copy repository
COPY . /metrics COPY . /metrics

7735
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -75,7 +75,7 @@ export default async function({log = true, nosettings = false, community = {}} =
if ((Array.isArray(conf.settings.community.templates)) && (conf.settings.community.templates.length)) { if ((Array.isArray(conf.settings.community.templates)) && (conf.settings.community.templates.length)) {
//Clean remote repository //Clean remote repository
logger(`metrics/setup > ${conf.settings.community.templates.length} community templates to install`) logger(`metrics/setup > ${conf.settings.community.templates.length} community templates to install`)
await fs.promises.rmdir(path.join(__templates, ".community"), {recursive:true}) await fs.promises.rm(path.join(__templates, ".community"), {recursive:true, force:true})
//Download community templates //Download community templates
for (const template of conf.settings.community.templates) { for (const template of conf.settings.community.templates) {
try { try {
@@ -88,7 +88,7 @@ export default async function({log = true, nosettings = false, community = {}} =
processes.execSync(command, {stdio:"ignore"}) processes.execSync(command, {stdio:"ignore"})
//Extract template //Extract template
logger(`metrics/setup > extract ${name} from ${repo}@${branch}`) logger(`metrics/setup > extract ${name} from ${repo}@${branch}`)
await fs.promises.rmdir(path.join(__templates, `@${name}`), {recursive:true}) await fs.promises.rm(path.join(__templates, `@${name}`), {recursive:true, force:true})
await fs.promises.rename(path.join(__templates, ".community/source/templates", name), path.join(__templates, `@${name}`)) await fs.promises.rename(path.join(__templates, ".community/source/templates", name), path.join(__templates, `@${name}`))
//JavaScript file //JavaScript file
if (trust) if (trust)
@@ -114,7 +114,7 @@ export default async function({log = true, nosettings = false, community = {}} =
//Clean remote repository //Clean remote repository
logger(`metrics/setup > clean ${repo}@${branch}`) logger(`metrics/setup > clean ${repo}@${branch}`)
await fs.promises.rmdir(path.join(__templates, ".community"), {recursive:true}) await fs.promises.rm(path.join(__templates, ".community"), {recursive:true, force:true})
logger(`metrics/setup > loaded community template ${name}`) logger(`metrics/setup > loaded community template ${name}`)
} }
catch (error) { catch (error) {

View File

@@ -24,7 +24,7 @@ export async function indepth({login, data, imports, repositories}, {skipped}) {
//Process //Process
try { try {
//Git clone into temporary directory //Git clone into temporary directory
await imports.fs.rmdir(path, {recursive:true}) await imports.fs.rm(path, {recursive:true, force:true})
await imports.fs.mkdir(path, {recursive:true}) await imports.fs.mkdir(path, {recursive:true})
const git = await imports.git(path) const git = await imports.git(path)
await git.clone(`https://github.com/${repo}`, ".").status() await git.clone(`https://github.com/${repo}`, ".").status()
@@ -38,7 +38,7 @@ export async function indepth({login, data, imports, repositories}, {skipped}) {
finally { finally {
//Cleaning //Cleaning
console.debug(`metrics/compute/${login}/plugins > languages > indepth > cleaning temp dir ${path}`) console.debug(`metrics/compute/${login}/plugins > languages > indepth > cleaning temp dir ${path}`)
await imports.fs.rmdir(path, {recursive:true}) await imports.fs.rm(path, {recursive:true, force:true})
} }
} }
return results return results
@@ -94,7 +94,7 @@ export async function recent({login, data, imports, rest, account}, {skipped = [
//Process //Process
try { try {
//Save patches in temporary directory matching respective repository and filename //Save patches in temporary directory matching respective repository and filename
await imports.fs.rmdir(path, {recursive:true}) await imports.fs.rm(path, {recursive:true, force:true})
await imports.fs.mkdir(path, {recursive:true}) await imports.fs.mkdir(path, {recursive:true})
await Promise.all(patches.map(async ({name, directory, patch}) => { await Promise.all(patches.map(async ({name, directory, patch}) => {
await imports.fs.mkdir(imports.paths.join(path, directory), {recursive:true}) await imports.fs.mkdir(imports.paths.join(path, directory), {recursive:true})
@@ -134,7 +134,7 @@ export async function recent({login, data, imports, rest, account}, {skipped = [
finally { finally {
//Cleaning //Cleaning
console.debug(`metrics/compute/${login}/plugins > languages > cleaning temp dir ${path}`) console.debug(`metrics/compute/${login}/plugins > languages > cleaning temp dir ${path}`)
await imports.fs.rmdir(path, {recursive:true}) await imports.fs.rm(path, {recursive:true, force:true})
} }
return results return results
} }

View File

@@ -29,7 +29,7 @@ export default async function({login, q, imports, data, graphql, queries, accoun
const path = imports.paths.join(imports.os.tmpdir(), `${repository.databaseId}`) const path = imports.paths.join(imports.os.tmpdir(), `${repository.databaseId}`)
//Create temporary directory //Create temporary directory
console.debug(`metrics/compute/${login}/plugins > licenses > creating temp dir ${path}`) console.debug(`metrics/compute/${login}/plugins > licenses > creating temp dir ${path}`)
await imports.fs.rmdir(path, {recursive:true}) await imports.fs.rm(path, {recursive:true, force:true})
await imports.fs.mkdir(path, {recursive:true}) await imports.fs.mkdir(path, {recursive:true})
//Clone repository //Clone repository
console.debug(`metrics/compute/${login}/plugins > licenses > cloning temp git repository ${repository.url} to ${path}`) console.debug(`metrics/compute/${login}/plugins > licenses > cloning temp git repository ${repository.url} to ${path}`)
@@ -67,7 +67,7 @@ export default async function({login, q, imports, data, graphql, queries, accoun
) )
//Cleaning //Cleaning
console.debug(`metrics/compute/${login}/plugins > licensed > cleaning temp dir ${path}`) console.debug(`metrics/compute/${login}/plugins > licensed > cleaning temp dir ${path}`)
await imports.fs.rmdir(path, {recursive:true}) await imports.fs.rm(path, {recursive:true, force:true})
} }
else else
console.debug(`metrics/compute/${login}/plugins > licenses > licensed not available`) console.debug(`metrics/compute/${login}/plugins > licenses > licensed not available`)

View File

@@ -70,7 +70,7 @@ placeholder.run = async vars => {
//Setup //Setup
beforeAll(async () => { beforeAll(async () => {
//Clean community template //Clean community template
await fs.promises.rmdir(path.join(__dirname, "../source/templates/@classic"), { recursive: true }) await fs.promises.rm(path.join(__dirname, "../source/templates/@classic"), { recursive: true, force:true })
//Start web instance //Start web instance
await web.start() await web.start()
}) })
@@ -79,7 +79,7 @@ afterAll(async () => {
//Stop web instance //Stop web instance
await web.stop() await web.stop()
//Clean community template //Clean community template
await fs.promises.rmdir(path.join(__dirname, "../source/templates/@classic"), { recursive: true }) await fs.promises.rm(path.join(__dirname, "../source/templates/@classic"), { recursive: true, force:true })
}) })
//Load metadata (as jest doesn't support ESM modules, we use this dirty hack) //Load metadata (as jest doesn't support ESM modules, we use this dirty hack)