remove bad templates

This commit is contained in:
Jacob Nguyen
2024-04-01 22:49:31 -05:00
parent 95db7b299f
commit 31a92ab455
36 changed files with 106 additions and 452 deletions

View File

@@ -32,7 +32,7 @@ npm create @sern/bot --template=ts-esm --name="mybot"
npm create @sern/bot -- --template=ts-esm --name="mybot"
# !!!!POWERSHELL SYNTAX
npm create @sern/bot '--' --template=ts-esm --name="mybot" --cli
npm create @sern/bot '--' --template=ts-esm --name="mybot"
# yarn
yarn create @sern/bot --template=ts-esm --name="mybot"
@@ -44,8 +44,4 @@ pnpm create @sern/bot --template=ts-esm --name="mybot"
Currently supported template presets include:
- `ts`
- `ts-esm`
- `js`
- `js-esm`
- `js+cli`
- `ts+cli`

View File

@@ -1,27 +1,10 @@
[
{
"title": "Typescript with sern cli & ESM",
"value": "ts+cli"
},
{
"title": "Javascript with sern cli & ESM",
"value": "js+cli"
},
{
"title": "Typescript",
"value": "ts"
},
{
"title": "Typescript with ESM",
"value": "ts-esm"
"title": "Typescript",
"value": "ts"
},
{
"title": "Javascript",
"value": "js"
},
{
"title": "Javascript with ESM",
"value": "js-esm"
"title": "Javascript",
"value": "js"
}
]

View File

@@ -101,12 +101,6 @@ async function runInteractive() {
argv.overwrite
);
const install = await prompt([
{
type: 'confirm',
name: 'cli',
message: 'install cli? (If you installed a template with `cli`, This is required!!)\n',
initial: true
},
which_manager
],
{ onCancel: () => {
@@ -114,24 +108,22 @@ async function runInteractive() {
},
})
if(install.cli) {
const jsonDeps = JSON.parse(String(execSync('npm ls -g --json')));
const cliVersion = jsonDeps.dependencies['@sern/cli']?.version;
if(semver.satisfies(cliVersion, '1.x')) {
console.log('You already have a good enough sern cli.');
} else {
console.log(`Installing ${magentaBright('@sern/cli')}:`)
await new Promise((resolve, reject) => {
const child = spawn('npm', ['install', '-g', '@sern/cli@latest'], { cwd, shell: true });
child.on('data', (s) => console.log(s.toString()));
child.on('error', (e) => {
console.error(e);
console.log(red('Something went wrong with installing. Please do it yourself.'));
reject();
});
child.on('close', resolve)
})
}
const jsonDeps = JSON.parse(String(execSync('npm ls -g --json')));
const cliVersion = jsonDeps.dependencies['@sern/cli']?.version;
if(semver.satisfies(cliVersion, '1.x')) {
console.log('You already have a good enough sern cli.');
} else {
console.log(`Installing ${magentaBright('@sern/cli')}:`)
await new Promise((resolve, reject) => {
const child = spawn('npm', ['install', '-g', '@sern/cli@latest'], { cwd, shell: true });
child.on('data', (s) => console.log(s.toString()));
child.on('error', (e) => {
console.error(e);
console.log(red('Something went wrong with installing. Please do it yourself.'));
reject();
});
child.on('close', resolve)
})
}
await runInstall(install.manager !== 'skip', root, install.manager);
}
@@ -275,8 +267,7 @@ async function init() {
'^(?:@[a-z0-9-*~][a-z0-9-*._~]*/)?[a-z0-9-~][a-z0-9-._~]*$',
'g'),
"project name does not match the regular expression");
const installCli = argv['cli'] ?? false;
await runShort(argv.template, argv.name, installCli, argv.install);
await runShort(argv.template, argv.name, true, argv.install);
}
console.log(magentaBright('Done!')

View File

@@ -1,2 +0,0 @@
/node_modules
.env

View File

@@ -1,15 +0,0 @@
# How to use
1.) Build
```
npm run build
```
2.) Run
```
node .
```
3.) Publish
```
npm run commands:publish
```

