This commit is contained in:
Philipp Kunz 2022-04-04 23:21:49 +02:00
parent 7737014464
commit c0d64926a0
13 changed files with 9113 additions and 14570 deletions

23544
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,29 +5,29 @@
"description": "interface with npm to retrieve package information", "description": "interface with npm to retrieve package information",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",
"type": "module",
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/)",
"build": "(tsbuild --web)" "build": "(tsbuild --web --allowimplicitany)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.25", "@gitzone/tsbuild": "^2.1.61",
"@gitzone/tsrun": "^1.2.12", "@gitzone/tsrun": "^1.2.32",
"@gitzone/tstest": "^1.0.54", "@gitzone/tstest": "^1.0.70",
"@pushrocks/tapbundle": "^3.2.14", "@pushrocks/tapbundle": "^5.0.3",
"@types/node": "^15.0.2", "@types/node": "^17.0.23"
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/consolecolor": "^2.0.1", "@pushrocks/consolecolor": "^2.0.1",
"@pushrocks/levelcache": "^1.0.10", "@pushrocks/levelcache": "^3.0.1",
"@pushrocks/smartarchive": "^2.0.4", "@pushrocks/smartarchive": "^3.0.1",
"@pushrocks/smartfile": "^8.0.10", "@pushrocks/smartfile": "^9.0.6",
"@pushrocks/smartpromise": "^3.1.5", "@pushrocks/smartpath": "^5.0.5",
"@pushrocks/smartrequest": "^1.1.51", "@pushrocks/smartpromise": "^3.1.7",
"@pushrocks/smarttime": "^3.0.38", "@pushrocks/smartrequest": "^1.1.56",
"@pushrocks/smarttime": "^3.0.45",
"@pushrocks/smartversion": "^2.0.7", "@pushrocks/smartversion": "^2.0.7",
"package-json": "^6.5.0" "package-json": "^6.5.0"
}, },

View File

@ -1,6 +1,6 @@
import { expect, tap } from '@pushrocks/tapbundle'; import { expect, tap } from '@pushrocks/tapbundle';
import * as smartnpm from '../ts/index'; import * as smartnpm from '../ts/index.js';
import { NpmRegistry } from '../ts/index'; import { NpmRegistry } from '../ts/index.js';
let npmRegistry: smartnpm.NpmRegistry; let npmRegistry: smartnpm.NpmRegistry;
let verdaccioRegistry: smartnpm.NpmRegistry; let verdaccioRegistry: smartnpm.NpmRegistry;
@ -9,17 +9,17 @@ let testPackage: smartnpm.NpmPackage;
// lets test things with the standard npm registry // lets test things with the standard npm registry
tap.test('should create valid instances', async () => { tap.test('should create valid instances', async () => {
npmRegistry = new smartnpm.NpmRegistry(); npmRegistry = new smartnpm.NpmRegistry();
expect(npmRegistry).to.be.instanceof(smartnpm.NpmRegistry); expect(npmRegistry).toBeInstanceOf(smartnpm.NpmRegistry);
testPackage = new smartnpm.NpmPackage(npmRegistry); testPackage = new smartnpm.NpmPackage(npmRegistry);
expect(testPackage).to.be.instanceof(smartnpm.NpmPackage); expect(testPackage).toBeInstanceOf(smartnpm.NpmPackage);
}); });
tap.test('should produce a valid search string and this return npmts', async () => { tap.test('should produce a valid search string and this return npmts', async () => {
const packages = await npmRegistry.searchOnNpm({ const packages = await npmRegistry.searchOnNpm({
name: '@pushrocks/smartupdate', name: '@pushrocks/smartupdate',
}); });
expect(packages[0].name).to.equal('@pushrocks/smartupdate'); expect(packages[0].name).toEqual('@pushrocks/smartupdate');
}); });
// lets test things with the verdaccio registry // lets test things with the verdaccio registry
@ -27,18 +27,18 @@ tap.test('should create a verdaccio registry', async () => {
verdaccioRegistry = new NpmRegistry({ verdaccioRegistry = new NpmRegistry({
npmRegistryUrl: 'https://verdaccio.lossless.one', npmRegistryUrl: 'https://verdaccio.lossless.one',
}); });
expect(verdaccioRegistry).to.be.instanceOf(smartnpm.NpmRegistry); expect(verdaccioRegistry).toBeInstanceOf(smartnpm.NpmRegistry);
}); });
tap.test('should get package from verdaccio', async () => { tap.test('should get package from verdaccio', async () => {
const npmPackage = await verdaccioRegistry.getPackageInfo('@pushrocks/smartupdate'); const npmPackage = await verdaccioRegistry.getPackageInfo('@pushrocks/smartupdate');
expect(npmPackage.license).to.equal('MIT'); expect(npmPackage.license).toEqual('MIT');
}); });
tap.test('should get a specific file from a package', async () => { tap.test('should get a specific file from a package', async () => {
const wantedFile = await verdaccioRegistry.getFileFromPackage( const wantedFile = await verdaccioRegistry.getFileFromPackage(
'@pushrocks/websetup', '@pushrocks/websetup',
'ts/index.ts' './ts/index.ts'
); );
console.log(wantedFile.contentBuffer.toString()); console.log(wantedFile.contentBuffer.toString());
}); });
@ -58,7 +58,7 @@ tap.test('should not get a nonexisting file from a package', async () => {
'@pushrocks/websetup', '@pushrocks/websetup',
'ts/notthere' 'ts/notthere'
); );
expect(wantedFileNotThere).to.be.null expect(wantedFileNotThere).toBeNull();
}); });
tap.start(); tap.start();

