diff --git a/README.md b/README.md index 9bc441b..e606736 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Nde (Node.js Dependencies Emitter) +# Ndepe (Node.js Dependencies Emitter) -`nde` is a utility that analyzes your Node.js project's source code to extract the necessary dependencies and files required for deployment and emits these files to a designed node_modules directory that can be used for the deployment. `nde` can simplify the deployment flow and greatly reduce the size of the deployment package. +`Ndepe` is a utility that analyzes your Node.js project's source code to extract the necessary dependencies and files required for deployment and emits these files to a designed node_modules directory that can be used for the deployment. `Ndepe` can simplify the deployment flow and greatly reduce the size of the deployment package. ## Features @@ -12,7 +12,7 @@ ## Usage ``` -import { nodeDepEmit } from 'nde' +import { nodeDepEmit } from 'ndepe' nodeDepEmit({ appDir: appDirectory, diff --git a/modern.config.ts b/modern.config.ts index e2d1d36..1b6cad1 100644 --- a/modern.config.ts +++ b/modern.config.ts @@ -2,5 +2,18 @@ import { moduleTools, defineConfig } from '@modern-js/module-tools'; export default defineConfig({ plugins: [moduleTools()], - buildPreset: 'npm-library', + buildConfig: [ + { + format: 'cjs', + target: 'es2021', + buildType: 'bundleless', + outDir: './dist/cjs', + }, + { + format: 'esm', + target: 'es2021', + buildType: 'bundleless', + outDir: './dist/esm', + } + ], }); diff --git a/package.json b/package.json index 429bb3c..33df165 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { - "name": "nde", + "name": "ndepe", "version": "0.1.0", - "types": "./dist/types/index.d.ts", - "main": "./dist/lib/index.js", - "module": "./dist/es/index.js", + "types": "./dist/cjs/index.d.ts", + "main": "./dist/cjs/index.js", + "module": "./dist/esm/index.js", "scripts": { "prepare": "modern build && husky install", "dev": "modern dev", @@ -18,6 +18,7 @@ "change-status": "modern change-status", "gen-release-note": "modern gen-release-note", "release": "modern release", + "prepublish": "modern build", "new": "modern new", "upgrade": "modern upgrade" }, diff --git a/src/index.ts b/src/index.ts index 8def55a..df0fa65 100644 --- a/src/index.ts +++ b/src/index.ts @@ -283,7 +283,7 @@ export const nodeDepEmit = async ({ for (const [version, parentPkgs] of versionEntires) { const pkg = tracedPackages[pkgName]; - const pkgDestPath = `.nde/${pkgName}@${version}/node_modules/${pkgName}`; + const pkgDestPath = `.ndepe/${pkgName}@${version}/node_modules/${pkgName}`; await writePackage({ pkg, version, @@ -297,7 +297,7 @@ export const nodeDepEmit = async ({ await (multiVersionPkgs[parentPkgName] ? linkPackage( pkgDestPath, - `.nde/${parentPkg}/node_modules/${pkgName}`, + `.ndepe/${parentPkg}/node_modules/${pkgName}`, sourceDir, ) : linkPackage( @@ -328,5 +328,5 @@ export const nodeDepEmit = async ({ const finalPkgJson = modifyPackageJson?.(newPkgJson) || newPkgJson; await fse.writeJSON(outputPkgPath, finalPkgJson); - debug('nde finish'); + debug('nodeDepEmit finish'); };