Socket
Socket
Sign inDemoInstall

nodart

Package Overview
Dependencies
364
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.3.4 to 3.3.5

7

core/app_config.ts

@@ -138,7 +138,8 @@ import {$, fs, object} from '../utils'

private validate() {
this._config.rootDir = $.trimPath(this._config.rootDir)
if (!this._config.rootDir || !fs.isDir(this._config.rootDir)) {
this._config.rootDir = fs.path($.trimPath(this._config.rootDir))
if (!this._config.rootDir || !fs.isDir(this._config.rootDir))
throw new RuntimeException('AppConfig: The App Root directory is not defined or does not exist.')
}
}

@@ -145,0 +146,0 @@ }

@@ -140,11 +140,11 @@ import {$, fs} from '../utils'

getRepo(rootDir?: string): string {
getRepo(rootDir?: string, repoName?: string): string {
rootDir ||= this._app.rootDir
const repo = this.repository
repoName ||= this.repository
if (!repo) return ''
if (!repoName) return ''
const path = fs.path(rootDir, repo)
const path = fs.path(rootDir, repoName)

@@ -151,0 +151,0 @@ this._app.isStart || fs.isDir(path) || fs.mkDeepDir(path)

@@ -17,3 +17,3 @@ import {AppListener, AppStore} from "./app_store";

import {HttpClient} from "./http_client";
import {fs} from "../utils";
import {fs, $} from "../utils";

@@ -66,3 +66,3 @@ const events = require('../store/system').events

return fs.path(this.config.get.rootDir)
return this.config.get.rootDir
}

@@ -318,3 +318,3 @@

const buildDir = fs.path(this.app.rootDir, buildDirName)
const buildDir = fs.path(this.app.factory.baseDir, buildDirName)

@@ -357,2 +357,9 @@ const tsConfig = this.app.factory.tsConfig

}
substractRootDir(buildDir: string, rootDir: string) {
const substract = $.trimPath(rootDir.replace(this.app.factory.baseDir, ''))
return substract ? fs.path(buildDir, substract) : buildDir
}
}
import {App} from "./app";
import {$, fs, object} from "../utils"
import {DEFAULT_CMD_COMMANDS_DIR, DEFAULT_CMD_DIR} from "./app_config";
import {DEFAULT_CMD_COMMANDS_DIR, DEFAULT_CMD_DIR, getSourcesDir} from "./app_config";
import {Command, CommandList, CommandExecutor, CommandSource} from "../interfaces/cmd";

@@ -31,3 +31,5 @@ import {FunctionArgumentParseData} from "../interfaces/object";

constructor(readonly app: App) {
this.parser = new CommandLineParser()
CommandLine._state = this

@@ -37,2 +39,3 @@ }

get command(): Command {
return this._command ||= CommandLineParser.parseCommand()

@@ -42,2 +45,3 @@ }

get appCmdDir() {
return fs.formatPath(fs.path(this.app.rootDir, DEFAULT_CMD_DIR))

@@ -47,5 +51,16 @@ }

