Skip to content

Commit

Permalink
cleanup repo: remove built files (.js) and put in an ignored /dist/ f…
Browse files Browse the repository at this point in the history
…older.
  • Loading branch information
jasonswearingen committed Sep 9, 2018
1 parent 461936c commit a3af1a6
Show file tree
Hide file tree
Showing 154 changed files with 286 additions and 11,568 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
dist/
79 changes: 79 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"runtimeArgs": [
"--inspect",
//"--trace-warnings",
],
"args": [
"logLevel=TRACE",
"envLevel=DEV",
"testLevel=NONE",
"logLevelOverrides={'.*connection':'WARN', '.*xlib.dev.core.net.js':'INFO'}",
],
"name": "node-dev",
"runtimeExecutable": "node-dev",
"program": "${workspaceFolder}/dist/_index.js",
"restart": true,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"protocol": "inspector",
"sourceMaps": true,
// "skipFiles": [
// "**/node_modules/**/*.js",
// "**/node_modules/bluebird/**/*.js",
// "**/node_modules/json5/**/*.js",
// "**/node_modules/rx/**/*.js",
// "**/node_modules/inert/**/*.js",
// "**/node_modules/@google-cloud/**/*.js",
// "<node_internals>/**/*.js",
// "**/xlib/dev/core/serialization.ts", //has serialization functions that throw on parse errors
// ],
"showAsyncStacks": true,
"smartStep": true,
"stopOnEntry": false,
},
{
"type": "node",
"request": "launch",
"runtimeArgs": [
"--inspect",
"--watch",
//"--trace-warnings",
],
// "args": [
// "logLevel=TRACE",
// "envLevel=DEV",
// "testLevel=FULL",
// "logLevelOverrides={'.*connection':'WARN', '.*xlib.dev.core.net.js':'INFO'}",
// ],
"name": "mocha watch",
"runtimeExecutable": "mocha",
"program": "${workspaceFolder}/dist/_index.js",
"restart": true,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"protocol": "inspector",
"sourceMaps": true,
"skipFiles": [
"**/node_modules/**/*.js",
// "**/node_modules/bluebird/**/*.js",
// "**/node_modules/json5/**/*.js",
// "**/node_modules/rx/**/*.js",
// "**/node_modules/inert/**/*.js",
// "**/node_modules/@google-cloud/**/*.js",
"<node_internals>/**/*.js",
// "**/xlib/dev/core/serialization.ts", //has serialization functions that throw on parse errors
],
"showAsyncStacks": true,
"smartStep": true,
"stopOnEntry": false,
},
]
}
4 changes: 0 additions & 4 deletions index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion index.d.ts.map

This file was deleted.

6 changes: 0 additions & 6 deletions index.js

This file was deleted.

1 change: 0 additions & 1 deletion index.js.map

This file was deleted.

7 changes: 0 additions & 7 deletions index.ts

This file was deleted.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "xlib",
"version": "10.1.0",
"description": "A Cross Platform, Monolithic Core Library for Typescript.",
"main": "index.js",
"main": "./dist/_index.js",
"types": "./dist/_index.d.ts",
"private": false,
"author": "jason swearingen <jasons@novaleaf.com>",
"dependencies": {
Expand Down Expand Up @@ -50,4 +51,4 @@
"url": "https://github.com/novaleaf/xlib/issues"
},
"homepage": "https://github.com/novaleaf/xlib"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 17 additions & 7 deletions src/init.ts → src/.internal/init.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
/** allows internal xlib modules to hook the xlib.initialize() method */
import promise = require( "./core/promise" );
import * as environment from './core/environment';
import promise = require( "../core/promise" );
import * as environment from '../core/environment';
import bb = promise.bluebird;


export type IInitArgs = {
/** if true, disables overriding settings from the commandline, envVars, or querystring */
disableEnvAutoRead?: boolean,
logLevel?: environment.LogLevel | "TRACE" | "INFO" | "WARN" | "ERROR" | "FATAL",
envLevel?: environment.EnvLevel | "DEV" | "TEST" | "UAT" | "PROD",
testLevel?: environment.TestLevel | "NONE" | "UNIT" | "INTEGRATION" | "SYSTEM" | "ACCEPTANCE",
logLevelOverrides?: { namePattern: RegExp, newLogLevel: environment.LogLevel | "TRACE" | "INFO" | "WARN" | "ERROR" | "FATAL" }[],
suppressStartupMessage?: boolean,
};

export function isInitializeStarted() {
return isStarted;
}

let isStarted = false;
let finishedPromise: promise.IExposedPromise<any>;
let finishedPromise: promise.IExposedPromise<IInitArgs>;

const initWorkArray: Array<promise.IocCallback<any, void>> = [];
const initWorkArray: Array<promise.IocCallback<IInitArgs, void>> = [];

