Compare commits

...

8 Commits

Author SHA1 Message Date
6b13e46947 1.0.19 2020-10-02 14:39:47 +00:00
096c38de9e fix(core): update 2020-10-02 14:39:46 +00:00
7292b45d33 1.0.18 2020-10-02 13:28:40 +00:00
3ddad53d29 fix(core): update 2020-10-02 13:28:39 +00:00
617b49aaba 1.0.17 2020-06-25 20:04:31 +00:00
2dcd93b431 fix(core): update 2020-06-25 20:04:30 +00:00
0e2dc83409 1.0.16 2020-06-25 20:03:53 +00:00
2cb227632f fix(core): update 2020-06-25 20:03:52 +00:00
9 changed files with 9472 additions and 445 deletions

View File

@ -19,23 +19,35 @@ mirror:
stage: security stage: security
script: script:
- npmci git mirror - npmci git mirror
only:
- tags
tags: tags:
- lossless - lossless
- docker - docker
- notpriv - notpriv
audit: auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security stage: security
script: script:
- npmci npm prepare - npmci npm prepare
- npmci command npm install --ignore-scripts - npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org - npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=moderate - npmci command npm audit --audit-level=high --only=dev
tags: tags:
- lossless
- docker - docker
- notpriv allow_failure: true
# ==================== # ====================
# test stage # test stage
@ -50,9 +62,7 @@ testStable:
- npmci npm test - npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- lossless
- docker - docker
- priv
testBuild: testBuild:
stage: test stage: test
@ -63,9 +73,7 @@ testBuild:
- npmci command npm run build - npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- lossless
- docker - docker
- notpriv
release: release:
stage: release stage: release
@ -85,6 +93,8 @@ release:
codequality: codequality:
stage: metadata stage: metadata
allow_failure: true allow_failure: true
only:
- tags
script: script:
- npmci command npm install -g tslint typescript - npmci command npm install -g tslint typescript
- npmci npm prepare - npmci npm prepare

View File

@ -15,7 +15,7 @@
"properties": { "properties": {
"projectType": { "projectType": {
"type": "string", "type": "string",
"enum": ["website", "element", "service", "npm"] "enum": ["website", "element", "service", "npm", "wcc"]
} }
} }
} }

9803
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartnpm", "name": "@pushrocks/smartnpm",
"version": "1.0.15", "version": "1.0.19",
"private": false, "private": false,
"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",
@ -9,23 +9,22 @@
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/)",
"build": "(tsbuild)" "build": "(tsbuild --web)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.22", "@gitzone/tsbuild": "^2.1.25",
"@gitzone/tsrun": "^1.2.8", "@gitzone/tsrun": "^1.2.12",
"@gitzone/tstest": "^1.0.28", "@gitzone/tstest": "^1.0.52",
"@pushrocks/tapbundle": "^3.2.1", "@pushrocks/tapbundle": "^3.2.9",
"@types/node": "^13.9.1", "@types/node": "^14.11.2",
"tslint": "^6.1.0", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/consolecolor": "^2.0.1", "@pushrocks/consolecolor": "^2.0.1",
"@pushrocks/smartarchive": "^1.0.12", "@pushrocks/smartarchive": "^1.0.12",
"@pushrocks/smartfile": "^7.0.11", "@pushrocks/smartfile": "^8.0.4",
"@pushrocks/smartlog": "^2.0.21", "@pushrocks/smartrequest": "^1.1.51",
"@pushrocks/smartrequest": "^1.1.47",
"package-json": "^6.5.0" "package-json": "^6.5.0"
}, },
"files": [ "files": [
@ -39,5 +38,8 @@
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
],
"browserslist": [
"last 1 chrome versions"
] ]
} }

0
qenv.yml Normal file
View File

View File

@ -8,25 +8,25 @@ interface with npm to retrieve package information
* [docs (typedoc)](https://pushrocks.gitlab.io/smartnpm/) * [docs (typedoc)](https://pushrocks.gitlab.io/smartnpm/)
## Status for master ## Status for master
[![pipeline status](https://gitlab.com/pushrocks/smartnpm/badges/master/pipeline.svg)](https://gitlab.com/pushrocks/smartnpm/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartnpm/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartnpm/commits/master) Status Category | Status Badge
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartnpm.svg)](https://www.npmjs.com/package/@pushrocks/smartnpm) -- | --
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartnpm/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartnpm) GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartnpm/badges/master/pipeline.svg)](https://lossless.cloud)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartnpm/badges/master/coverage.svg)](https://lossless.cloud)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartnpm)](https://lossless.cloud)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/) Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartnpm)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartnpm)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartnpm)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartnpm)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage ## Usage
Use TypeScript for best in class instellisense. Use TypeScript for best in class instellisense.
For further information read the linked docs at the top of this README.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)
## Contribution ## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)

