Skip to content

Commit

Permalink
fix: akk merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
USERSATOSHI committed Jan 14, 2025
1 parent c68eb69 commit 5d6b88e
Show file tree
Hide file tree
Showing 54 changed files with 0 additions and 998 deletions.
6 changes: 0 additions & 6 deletions bin/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ import chalk from 'chalk';
import add from './add.mjs';
import addLicense from './addLicense.mjs';
import run from './run.mjs';
<<<<<<< HEAD
import genTest from './genTest.mjs';
import { init } from './init.mjs';
=======
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb

program
.command('test')
Expand Down Expand Up @@ -69,7 +66,6 @@ program
.action(run);

program
<<<<<<< HEAD
.command('genTest')
.description('generate all tests for the given library')
.requiredOption('-l, --library <library>', 'the library to test')
Expand All @@ -83,8 +79,6 @@ program
.action(init);

program
=======
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
.name(pkg.name)
.version(pkg.version)
.description(pkg.description)
Expand Down
32 changes: 0 additions & 32 deletions bin/test.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import path from 'node:path';
<<<<<<< HEAD
import { exec, spawn } from 'node:child_process';
import chalk from 'chalk';
import { existsSync } from 'node:fs';
Expand All @@ -8,44 +7,26 @@ import { promisify } from 'node:util';

const execAsync = promisify(exec);

=======
import { spawn } from 'node:child_process';
import { pathToFileURL } from 'node:url';
import chalk from 'chalk';
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
/**
* Run all tests for the given library
* @param {object} options - The options object
* @param {string} options.library - The library to test
<<<<<<< HEAD
* @param {string} [options.folder] - The folder to test
* @returns {Promise<void>}
*/
const test = async ({ library, folder }) => {
=======
* @returns {Promise<void>}
*/
const test = async ({ library, folder, reporter }) => {
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
const start = performance.now();
console.log(`Running tests for ${library}`);

// Resolve paths in a cross-platform way
const mainFolder = path.join(process.cwd(), 'lib', library);
<<<<<<< HEAD
=======
const reporterPath = pathToFileURL(
path.join(process.cwd(), 'tools', 'testing', 'testReporter.mjs'),
);
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
const flags = folder ? `--folder=${folder}` : '';
const runnerPath = path.join(
process.cwd(),
'tools',
'testing',
'testRunner.mjs',
);
<<<<<<< HEAD

if (!folder?.endsWith('.test.ts')) {
if (existsSync(mainFolder + '/.tmp')) {
Expand All @@ -72,22 +53,12 @@ const test = async ({ library, folder, reporter }) => {
(folder?.endsWith('.test.ts'))
? `node --import tsx "${runnerPath.toString()}" -- ${flags}` :
`node "${runnerPath.toString()}" -- ${flags}`,
=======
// "glob -c \"tsx --test\" \"./src/**/*.test.ts\""
const spwn = spawn(
// `npx glob -c "tsx --test-reporter="${reporterPath.toString()}" --test" "./src/**/*.test.ts"`,
`node --import tsx "${runnerPath.toString()}" -- ${flags}`,
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
[],
{
stdio: 'inherit',
// Set cwd to the project root
<<<<<<< HEAD
cwd: (!folder?.endsWith('.test.ts'))
? `${mainFolder}/.tmp/src` : `${mainFolder}/src`,
=======
cwd: `${mainFolder}`,
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
shell: true,
},
);
Expand All @@ -113,11 +84,8 @@ const test = async ({ library, folder, reporter }) => {
`Duration: ${((performance.now() - start) / 1000).toFixed(2)}s`,
),
);
<<<<<<< HEAD

if ((!folder?.endsWith('.test.ts'))) await rm(mainFolder + '/.tmp', { recursive: true });
=======
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
});
};

Expand Down
7 changes: 0 additions & 7 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ export default [
{ files: ['**/*.js'], languageOptions: { sourceType: 'commonjs' }, ignorePatterns: ['**/node_modules/**', '**/dist/**'] },

...compat.extends('xo-typescript'),
<<<<<<< HEAD

=======
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
// ...tseslint.configs.stylisticTypeChecked,
{
// enable object curly spacing
Expand Down Expand Up @@ -69,10 +65,7 @@ export default [
allowBitwiseExpressions: true,
},
],
<<<<<<< HEAD
'@typescript-eslint/prefer-ts-expect-error': 'off',
=======
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
},
},
{
Expand Down
4 changes: 0 additions & 4 deletions lib/aoi.js/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ node_modules
dist
coverage
index.mjs
<<<<<<< HEAD
bin/index.mjs
index.js
.tsbuildinfo
pnpm-lock.yaml
=======
index.js
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
4 changes: 0 additions & 4 deletions lib/aoi.js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@
"devDependencies": {
"@types/uglify-js": "^3.17.5",
"@vladfrangu/async_event_emitter": "^2.4.6",
<<<<<<< HEAD
"discord-api-types": "^0.37.100",
"json5": "^2.2.3"
=======
"discord-api-types": "^0.37.100"
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
}
}
22 changes: 0 additions & 22 deletions lib/aoi.js/src/classes/AoiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,10 @@ import {
type ICommandOptions,
type IAoiClientOptions,
} from '@aoi.js/typings/interface.js';
<<<<<<< HEAD
import { type Optional, type CommandTypes, type AsyncFunction } from '@aoi.js/typings/type.js';
import { Client, Partials, type ClientOptions } from 'discord.js';
import * as Events from '@aoi.js/events/index.js';
import { MacrosManager } from '@aoi.js/managers/Macro.js';
=======
import {
type Optional,
type CommandTypes,
} from '@aoi.js/typings/type.js';
import { Client, Partials, type ClientOptions } from 'discord.js';
import * as Events from '@aoi.js/events/index.js';
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb

