From 1a8dec7c69103dc302241d3270792ebbe53da063 Mon Sep 17 00:00:00 2001 From: Niloy Sikdar Date: Sun, 7 Aug 2022 01:44:35 +0530 Subject: [PATCH] feat(example): add example for ESM Add an example inside the example directory to show the example of how to use the package with the ECMAScript modules standard for the Node.js environment (i.e. import/export syntax) Resolves #72 Signed-off-by: Niloy Sikdar --- example/fixup.sh | 7 ++++ example/generate-esm/index.js | 10 +++++- example/generate-esm/package.json | 2 +- example/package.json | 5 +-- example/tsconfig.json | 34 +++++++++++------- example/yarn.lock | 58 ++++++++++++++++++++++++------- 6 files changed, 87 insertions(+), 29 deletions(-) create mode 100644 example/fixup.sh diff --git a/example/fixup.sh b/example/fixup.sh new file mode 100644 index 0000000..fd01b74 --- /dev/null +++ b/example/fixup.sh @@ -0,0 +1,7 @@ +cat >lib/esm/package.json <=16.8": + "integrity" "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==" + "resolved" "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz" + "version" "18.2.0" + dependencies: + "loose-envify" "^1.1.0" + "scheduler" "^0.23.0" + +"react@^18.2.0", "react@>=16.8": + "integrity" "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==" + "resolved" "https://registry.npmjs.org/react/-/react-18.2.0.tgz" + "version" "18.2.0" + dependencies: + "loose-envify" "^1.1.0" + +"scheduler@^0.23.0": + "integrity" "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==" + "resolved" "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz" + "version" "0.23.0" + dependencies: + "loose-envify" "^1.1.0" + +"textversionjs@^1.1.3": + "integrity" "sha512-yZbBK7+1KRkgTJFOeIkCbQSZ+jR9ojDO/KrUKN3xEA6hA/DCMJ+aMWqjZ0rpxBJDjesbP795P5NEw+j3NnWJtA==" + "resolved" "https://registry.npmjs.org/textversionjs/-/textversionjs-1.1.3.tgz" + "version" "1.1.3" + +"typescript@^4.7.4": + "integrity" "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==" + "resolved" "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz" + "version" "4.7.4"