Skip to content

Commit

Permalink
v0.0.20
Browse files Browse the repository at this point in the history
  • Loading branch information
vanvianen committed Jan 3, 2024
1 parent fb924f7 commit 84156c0
Show file tree
Hide file tree
Showing 24 changed files with 213 additions and 66 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.19
0.0.20
2 changes: 1 addition & 1 deletion dist/js/class/DirectoryCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class DirectoryCreator {
for (const dir of directories) {
const dirPath = path_1.default.join(basePath, dir);
await fs_1.promises.mkdir(dirPath, { recursive: true });
console.log(`Directory created or already exists: ${dirPath}`);
// console.log(`Directory created or already exists: ${dirPath}`);
}
}
catch (error) {
Expand Down
13 changes: 10 additions & 3 deletions dist/js/class/JavaScriptMinifier.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@
* Class to minify JavaScript files using Terser.
*/
declare class JavaScriptMinifier {
/**
* Configuration for the JavaScript compiler.
*/
private config;
/**
* Constructs an instance with the provided configuration.
* @param {any} config - Configuration object - minification options for Terser.
* Default configuration for the JavaScript compiler.
*/
private static defaultConfig;
/**
* Constructs an instance with merged configuration of default and custom options.
* @param {any} customConfig - OptionalConfiguration object - minification options for Terser.
*/
constructor(config: any);
constructor(customConfig?: any);
/**
* Minifies a JavaScript file.
* @param {string} inputPath - Path to the input JavaScript file.
Expand Down
19 changes: 15 additions & 4 deletions dist/js/class/JavaScriptMinifier.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"use strict";
// class/JavaScriptMinifier.ts
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
// Copyright 2023 Scape Agency BV
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -16,6 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
// ============================================================================
var terser_1 = require("terser");
var fs_1 = require("fs");
var terser_config_js_1 = __importDefault(require("../config/terser.config.js"));
// ============================================================================
// Classes
// ============================================================================
Expand All @@ -24,11 +28,18 @@ var fs_1 = require("fs");
*/
class JavaScriptMinifier {
/**
* Constructs an instance with the provided configuration.
* @param {any} config - Configuration object - minification options for Terser.
* Default configuration for the JavaScript compiler.
*/
constructor(config) {
this.config = config;
static { this.defaultConfig = terser_config_js_1.default; }
/**
* Constructs an instance with merged configuration of default and custom options.
* @param {any} customConfig - OptionalConfiguration object - minification options for Terser.
*/
constructor(customConfig = {}) {
this.config = {
...JavaScriptMinifier.defaultConfig,
...customConfig
};
}
/**
* Minifies a JavaScript file.
Expand Down
4 changes: 2 additions & 2 deletions dist/js/class/TypeScriptCompiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ var ts_config_js_1 = __importDefault(require("../config/ts.config.js"));
* TypeScriptCompiler class for compiling TypeScript files to JavaScript.
*/
class TypeScriptCompiler {
// private config: ts.CompilerOptions;
// private config: { [key: symbol]: any};
/**
* Default configuration for the TypeScript compiler.
*/
static { this.defaultConfig = ts_config_js_1.default; }
// private static defaultConfig: ts.CompilerOptions = tsConfig;
// private static defaultConfig: CompilerOptions = tsConfig;
// private static defaultConfig: ts.CompilerOptions = tsConfig;
/**
* Constructs an instance with merged configuration of default and custom options.
* @param {any} customConfig - Optional custom configuration object for TypeScript compiler
Expand Down
32 changes: 32 additions & 0 deletions dist/js/config/terser.config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
declare const terserConfig: {
parse: {};
compress: {
drop_console: boolean;
drop_debugger: boolean;
pure_funcs: string[];
arrows: boolean;
};
mangle: {
properties: {
bare_returns: boolean;
html5_comments: boolean;
shebang: boolean;
spidermonkey: boolean;
};
};
format: {
comments: boolean;
beautify: boolean;
};
sourceMap: {};
ecma: number;
enclose: boolean;
keep_classnames: boolean;
keep_fnames: boolean;
ie8: boolean;
module: boolean;
nameCache: null;
safari10: boolean;
toplevel: boolean;
};
export default terserConfig;
71 changes: 71 additions & 0 deletions dist/js/config/terser.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
"use strict";
// config/terser.config.ts
Object.defineProperty(exports, "__esModule", { value: true });
// Copyright 2023 Scape Agency BV
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ============================================================================
// Import
// ============================================================================
// ============================================================================
// Constants
// ============================================================================
// https://terser.org/docs/api-reference/
const terserConfig = {
parse: {
// parse options
},
compress: {
// compress options
drop_console: true, // Remove console.log statements
drop_debugger: true, // Remove debugger statements
pure_funcs: ['console.info', 'console.debug', 'console.warn'], // Remove specific console functions
// defaults (default: true) -- Pass false to disable most default enabled compress transforms. Useful when you only want to enable a few compress options while disabling the rest.
// Class and object literal methods are converted will also be
// converted to arrow expressions if the resultant code is shorter:
// m(){return x} becomes m:()=>x. To do this to regular ES5 functions
// which don't use this or arguments, see unsafe_arrows.
arrows: true
},
mangle: {
// mangle options
// Mangle names for obfuscation and size reduction
// properties: true, // Mangle property names
properties: {
// mangle property options
bare_returns: false, //support top level return statements
html5_comments: true, // (default true)
shebang: true, //(default true) -- support #!command as the first line
spidermonkey: false
}
},
format: {
// format options (can also use `output` for backwards compatibility)
comments: false, // Remove comments to reduce file size
beautify: false
},
sourceMap: {
// source map options
},
// Define ECMAScript target version
ecma: 5, // specify one of: 5, 2015, 2016, etc.
enclose: false, // or specify true, or "args:values"
keep_classnames: false, // Remove class names
keep_fnames: false, // Remove function names
ie8: false,
module: false,
nameCache: null, // or specify a name cache object
safari10: false,
toplevel: true
};
// ============================================================================
// Export
// ============================================================================
exports.default = terserConfig;
1 change: 1 addition & 0 deletions dist/js/function/clean_directory.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
var DirectoryCleaner_js_1 = __importDefault(require("../class/DirectoryCleaner.js"));
var StylizedLogger_js_1 = __importDefault(require("../class/StylizedLogger.js"));
// import CONFIG from '../path/to/config.js'; // Assuming CONFIG is imported from a config file
const directoryCleaner = new DirectoryCleaner_js_1.default();
const logger = new StylizedLogger_js_1.default();
/**
Expand Down
2 changes: 1 addition & 1 deletion dist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pack.gl",
"version": "0.0.19",
"version": "0.0.20",
"description": "Package Builder.",
"keywords": [
"pack.gl",
Expand Down
2 changes: 1 addition & 1 deletion dist/ts/class/DirectoryCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import path from 'path';
for (const dir of directories) {
const dirPath = path.join(basePath, dir);
await fsPromises.mkdir(dirPath, { recursive: true });
console.log(`Directory created or already exists: ${dirPath}`);
// console.log(`Directory created or already exists: ${dirPath}`);
}
} catch (error) {
console.error(`Error creating directories: ${error}`);
Expand Down
28 changes: 21 additions & 7 deletions dist/ts/class/JavaScriptMinifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import { minify } from 'terser';
import { promises as fs } from 'fs';
import terserConfig from "../config/terser.config.js"


// ============================================================================
Expand All @@ -32,15 +33,28 @@ import { promises as fs } from 'fs';
*/
class JavaScriptMinifier {

private config: any;

/**
* Constructs an instance with the provided configuration.
* @param {any} config - Configuration object - minification options for Terser.
* Configuration for the JavaScript compiler.
*/
constructor(config: any) {
this.config = config;
}
private config: any;

/**
* Default configuration for the JavaScript compiler.
*/
private static defaultConfig: any = terserConfig;

/**
* Constructs an instance with merged configuration of default and custom options.
* @param {any} customConfig - OptionalConfiguration object - minification options for Terser.
*/
constructor(
customConfig: any = {},
) {
this.config = {
...JavaScriptMinifier.defaultConfig,
...customConfig
};
}

/**
* Minifies a JavaScript file.
Expand Down
1 change: 1 addition & 0 deletions dist/ts/class/PackageCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { PackageJson } from '../interface/PackageJson.js'
*/
class PackageCreator {


private packageJson: PackageJson;

/**
Expand Down
5 changes: 2 additions & 3 deletions dist/ts/class/TypeScriptCompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@ import tsConfig from "../config/ts.config.js"
/**
* Configuration for the TypeScript compiler.
*/
// private config: ts.CompilerOptions;
private config: any;
// private config: ts.CompilerOptions;
// private config: { [key: symbol]: any};

/**
* Default configuration for the TypeScript compiler.
*/
private static defaultConfig: any = tsConfig;
// private static defaultConfig: ts.CompilerOptions = tsConfig;
// private static defaultConfig: CompilerOptions = tsConfig;
// private static defaultConfig: ts.CompilerOptions = tsConfig;

/**
* Constructs an instance with merged configuration of default and custom options.
Expand Down
2 changes: 1 addition & 1 deletion dist/ts/function/clean_directory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import DirectoryCleaner from '../class/DirectoryCleaner.js';
import StylizedLogger from '../class/StylizedLogger.js';
import CONFIG from '../path/to/config.js'; // Assuming CONFIG is imported from a config file
// import CONFIG from '../path/to/config.js'; // Assuming CONFIG is imported from a config file

const directoryCleaner = new DirectoryCleaner();
const logger = new StylizedLogger();
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pack.gl",
"description": "Package Builder.",
"version": "0.0.19",
"version": "0.0.20",
"config": {
"version_short": "0.0"
},
Expand Down Expand Up @@ -95,7 +95,7 @@
"icon.gl": "^0.0.1",
"loop.gl": "^0.0.1",
"mini-css-extract-plugin": "^2.7.6",
"pack.gl": "^0.0.18",
"pack.gl": "^0.0.19",
"page.gl": "^0.0.1",
"postcss-loader": "^7.3.3",
"postcss-preset-env": "^9.1.2",
Expand Down
Loading

0 comments on commit 84156c0

Please sign in to comment.