Skip to content

Commit

Permalink
Added test that esm module could be imported (via import statement) i…
Browse files Browse the repository at this point in the history
…n nodejs context

It's the case to handle that the library might be used with SSR
  • Loading branch information
timocov committed Mar 3, 2022
1 parent 09fc8ae commit af06222
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,18 @@ jobs:
- checkout-with-deps
- run: npm run lint:md

usable-in-nodejs:
executor: node16-executor
steps:
- checkout-with-deps
- attach_workspace:
at: ./
- run: npm link lightweight-charts
- run: npm run prepare-package-json-for-release
- run:
name: "Check CJS could be imported in NodeJS"
command: node -e "import 'lightweight-charts'" --input-type=module

unittests:
executor: node16-executor
environment:
Expand Down Expand Up @@ -303,6 +315,10 @@ workflows:
filters: *default-filters
requires:
- build
- usable-in-nodejs:
filters: *default-filters
requires:
- build
- unittests:
filters: *default-filters
requires:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@
"build:watch": "npm-run-all tsc -p tsc-watch rollup-watch",
"build:prod": "cross-env NODE_ENV=production npm run build",
"build:release": "cross-env BUILD_TAG=release npm run build:prod",
"prepare-release": "npm-run-all clean build:release && node ./scripts/clean-package-json.cjs",
"prepare-release": "npm-run-all clean build:release && npm run prepare-package-json-for-release",
"prepare-package-json-for-release": "node ./scripts/clean-package-json.cjs",
"size-limit": "size-limit",
"verify": "npm-run-all clean -p lint check-markdown-links build:prod -p check-dts-docs tsc-verify test size-limit",
"test": "mocha tests/unittests/**/*.spec.ts"
Expand Down

0 comments on commit af06222

Please sign in to comment.