From 2f7b579fc7d0c63ff2fce5058cda7ee0c5870a9c Mon Sep 17 00:00:00 2001 From: jinan Date: Tue, 19 Dec 2023 11:50:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20export=20esm=20module?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Foyfile.ts | 10 +++++++--- package.json | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Foyfile.ts b/Foyfile.ts index b610500..6c0271e 100644 --- a/Foyfile.ts +++ b/Foyfile.ts @@ -1,7 +1,6 @@ import { task, desc, option, logger, fs, strict, setGlobalOptions, setOption, sleep, namespace, exec, before, execa } from './src/' import marked from 'marked' import * as ejs from 'ejs' -import { ChildProcess } from 'child_process' setGlobalOptions({ loading: false, strict: true }) @@ -16,6 +15,11 @@ task('build', async ctx => { 'tsc', 'chmod +x ./lib/cli.js', ]) + await fs.rmrf('./es') + await ctx.exec([ + 'tsc --module esnext --outDir es', + 'chmod +x ./es/cli.js', + ]) }) desc('generate doc') @@ -29,7 +33,7 @@ const JasmineCli = `jasmine --require=tsconfig-paths/register --require=ts-node/ task<{ args: string, env: NodeJS.ProcessEnv }>('test', async ctx => { await ctx.exec(`${JasmineCli} "src/test/*.test.ts" ${ctx.options.args || ''} ${(ctx.task.rawArgs).map(a => `"${a - }"`).join(' ')}`, { env: ctx.options.env || process.env }) + }"`).join(' ')}`, { env: ctx.options.env || process.env }) }) task('test:update-snap', [{ @@ -114,7 +118,7 @@ task('demodemodemodemodemodemodemo1', async ctx => { task('demo2', async ctx => sleep(3000)) task('demo3', ['demo2', 'demodemodemodemodemodemodemo1'], async ctx => sleep(3000)) -task('demo', ['demodemodemodemodemodemodemo1','demo2'.async(), 'demo3'.async()]) +task('demo', ['demodemodemodemodemodemodemo1', 'demo2'.async(), 'demo3'.async()]) namespace('client', ns => { diff --git a/package.json b/package.json index d1cd6da..0225691 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,10 @@ { "name": "foy", - "version": "0.2.22", + "version": "0.2.23", "description": "A simple, light-weight and modern task runner for general purpose.", "main": "./lib/index.js", "typings": "./lib/index", + "module": "./es/index", "types": "./lib/index", "sideEffects": false, "scripts": {