diff --git a/examples/TypeScriptExample/.gitignore b/examples/TypeScriptExample/.gitignore index a38a51a9..5a27aae6 100644 --- a/examples/TypeScriptExample/.gitignore +++ b/examples/TypeScriptExample/.gitignore @@ -1,47 +1,3 @@ -# Node.js node_modules/ -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* -package-lock.json -yarn.lock -.pnpm-debug.log - -# Typescript dist/ -*.tsbuildinfo - -# Logs -logs -*.log -logs/* - -# OS generated files -.DS_Store -Thumbs.db - -# IDEs and Editors -.vscode/ -.idea/ -*.suo -*.ntvs* -*.njsproj -*.sln - -# Testing -coverage/ - -# Optional npm cache directory -.npm/ -.npmrc - -# TypeScript cache -*.tsbuildinfo - -# Mac system files -.DS_Store - -# Environment variables -.env -.env.* +*.log \ No newline at end of file diff --git a/examples/TypeScriptExample/index.js b/examples/TypeScriptExample/index.js deleted file mode 100644 index 6f4d9150..00000000 --- a/examples/TypeScriptExample/index.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const web5_1 = require("web5"); -console.log(web5_1.dids); diff --git a/examples/TypeScriptExample/index.ts b/examples/TypeScriptExample/index.ts deleted file mode 100644 index d3473601..00000000 --- a/examples/TypeScriptExample/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { generate_ed25519_key } from '../../bound/typescript/dist/web5_wasm'; -console.log(generate_ed25519_key()); \ No newline at end of file diff --git a/examples/TypeScriptExample/package-lock.json b/examples/TypeScriptExample/package-lock.json new file mode 100644 index 00000000..b0b22cd5 --- /dev/null +++ b/examples/TypeScriptExample/package-lock.json @@ -0,0 +1,28 @@ +{ + "name": "web5-example", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "web5-example", + "version": "1.0.0", + "devDependencies": { + "typescript": "^5.0.0" + } + }, + "node_modules/typescript": { + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", + "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + } + } +} diff --git a/examples/TypeScriptExample/package.json b/examples/TypeScriptExample/package.json index 855b0db6..b5de5e49 100644 --- a/examples/TypeScriptExample/package.json +++ b/examples/TypeScriptExample/package.json @@ -1,21 +1,16 @@ { - "name": "typescriptexample", - "version": "1.0.0", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "build": "tsc", - "start": "node dist/index.js" - }, - "keywords": [], - "author": "", - "type": "module", - "license": "ISC", - "description": "", - "dependencies": { - "web5": "../../bound/typescript" - }, - "devDependencies": { - "typescript": "^5.6.2" + "name": "web5-example", + "version": "1.0.0", + "description": "A simple Hello World in TypeScript as an ES Module", + "type": "module", + "main": "./dist/index.js", + "scripts": { + "build": "tsc", + "start": "node dist/index.js" + }, + "dependencies": {}, + "devDependencies": { + "typescript": "^5.0.0" + } } -} + \ No newline at end of file diff --git a/examples/TypeScriptExample/pnpm-lock.yaml b/examples/TypeScriptExample/pnpm-lock.yaml deleted file mode 100644 index 790ffded..00000000 --- a/examples/TypeScriptExample/pnpm-lock.yaml +++ /dev/null @@ -1,34 +0,0 @@ -lockfileVersion: '9.0' - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - -importers: - - .: - dependencies: - web5: - specifier: file:/Users/nealr/MY-WORKSPACE/WEB5-RS/web5-rs/bound/typescript - version: file:../../bound/typescript - devDependencies: - typescript: - specifier: ^5.6.2 - version: 5.6.2 - -packages: - - typescript@5.6.2: - resolution: {integrity: sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==} - engines: {node: '>=14.17'} - hasBin: true - - web5@file:../../bound/typescript: - resolution: {directory: ../../bound/typescript, type: directory} - engines: {node: '>= 18'} - -snapshots: - - typescript@5.6.2: {} - - web5@file:../../bound/typescript: {} diff --git a/examples/TypeScriptExample/src/index.ts b/examples/TypeScriptExample/src/index.ts new file mode 100644 index 00000000..8f0db48d --- /dev/null +++ b/examples/TypeScriptExample/src/index.ts @@ -0,0 +1,3 @@ +import { generate_ed25519_key } from '../../../bound/typescript/dist/web5_wasm'; + +console.log(generate_ed25519_key()); \ No newline at end of file diff --git a/examples/TypeScriptExample/tsconfig.json b/examples/TypeScriptExample/tsconfig.json index 150cbbd3..d0d84ecf 100644 --- a/examples/TypeScriptExample/tsconfig.json +++ b/examples/TypeScriptExample/tsconfig.json @@ -1,13 +1,14 @@ { - "compilerOptions": { - "target": "ES6", - "module": "commonjs", - "outDir": "./dist", - "rootDir": "./", - "strict": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true - }, - "include": ["./**/*.ts"], - "exclude": ["node_modules"] -} + "compilerOptions": { + "target": "ES2020", // Output ES2020 code + "module": "ESNext", // Use ES modules + "moduleResolution": "node", // Resolve modules like Node.js + "outDir": "./dist", // Output directory for compiled JS + "strict": true, // Enable strict type-checking + "esModuleInterop": true, // Ensure interoperability between CommonJS and ES modules + "forceConsistentCasingInFileNames": true, + "skipLibCheck": true + }, + "include": ["src/**/*"] + } + \ No newline at end of file