View File

@ -1,4 +1,4 @@
import * as plugins from './smartnpm.plugins'; import * as plugins from './smartnpm.plugins.js';
export * from './smartnpm.classes.npmregistry'; export * from './smartnpm.classes.npmregistry.js';
export * from './smartnpm.classes.npmpackage'; export * from './smartnpm.classes.npmpackage.js';

View File

@ -1,7 +1,7 @@
import * as plugins from './smartnpm.plugins'; import * as plugins from './smartnpm.plugins.js';
import { NpmRegistry } from './smartnpm.classes.npmregistry'; import { NpmRegistry } from './smartnpm.classes.npmregistry.js';
import { PackageDisttag } from './smartnpm.classes.packagedisttag'; import { PackageDisttag } from './smartnpm.classes.packagedisttag.js';
import { PackageVersion, IVersionData } from './smartnpm.classes.packageversion'; import { PackageVersion, IVersionData } from './smartnpm.classes.packageversion.js';
export class NpmPackage { export class NpmPackage {
public static async createFromFullMetadataAndVersionData( public static async createFromFullMetadataAndVersionData(

View File

@ -1,12 +1,12 @@
import * as plugins from './smartnpm.plugins'; import * as plugins from './smartnpm.plugins.js';
import * as paths from './smartnpm.paths'; import * as paths from './smartnpm.paths.js';
// interfaces // interfaces
import { ISearchObject } from './smartnpm.interfaces'; import { ISearchObject } from './smartnpm.interfaces.js';
// classes // classes
import { NpmPackage } from './smartnpm.classes.npmpackage'; import { NpmPackage } from './smartnpm.classes.npmpackage.js';
import { ICacheDescriptor, RegistryCache } from './smartnpm.classes.registrycache'; import { ICacheDescriptor, RegistryCache } from './smartnpm.classes.registrycache.js';
export interface INpmRegistryConstructorOptions { export interface INpmRegistryConstructorOptions {
npmRegistryUrl?: string; npmRegistryUrl?: string;

View File

@ -1,4 +1,4 @@
import * as plugins from './smartnpm.plugins'; import * as plugins from './smartnpm.plugins.js';
export class PackageDisttag { export class PackageDisttag {
name: string; name: string;

View File

@ -1,4 +1,4 @@
import * as plugins from './smartnpm.plugins'; import * as plugins from './smartnpm.plugins.js';
export interface IVersionData { export interface IVersionData {
name: string; name: string;

View File

@ -1,5 +1,5 @@
import { NpmRegistry } from './smartnpm.classes.npmregistry'; import { NpmRegistry } from './smartnpm.classes.npmregistry.js';
import * as plugins from './smartnpm.plugins'; import * as plugins from './smartnpm.plugins.js';
export interface ICacheDescriptor { export interface ICacheDescriptor {

View File

@ -1,4 +1,4 @@
import * as plugins from './smartnpm.plugins'; import * as plugins from './smartnpm.plugins.js';
export const packageDir = plugins.path.join(__dirname, '../'); export const packageDir = plugins.path.join(plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url), '../');
export const nogitDir = plugins.path.join(packageDir, '.nogit/'); export const nogitDir = plugins.path.join(packageDir, '.nogit/');

View File

@ -8,12 +8,13 @@ import * as consolecolor from '@pushrocks/consolecolor';
import * as levelcache from '@pushrocks/levelcache'; import * as levelcache from '@pushrocks/levelcache';
import * as smartarchive from '@pushrocks/smartarchive'; import * as smartarchive from '@pushrocks/smartarchive';
import * as smartfile from '@pushrocks/smartfile'; import * as smartfile from '@pushrocks/smartfile';
import * as smartpath from '@pushrocks/smartpath';
import * as smartpromise from '@pushrocks/smartpromise'; import * as smartpromise from '@pushrocks/smartpromise';
import * as smartrequest from '@pushrocks/smartrequest'; import * as smartrequest from '@pushrocks/smartrequest';
import * as smartversion from '@pushrocks/smartversion'; import * as smartversion from '@pushrocks/smartversion';
import * as smarttime from '@pushrocks/smarttime'; import * as smarttime from '@pushrocks/smarttime';
export { consolecolor, levelcache, smartarchive, smartfile, smartpromise, smartrequest, smartversion, smarttime }; export { consolecolor, levelcache, smartarchive, smartfile, smartpath, smartpromise, smartrequest, smartversion, smarttime };
// third party scope // third party scope
import packageJson from 'package-json'; import packageJson from 'package-json';

9
tsconfig.json Normal file
View File

@ -0,0 +1,9 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "nodenext"
}
}

View File

@ -1,17 +0,0 @@
{
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}