Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

Structure cleaning preparation for 3.0 #265

Merged
merged 38 commits into from
Aug 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a94f494
chore: code quality changes/internals
scarletquasar Jun 12, 2023
e9e8926
chore: base restructuring core
scarletquasar Jul 3, 2023
7769697
chore: updated ignores
scarletquasar Jul 3, 2023
85123b8
chore: added dotnet structural types
scarletquasar Jul 3, 2023
99164b2
chore: code quality implementations
scarletquasar Jul 3, 2023
984d6aa
chore: added miscellaneous structural types
scarletquasar Jul 7, 2023
f93bc48
chore: added miscellaneous structural types
scarletquasar Jul 9, 2023
07e2664
chore: added miscellaneous structural types
scarletquasar Jul 9, 2023
4027b7d
wip for std types implementation in types core
scarletquasar Jul 9, 2023
1ab1723
wip for std types implementation in types core
scarletquasar Jul 9, 2023
4ca62ef
chore(wip): code quality updates
scarletquasar Jul 17, 2023
1cafd1c
fix: removed @ alias to avoid problems
scarletquasar Jul 17, 2023
ebda4d1
fix typos
scarletquasar Jul 18, 2023
08b5eb9
fixed type imports to avoid module fault with webpack
scarletquasar Jul 19, 2023
fb9cf35
chore(Wip): restructuring console module to make result-based outputs…
scarletquasar Jul 20, 2023
0ab8bf8
chore(Wip): console module
scarletquasar Jul 20, 2023
7c2ddd5
chore
scarletquasar Jul 21, 2023
aee4848
feat(wip): console.table result-based logic
scarletquasar Jul 22, 2023
304969f
chore: ConsoleTimer logic
scarletquasar Jul 22, 2023
c025c17
chore(wip): structure reorganization
scarletquasar Jul 23, 2023
faa6562
chore change $ pipe method to and method
scarletquasar Jul 24, 2023
f8663a8
chore fixes
scarletquasar Jul 24, 2023
d819434
fix Result types
scarletquasar Jul 24, 2023
b8d709d
fix typo
scarletquasar Jul 24, 2023
109a962
feat(build): created Node-based core project builder
scarletquasar Jul 29, 2023
f25475b
created help command to core builder
scarletquasar Jul 29, 2023
1be85c1
chore: normalized builder and fixed wrong imports
scarletquasar Jul 29, 2023
887ae50
package changes for melon-types
scarletquasar Jul 29, 2023
b3aa4e0
changed project names
scarletquasar Jul 29, 2023
f979a53
updated native build system
scarletquasar Jul 29, 2023
1114a19
chore
scarletquasar Jul 30, 2023
d3d8731
wip std types
scarletquasar Jul 30, 2023
174baec
chore: improved std typing
scarletquasar Aug 1, 2023
c207228
fix value word
scarletquasar Aug 2, 2023
dee6401
Typings for Std
scarletquasar Aug 3, 2023
7a5b150
Merge branch 'chore/core-structure-clean' of https://github.com/Melon…
scarletquasar Aug 3, 2023
c8281e2
structures update
scarletquasar Aug 5, 2023
5c36829
Structure cleaning for 3.0 (#264)
scarletquasar Aug 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
projects/melon-runtime/Output
projects/melon-core/babel
projects/melon-core/dist
projects/melon-core/types
projects/native/Output
projects/native/bin
projects/native/obj
projects/core/output
node_modules
projects/melon-tests/dist
projects/melon-tests/babel
projects/tests/dist
projects/tests/babel

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
Expand Down
17 changes: 2 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
{
"scripts": {
"_build_core": "cd ./projects/melon-core && npm run build && cd ../..",
"_build_tests": "cd ./projects/melon-tests && npm run build && cd ../..",
"_apply_core_bundle_windows": "xcopy .\\projects\\melon-core\\dist\\core.js .\\projects\\melon-runtime\\MelonRuntime.Core\\Scripts\\core.js /Y",
"_apply_core_bundle_linux": "cp ./projects/melon-core/dist/core.js ./projects/melon-runtime/Melon.Library/Bundle/core.js",
"_apply_tests_bundle_windows": "xcopy .\\projects\\melon-tests\\dist\\tests.js .\\projects\\melon-runtime\\MelonRuntime.Core\\Scripts\\tests.js /Y",
"_apply_tests_bundle_linux": "cp ./projects/melon-tests/dist/tests.js ./projects/melon-runtime/Melon.Library/Bundle/tests.js",
"_build_runtime": "cd ./projects/melon-runtime && npm run build && cd ../..",
"_run": "cd ./projects/melon-runtime && npm run dev && cd ../..",
"build:win": "npm run _build_core && npm run _apply_core_bundle_windows && npm run _build_tests && npm run _apply_tests_bundle_windows && npm run _build_runtime",
"build:linux": "npm run _build_core && npm run _apply_core_bundle_linux && npm run _build_tests && npm run _apply_tests_bundle_linux && npm run _build_runtime",
"dev:win": "npm run build:win && npm run _run",
"dev:linux": "npm run build:linux && npm run _run",
"install-dev:win": "npm run build:win && cd ./projects/melon-runtime && npm i -g -f && cd ../..",
"install-dev:linux": "npm run build:linux && cd ./projects/melon-runtime && npm i -g -f && cd ../..",
"all-benchmarks": "cd ./projects/melon-benchmarks/ && npm run all-benchmarks"
"build": "cd projects/core && npm run build && cd ../native && npm run build",
"dev": "cd projects/native && npm run dev"
}
}
14 changes: 14 additions & 0 deletions projects/core/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"presets": ["@babel/preset-typescript", "@babel/preset-env"],
"plugins": [
[
"module-resolver",
{
"alias": {
"types": "./types",
"logic": "./logic"
}
}
]
]
}
103 changes: 103 additions & 0 deletions projects/core/build-core.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import { spawnSync } from "child_process"
import { mkdirSync, cpSync, rmSync, existsSync } from "fs"

