From 95f8e3ba0c64d28e00baf5b80078f316558030b1 Mon Sep 17 00:00:00 2001 From: Hugo-ter-Doest Date: Thu, 30 May 2024 15:27:34 +0200 Subject: [PATCH] Adapted build scripts --- package.json | 9 +++++---- spec/test_esm_bundle/test_imports.mjs | 1 + tsconfig.json | 7 ++++--- 3 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 spec/test_esm_bundle/test_imports.mjs diff --git a/package.json b/package.json index 2516b21f..20bd25f9 100644 --- a/package.json +++ b/package.json @@ -79,14 +79,15 @@ }, "scripts": { "benchmark": "node benchmarks", - "build": "tsc && ncp spec/test_data dist", + "build": "npm run build:tests & npm run build:esm", + "build:esm": "rollup -c", + "build:tests": "tsc", "clean": "rimraf *~ #* *classifier.json dist io_spec/tmp/*.json coverage", "test_io": "jasmine --random=false io_spec/*_spec.js", - "test": "cross-env NODE_PATH=.:./dist jasmine --random=false dist/spec/*_spec.js", + "test": "cross-env NODE_PATH=. jasmine --random=false dist/cjs/spec/*_spec.js", "coverage": "nyc --no-clean npm run test && nyc --no-clean npm run test_io", "test_browser": "cross-env NODE_PATH=. node ./node_modules/gulp/bin/gulp.js", - "lint": "eslint . --ext .ts", - "build_esm": "rollup -c" + "lint": "eslint . --ext .ts" }, "license": "MIT", "author": "Chris Umbel ", diff --git a/spec/test_esm_bundle/test_imports.mjs b/spec/test_esm_bundle/test_imports.mjs new file mode 100644 index 00000000..e271571b --- /dev/null +++ b/spec/test_esm_bundle/test_imports.mjs @@ -0,0 +1 @@ +import natural from '../../dist/esm/index.js' \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 9939b572..1c7a6ba0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,7 @@ "baseUrl": "./", "moduleResolution": "node", "allowJs": true, - "outDir": "./dist", + "outDir": "./dist/cjs", "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "strict": true @@ -18,8 +18,9 @@ "include": [ "lib/natural/**/*.ts", "spec/*.ts", - "io_spec/*.ts" -, "lib/natural/analyzers/SenType.ts" ], + "io_spec/*.ts", + "lib/natural/analyzers/SenType.ts" + ], "exclude": [ "./node_modules" ]