diff --git a/scripts/build/babel.ts b/scripts/build/babel.ts index 4d51dca20..db923b88c 100644 --- a/scripts/build/babel.ts +++ b/scripts/build/babel.ts @@ -2,18 +2,18 @@ import {BundleDef, BundleType} from "./bundles" import {getBundleOutputPaths} from "./packaging" import {asyncMkDirP, getPackageDir} from "./utils" +import {transformFileSync} from '@babel/core'; const fs = require("fs") const path = require("path") const chalk = require("chalk") -const babel = require("babel-core") const ora = require("ora") const babelConfig = require("./babel.config") const ignorePatterns = [/\.test.[jt]s$/, /fixtures/] -function walk(base: string, relativePath = "") { - let files = [] +function walk(base: string, relativePath = ""): string[] { + let files: string[] = [] fs.readdirSync(path.join(base, relativePath)).forEach(dirname => { const directory = path.join(relativePath, dirname) @@ -64,7 +64,7 @@ export default async function(bundle: BundleDef) { await asyncMkDirP(outputDir) if (!filename.endsWith(".d.ts")) { - const { code } = babel.transformFileSync( + const { code } = transformFileSync( path.join(srcDir, filename), babelConfig({ modules: true }) ) diff --git a/scripts/build/packaging.ts b/scripts/build/packaging.ts index b6d8f772a..ed7d46ccf 100644 --- a/scripts/build/packaging.ts +++ b/scripts/build/packaging.ts @@ -1,4 +1,4 @@ -import {existsSync, readdirSync, unlinkSync} from "fs" +import {existsSync, readdirSync} from "fs" import {BundleType as BundleType} from "./bundles" import { @@ -6,16 +6,14 @@ import { } from "./utils" export function getBundleOutputPaths(bundleType: BundleType, filename: string, packageName: string) { - const _filename = filename.replace(/^@lingui\//, "") - switch (bundleType) { case BundleType.NOOP: case BundleType.NODE: - return [`packages/${packageName}/build/${_filename}`] + return [`packages/${packageName}/build/${filename}`] case BundleType.ESM: - return [`packages/${packageName}/build/esm/${_filename}`] + return [`packages/${packageName}/build/esm/${filename}`] case BundleType.UNIVERSAL: - return [`packages/${packageName}/build/cjs/${_filename}`] + return [`packages/${packageName}/build/cjs/${filename}`] // case BundleType.UMD_DEV: // case BundleType.UMD_PROD: // return [ diff --git a/scripts/build/rollup.ts b/scripts/build/rollup.ts index 4644ecc47..6467e419b 100644 --- a/scripts/build/rollup.ts +++ b/scripts/build/rollup.ts @@ -321,7 +321,6 @@ async function build(bundle: BundleDef, bundleType: RollupBundleType) { export default async function (bundle: BundleDef) { await build(bundle, RollupBundleType.NODE_DEV) - await build(bundle, RollupBundleType.NODE_PROD) await build(bundle, RollupBundleType.ESM_DEV) await build(bundle, RollupBundleType.ESM_PROD) diff --git a/scripts/build/utils.ts b/scripts/build/utils.ts index 5e83ae16d..95d09ce6d 100644 --- a/scripts/build/utils.ts +++ b/scripts/build/utils.ts @@ -9,7 +9,7 @@ export async function asyncCopyTo(from: string, to: string) { await asyncMkDirP(path.dirname(to)) - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { ncp(from, to, error => { if (error) { // Wrap to have a useful stack trace. @@ -30,7 +30,7 @@ export function asyncMkDirP(filepath: string) { } export function asyncRimRaf(filepath: string) { - return new Promise((resolve, reject) => + return new Promise((resolve, reject) => rimraf(filepath, error => { if (error) { reject(error)