Skip to content

Commit

Permalink
feat: merge all tsconfig to tsconfig.json (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lampese authored Feb 24, 2024
1 parent 662f3c5 commit 1117404
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 27 deletions.
37 changes: 12 additions & 25 deletions raw/gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
// === REFRESH TAG = ERROR
// === CONFIGURABLE VARIABLES
import config from './.serein.json' assert { type: 'json' };
const config = getJSON('./.serein.json');
const output = config.output;
const pack_name = config.name;
const behPath = config.behPath;
const resPath = config.resPath;
const behManifestPath = config.behManifestPath;
const scriptsPath = config.scriptsPath;
const useMinecraftPreview = config.mc_preview;
const manifest = JSON.parse(
stripJsonComments(readFileSync(behManifestPath, 'utf-8'))
);
const manifest = getJSON(behManifestPath);
const tsconfig = config.language === 'ts' ? getJSON('./tsconfig.json') : {};
const scriptEntry = (function () {
for (const current of manifest.modules) {
for (const current of manifest.modules)
if (current.type === 'script') return current.entry;
}
return 'script module not found.';
})();
const esbuildConfig = config.esbuild;
const tsconfig = config.tsconfig;
// === END CONFIGURABLE VARIABLES

import os from 'os';
Expand All @@ -31,7 +27,11 @@ import { readFileSync } from 'fs';
import gulpEsbuild from 'gulp-esbuild';
import stripJsonComments from 'strip-json-comments';

const get_mojang_dir = () => {
function getJSON(fileName) {
return stripJsonComments(readFileSync(fileName, 'utf-8'));
}

function get_mojang_dir() {
if (config.mc_dir !== null) return config.mc_dir;
const homeDir = os.homedir();
switch (process.platform) {
Expand All @@ -45,7 +45,7 @@ const get_mojang_dir = () => {
'/.var/app/io.mrarm.mcpelauncher/data/mcpelauncher/games/com.mojang/'
);
}
};
}

const mc_dir = get_mojang_dir();

Expand Down Expand Up @@ -77,20 +77,7 @@ function copy_resource_packs() {
function compile_scripts() {
return gulp
.src(resolve(scriptsPath, '**/*.ts'))
.pipe(
ts(
Object.assign(
{
module: 'es2020',
moduleResolution: 'node',
lib: ['es2020', 'dom'],
strict: true,
target: 'es2020'
},
tsconfig
)
)
)
.pipe(ts(tsconfig))
.pipe(gulp.dest(resolve(output, 'scripts')));
}

Expand Down Expand Up @@ -214,5 +201,5 @@ export {
deploy,
default_action as default,
watch,
compile_scripts as cs,
compile_scripts as cs
};
5 changes: 3 additions & 2 deletions src/base/constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// === CLI INFORMATIONS
const CLI_VERSION = '1.4.4.patch.3';
const CLI_VERSION = '1.4.5';
// === END CLI INFORMATIONS

// === NPM PACKAGES
Expand Down Expand Up @@ -43,6 +43,8 @@ const GULPFILE = 'https://serein.meowshe.com/gulpfile.js';
// === DEFUALT TSCONFIG
const TSCONFIG = {
compilerOptions: {
moduleResolution: 'node',
lib: ['es2020', 'dom'],
target: 'es2020',
module: 'es2020',
noLib: false,
Expand All @@ -54,7 +56,6 @@ const TSCONFIG = {
noImplicitAny: true,
rootDir: '.',
listFiles: false,
moduleResolution: 'node',
noEmitHelpers: true
},
include: [],
Expand Down

0 comments on commit 1117404

Please sign in to comment.