/*
:: [core] building Script
:: =========================
:: Warning: "-i" will overwrite the packages '@babel/core',
:: '@babel/cli' and 'webpack-cli' globally.
*/

export const CHILD_SPAWN_OPTIONS: unknown = {
stdio: "inherit",
shell: true
};

const GLOBAL_INSTALLS = [
"@babel/cli",
"@babel/core",
"webpack-cli"
];

const args = process.argv;
const forceGlobalInstalls = args.includes(" -i ");
const keepCache = args.includes(" -kc ");

if (args.includes(" --help ")) {
console.log(" --kc | Keep the previous build cache")
console.log(" -i | Forces global installs")
process.exit(0);
}

console.log("──────────────────────────────────────────────────────");
console.log("Melon Runtime Builder - Core");
console.log("──────────────────────────────────────────────────────");

if (forceGlobalInstalls) {
console.log("──────────────────────────────────────────────────────");
console.log("Installing Global Dependencies");
console.log("──────────────────────────────────────────────────────");

spawnSync("npm", [
"install",
...GLOBAL_INSTALLS,
"-g",
"-f"
], CHILD_SPAWN_OPTIONS);
}

if (!keepCache) {
console.log("──────────────────────────────────────────────────────");
console.log("Cleaning the previous build...");
console.log("──────────────────────────────────────────────────────");

if (existsSync(__dirname + "\\output")) {
rmSync(__dirname + "\\output", { recursive: true, force: true });
}
}

console.log("──────────────────────────────────────────────────────");
console.log("Installing Local Dependencies...");
console.log("──────────────────────────────────────────────────────");

mkdirSync("output");

spawnSync("npm", [
"install",
"-f"
], CHILD_SPAWN_OPTIONS);

console.log("──────────────────────────────────────────────────────");
console.log("Executing transpiler (TypeScript >> JavaScript)...");
console.log("──────────────────────────────────────────────────────");

spawnSync("echo", ["a"])
spawnSync("npx", [
"babel",
"--extensions",
".ts",
__dirname + "\\",
"--out-dir",
__dirname + "\\output\\js-logic"
], CHILD_SPAWN_OPTIONS);

console.log("──────────────────────────────────────────────────────");
console.log("Executing bundler (JavaScript >> Core bundle)...");
console.log("──────────────────────────────────────────────────────");

spawnSync("npx", [
"webpack",
__dirname + "\\output\\js-logic\\logic\\index.js",
"--config webpack.config.json"
], CHILD_SPAWN_OPTIONS);

console.log("──────────────────────────────────────────────────────");
console.log("Copying output files...");
console.log("──────────────────────────────────────────────────────");

cpSync(__dirname + "\\dist", __dirname + "\\output\\final", { recursive: true, force: true });
rmSync(__dirname + "\\dist", { recursive: true, force: true });

console.log("──────────────────────────────────────────────────────");
console.log("Done.");
console.log("──────────────────────────────────────────────────────");
41 changes: 41 additions & 0 deletions projects/core/logic/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Utilitary imports
import { setupEnvironmentVariables } from "logic/runtime/global-environment-core";
import { addPrototypeExtension } from "./partials/utils/generic/addPrototypeExtension";
import { and } from "logic/runtime/global-extensions";

// Isolated imports
import { _Version } from "./partials/constructors/_Version"

// Module imports
import { console as _console } from "logic/partials/modules/console/console"
import { dotnet } from "./partials/modules/dotnet/dotnet"
import { _crypto } from "./partials/statics/_Crypto"
import { _fs } from "./partials/modules/fs/fs"
import { _guards } from "./partials/modules/guards/_guards"
import { http } from "./partials/modules/http/http"
import { _std } from "./partials/modules/std/_std"
import { _data } from "./partials/modules/data/_data"
import { testing } from "./partials/modules/testing/testing"
import { runtime } from "./partials/modules/runtime/runtime"
import { interopCache } from "./runtime/interop-cache-core";

setupEnvironmentVariables();
addPrototypeExtension(Object, "and", and);

const Melon = {
console: _console,
testing,
std: _std,
data: _data,
guards: _guards,
fs: _fs,
http,
dotnet,
crypto: _crypto,
runtime,
Version: _Version
}

globalThis["Melon"] = Melon;

export { Melon }
Loading