View File

@@ -1,25 +0,0 @@
{
"name": "js-example",
"version": "1.0.0",
"private": true,
"description": "",
"main": "src/index.js",
"scripts": {
"start": "node .",
"commands:publish": "sern commands publish"
},
"keywords": [
"javascript",
"sern",
"discord.js"
],
"dependencies": {
"@sern/handler": "^3.0.3",
"discord.js": "latest",
"dotenv": "^16.3.1"
},
"devDependencies": {
"@types/node": "^18.0.25"
},
"type": "module"
}

View File

@@ -1,11 +0,0 @@
import { CommandType, commandModule } from '@sern/handler';
export default commandModule({
type: CommandType.Both,
plugins: [], //optional
description: 'A ping command',
//alias : [],
execute: async (ctx, args) => {
await ctx.reply('Pong 🏓');
},
});

View File

@@ -1,32 +0,0 @@
/// <reference path="dependencies.d.ts" />
import 'dotenv/config'
import { Client, GatewayIntentBits } from 'discord.js';
import { Sern, single, makeDependencies } from '@sern/handler';
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent, // Make sure this is enabled for text commands!
],
});
/**
* Where all of your dependencies are composed.
* '@sern/client' is usually your Discord Client.
* Use this function to access all of your dependencies.
* This is used for external event modules as well
*/
await makeDependencies(({ add }) => {
add('@sern/client', single(() => client));
});
//View docs for all options
Sern.init({
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
commands: 'src/commands',
// events: 'src/events', //(optional)
});
client.login();

View File

@@ -1,2 +0,0 @@
/node_modules
.env

View File

@@ -1 +0,0 @@
# TODO

View File

@@ -1,24 +0,0 @@
{
"name": "js-example",
"version": "1.0.0",
"description": "",
"private": true,
"main": "src/index.js",
"scripts": {
"test": "node ./src/index.js"
},
"keywords": [
"javacsript",
"sern",
"discord.js"
],
"license": "UNLICENSED",
"dependencies": {
"@sern/handler": "^3.0.3",
"discord.js": "latest"
},
"devDependencies": {
"@types/node": "^17.0.25"
},
"type": "module"
}

View File

@@ -1,11 +0,0 @@
import { CommandType, commandModule } from '@sern/handler';
export default commandModule({
type: CommandType.Both,
plugins: [], //optional
description: 'A ping command',
//alias : [],
execute: async (ctx, args) => {
await ctx.reply('Pong 🏓');
},
});

View File

@@ -1,32 +0,0 @@
/// <reference path="dependencies.d.ts" />
import { Client, GatewayIntentBits } from 'discord.js';
import { Sern, single, makeDependencies } from '@sern/handler';
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent, // Make sure this is enabled for text commands!
],
});
/**
* Where all of your dependencies are composed.
* '@sern/client' is usually your Discord Client.
* Use this function to access all of your dependencies.
* This is used for external event modules as well
*/
await makeDependencies(({ add }) => {
add('@sern/client', single(() => client));
});
//View docs for all options
Sern.init({
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
commands: 'src/commands',
// events: 'src/events', //(optional)
});
client.login();

View File

@@ -1 +1,15 @@
# TODO
# How to use
1.) Build
```
npm run build
```
2.) Run
```
node .
```
3.) Publish
```
npm run commands:publish
```

View File

