mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
Rename external modules to index.d.ts
This commit is contained in:
18
scripts/rename-proper-modules.ts
Normal file
18
scripts/rename-proper-modules.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
const data = JSON.parse(fs.readFileSync(path.join(__dirname, '../../publish-typings/data/definitions.json'), 'utf-8'));
|
||||
|
||||
Object.keys(data).forEach(libName => {
|
||||
const libData = data[libName];
|
||||
if(libData.kind === 'ProperModule') {
|
||||
if (libData.definitionFilename !== 'index.d.ts') {
|
||||
console.log(`${libName} needs renaming from ${libData.definitionFilename}`);
|
||||
const src = path.join(__dirname, '..', libName, libData.definitionFilename);
|
||||
const dst = path.join(__dirname, '..', libName, 'index.d.ts');
|
||||
fs.rename(src, dst);
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user