Skip to content

Commit 7a1249f

Browse files
committed
chore: update the package creation script
This ensures that the correct type definitions are created.
1 parent 97311fd commit 7a1249f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

scripts/create-package.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const releasePleaseManifest = require('../.release-please-manifest.json');
3434
license: rootManifest.license,
3535
engines: rootManifest.engines,
3636
main: 'lib/index.js',
37-
types: 'lib/index.d.ts'
37+
types: 'types/index.d.ts'
3838
};
3939
console.log('📦 initialising "package.json"');
4040
await fs.writeFile(
@@ -56,7 +56,7 @@ This module is part of [FT.com Reliability Kit](https://github.com/Financial-Tim
5656
console.log('📄 adding ".npmignore"');
5757
await fs.writeFile(
5858
path.join(packagePath, '.npmignore'),
59-
['!*.d.ts', '!*.d.ts.map', 'CHANGELOG.md', 'docs', 'test'].join('\n')
59+
['CHANGELOG.md', 'docs', 'test'].join('\n')
6060
);
6161

6262
// Bootstrap base JavaScript files
@@ -68,6 +68,14 @@ This module is part of [FT.com Reliability Kit](https://github.com/Financial-Tim
6868
`module.exports = {};
6969
`
7070
);
71+
console.log('🏗 adding "types/index.d.ts"');
72+
const typesPath = path.join(packagePath, 'types');
73+
await fs.mkdir(typesPath);
74+
await fs.writeFile(
75+
path.join(typesPath, 'index.d.ts'),
76+
`declare module '@dotcom-reliability-kit/${name}' {}
77+
`
78+
);
7179

7280
// Bootstrap test JavaScript files
7381
console.log('🏗 adding "test/unit/lib/index.spec.js"');

0 commit comments

Comments
 (0)