@@ -1,23 +1,25 @@
{
"name": "js-example",
"version": "1.0.0",
"description": "",
"private": true,
"description": "",
"main": "src/index.js",
"scripts": {
"test": "node ./src/index.js"
"start": "node .",
"commands:publish": "sern commands publish"
},
"keywords": [
"javacsript",
"sern",
"discord.js"
"javascript",
"sern",
"discord.js"
],
"license": "UNLICENSED",
"dependencies": {
"@sern/handler": "^3.0.3",
"discord.js": "latest"
"@sern/handler": "^3.0.3",
"discord.js": "latest",
"dotenv": "^16.3.1"
},
"devDependencies": {
"@types/node": "^17.0.25"
}
"@types/node": "^18.0.25"
},
"type": "module"
}

View File

@@ -1,6 +1,6 @@
const { CommandType, commandModule } = require('@sern/handler');
import { CommandType, commandModule } from '@sern/handler';
exports.default = commandModule({
export default commandModule({
type: CommandType.Both,
plugins: [], //optional
description: 'A ping command',

View File

@@ -1,7 +1,7 @@
/// <reference path="dependencies.d.ts" />
const { Client, GatewayIntentBits } = require('discord.js');
const { Sern, single, makeDependencies } = require('@sern/handler');
import 'dotenv/config'
import { Client, GatewayIntentBits } from 'discord.js';
import { Sern, single, makeDependencies } from '@sern/handler';
const client = new Client({
intents: [
@@ -15,21 +15,18 @@ const client = new Client({
/**
* Where all of your dependencies are composed.
* '@sern/client' is usually your Discord Client.
* View documentation for pluggable dependencies
* Use this function to access all of your dependencies.
* This is used for external event modules as well
*/
await makeDependencies(({ add }) => {
add('@sern/client', single(() => client));
});
async function init() {
await makeDependencies(({ add }) => {
add('@sern/client', single(() => client));
});
//View docs for all options
Sern.init({
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
commands: 'src/commands',
// events: 'src/events', //(optional)
});
//View docs for all options
Sern.init({
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
commands: 'src/commands',
// events: 'src/events', //(optional)
});
}
init().then(() => client.login());
client.login();

View File

@@ -1,3 +0,0 @@
/node_modules
/dist
.env

View File

@@ -1,15 +0,0 @@
# How to use
1.) Build
```
npm run build
```
2.) Run
```
node .
```
3.) Publish
```
npm run commands:publish
```

View File

@@ -1,28 +0,0 @@
{
"name": "ts-example",
"version": "1.0.0",
"private": true,
"description": "",
"main": "dist/index.js",
"scripts": {
"build": "sern build",
"start": "node .",
"install": "sern build",
"commands:publish": "sern commands publish"
},
"keywords": [
"typescript",
"sern",
"discord.js"
],
"dependencies": {
"@sern/handler": "^3.0.3",
"discord.js": "latest",
"dotenv": "^16.3.1"
},
"devDependencies": {
"@types/node": "^17.0.25",
"typescript": "^5.0"
},
"type": "module"
}

View File

@@ -1,11 +0,0 @@
import { commandModule, CommandType } from '@sern/handler';
export default commandModule({
type: CommandType.Both,
plugins: [],
description: 'A ping command',
//alias : [],
execute: async (ctx, args) => {
await ctx.reply('Pong 🏓');
},
});

View File

@@ -1,32 +0,0 @@
import 'dotenv/config'
import { Client, GatewayIntentBits } from 'discord.js';
import { Sern, single, makeDependencies } from '@sern/handler';
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent, //Make sure this is enabled for text commands!
],
});
/**
* Where all of your dependencies are composed.
* '@sern/client' is usually your Discord Client.
* Use this function to access all of your dependencies.
* This is used for external event modules as well
*/
await makeDependencies(({ add }) => {
add('@sern/client', single(() => client));
});
//View docs for all options
Sern.init({
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
commands: 'dist/commands',
// events: 'dist/events', //(optional)
});
await client.login()

View File

@@ -1,3 +0,0 @@
{
"extends": "./.sern/tsconfig.json"
}

View File

@@ -1,3 +0,0 @@
/node_modules
/dist
.env

View File

@@ -1 +0,0 @@
# TODO

View File

@@ -1,25 +0,0 @@
{
"name": "ts-example",
"version": "1.0.0",
"description": "",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
"start": "tsc && node ./dist/index.js"
},
"keywords": [
"typescript",
"sern",
"discord.js"
],
"license": "UNLICENSED",
"dependencies": {
"@sern/handler": "^3.0.3",
"discord.js": "latest"
},
"devDependencies": {
"@types/node": "^17.0.25",
"typescript": "5.0"
},
"type": "module"
}

View File

@@ -1,11 +0,0 @@
import { commandModule, CommandType } from '@sern/handler';
export default commandModule({
type: CommandType.Both,
plugins: [],
description: 'A ping command',
//alias : [],
execute: async (ctx, args) => {
await ctx.reply('Pong 🏓');
},
});

View File

@@ -1,31 +0,0 @@
import { Client, GatewayIntentBits } from 'discord.js';
import { Sern, makeDependencies, single } from '@sern/handler';
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent, //Make sure this is enabled for text commands!
],
});
/**
* Where all of your dependencies are composed.
* '@sern/client' is usually your Discord Client.
* Use this function to access all of your dependencies.
* This is used for external event modules as well
*/
await makeDependencies(({ add }) => {
add('@sern/client', single(() => client));
});
//View docs for all options
Sern.init({
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
commands: 'dist/commands',
// events: 'dist/events', //(optional)
});
client.login();

