Skip to content

Commit

Permalink
feat: add type declaration file
Browse files Browse the repository at this point in the history
  • Loading branch information
demouth committed Mar 29, 2022
1 parent 1bdfc74 commit 287ee2c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "@demouth/mb_strwidth",
"version": "1.0.0",
"version": "1.1.0",
"main": "dist/index.js",
"module": "dist/index.es.js",
"browser": "dist/mb_strwidth.js",
"types": "dist/index.d.ts",
"repository": "[email protected]:demouth/mb_strwidth.git",
"author": "demouth <[email protected]>",
"license": "MIT",
Expand Down
12 changes: 9 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export default [
}
],
plugins: [
pluginTypescript(),
pluginTypescript({
tsconfig: './tsconfig.json'
}),
pluginCommonjs({
extensions: ['.js', '.ts'],
}),
Expand Down Expand Up @@ -73,7 +75,9 @@ export default [
...Object.keys(pkg.devDependencies || {}),
],
plugins: [
pluginTypescript(),
pluginTypescript({
tsconfig: './tsconfig.json'
}),
pluginCommonjs({
extensions: ['.js', '.ts'],
}),
Expand Down Expand Up @@ -104,7 +108,9 @@ export default [
...Object.keys(pkg.devDependencies || {}),
],
plugins: [
pluginTypescript(),
pluginTypescript({
tsconfig: './tsconfig.json'
}),
pluginCommonjs({
extensions: ['.js', '.ts'],
}),
Expand Down
8 changes: 5 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"include": ["src"],
"exclude": ["dist"],
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */

Expand Down Expand Up @@ -42,12 +44,12 @@
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */

/* Emit */
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
// "outDir": "./", /* Specify an output folder for all emitted files. */
"outDir": "dist", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
Expand All @@ -63,7 +65,7 @@
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
"declarationDir": ".", /* Specify the output directory for generated declaration files. */
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */

/* Interop Constraints */
Expand Down

0 comments on commit 287ee2c

Please sign in to comment.