@orion-js/core 3.0.31 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE
CHANGED
package/lib/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const safe_1 = __importDefault(require("colors/safe"));
|
|
|
11
11
|
const test_1 = __importDefault(require("./test"));
|
|
12
12
|
require("./handleErrors");
|
|
13
13
|
const version_1 = __importDefault(require("./version"));
|
|
14
|
+
require("dotenv/config");
|
|
14
15
|
const program = new commander_1.Command();
|
|
15
16
|
const run = function (action) {
|
|
16
17
|
return async function (...args) {
|
|
@@ -3,14 +3,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
/**
|
|
9
|
+
* Remove directory recursively
|
|
10
|
+
* @param {string} dir_path
|
|
11
|
+
* @see https://stackoverflow.com/a/42505874/3027390
|
|
12
|
+
*/
|
|
13
|
+
function rimraf(dir_path) {
|
|
14
|
+
if (fs_1.default.existsSync(dir_path)) {
|
|
15
|
+
fs_1.default.readdirSync(dir_path).forEach(function (entry) {
|
|
16
|
+
var entry_path = path_1.default.join(dir_path, entry);
|
|
17
|
+
if (fs_1.default.lstatSync(entry_path).isDirectory()) {
|
|
18
|
+
rimraf(entry_path);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
fs_1.default.unlinkSync(entry_path);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
fs_1.default.rmdirSync(dir_path);
|
|
10
25
|
}
|
|
11
|
-
|
|
26
|
+
}
|
|
27
|
+
async function cleanDirectory() {
|
|
12
28
|
try {
|
|
13
|
-
|
|
29
|
+
const path = `${process.cwd()}/.orion/build`;
|
|
30
|
+
rimraf(path);
|
|
14
31
|
}
|
|
15
32
|
catch { }
|
|
16
33
|
}
|
|
@@ -4,9 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const typescript_1 = __importDefault(require("typescript"));
|
|
7
|
+
const cleanDirectory_1 = __importDefault(require("./cleanDirectory"));
|
|
7
8
|
const getHost_1 = require("./getHost");
|
|
9
|
+
const watchDeletes_1 = require("./watchDeletes");
|
|
8
10
|
async function watchAndCompile(runner) {
|
|
11
|
+
await (0, cleanDirectory_1.default)();
|
|
9
12
|
const host = (0, getHost_1.getHost)(runner);
|
|
10
13
|
typescript_1.default.createWatchProgram(host);
|
|
14
|
+
(0, watchDeletes_1.watchDeletes)();
|
|
11
15
|
}
|
|
12
16
|
exports.default = watchAndCompile;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.watchDeletes = void 0;
|
|
7
|
+
const chokidar_1 = __importDefault(require("chokidar"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
async function watchDeletes() {
|
|
11
|
+
const projectPath = path_1.default.resolve('./app');
|
|
12
|
+
const watcher = chokidar_1.default.watch(projectPath, {
|
|
13
|
+
ignoreInitial: true
|
|
14
|
+
});
|
|
15
|
+
watcher.on('unlink', async (filepath) => {
|
|
16
|
+
if (!filepath.endsWith('.ts'))
|
|
17
|
+
return;
|
|
18
|
+
const relative = path_1.default.relative(process.cwd(), filepath);
|
|
19
|
+
const atBuildPath = path_1.default.resolve('.orion/build', relative.replace(/.ts$/, ''));
|
|
20
|
+
try {
|
|
21
|
+
fs_1.default.unlinkSync(`${atBuildPath}.js`);
|
|
22
|
+
fs_1.default.unlinkSync(`${atBuildPath}.d.ts`);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
console.log(`Error cleaning ${atBuildPath}. Restar project is suggested. Error: ${error.message}`);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.watchDeletes = watchDeletes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-js/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"author": "nicolaslopezj",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
"upgrade-interactive": "yarn upgrade-interactive"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
+
"chokidar": "3.5.3",
|
|
19
20
|
"colors": "^1.4.0",
|
|
20
21
|
"commander": "^8.3.0",
|
|
21
22
|
"comment-json": "^4.1.1",
|
|
23
|
+
"dotenv": "^16.0.0",
|
|
22
24
|
"lodash": "^4.17.21",
|
|
23
25
|
"typescript": "^4.4.4"
|
|
24
26
|
},
|
|
@@ -28,7 +30,7 @@
|
|
|
28
30
|
"engines": {
|
|
29
31
|
"node": ">=14.0.0"
|
|
30
32
|
},
|
|
31
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "36598f7a3c10b52efdce40e8e874e83634f2f22e",
|
|
32
34
|
"devDependencies": {
|
|
33
35
|
"@shelf/jest-mongodb": "^2.1.0"
|
|
34
36
|
}
|