Add more instance types
This commit is contained in:
@@ -128,6 +128,26 @@ declare const CreatableInstancesWithConstructors: CreatableInstancesWithConstruc
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the instance-classes.ts file content
|
||||
* @param {string[]} classNames List of creatable instance class names
|
||||
* @returns {string} The content for the instance-classes.ts file
|
||||
*/
|
||||
function generateInstanceClassesFile(classNames) {
|
||||
return `/**
|
||||
* This file is auto-generated by the generate-instance-classes script.
|
||||
* Do not modify manually.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Array of all creatable Roblox instance class names
|
||||
* Used by the transformer to identify constructor calls
|
||||
*/
|
||||
export const CREATABLE_INSTANCES = [
|
||||
${classNames.map(name => `"${name}"`).join(",\n ")}
|
||||
];`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main function
|
||||
*/
|
||||
@@ -135,12 +155,17 @@ function main() {
|
||||
const classNames = getCreatableInstanceNames();
|
||||
console.log(`Found ${classNames.length} creatable instance types`);
|
||||
|
||||
// Generate and write declarations file
|
||||
const declarationsContent = generateDeclarations(classNames);
|
||||
const outputPath = path.join(__dirname, '..', 'index.d.ts');
|
||||
const declarationsPath = path.join(__dirname, '..', 'index.d.ts');
|
||||
fs.writeFileSync(declarationsPath, declarationsContent, 'utf-8');
|
||||
console.log(`Successfully generated declarations in ${declarationsPath}`);
|
||||
|
||||
// Write to file
|
||||
fs.writeFileSync(outputPath, declarationsContent, 'utf-8');
|
||||
console.log(`Successfully generated declarations in ${outputPath}`);
|
||||
// Generate and write instance-classes.ts
|
||||
const instanceClassesContent = generateInstanceClassesFile(classNames);
|
||||
const instanceClassesPath = path.join(__dirname, '..', 'src', 'instance-classes.ts');
|
||||
fs.writeFileSync(instanceClassesPath, instanceClassesContent, 'utf-8');
|
||||
console.log(`Successfully generated instance classes in ${instanceClassesPath}`);
|
||||
|
||||
console.log('Example declarations:');
|
||||
const examples = classNames.slice(0, 5);
|
||||
|
||||
Reference in New Issue
Block a user