Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add TS unit test, pin to typescript@5.0.4 #860

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"build": "true",
"start": "npm run build && npx http-server . -o",
"pretest": "HUSKY=0 npm install --no-package-lock",
"pretest": "rm -fr node_modules && npm install --no-package-lock",
"test": "node node.js"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-rollup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
"build": "npm install --no-package-lock && rm -rf dist && rollup -c",
"build": "rm -fr node_modules && npm install --no-package-lock && rm -rf dist && rollup -c",
"start": "npm run build && npx http-server . -o"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
"build": "npm install --no-package-lock && rm -rf dist && webpack",
"build": "rm -fr node_modules && npm install --no-package-lock && rm -rf dist && webpack",
"start": "npm run build && npx http-server . -o"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/node-commonjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
"pretest": "npm install --no-package-lock",
"pretest": "rm -fr node_modules && npm install --no-package-lock",
"test": "node example.js"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/node-esmodules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"test:package": "( node --version | grep -vq 'v16' ) || ( node --experimental-json-modules package.mjs )",
"test:example": "node example.mjs",
"pretest": "npm install --no-package-lock",
"pretest": "rm -fr node_modules && npm install --no-package-lock",
"test": "npm-run-all test:*"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/node-jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
"pretest": "npm install --no-package-lock",
"pretest": "rm -fr node_modules && npm install --no-package-lock",
"test": "jest"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/node-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"build": "rm -rf dist && webpack",
"pretest": "npm install --no-package-lock",
"pretest": "rm -fr node_modules && npm install --no-package-lock",
"test": "npm run build && node dist/v1.js && node dist/v4.js && node dist/v7.js && node dist/all.js"
},
"dependencies": {
Expand Down
8 changes: 8 additions & 0 deletions examples/typescript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# uuid test for typescript support (not really an example)

```
npm install
npm test
```

This runs `tsc` using the oldest version of TypeScript supported by this project
3 changes: 3 additions & 0 deletions examples/typescript/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import * as uuid from 'uuid';

console.log(uuid);
9 changes: 9 additions & 0 deletions examples/typescript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"dependencies": {
"uuid": "file:../../.build/uuid.tgz"
},
"scripts": {
"pretest": "rm -fr node_modules && npm install --no-package-lock",
"test": "npx -y --package=typescript@5.0.4 -- tsc --noEmit"
}
}
1 change: 1 addition & 0 deletions examples/typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"release-please": "16.15.0",
"runmd": "1.4.1",
"standard-version": "9.5.0",
"typescript": "5.7.2",
"typescript": "5.0.4",
"typescript-eslint": "8.18.2"
},
"optionalDevDependencies": {
Expand All @@ -92,21 +92,22 @@
"examples:node:commonjs:test": "cd examples/node-commonjs && npm test",
"examples:node:esmodules:test": "cd examples/node-esmodules && npm test",
"examples:node:jest:test": "cd examples/node-jest && npm test",
"examples:node:typescript:test": "cd examples/typescript && npm test",
"lint": "npm run eslint:check && npm run prettier:check",
"md": "runmd --watch --output=README.md README_js.md",
"prepack": "npm run build -- --no-pack",
"prepare": "husky",
"prepublishOnly": "npm run build",
"pretest:benchmark": "npm run build",
"pretest:browser": "./scripts/iodd && npm run build && npm-run-all examples:browser:**",
"pretest:browser": "./scripts/iodd && npm run build && npm-run-all --parallel examples:browser:**",
"pretest:node": "npm run build",
"pretest": "npm run build",
"prettier:check": "prettier --check .",
"prettier:fix": "prettier --write .",
"release": "standard-version --no-verify",
"test:benchmark": "cd examples/benchmark && npm test",
"test:browser": "wdio run ./wdio.conf.js",
"test:node": "npm-run-all examples:node:**",
"test:node": "npm-run-all --parallel examples:node:**",
"test:watch": "node --test --enable-source-maps --watch dist/esm/test/*.js",
"test": "node --test --enable-source-maps dist/esm/test/*.js"
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ done
if [ "${1-}" != "--no-pack" ]; then
# Prep tarball dir
BUILD_DIR="$ROOT/.build"
rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR"
rm -rf "$BUILD_DIR/uuid-*.tgz"

# Create tarball for local installation (in tests and examples)
echo "Packing tarball"
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"skipLibCheck": true,
"strict": true,
"target": "ES2022"
}
},
"exclude": ["dist", "examples"]
}
Loading