get commandsDirectory() {
return fs.path(this.appCmdDir, (this.app.config.get.cli.commandDirName || DEFAULT_CMD_COMMANDS_DIR))
}
lock() {
CommandLine._lock = true
}
unlock() {
CommandLine._lock = false
}
commandList(directory?: string): CommandList {

@@ -87,2 +102,3 @@

get state(): CommandLine {
return CommandLine._state

@@ -92,26 +108,4 @@ }

get system() {
const commandsDir = fs.path(SYSTEM_BIN_DIR, DEFAULT_CMD_COMMANDS_DIR)
return {
commandsDir,
source: (commandName?: string) => this.getCommandSource(commandName, commandsDir),
commands: () => this.commandList(commandsDir),
run: (commandName?: string) => this.run(commandName, commandsDir),
fetchAppState: (app: App) => {
CommandLine._lock = true
fs.include(this.appCmdDir, {
error: () => fs.include(fs.path(app.builder.buildDir, DEFAULT_CMD_DIR))
})
Object.assign(app, this.state.app)
CommandLine._lock = false
return this.state
},
buildApp: (app: App, exitOnError: boolean = true) => {
const dist = app.builder.buildDir
app.builder.build(() => {
console.error('The App build directory does not exist.')
exitOnError && process.exit(1)
})
fs.isDir(dist) && app.config.set({rootDir: dist})
}
}
return new SystemCommandLine(this)
}

@@ -150,2 +144,77 @@

class SystemCommandLine {
protected _commandsDir: string
constructor(readonly cmd: CommandLine) {
this._commandsDir = fs.path(SYSTEM_BIN_DIR, DEFAULT_CMD_COMMANDS_DIR)
}
get commandsDir() {
return this._commandsDir
}
init() {
const repo = fs.path(this.cmd.app.factory.baseDir, DEFAULT_CMD_DIR)
const cmdDir = fs.path(repo, this.cmd.app.config.get.cli.commandDirName || DEFAULT_CMD_COMMANDS_DIR)
const dest = repo + '/index.js'
fs.isFile(dest) || fs.copy(getSourcesDir(DEFAULT_CMD_DIR + '/index.js'), dest)
fs.isDir(cmdDir) || fs.mkDeepDir(cmdDir)
return this.cmd
}
source(commandName?: string) {
return this.cmd.getCommandSource(commandName, this.commandsDir)
}
commands() {
return this.cmd.commandList(this.commandsDir)
}
run(commandName?: string) {
return this.cmd.run(commandName, this.commandsDir)
}
fetchAppState(app: App) {
this.cmd.lock()
fs.include(this.cmd.appCmdDir, {error: () => fs.include(fs.path(app.builder.buildDir, DEFAULT_CMD_DIR))})
Object.assign(app, this.cmd.state.app)
this.cmd.unlock()
return this.cmd.state
}
buildApp(app: App, exitOnError: boolean = true) {
const dist = app.builder.buildDir
const rootDir = app.builder.substractRootDir(dist, app.rootDir)
app.builder.build(() => {
console.error('The App build directory does not exist.')
exitOnError && process.exit(1)
})
fs.isDir(rootDir) && app.config.set({rootDir})
}
}
export class CommandLineParser {

@@ -152,0 +221,0 @@

@@ -127,6 +127,5 @@ "use strict";

validate() {
this._config.rootDir = utils_1.$.trimPath(this._config.rootDir);
if (!this._config.rootDir || !utils_1.fs.isDir(this._config.rootDir)) {
this._config.rootDir = utils_1.fs.path(utils_1.$.trimPath(this._config.rootDir));
if (!this._config.rootDir || !utils_1.fs.isDir(this._config.rootDir))
throw new exception_2.RuntimeException('AppConfig: The App Root directory is not defined or does not exist.');
}
}

@@ -133,0 +132,0 @@ }

@@ -97,8 +97,8 @@ "use strict";

}
getRepo(rootDir) {
getRepo(rootDir, repoName) {
rootDir || (rootDir = this._app.rootDir);
const repo = this.repository;
if (!repo)
repoName || (repoName = this.repository);
if (!repoName)
return '';
const path = utils_1.fs.path(rootDir, repo);
const path = utils_1.fs.path(rootDir, repoName);
this._app.isStart || utils_1.fs.isDir(path) || utils_1.fs.mkDeepDir(path);

@@ -105,0 +105,0 @@ return path;

@@ -36,3 +36,3 @@ "use strict";

get rootDir() {
return utils_1.fs.path(this.config.get.rootDir);
return this.config.get.rootDir;
}

@@ -199,3 +199,3 @@ get(loader) {

const buildDirName = this.app.config.get.buildDirName || app_config_1.DEFAULT_APP_BUILD_DIR;
const buildDir = utils_1.fs.path(this.app.rootDir, buildDirName);
const buildDir = utils_1.fs.path(this.app.factory.baseDir, buildDirName);
const tsConfig = this.app.factory.tsConfig;

@@ -226,4 +226,8 @@ return ((_a = tsConfig === null || tsConfig === void 0 ? void 0 : tsConfig.compilerOptions) === null || _a === void 0 ? void 0 : _a.outDir) === buildDirName ? buildDir : null;

}
substractRootDir(buildDir, rootDir) {
const substract = utils_1.$.trimPath(rootDir.replace(this.app.factory.baseDir, ''));
return substract ? utils_1.fs.path(buildDir, substract) : buildDir;
}
}
exports.AppBuilder = AppBuilder;
//# sourceMappingURL=app.js.map

@@ -33,2 +33,8 @@ "use strict";

}
lock() {
CommandLine._lock = true;
}
unlock() {
CommandLine._lock = false;
}
commandList(directory) {

@@ -64,26 +70,3 @@ directory || (directory = this.commandsDirectory);

get system() {
const commandsDir = utils_1.fs.path(exports.SYSTEM_BIN_DIR, app_config_1.DEFAULT_CMD_COMMANDS_DIR);
return {
commandsDir,
source: (commandName) => this.getCommandSource(commandName, commandsDir),
commands: () => this.commandList(commandsDir),
run: (commandName) => this.run(commandName, commandsDir),
fetchAppState: (app) => {
CommandLine._lock = true;
utils_1.fs.include(this.appCmdDir, {
error: () => utils_1.fs.include(utils_1.fs.path(app.builder.buildDir, app_config_1.DEFAULT_CMD_DIR))
});
Object.assign(app, this.state.app);
CommandLine._lock = false;
return this.state;
},
buildApp: (app, exitOnError = true) => {
const dist = app.builder.buildDir;
app.builder.build(() => {
console.error('The App build directory does not exist.');
exitOnError && process.exit(1);
});
utils_1.fs.isDir(dist) && app.config.set({ rootDir: dist });
}
};
return new SystemCommandLine(this);
}

@@ -122,2 +105,44 @@ run(commandName, directory, onGetExecutor) {

CommandLine._lock = false;
class SystemCommandLine {
constructor(cmd) {
this.cmd = cmd;
this._commandsDir = utils_1.fs.path(exports.SYSTEM_BIN_DIR, app_config_1.DEFAULT_CMD_COMMANDS_DIR);
}
get commandsDir() {
return this._commandsDir;
}
init() {
const repo = utils_1.fs.path(this.cmd.app.factory.baseDir, app_config_1.DEFAULT_CMD_DIR);
const cmdDir = utils_1.fs.path(repo, this.cmd.app.config.get.cli.commandDirName || app_config_1.DEFAULT_CMD_COMMANDS_DIR);
const dest = repo + '/index.js';
utils_1.fs.isFile(dest) || utils_1.fs.copy((0, app_config_1.getSourcesDir)(app_config_1.DEFAULT_CMD_DIR + '/index.js'), dest);
utils_1.fs.isDir(cmdDir) || utils_1.fs.mkDeepDir(cmdDir);
return this.cmd;
}
source(commandName) {
return this.cmd.getCommandSource(commandName, this.commandsDir);
}
commands() {
return this.cmd.commandList(this.commandsDir);
}
run(commandName) {
return this.cmd.run(commandName, this.commandsDir);
}
fetchAppState(app) {
this.cmd.lock();
utils_1.fs.include(this.cmd.appCmdDir, { error: () => utils_1.fs.include(utils_1.fs.path(app.builder.buildDir, app_config_1.DEFAULT_CMD_DIR)) });
Object.assign(app, this.cmd.state.app);
this.cmd.unlock();
return this.cmd.state;
}
buildApp(app, exitOnError = true) {
const dist = app.builder.buildDir;
const rootDir = app.builder.substractRootDir(dist, app.rootDir);
app.builder.build(() => {
console.error('The App build directory does not exist.');
exitOnError && process.exit(1);
});
utils_1.fs.isDir(rootDir) && app.config.set({ rootDir });
}
}
class CommandLineParser {

@@ -124,0 +149,0 @@ static parseCommand() {

@@ -6,24 +6,13 @@ "use strict";

const cmd_1 = require("../core/cmd");
const app_config_1 = require("../core/app_config");
const utils_1 = require("../utils");
class CommandLineLoader extends app_loader_1.AppLoader {
constructor() {
super(...arguments);
this._repository = app_config_1.DEFAULT_CMD_DIR;
}
_onCall(target, args) {
}
_onGenerate(repository) {
const cmdDir = utils_1.fs.path(repository, this._app.config.get.cli.commandDirName || app_config_1.DEFAULT_CMD_COMMANDS_DIR);
this._loadSource();
utils_1.fs.isDir(cmdDir) || utils_1.fs.mkDeepDir(cmdDir);
this._init();
}
_resolve(target, args) {
var _a;
this._loadSource();
return new cmd_1.CommandLine((_a = args === null || args === void 0 ? void 0 : args[0]) !== null && _a !== void 0 ? _a : this._app);
return this._init();
}
_loadSource() {
const dest = this.getRepo() + '/index.js';
utils_1.fs.isFile(dest) || utils_1.fs.copy((0, app_config_1.getSourcesDir)('cmd/index.js'), dest);
_init(app) {
return new cmd_1.CommandLine(app !== null && app !== void 0 ? app : this._app).system.init();
}

@@ -30,0 +19,0 @@ }

@@ -63,3 +63,3 @@ "use strict";

trimPath(pathLike) {
return this.trim(pathLike, ['/', '\\']);
return (pathLike === null || pathLike === void 0 ? void 0 : pathLike.trim().replace(/^[\\|\/]*/g, '').replace(/[\\|\/]*$/g, '')) || '';
},

@@ -66,0 +66,0 @@ prettyNumber(x) {

@@ -93,3 +93,7 @@ "use strict";

const formatPath = (path) => index_1.$.trimPath(path !== null && path !== void 0 ? path : '').replace(/\\/g, '/').replace(/\/$/, '');
const path = (path, to = '') => _path.resolve(path, to);
const path = (path, to = '') => {
return to
? _path.resolve(path, to)
: _path.join(path.startsWith(_path.sep) ? path : _path.sep === '/' ? '/' + path : path, '');
};
const skipExtension = (path) => path.replace(/\.[a-z\d]+$/i, '');

@@ -96,0 +100,0 @@ module.exports = {

@@ -0,10 +1,7 @@

import {App} from "../core/app";
import {AppLoader} from "../core/app_loader";
import {CommandLine} from "../core/cmd";
import {DEFAULT_CMD_DIR, DEFAULT_CMD_COMMANDS_DIR, getSourcesDir} from "../core/app_config";
import {fs} from "../utils";
export class CommandLineLoader extends AppLoader {
protected _repository = DEFAULT_CMD_DIR
protected _onCall(target: any, args?: any[]): void {

@@ -15,7 +12,3 @@ }

const cmdDir = fs.path(repository, this._app.config.get.cli.commandDirName || DEFAULT_CMD_COMMANDS_DIR)
this._loadSource()
fs.isDir(cmdDir) || fs.mkDeepDir(cmdDir)
this._init()
}

@@ -25,14 +18,10 @@

this._loadSource()
return new CommandLine(args?.[0] ?? this._app)
return this._init()
}
protected _loadSource() {
protected _init(app?: App) {
const dest = this.getRepo() + '/index.js'
fs.isFile(dest) || fs.copy(getSourcesDir('cmd/index.js'), dest)
return new CommandLine(app ?? this._app).system.init()
}
}
{
"name": "nodart",
"version": "3.3.4",
"description": "typescript backend framework",
"version": "3.3.5",
"description": "A complete framework for creating microservices and large-scale server-side applications for businesses",
"repository": {

@@ -36,14 +36,19 @@ "type": "git",

"devDependencies": {
"@types/node": "^17.0.35",
"@types/node": "^18.11.3",
"copy-dir": "^1.3.0",
"nodart": "^3.3.1",
"nodemon": "^2.0.15",
"typescript": "^4.6.4"
"nodart": "^3.3.4",
"nodemon": "^2.0.20",
"typescript": "^4.8.4"
},
"keywords": [
"ts framework",
"typescript framework",
"node.js framework"
"framework",
"ts",
"ECMAScript",
"JavaScript",
"typescript",
"back-end",
"server-side",
"node.js"
],
"bin": "bin/index.js"
}

@@ -6,3 +6,3 @@

<h3 align="center">NodArt - The Art of Node.js.</h3>
<h3 align="center">A complete web framework
<h3 align="center">A complete framework
<br/>

@@ -61,2 +61,8 @@ for creating microservices and

### System requirements:
* OS Linux or Windows
* Node.js >= **v16.14.2**
#### 1. GIT

@@ -63,0 +69,0 @@

@@ -12,3 +12,3 @@ {

"dependencies": {
"nodart": "^3.3.3"
"nodart": "^3.3.5"
},

@@ -15,0 +15,0 @@ "devDependencies": {

@@ -6,2 +6,8 @@

### System requirements:
* OS Linux or Windows
* Node.js >= **v16.14.2**
### 1. GIT

@@ -8,0 +14,0 @@

@@ -12,3 +12,3 @@ {

"dependencies": {
"nodart": "^3.3.3",
"nodart": "^3.3.5",
"ts-node": "^10.8.0"

@@ -15,0 +15,0 @@ },

@@ -6,2 +6,8 @@

### System requirements:
* OS Linux or Windows
* Node.js >= **v16.14.2**
### 1. GIT

@@ -8,0 +14,0 @@

@@ -80,3 +80,3 @@ export = {

return this.trim(pathLike, ['/', '\\'])
return pathLike?.trim().replace(/^[\\|\/]*/g, '').replace(/[\\|\/]*$/g, '') || ''
},

@@ -83,0 +83,0 @@

@@ -134,3 +134,7 @@ import {$, object} from './index'

const path = (path: string, to: string = '') => _path.resolve(path, to)
const path = (path: string, to: string = '') => {
return to
? _path.resolve(path, to)
: _path.join(path.startsWith(_path.sep) ? path : _path.sep === '/' ? '/' + path : path, '')
}

@@ -137,0 +141,0 @@ const skipExtension = (path: string) => path.replace(/\.[a-z\d]+$/i, '')

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc