-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trying to get esm to play nicely with node and ts
- Loading branch information
Showing
10 changed files
with
71 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
set -e | ||
node_major_version=$(node --version|sed 's/v\([^.]*\).*/\1/g') | ||
rm -rf e2e | ||
mkdir -p e2e | ||
|
||
rm -f dont-crop*.tgz | ||
npm pack | ||
tarball=(dont-crop*.tgz) | ||
|
||
mv "$tarball" e2e | ||
cd e2e | ||
|
||
# run node sharp example as end to end test for ts-node | ||
cp -R ../examples/node-sharp . | ||
cd node-sharp | ||
npm unlink dont-crop | ||
npm install "../$tarball" | ||
echo "testing ts-node commonjs" | ||
npm start | ||
# test esm compatibility as well | ||
if [ "$node_major_version" -ge 14 ] | ||
then | ||
echo "testing ts-node esm" | ||
node --loader ts-node/esm example.ts | ||
fi | ||
cd .. | ||
|
||
# test plain node module compatibility | ||
cp -R ../tests/node-module-compatibility . | ||
cd node-module-compatibility | ||
npm install "../$tarball" | ||
echo "testing node commonjs" | ||
node commonjs.js | ||
if [ "$node_major_version" -ge 14 ] | ||
then | ||
node esm.mjs | ||
fi | ||
cd .. | ||
|
||
cd .. | ||
rm -rf e2e | ||
# run testsuite as end to end test using pupeteer | ||
echo "testing browser" | ||
ts-node tests/puppeteer.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const { fitGradientToImageData } = require('dont-crop'); | ||
|
||
console.log(fitGradientToImageData); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import {fitGradientToImageData} from 'dont-crop'; | ||
console.log(fitGradientToImageData); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
File renamed without changes.
File renamed without changes.