export async function initialize<TArgs>( args?: any ) {
export async function initialize<TArgs>( args?: IInitArgs ) {
args = { ...args };

if ( isStarted ) {
throw new Error( "initialize already started and trying to start it again" );
}
isStarted = true;
finishedPromise = promise.CreateExposedPromise<any>();
finishedPromise = promise.CreateExposedPromise<IInitArgs>();


for ( let i = 0; i < initWorkArray.length; i++ ) {
Expand All @@ -41,7 +51,7 @@ export async function initialize<TArgs>( args?: any ) {


/** do work during the .initialize() call. returning promise yields once all initialize work is complete. */
export async function onInitialize<TArgs>( /**if your code needs to do asynchronous work during initialize, initialize won't finish until the promise is resolved. */ initWork?: promise.IocCallback<TArgs, void> ) {
export async function onInitialize( /**if your code needs to do asynchronous work during initialize, initialize won't finish until the promise is resolved. */ initWork?: promise.IocCallback<IInitArgs, void> ) {

if ( isStarted ) {
throw new Error( "initialize already started and you are trying to schedule init work" );
Expand Down
File renamed without changes.
69 changes: 48 additions & 21 deletions src/xlib.ts → src/_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,22 @@




export type IInitArgs = {} & environment.IInitArgs & diagnostics.logging.IInitArgs;


/** need to do init work serially, at least until after promise initializtaion, so taht bluebird can initialize properly (it can't initialize once a promise has been created) */
const serialInits: Array<( ( args: IInitArgs ) => void )> = [];
const serialInits: Array<( ( args: init.IInitArgs ) => void )> = [];

import jsShims = require( "./core/jsshims" );
serialInits.push( jsShims.initialize );

export import environment = require( "./core/environment" );
import __env = require( "./core/environment" );
serialInits.push( __env.initialize );
serialInits.push( environment.initialize );

export import promise = require( "./core/promise" );
serialInits.push( promise.initialize );

////////////////////// initialization section
import init = require( "./init" );
import init = require( "./.internal/init" );
let isInitializeStarted = false;
export async function initialize( args?: IInitArgs ) {
export async function initialize( args?: init.IInitArgs ) {
args = { ...args };

if ( isInitializeStarted === true ) {
Expand Down Expand Up @@ -58,9 +53,7 @@ export import lolo = require( "./core/lolo" );
export import arrayHelper = require( "./core/arrayhelper" );
export import ClassBase = require( "./core/classbase" );
export import diagnostics = require( "./core/diagnostics" );
import __diag = require( "./core/diagnostics" );
serialInits.push( __diag.logging.initialize );
const log = new __diag.logging.Logger( __filename );
const log = new diagnostics.logging.Logger( __filename );
export import collections = require( "./core/collections" );

/** various math and numerical conversion/manipulation related helper functions */
Expand Down Expand Up @@ -167,8 +160,6 @@ export import string_decoder = require( "string_decoder" );
export import url = require( "url" );

export import definitions = require( "./definitions/definitions" );
import { resolve } from "bluebird";
import { diagnostics, environment } from "..";



Expand Down Expand Up @@ -223,18 +214,18 @@ export abstract class PayloadTemplate<TThis>{
}


serialInits.push( ( args: IInitArgs ) => {
serialInits.push( ( args: init.IInitArgs ) => {

mockMocha.initialize();


if ( lolo.env.isDebug === true || lolo.env.isDev === true ) {
if ( lolo.env.isDebug === true ) {
//try {
///** https://www.npmjs.com/package/source-map-support
// * This module provides source map support for stack traces in node via the V8 stack trace API. It uses the source-map module to replace the paths and line numbers of source-mapped files with their original paths and line numbers. The output mimics node's stack trace format with the goal of making every compile-to-JS language more of a first-class citizen. Source maps are completely general (not specific to any one language) so you can use source maps with multiple compile-to-JS languages in the same node process.
// */
if ( args.suppressStartupMessage !== true ) {
console.log( "loading sourcemap support (in logLevel.DEBUG or envLevel.DEV)" );
console.log( "loading sourcemap support (in logLevel.DEBUG or TRACE" );
}
var source_map_support = require( "source-map-support" );
source_map_support.install( { handleUncaughtExceptions: false } );
Expand All @@ -245,13 +236,49 @@ serialInits.push( ( args: IInitArgs ) => {


//set lodash as a global if it's not.
if ( __env.getGlobal()[ "_" ] == null ) {
__env.getGlobal()[ "_" ] = lodash;
if ( environment.getGlobal()[ "_" ] == null ) {
environment.getGlobal()[ "_" ] = lodash;
}


if ( __env.getGlobal()[ "moment" ] == null ) {
if ( environment.getGlobal()[ "moment" ] == null ) {
//define momentStatic
__env.getGlobal()[ "moment" ] = dateTime.moment;
environment.getGlobal()[ "moment" ] = dateTime.moment;
}
} );


describe( __filename + " basic xlib unit tests", () => {

before( async () => {
await initialize();
} );





it( "logger basic console output", async () => {

const testLogger = new diagnostics.logging.Logger( "test logging" );

testLogger.trace( "traced" );
testLogger.info( "infoed" );
testLogger.warn( "warned" );
testLogger.error( "errored" );

} );

it( "should fail, test log.assert()", () => {
log.assert( false, "assert condition" );
} )


it( "read env", () => {

log.assert( environment.envLevel != null );

} );


} );
27 changes: 0 additions & 27 deletions src/browser/browserhelper.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/browser/browserhelper.d.ts.map

This file was deleted.

Loading

0 comments on commit a3af1a6

Please # to comment.