using sync versions to work with nodejs 12.x

nothing to gain from the async/promises version
This commit is contained in:
Ralf Becker 2021-07-13 08:30:51 +02:00
parent 1563337458
commit 812d0d91c0

View File

@ -11,10 +11,9 @@
import path from 'path'; import path from 'path';
import babel from '@babel/core'; import babel from '@babel/core';
import { readFileSync } from "fs"; import { readFileSync, readdirSync, statSync } from "fs";
import rimraf from 'rimraf'; import rimraf from 'rimraf';
import { minify } from 'terser'; import { minify } from 'terser';
import { readdir,stat } from 'fs/promises';
import resolve from '@rollup/plugin-node-resolve'; import resolve from '@rollup/plugin-node-resolve';
// Best practice: use this // Best practice: use this
@ -144,21 +143,21 @@ const config = {
* *
* @return Promise<object> * @return Promise<object>
*/ */
export default async function addAppsConfig() export default function addAppsConfig()
{ {
const conf = config; const conf = config;
const files = await readdir('.', { withFileTypes: true}); const files = readdirSync('.', { withFileTypes: true});
for (const file of files) for (const file of files)
{ {
if (file.isDirectory()) if (file.isDirectory())
{ {
try { try {
await stat(file.name + '/js/app.ts'); statSync(file.name + '/js/app.ts');
config.input[file.name + '/js/app'] = file.name + '/js/app.ts'; config.input[file.name + '/js/app'] = file.name + '/js/app.ts';
} }
catch (e) { catch (e) {
try { try {
await stat(file.name + '/js/app.js'); statSync(file.name + '/js/app.js');
config.input[file.name + '/js/app.min'] = file.name + '/js/app.js'; config.input[file.name + '/js/app.min'] = file.name + '/js/app.js';
} }
catch (e) { catch (e) {