View File

@@ -1,16 +0,0 @@
{
"compilerOptions": {
"moduleResolution": "node",
"resolveJsonModule": true,
"target": "ESNext",
"module": "ESNext",
"outDir": "dist",
"rootDir": "src",
"strict": true,
"esModuleInterop": true,
"noImplicitAny": true,
"strictNullChecks": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
}

View File

@@ -1 +1,15 @@
# TODO
# How to use
1.) Build
```
npm run build
```
2.) Run
```
node .
```
3.) Publish
```
npm run commands:publish
```

View File

@@ -5,8 +5,10 @@
"description": "",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
"start": "tsc && node ./dist/index.js"
"build": "sern build",
"start": "node .",
"install": "sern build",
"commands:publish": "sern commands publish"
},
"keywords": [
"typescript",
@@ -15,10 +17,12 @@
],
"dependencies": {
"@sern/handler": "^3.0.3",
"discord.js": "latest"
"discord.js": "latest",
"dotenv": "^16.3.1"
},
"devDependencies": {
"@types/node": "^17.0.25",
"typescript": "^5.0"
}
},
"type": "module"
}

View File

@@ -1,3 +1,4 @@
import 'dotenv/config'
import { Client, GatewayIntentBits } from 'discord.js';
import { Sern, single, makeDependencies } from '@sern/handler';
@@ -11,23 +12,21 @@ const client = new Client({
});
async function init() {
/**
* Where all of your dependencies are composed.
* '@sern/client' is usually your Discord Client.
* Use this function to access all of your dependencies.
* This is used for external event modules as well
*/
await makeDependencies(({ add }) => {
add('@sern/client', single(() => client));
});
/**
* Where all of your dependencies are composed.
* '@sern/client' is usually your Discord Client.
* Use this function to access all of your dependencies.
* This is used for external event modules as well
*/
await makeDependencies(({ add }) => {
add('@sern/client', single(() => client));
});
//View docs for all options
Sern.init({
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
commands: 'dist/commands',
// events: 'dist/events', //(optional)
});
}
//View docs for all options
Sern.init({
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
commands: 'dist/commands',
// events: 'dist/events', //(optional)
});
init().then(() => client.login())
await client.login()

View File

@@ -1,15 +1,3 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"target": "ESNext",
"module": "CommonJS",
"outDir": "dist",
"rootDir": "src",
"strict": true,
"esModuleInterop": true,
"noImplicitAny": true,
"strictNullChecks": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
"extends": "./.sern/tsconfig.json"
}