From 91a04c147f19a630d1fed954810d7239d7dc0923 Mon Sep 17 00:00:00 2001 From: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com> Date: Tue, 21 Jun 2022 00:28:21 +0800 Subject: [PATCH] improve --- Makefile.mjs | 2 +- scripts/clone-license.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Makefile.mjs b/Makefile.mjs index a82411efb823..567788439db0 100644 --- a/Makefile.mjs +++ b/Makefile.mjs @@ -1,5 +1,5 @@ import "shelljs/make.js"; -import { default as path } from "path"; +import path from "path"; import { execFileSync } from "child_process"; import { writeFileSync } from "fs"; diff --git a/scripts/clone-license.js b/scripts/clone-license.js index fbcd35dce01c..289519fe592a 100644 --- a/scripts/clone-license.js +++ b/scripts/clone-license.js @@ -1,19 +1,25 @@ -import { default as shell } from "shelljs"; +import { readFileSync, writeFileSync } from "fs"; +import shell from "shelljs"; +import path from "path"; console.log("Cloning LICENSE to babel packages"); +const LICENSE = readFileSync("LICENSE", "utf8"); + +console.log(LICENSE); + shell.ls("-d", "./packages/*/").forEach(dir => { if ( !dir.match( /.*packages\/(babel-parser|babel-plugin-transform-object-assign)\/?$/ ) ) { - shell.cp("LICENSE", dir); + writeFileSync(path.join(dir, "LICENSE"), LICENSE); } }); shell.ls("-d", "./eslint/*/").forEach(dir => { if (!dir.match(/.*eslint\/(babel-eslint-plugin)\/?$/)) { - shell.cp("LICENSE", dir); + writeFileSync(path.join(dir, "LICENSE"), LICENSE); } });