class AoiClient {
client!: Client;
Expand All @@ -27,10 +18,7 @@ class AoiClient {
managers!: {
commands: CommandManager;
functions: FunctionManager;
<<<<<<< HEAD
macros: MacrosManager;
=======
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
};

readonly #options: IAoiClientOptions;
Expand All @@ -48,10 +36,7 @@ class AoiClient {
this.managers = {
commands: new CommandManager(this),
functions: new FunctionManager(this),
<<<<<<< HEAD
macros: new MacrosManager(this),
=======
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
};
if (options.testMode) return;

Expand All @@ -78,19 +63,14 @@ class AoiClient {
await this.client.login(this.#options.token);
}

<<<<<<< HEAD
command(data: Optional<ICommandOptions, '__path__' | 'type'>) {
=======
command(data: Optional<ICommandOptions, '__path__' | 'type'> ) {
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
if (!data.type) data.type = 'basic' as CommandTypes;
data.__path__ = data.__path__ ?? 'root';

this.managers.commands.add(data as ICommandOptions);
return this;
}

<<<<<<< HEAD
macro(name: string, code: string | AsyncFunction) {
this.managers.macros.add({ name, code });
return this;
Expand All @@ -110,8 +90,6 @@ class AoiClient {
// `;
// }

=======
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
#validateOptions(options: IAoiClientOptions) {
if (options.intents === undefined) {
throw new SyntaxError(
Expand Down
21 changes: 0 additions & 21 deletions lib/aoi.js/src/classes/Command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ export default class Command {
executeAt?: 'guild' | 'dm' | 'both';
// eslint-disable-next-line @typescript-eslint/naming-convention
__compiled__!: AsyncFunction;
<<<<<<< HEAD
// eslint-disable-next-line @typescript-eslint/naming-convention
__rawFnString__!: string;
=======
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb

constructor(data: ICommandOptions, client: AoiClient) {
this.name = data.name;
Expand Down Expand Up @@ -49,18 +46,13 @@ export default class Command {
this[key] = data[key];
}

<<<<<<< HEAD
if (this.code instanceof Function) {
this.__compiled__ = this.code;
// get string representation of the function with the function name
this.__rawFnString__ = `const ${this.name}_func = ${this.code.toString()}
${this.name}_func(__$DISCORD_DATA$__);
`;
} else {
=======
if (this.code instanceof Function) this.__compiled__ = this.code;
else {
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
let channelId: Snowflake | undefined;
if (this.channel) {
if (
Expand All @@ -73,24 +65,17 @@ export default class Command {
name: 'GLOBAL_CHANNEL',
},
asFunction: false,
<<<<<<< HEAD
command: this,
=======
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
}).result;
} else channelId = this.channel;
}

<<<<<<< HEAD


=======
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
const func = transpiler.transpile(this.code, {
sendMessage: true,
reverse: this.reverseRead,
scopeData: {
<<<<<<< HEAD
useChannel: channelId?.includes('__$DISCORD_DATA$__')
? escapeResult(channelId)
: channelId,
Expand All @@ -102,12 +87,6 @@ export default class Command {

this.__compiled__ = func.func!;
this.__rawFnString__ = func.result;
=======
useChannel: channelId?.includes('__$DISCORD_DATA$__') ? escapeResult(channelId) : channelId,
},
});
this.__compiled__ = func.func!;
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
}
}
}
19 changes: 0 additions & 19 deletions lib/aoi.js/src/core/AoiReader.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
<<<<<<< HEAD
import { BundlerCustoms, ErrorCode } from '@aoi.js/typings/enum.js';
import AoiError from './Error.js';
import { type ICommandOptions } from '@aoi.js/typings/interface.js';
import { type Optional } from '@aoi.js/typings/type.js';
import type AoiClient from '@aoi.js/classes/AoiClient.js';
import Command from '@aoi.js/classes/Command.js';
=======
import { BundlerCustoms } from '@aoi.js/typings/enum.js';
import { TranspilerError } from './Error.js';
import { type ICommandOptions } from '@aoi.js/typings/interface.js';
import { type Optional } from '@aoi.js/typings/type.js';
import type AoiClient from '@aoi.js/classes/AoiClient.js';
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb

export default class AoiReader {
_parseEmbeddedJS(code: string) {
Expand Down Expand Up @@ -58,15 +50,11 @@ export default class AoiReader {
}

if (cntr) {
<<<<<<< HEAD
throw AoiError.ReaderError(
ErrorCode.EmbedBracketsMismatch,
'Invalid embedded JS',
code,
);
=======
throw TranspilerError.AoiReaderError('Invalid embedded JS', code);
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
}

return embeds;
Expand Down Expand Up @@ -152,24 +140,17 @@ export default class AoiReader {
code = code.replace(`\${${ejs}}`, BundlerCustoms.EJS);
}

<<<<<<< HEAD
const cmd = new Command(
{ ...this._parseCmd(code), __path__: 'root' },
client,
);
=======
const cmd = this._parseCmd(code);
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
cmd.code = client.transpiler.transpile(cmd.code as string, {
scopeData: {
embeddedJS: embeddedJS,
},
sendMessage: true,
reverse: cmd.reverseRead ?? false,
<<<<<<< HEAD
command: cmd,
=======
>>>>>>> 9d1637b2e80d4bcbd055ccc60a53aa9f1c178bcb
}).func!;

return cmd;
Expand Down
Loading

0 comments on commit 5d6b88e

Please sign in to comment.