signmx-sdk
v1.1.5
Published
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
Readme
Introduction
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
Getting Started
TODO: Guide users through getting your code up and running on their own system. In this section you can talk about:
- Installation process
- Software dependencies
- Latest releases
- API references
Build and Test
TODO: Describe and show how to build your code and run the tests.
Contribute
TODO: Explain how other users and developers can contribute to make your code better.
If you want to learn more about creating good readme files then refer the following guidelines. You can also seek inspiration from the below readme files:
How to use it
import createSDK from './sdk';
const sdk = createSDK({ apiBaseUrl: 'https://api.example.com', apiKey: 'your-api-key' });
sdk.users.getUserById(1).then(user => console.log(user)).catch(err => console.error(err));In case this error
The error might be happening because Rollup cannot find the index.d.ts file in the expected location. This can occur if the .d.ts files are not being generated correctly or the paths in the rollup.config.js are incorrect.
Steps to Fix the Issue:
Ensure .d.ts Files are Being Generated First, check if .d.ts files are being generated in your dist/types folder by running: npx tsc --declaration This command will compile your TypeScript files and generate .d.ts files as per the tsconfig.json configuration. Ensure that the dist/types directory is created and contains the index.d.ts file.
Verify tsconfig.json Declaration Settings Make sure that tsconfig.json has the correct settings to generate declaration files. The key settings are:
{
"compilerOptions": {
"declaration": true,
"declarationDir": "./dist/types",
"emitDeclarationOnly": true,
"outDir": "./dist"
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist"]
}Ensure that the declarationDir is correctly pointing to dist/types, and TypeScript should generate .d.ts files in that location.
- Check Rollup Configuration for .d.ts Files Ensure your rollup.config.js is pointing to the correct location where the .d.ts files are generated.
Here’s an updated rollup.config.js:
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import dts from 'rollup-plugin-dts';
export default [
// Build the SDK (ESM and CJS)
{
input: 'src/index.ts',
output: [
{
file: 'dist/esm/index.js',
format: 'es',
sourcemap: true
},
{
file: 'dist/cjs/index.js',
format: 'cjs',
sourcemap: true
}
],
plugins: [
resolve(),
commonjs(),
typescript({ tsconfig: './tsconfig.json' })
],
external: ['axios'] // Add any external dependencies here
},
// Build TypeScript declarations
{
input: 'dist/types/index.d.ts', // Ensure this path matches where your declaration files are being generated
output: [
{ file: 'dist/esm/types/index.d.ts', format: 'es' }
],
plugins: [dts()],
}
];In this configuration:
The input: 'dist/types/index.d.ts' must match the location where your .d.ts files are generated by TypeScript (from the tsconfig.json settings). Ensure that .d.ts files are being generated into the dist/types directory. 4. Rebuild with TypeScript First You can try building the TypeScript files first to make sure the .d.ts files are correctly generated:
npx tsc --emitDeclarationOnly
Then verify that dist/types/index.d.ts exists. If it does, you can proceed to run the Rollup build:
npm run build
- Check Rollup and TypeScript Versions Ensure you're using compatible versions of Rollup and TypeScript. For example:
Rollup: ^2.x.x TypeScript: ^4.x.x You can check and update them with the following commands:
npm install rollup typescript --save-dev
- Manually Check the dist Folder Check the contents of your dist folder after running npx tsc to ensure the .d.ts files are being generated in the expected locations. If they are not, there might be an issue with your tsconfig.json or build process.
