chore: tsup config setup for scripts and rest-executor

This commit is contained in:
Nishchit Dhanani
2023-05-10 17:44:34 +05:30
parent 2b050f3860
commit 07b9978a9e
6 changed files with 52 additions and 3 deletions

View File

@@ -5,7 +5,10 @@
"private": true,
"repository": "https://github.com/firecamp-io/firecamp/packages-executors/rest-executor",
"keywords": [],
"main": "dist/index.js",
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"scripts": {
"build": "tsup src --target esnext --dts",
"build-old": "run-p 'build:*'",

View File

@@ -1,2 +1,3 @@
export { TPreScript, TTestScript, preScript, testScript } from './scripts';
export { preScript, testScript } from './scripts';
export type { TPreScript, TTestScript } from './scripts';
export * from './snippets';

View File

@@ -0,0 +1,18 @@
import type { Options } from 'tsup';
const env = process.env.NODE_ENV;
export const tsup: Options = {
splitting: true,
clean: true, // clean up the dist folder
dts: true, // generate dts files
format: ['cjs', 'esm'], // generate cjs and esm files
minify: env === 'production',
bundle: env === 'production',
skipNodeModulesBundle: true,
entryPoints: ['src/index.ts'],
watch: env === 'development',
target: 'es2020',
outDir: 'dist',
entry: ['src/**/*.ts'], //include all files under src
};

View File

@@ -5,7 +5,10 @@
"repository": "https://github.com/firecamp-io/firecamp/packages-executors/rest-executor",
"license": "",
"keywords": [],
"main": "dist/index.js",
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"scripts": {
"build:old": "run-p 'build:*'",
"build": "tsup src --target esnext --dts",

View File

@@ -0,0 +1,18 @@
import type { Options } from 'tsup';
const env = process.env.NODE_ENV;
export const tsup: Options = {
splitting: true,
clean: true, // clean up the dist folder
dts: true, // generate dts files
format: ['cjs', 'esm'], // generate cjs and esm files
minify: env === 'production',
bundle: env === 'production',
skipNodeModulesBundle: true,
entryPoints: ['src/index.ts'],
watch: env === 'development',
target: 'es2020',
outDir: 'dist',
entry: ['src/**/*.ts'], //include all files under src
};

View File

@@ -185,4 +185,10 @@ exports.rules = [
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset/resource',
},
{
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
},
];