feat(projectinfo): migrate project info loading to async factories and update build configuration

This commit is contained in:
2026-03-26 08:35:13 +00:00
parent 9e79ea4e70
commit 4a20f31b99
15 changed files with 7519 additions and 4135 deletions

View File

@@ -1,11 +1,16 @@
import { tap, expect } from '@push.rocks/tapbundle';
import { tap, expect } from '@git.zone/tstest/tapbundle';
import * as smartpath from '@push.rocks/smartpath';
import * as projectinfo from '../ts/index.js';
import * as path from 'path';
let testBasePath = path.resolve(smartpath.get.dirnameFromImportMetaUrl(import.meta.url));
let myNpm = new projectinfo.ProjectinfoNpm(testBasePath, { gitAccessToken: 'sometoken' });
let myNpm: projectinfo.ProjectinfoNpm;
tap.test('should create ProjectinfoNpm instance', async () => {
myNpm = await projectinfo.ProjectinfoNpm.create(testBasePath, { gitAccessToken: 'sometoken' });
});
tap.test('should have .packageJson', async () => {
expect(myNpm.packageJson).property('version').toEqual('1.0.0');
expect(myNpm.packageJson).property('name').toEqual('testpackage');
@@ -23,10 +28,10 @@ tap.test('should have .license', async () => {
expect(myNpm).property('license').toEqual('MIT');
});
tap.test('should have .git', async () => {
expect(myNpm.git.httpsUrl).toEqual('https://sometoken@github.com/someuser/somerepo.git');
expect(myNpm.git!.httpsUrl).toEqual('https://sometoken@github.com/someuser/somerepo.git');
});
tap.test('should return a name', async () => {
expect(projectinfo.getNpmNameForDir(testBasePath)).toEqual('testpackage');
expect(await projectinfo.getNpmNameForDir(testBasePath)).toEqual('testpackage');
});
tap.start();
export default tap.start();