diff --git a/template-js-esm/src/dependencies.d.ts b/dependencies.d.txt similarity index 58% rename from template-js-esm/src/dependencies.d.ts rename to dependencies.d.txt index e793aa0..1fab563 100644 --- a/template-js-esm/src/dependencies.d.ts +++ b/dependencies.d.txt @@ -1,3 +1,9 @@ +/** + * This file serves as intellisense for sern projects. + * Types are declared here for dependencies to function properly + * Service(s) api rely on this file to provide a better developer experience. + */ + import { SernEmitter, Logging, CoreModuleStore, ModuleManager, ErrorHandling, CoreDependencies, Singleton } from '@sern/handler' import { Client } from 'discord.js' diff --git a/src/index.ts b/src/index.ts index 31a416e..3127814 100644 --- a/src/index.ts +++ b/src/index.ts @@ -73,11 +73,11 @@ async function runInteractive() { }; console.log(greenBright(`overwrite: ${argv.overwrite ?? false};\ncopy: ${selectedTemplate} ${root}`)); await copyFolderRecursiveAsync(selectedTemplate , root); - console.log(greenBright('Writing sern.config.json to '+ result.name + "/sern.config.json")); - - await fs.promises.writeFile(path.join(root, 'sern.config.json'), JSON.stringify(configJson), 'utf8'); - - + console.log(greenBright('Writing dependencies.d.ts to '+ name)); + await Promise.all([ + fs.promises.writeFile(path.join(root, 'sern.config.json'), JSON.stringify(configJson), 'utf8'), + fs.promises.writeFile(path.join(root, 'src', 'dependencies.d.ts'), await fs.promises.readFile(path.join(cwd, 'dependencies.d.txt')), 'utf8') + ]); console.log(greenBright('Done! visit https://sern.dev for documentation and join https://sern.dev/discord! Happy hacking :)' )); } @@ -107,9 +107,12 @@ async function runShort(templateName: string, name:string) { console.log(greenBright(`overwrite: ${argv.overwrite ?? false};\ncopy: ${selectedTemplate} ${root}`)); await copyFolderRecursiveAsync(selectedTemplate , root); console.log(greenBright('Writing sern.config.json to '+ name + "/sern.config.json")); - - await fs.promises.writeFile(path.join(root, 'sern.config.json'), JSON.stringify(configJson), 'utf8'); - + console.log(greenBright('Writing dependencies.d.ts to '+ name)); + await Promise.all([ + fs.promises.writeFile(path.join(root, 'sern.config.json'), JSON.stringify(configJson), 'utf8'), + fs.promises.writeFile(path.join(root, 'src', 'dependencies.d.ts'), await fs.promises.readFile(path.join(cwd, 'dependencies.d.txt')), 'utf8') + ]); + console.log(greenBright('Done! visit https://sern.dev for documentation and join https://sern.dev/discord! Happy hacking :)' )); } async function init() { diff --git a/template-js/src/dependencies.d.ts b/template-js/src/dependencies.d.ts deleted file mode 100644 index e793aa0..0000000 --- a/template-js/src/dependencies.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { SernEmitter, Logging, CoreModuleStore, ModuleManager, ErrorHandling, CoreDependencies, Singleton } from '@sern/handler' -import { Client } from 'discord.js' - -declare global { - interface Dependencies extends CoreDependencies { - '@sern/client': Singleton - } -} - - -export {} diff --git a/template-js/src/index.js b/template-js/src/index.js index 656bbd7..1dc4070 100644 --- a/template-js/src/index.js +++ b/template-js/src/index.js @@ -1,5 +1,5 @@ const { Client, GatewayIntentBits } = require('discord.js'); -const { Sern, single, DefaultLogging } = require('@sern/handler'); +const { Sern, single } = require('@sern/handler'); const client = new Client({ intents: [ diff --git a/template-ts-esm/src/dependencies.d.ts b/template-ts-esm/src/dependencies.d.ts deleted file mode 100644 index e793aa0..0000000 --- a/template-ts-esm/src/dependencies.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { SernEmitter, Logging, CoreModuleStore, ModuleManager, ErrorHandling, CoreDependencies, Singleton } from '@sern/handler' -import { Client } from 'discord.js' - -declare global { - interface Dependencies extends CoreDependencies { - '@sern/client': Singleton - } -} - - -export {} diff --git a/template-ts/src/dependencies.d.ts b/template-ts/src/dependencies.d.ts deleted file mode 100644 index e793aa0..0000000 --- a/template-ts/src/dependencies.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { SernEmitter, Logging, CoreModuleStore, ModuleManager, ErrorHandling, CoreDependencies, Singleton } from '@sern/handler' -import { Client } from 'discord.js' - -declare global { - interface Dependencies extends CoreDependencies { - '@sern/client': Singleton - } -} - - -export {}