View File

@ -17,7 +17,7 @@ tap.test('should create valid instances', async () => {
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).to.equal('@pushrocks/smartupdate');
}); });
@ -25,7 +25,7 @@ tap.test('should produce a valid search string and this return npmts', async ()
// lets test things with the verdaccio registry // lets test things with the verdaccio registry
tap.test('should create a verdaccio registry', async () => { 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).to.be.instanceOf(smartnpm.NpmRegistry);
}); });

View File

@ -18,11 +18,11 @@ export class NpmRegistry {
constructor(optionsArg: INpmRegistryConstructorOptions = {}) { constructor(optionsArg: INpmRegistryConstructorOptions = {}) {
const defaultOptions: INpmRegistryConstructorOptions = { const defaultOptions: INpmRegistryConstructorOptions = {
npmRegistryUrl: 'https://registry.npmjs.org' npmRegistryUrl: 'https://registry.npmjs.org',
}; };
this.options = { this.options = {
...defaultOptions, ...defaultOptions,
...optionsArg ...optionsArg,
}; };
} }
@ -33,7 +33,7 @@ export class NpmRegistry {
public async getPackageInfo(packageName: string): Promise<NpmPackage> { public async getPackageInfo(packageName: string): Promise<NpmPackage> {
const fullMetadata = await plugins.packageJson(packageName, { const fullMetadata = await plugins.packageJson(packageName, {
registryUrl: this.options.npmRegistryUrl, registryUrl: this.options.npmRegistryUrl,
fullMetadata: true fullMetadata: true,
}); });
const npmPackage = await NpmPackage.createFromFullMetadata(this, fullMetadata); const npmPackage = await NpmPackage.createFromFullMetadata(this, fullMetadata);
return npmPackage; return npmPackage;
@ -52,10 +52,10 @@ export class NpmRegistry {
/** /**
* gets a file from a package as Smartfile * gets a file from a package as Smartfile
*/ */
public async getFileFromPackage(packageName: string, filePath: string) { public async getFileFromPackage(packageNameArg: string, filePath: string) {
const baseDir = plugins.path.join(paths.nogitDir, packageName.replace('/', '__')); const baseDir = plugins.path.join(paths.nogitDir, packageNameArg.replace('/', '__'));
await plugins.smartfile.fs.ensureDir(baseDir); await plugins.smartfile.fs.ensureDir(baseDir);
await this.savePackageToDisk(packageName, baseDir); await this.savePackageToDisk(packageNameArg, baseDir);
const smartfile = await plugins.smartfile.Smartfile.fromFilePath( const smartfile = await plugins.smartfile.Smartfile.fromFilePath(
plugins.path.join(baseDir, 'package', filePath) plugins.path.join(baseDir, 'package', filePath)
); );
@ -63,6 +63,15 @@ export class NpmRegistry {
return smartfile; return smartfile;
} }
public async getPackageAsSmartfileVirtualDir(packageNameArg: string): Promise<plugins.smartfile.VirtualDirectory> {
const baseDir = plugins.path.join(paths.nogitDir, packageNameArg.replace('/', '__'));
await plugins.smartfile.fs.ensureDir(baseDir);
await this.savePackageToDisk(packageNameArg, baseDir);
const virtualDir = await plugins.smartfile.VirtualDirectory.fromFsDirPath(baseDir);
await plugins.smartfile.fs.remove(baseDir);
return virtualDir;
}
/** /**
* searches for a package on npm * searches for a package on npm
* @param searchObjectArg * @param searchObjectArg
@ -134,9 +143,8 @@ export class NpmRegistry {
addToSearchString(`author:${searchObjectArg.maintenanceWeight}`); addToSearchString(`author:${searchObjectArg.maintenanceWeight}`);
} }
plugins.smartlog.defaultLogger.log( console.log(
'info', `info: Search on npm for ${plugins.consolecolor.coloredString(searchString, 'pink')}`
`Search on npm for ${plugins.consolecolor.coloredString(searchString, 'pink')}`
); );
let body: any; let body: any;

View File

@ -7,11 +7,9 @@ export { path };
import * as consolecolor from '@pushrocks/consolecolor'; import * as consolecolor from '@pushrocks/consolecolor';
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 smartlog from '@pushrocks/smartlog';
smartlog.defaultLogger.enableConsole();
import * as smartrequest from '@pushrocks/smartrequest'; import * as smartrequest from '@pushrocks/smartrequest';
export { consolecolor, smartarchive, smartfile, smartlog, smartrequest }; export { consolecolor, smartarchive, smartfile, smartrequest };
// third party scope // third party scope
import packageJson from 'package-json'; import packageJson from 'package-json';