fix(core): update

This commit is contained in:
Philipp Kunz 2023-08-24 17:25:55 +02:00
parent f96de8cdc3
commit 0d42e5f6eb
8 changed files with 1233 additions and 396 deletions

View File

@ -29,21 +29,21 @@
"@gitzone/tsbuild": "^2.1.66", "@gitzone/tsbuild": "^2.1.66",
"@gitzone/tsrun": "^1.2.44", "@gitzone/tsrun": "^1.2.44",
"@gitzone/tstest": "^1.0.77", "@gitzone/tstest": "^1.0.77",
"@push.rocks/tapbundle": "^5.0.12", "@push.rocks/tapbundle": "^5.0.15",
"@types/node": "^20.4.2" "@types/node": "^20.5.4"
}, },
"dependencies": { "dependencies": {
"@api.global/typedrequest": "^3.0.1", "@api.global/typedrequest": "^3.0.1",
"@push.rocks/lik": "^6.0.3", "@push.rocks/lik": "^6.0.5",
"@push.rocks/npmextra": "^3.0.9", "@push.rocks/npmextra": "^4.0.0",
"@push.rocks/projectinfo": "^5.0.1", "@push.rocks/projectinfo": "^5.0.2",
"@push.rocks/qenv": "^5.0.2", "@push.rocks/qenv": "^6.0.2",
"@push.rocks/smartanalytics": "^2.0.15", "@push.rocks/smartanalytics": "^2.0.15",
"@push.rocks/smartcli": "^4.0.6", "@push.rocks/smartcli": "^4.0.8",
"@push.rocks/smartdelay": "^3.0.5", "@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartenv": "^5.0.5", "@push.rocks/smartenv": "^5.0.5",
"@push.rocks/smartfile": "^10.0.28", "@push.rocks/smartfile": "^10.0.30",
"@push.rocks/smartgit": "^3.0.0", "@push.rocks/smartgit": "^3.0.1",
"@push.rocks/smartlog": "^3.0.3", "@push.rocks/smartlog": "^3.0.3",
"@push.rocks/smartlog-destination-local": "^9.0.0", "@push.rocks/smartlog-destination-local": "^9.0.0",
"@push.rocks/smartobject": "^1.0.12", "@push.rocks/smartobject": "^1.0.12",
@ -51,9 +51,9 @@
"@push.rocks/smartpromise": "^4.0.2", "@push.rocks/smartpromise": "^4.0.2",
"@push.rocks/smartrequest": "^2.0.18", "@push.rocks/smartrequest": "^2.0.18",
"@push.rocks/smartshell": "^3.0.3", "@push.rocks/smartshell": "^3.0.3",
"@push.rocks/smartsocket": "^2.0.19", "@push.rocks/smartsocket": "^2.0.22",
"@push.rocks/smartssh": "^2.0.0", "@push.rocks/smartssh": "^2.0.1",
"@push.rocks/smartstring": "^4.0.7", "@push.rocks/smartstring": "^4.0.8",
"@servezone/interfaces": "^1.0.3", "@servezone/interfaces": "^1.0.3",
"@tsclass/tsclass": "^4.0.42", "@tsclass/tsclass": "^4.0.42",
"@types/through2": "^2.0.38", "@types/through2": "^2.0.38",

File diff suppressed because it is too large Load Diff

View File

@ -37,6 +37,8 @@ let sortableArray: npmci.Dockerfile[];
tap.test('should return valid Dockerfiles', async () => { tap.test('should return valid Dockerfiles', async () => {
const npmciInstance = new npmci.Npmci(); const npmciInstance = new npmci.Npmci();
await npmciInstance.start();
await npmciInstance.start();
dockerfile1 = new npmci.Dockerfile(npmciInstance.dockerManager, { dockerfile1 = new npmci.Dockerfile(npmciInstance.dockerManager, {
filePath: './Dockerfile', filePath: './Dockerfile',
read: true, read: true,
@ -51,6 +53,7 @@ tap.test('should return valid Dockerfiles', async () => {
tap.test('should read a directory of Dockerfiles', async () => { tap.test('should read a directory of Dockerfiles', async () => {
const npmciInstance = new npmci.Npmci(); const npmciInstance = new npmci.Npmci();
await npmciInstance.start();
return npmci.Dockerfile.readDockerfiles(npmciInstance.dockerManager).then( return npmci.Dockerfile.readDockerfiles(npmciInstance.dockerManager).then(
async (readDockerfilesArrayArg: npmci.Dockerfile[]) => { async (readDockerfilesArrayArg: npmci.Dockerfile[]) => {
sortableArray = readDockerfilesArrayArg; sortableArray = readDockerfilesArrayArg;
@ -69,6 +72,7 @@ tap.test('should sort an array of Dockerfiles', async () => {
tap.test('should build all Dockerfiles', async () => { tap.test('should build all Dockerfiles', async () => {
const npmciInstance = new npmci.Npmci(); const npmciInstance = new npmci.Npmci();
await npmciInstance.start();
return npmciInstance.dockerManager.handleCli({ return npmciInstance.dockerManager.handleCli({
_: ['docker', 'build'], _: ['docker', 'build'],
}); });
@ -76,6 +80,7 @@ tap.test('should build all Dockerfiles', async () => {
tap.test('should test all Dockerfiles', async () => { tap.test('should test all Dockerfiles', async () => {
const npmciInstance = new npmci.Npmci(); const npmciInstance = new npmci.Npmci();
await npmciInstance.start();
return npmciInstance.dockerManager.handleCli({ return npmciInstance.dockerManager.handleCli({
_: ['docker', 'test'], _: ['docker', 'test'],
}); });
@ -83,6 +88,7 @@ tap.test('should test all Dockerfiles', async () => {
tap.test('should test dockerfiles', async () => { tap.test('should test dockerfiles', async () => {
const npmciInstance = new npmci.Npmci(); const npmciInstance = new npmci.Npmci();
await npmciInstance.start();
return npmciInstance.dockerManager.handleCli({ return npmciInstance.dockerManager.handleCli({
_: ['docker', 'test'], _: ['docker', 'test'],
}); });
@ -90,6 +96,7 @@ tap.test('should test dockerfiles', async () => {
tap.test('should login docker daemon', async () => { tap.test('should login docker daemon', async () => {
const npmciInstance = new npmci.Npmci(); const npmciInstance = new npmci.Npmci();
await npmciInstance.start();
return npmciInstance.dockerManager.handleCli({ return npmciInstance.dockerManager.handleCli({
_: ['docker', 'login'], _: ['docker', 'login'],
}); });
@ -110,6 +117,7 @@ tap.test('should prepare SSH keys', async () => {
// ==== // ====
tap.test('should install a certain version of node', async () => { tap.test('should install a certain version of node', async () => {
const npmciInstance = new npmci.Npmci(); const npmciInstance = new npmci.Npmci();
await npmciInstance.start();
await npmciInstance.nodejsManager.handleCli({ await npmciInstance.nodejsManager.handleCli({
_: ['node', 'install', 'stable'], _: ['node', 'install', 'stable'],
}); });

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@ship.zone/npmci', name: '@ship.zone/npmci',
version: '4.1.26', version: '4.1.27',
description: 'node and docker in gitlab ci on steroids' description: 'node and docker in gitlab ci on steroids'
} }

View File

@ -6,5 +6,5 @@ export const npmciInstance = new Npmci();
export { Dockerfile, Npmci }; export { Dockerfile, Npmci };
export const runCli = async () => { export const runCli = async () => {
npmciInstance.start(); await npmciInstance.start();
}; };

View File

@ -39,11 +39,16 @@ export class Npmci {
projectId: 'gitzone', projectId: 'gitzone',
appName: 'npmci', appName: 'npmci',
}); });
}
public async start() {
this.cloudlyConnector = new CloudlyConnector(this); this.cloudlyConnector = new CloudlyConnector(this);
this.npmciEnv = new NpmciEnv(this); this.npmciEnv = new NpmciEnv(this);
this.npmciInfo = new NpmciInfo(this); this.npmciInfo = new NpmciInfo(this);
await this.npmciInfo.printToConsole();
this.npmciCli = new NpmciCli(this); this.npmciCli = new NpmciCli(this);
this.npmciConfig = new NpmciConfig(this); this.npmciConfig = new NpmciConfig(this);
await this.npmciConfig.init();
// managers // managers
this.cloudronManager = new NpmciCloudronManager(this); this.cloudronManager = new NpmciCloudronManager(this);
@ -51,11 +56,6 @@ export class Npmci {
this.gitManager = new NpmciGitManager(this); this.gitManager = new NpmciGitManager(this);
this.nodejsManager = new NpmciNodeJsManager(this); this.nodejsManager = new NpmciNodeJsManager(this);
this.npmManager = new NpmciNpmManager(this); this.npmManager = new NpmciNpmManager(this);
}
public async start() {
await this.npmciInfo.printToConsole();
await this.npmciConfig.init();
this.npmciCli.startParse(); this.npmciCli.startParse();
} }
} }

View File

@ -44,10 +44,12 @@ export class NpmciConfig {
constructor(npmciRefArg: Npmci) { constructor(npmciRefArg: Npmci) {
this.npmciRef = npmciRefArg; this.npmciRef = npmciRefArg;
}
public async init() {
this.npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd); this.npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd);
this.kvStorage = new plugins.npmextra.KeyValueStore( this.kvStorage = new plugins.npmextra.KeyValueStore(
'custom', 'userHomeDir',
`${this.npmciRef.npmciEnv.repo.user}_${this.npmciRef.npmciEnv.repo.repo}` `${this.npmciRef.npmciEnv.repo.user}_${this.npmciRef.npmciEnv.repo.repo}`
); );
this.npmciQenv = new plugins.qenv.Qenv( this.npmciQenv = new plugins.qenv.Qenv(
@ -65,11 +67,8 @@ export class NpmciConfig {
npmRegistryUrl: 'registry.npmjs.org', npmRegistryUrl: 'registry.npmjs.org',
gitlabRunnerTags: [], gitlabRunnerTags: [],
dockerBuildargEnvMap: {}, dockerBuildargEnvMap: {},
urlCloudly: this.npmciQenv.getEnvVarOnDemand('NPMCI_URL_CLOUDLY'), urlCloudly: await this.npmciQenv.getEnvVarOnDemand('NPMCI_URL_CLOUDLY'),
}; };
}
public async init() {
this.configObject = this.npmciNpmextra.dataFor<INpmciOptions>('npmci', this.configObject); this.configObject = this.npmciNpmextra.dataFor<INpmciOptions>('npmci', this.configObject);
} }

View File

@ -11,7 +11,7 @@ export class NpmciInfo {
this.npmciRef = npmciArg; this.npmciRef = npmciArg;
} }
public printToConsole() { public async printToConsole() {
logger.log('info', `npmci version: ${this.projectInfo.version}`); await logger.log('info', `npmci version: ${this.projectInfo.version}`);
} }
} }