Skip to content

Commit

Permalink
release: v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yimingjfe committed Aug 15, 2024
1 parent 5c1c873 commit 7e05d9e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -12,7 +12,7 @@
## Usage

```
import { nodeDepEmit } from 'nde'
import { nodeDepEmit } from 'ndepe'
nodeDepEmit({
appDir: appDirectory,
Expand Down
15 changes: 14 additions & 1 deletion modern.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
],
});
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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"
},
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(
Expand Down Expand Up @@ -328,5 +328,5 @@ export const nodeDepEmit = async ({
const finalPkgJson = modifyPackageJson?.(newPkgJson) || newPkgJson;

await fse.writeJSON(outputPkgPath, finalPkgJson);
debug('nde finish');
debug('nodeDepEmit finish');
};

0 comments on commit 7e05d9e

Please sign in to comment.