@nu-art/build-and-install 0.204.92 → 0.204.94
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/build-and-install.js +0 -3
- package/core/types/package/package.d.ts +3 -0
- package/package.json +1 -1
- package/v2/phase-runner/PhaseRunner.js +3 -3
- package/v2/unit/core/BaseUnit.d.ts +11 -4
- package/v2/unit/core/BaseUnit.js +53 -5
- package/v2/unit/core/Unit_Python.d.ts +0 -4
- package/v2/unit/core/Unit_Python.js +5 -19
- package/v2/unit/core/Unit_Typescript.js +3 -3
- package/v2/unit/core/Unit_TypescriptLib.js +13 -21
- package/v2/unit/core/Unit_TypescriptProject.js +16 -8
- package/v2/unit/firebase-units/Unit_FirebaseFunctionsApp.js +17 -28
- package/v2/unit/firebase-units/Unit_FirebaseHostingApp.js +13 -19
- package/v2/unit/tools/tools.d.ts +2 -0
- package/v2/unit/tools/tools.js +16 -0
- package/logic/ProjectManager.d.ts +0 -49
- package/logic/ProjectManager.js +0 -271
- package/logic/command-executors/CommandExecutor_FirebaseFunction.d.ts +0 -21
- package/logic/command-executors/CommandExecutor_FirebaseFunction.js +0 -71
- package/logic/command-executors/CommandExecutor_FirebaseHosting.d.ts +0 -13
- package/logic/command-executors/CommandExecutor_FirebaseHosting.js +0 -48
- package/logic/command-executors/CommandExecutor_Python.d.ts +0 -15
- package/logic/command-executors/CommandExecutor_Python.js +0 -53
- package/logic/command-executors/index.d.ts +0 -2
- package/logic/command-executors/index.js +0 -18
- package/logic/map-project-packages.d.ts +0 -4
- package/logic/map-project-packages.js +0 -128
- package/phases/phases.d.ts +0 -24
- package/phases/phases.js +0 -775
- package/project-manager.d.ts +0 -4
- package/project-manager.js +0 -9
- package/screen/ProjectScreen.d.ts +0 -31
- package/screen/ProjectScreen.js +0 -140
- package/screen/RunningProcessLogs.d.ts +0 -17
- package/screen/RunningProcessLogs.js +0 -137
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mapProjectPackages = exports.convertToRuntimePackage = exports.convertPackageJSONTemplateToPackJSON_Value = void 0;
|
|
4
|
-
const consts_1 = require("../core/consts");
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
|
-
const types_1 = require("../core/types");
|
|
7
|
-
const ts_common_1 = require("@nu-art/ts-common");
|
|
8
|
-
const tools_1 = require("@nu-art/commando/shell/tools");
|
|
9
|
-
function getRuntimePackageBaseDetails_Sourceless(basePackage) {
|
|
10
|
-
return {
|
|
11
|
-
name: basePackage.name,
|
|
12
|
-
path: (0, tools_1.convertToFullPath)(basePackage.path),
|
|
13
|
-
type: basePackage.type,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function getRuntimePackageBaseDetails_Lib(basePackage) {
|
|
17
|
-
var _a, _b;
|
|
18
|
-
const packageRoot = (0, tools_1.convertToFullPath)(basePackage.path);
|
|
19
|
-
return {
|
|
20
|
-
name: basePackage.name,
|
|
21
|
-
path: packageRoot,
|
|
22
|
-
type: basePackage.type,
|
|
23
|
-
output: (0, tools_1.convertToFullPath)(basePackage.output, packageRoot),
|
|
24
|
-
customTsConfig: (_a = basePackage.customTsConfig) !== null && _a !== void 0 ? _a : false,
|
|
25
|
-
sources: (_b = basePackage.sources) !== null && _b !== void 0 ? _b : []
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function getRuntimePackageBaseDetails_Firebase(basePackage) {
|
|
29
|
-
var _a, _b, _c;
|
|
30
|
-
const packageRoot = (0, tools_1.convertToFullPath)(basePackage.path);
|
|
31
|
-
return {
|
|
32
|
-
name: basePackage.name,
|
|
33
|
-
path: packageRoot,
|
|
34
|
-
type: basePackage.type,
|
|
35
|
-
output: (0, tools_1.convertToFullPath)(basePackage.output, packageRoot),
|
|
36
|
-
customTsConfig: (_a = basePackage.customTsConfig) !== null && _a !== void 0 ? _a : false,
|
|
37
|
-
sources: (_b = basePackage.sources) !== null && _b !== void 0 ? _b : [],
|
|
38
|
-
envConfig: (_c = basePackage.envConfig) !== null && _c !== void 0 ? _c : {},
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function getRuntimePackageBaseDetails(basePackage) {
|
|
42
|
-
switch (basePackage.type) {
|
|
43
|
-
case types_1.PackageType_Sourceless:
|
|
44
|
-
return getRuntimePackageBaseDetails_Sourceless(basePackage);
|
|
45
|
-
case types_1.PackageType_ProjectLib:
|
|
46
|
-
case types_1.PackageType_InfraLib:
|
|
47
|
-
return getRuntimePackageBaseDetails_Lib(basePackage);
|
|
48
|
-
case types_1.PackageType_FirebaseFunctionsApp:
|
|
49
|
-
case types_1.PackageType_FirebaseHostingApp:
|
|
50
|
-
return getRuntimePackageBaseDetails_Firebase(basePackage);
|
|
51
|
-
default:
|
|
52
|
-
throw new ts_common_1.ImplementationMissingException(`Missin runtime package converter for package of type ${basePackage.type}`);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
function convertPackageJSONTemplateToPackJSON_Value(template, value) {
|
|
56
|
-
let workspacePackageJsonAsString = (0, ts_common_1.__stringify)(template, true);
|
|
57
|
-
let match = null;
|
|
58
|
-
do {
|
|
59
|
-
match = workspacePackageJsonAsString.match(/"(.*?)": ?"\$([A-Z_]+?)"/);
|
|
60
|
-
if (match === null || match === void 0 ? void 0 : match[0])
|
|
61
|
-
workspacePackageJsonAsString = workspacePackageJsonAsString.replace(new RegExp(`\\$${match[2]}`), value(match[2], match[1]));
|
|
62
|
-
} while (match);
|
|
63
|
-
const packageJson = JSON.parse(workspacePackageJsonAsString);
|
|
64
|
-
return packageJson;
|
|
65
|
-
}
|
|
66
|
-
exports.convertPackageJSONTemplateToPackJSON_Value = convertPackageJSONTemplateToPackJSON_Value;
|
|
67
|
-
function convertToRuntimePackage(basePackage, project) {
|
|
68
|
-
const runtimePackage = getRuntimePackageBaseDetails(basePackage);
|
|
69
|
-
//Get template package json
|
|
70
|
-
if (!(0, fs_1.existsSync)(runtimePackage.path))
|
|
71
|
-
throw new Error(`package: ${runtimePackage.path} is missing the ${consts_1.CONST_PackageJSONTemplate} files`);
|
|
72
|
-
const pjTemplate = JSON.parse((0, fs_1.readFileSync)(`${runtimePackage.path}/${consts_1.CONST_PackageJSONTemplate}`, 'utf-8'));
|
|
73
|
-
return Object.assign(Object.assign({}, runtimePackage), { packageJsonTemplate: pjTemplate });
|
|
74
|
-
}
|
|
75
|
-
exports.convertToRuntimePackage = convertToRuntimePackage;
|
|
76
|
-
function mapProjectPackages(projectConfig) {
|
|
77
|
-
const packages = projectConfig.packages.filter(pkg => pkg.type !== types_1.PackageType_Python).map(basePackage => convertToRuntimePackage(basePackage, projectConfig));
|
|
78
|
-
const pythonPackages = projectConfig.packages.filter(pkg => pkg.type === types_1.PackageType_Python);
|
|
79
|
-
const packagesDependency = groupPackagesByDependencyLevel(packages);
|
|
80
|
-
packagesDependency.push(pythonPackages);
|
|
81
|
-
return Object.assign(Object.assign({}, projectConfig), { packages: [...packages, ...pythonPackages], packagesDependency, packageMap: (0, ts_common_1.arrayToMap)(packages, p => p.packageJsonTemplate.name) });
|
|
82
|
-
}
|
|
83
|
-
exports.mapProjectPackages = mapProjectPackages;
|
|
84
|
-
function groupPackagesByDependencyLevel(packages) {
|
|
85
|
-
const packageNames = packages.map(p => p.packageJsonTemplate.name);
|
|
86
|
-
const packagesConfigWithDependencies = packages
|
|
87
|
-
.map(_package => {
|
|
88
|
-
const packageDependencies = packageNames.filter(name => { var _a; return (_a = _package.packageJsonTemplate.dependencies) === null || _a === void 0 ? void 0 : _a[name]; });
|
|
89
|
-
return Object.assign({ packageDependencies }, _package);
|
|
90
|
-
});
|
|
91
|
-
// Map to keep track of each package's level
|
|
92
|
-
const levels = new Map();
|
|
93
|
-
// Function to recursively find the level of a package
|
|
94
|
-
function findLevel(pkgName, visited = new Set()) {
|
|
95
|
-
if (visited.has(pkgName)) {
|
|
96
|
-
throw new Error(`Circular dependency detected for package ${pkgName}`);
|
|
97
|
-
}
|
|
98
|
-
visited.add(pkgName);
|
|
99
|
-
const pkg = packagesConfigWithDependencies.find(p => p.packageJsonTemplate.name === pkgName);
|
|
100
|
-
if (!pkg)
|
|
101
|
-
throw new Error(`Package ${pkgName} not found`);
|
|
102
|
-
// A package with no dependencies is at level 0
|
|
103
|
-
if (pkg.packageDependencies.length === 0)
|
|
104
|
-
return 0;
|
|
105
|
-
// Find the maximum level among dependencies
|
|
106
|
-
const maxDependencyLevel = Math.max(...pkg.packageDependencies.map(dep => findLevel(dep, new Set(visited))));
|
|
107
|
-
return 1 + maxDependencyLevel;
|
|
108
|
-
}
|
|
109
|
-
// Determine the level of each package
|
|
110
|
-
packagesConfigWithDependencies.forEach(pkg => {
|
|
111
|
-
const level = findLevel(pkg.packageJsonTemplate.name);
|
|
112
|
-
levels.set(pkg.packageJsonTemplate.name, level);
|
|
113
|
-
});
|
|
114
|
-
// Group packages by their level
|
|
115
|
-
const groupedPackages = new Map();
|
|
116
|
-
levels.forEach((level, pkgName) => {
|
|
117
|
-
const pkg = packages.find(p => p.packageJsonTemplate.name === pkgName);
|
|
118
|
-
if (pkg) {
|
|
119
|
-
if (!groupedPackages.has(level)) {
|
|
120
|
-
groupedPackages.set(level, []);
|
|
121
|
-
}
|
|
122
|
-
groupedPackages.get(level).push(pkg);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
// Sort and convert the grouped packages into a sorted array of arrays
|
|
126
|
-
const sortedLevels = Array.from(groupedPackages.keys()).sort((a, b) => a - b);
|
|
127
|
-
return sortedLevels.map(level => groupedPackages.get(level));
|
|
128
|
-
}
|
package/phases/phases.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { BuildPhase } from '../logic/ProjectManager';
|
|
2
|
-
export declare const Phase_PrintHelp: BuildPhase;
|
|
3
|
-
export declare const Phase_SetWithThunderstorm: BuildPhase;
|
|
4
|
-
export declare const Phase_SetupProject: BuildPhase;
|
|
5
|
-
export declare const Phase_PrepareParams: BuildPhase;
|
|
6
|
-
export declare const Phase_ResolveTemplate: BuildPhase;
|
|
7
|
-
export declare const Phase_ResolveEnv: BuildPhase;
|
|
8
|
-
export declare const Phase_ResolvePackages: BuildPhase;
|
|
9
|
-
export declare const Phase_PrintDependencyTree: BuildPhase;
|
|
10
|
-
export declare const Phase_CheckCyclicImports: BuildPhase;
|
|
11
|
-
export declare const Phase_PrintEnv: BuildPhase;
|
|
12
|
-
export declare const Phase_PackagePurge: BuildPhase;
|
|
13
|
-
export declare const Phase_InstallGlobals: BuildPhase;
|
|
14
|
-
export declare const Phase_InstallPackages: BuildPhase;
|
|
15
|
-
export declare const Phase_InstallPythonPackages: BuildPhase;
|
|
16
|
-
export declare const Phase_Lint: BuildPhase;
|
|
17
|
-
export declare const Phase_Debug: BuildPhase;
|
|
18
|
-
export declare const Phase_PrepareCompile: BuildPhase;
|
|
19
|
-
export declare const Phase_PreCompile: BuildPhase;
|
|
20
|
-
export declare const Phase_Compile: BuildPhase;
|
|
21
|
-
export declare const Phase_CompileWatch: BuildPhase;
|
|
22
|
-
export declare const Phase_Launch: BuildPhase;
|
|
23
|
-
export declare const Phase_DeployFrontend: BuildPhase;
|
|
24
|
-
export declare const Phase_DeployBackend: BuildPhase;
|