Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
31bcc5f8c2 | |||
216eabe035 | |||
bc79a9ae42 | |||
b82b6de5f5 | |||
b27c069177 | |||
b25be551f6 |
@ -9,7 +9,7 @@
|
||||
"githost": "gitlab.com",
|
||||
"gitscope": "pushrocks",
|
||||
"gitrepo": "projectinfo",
|
||||
"shortDescription": "gather information about projects. supports npm, git etc.",
|
||||
"description": "gather information about projects. supports npm, git etc.",
|
||||
"npmPackagename": "@pushrocks/projectinfo",
|
||||
"license": "MIT"
|
||||
}
|
||||
|
17763
package-lock.json
generated
17763
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
25
package.json
25
package.json
@ -1,13 +1,14 @@
|
||||
{
|
||||
"name": "@pushrocks/projectinfo",
|
||||
"version": "4.0.3",
|
||||
"version": "5.0.0",
|
||||
"private": false,
|
||||
"description": "gather information about projects. supports npm, git etc.",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "(tstest test/)",
|
||||
"build": "(tsbuild)"
|
||||
"build": "(tsbuild --web --allowimplicitany)"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -27,19 +28,19 @@
|
||||
},
|
||||
"homepage": "https://gitlab.com/pushrocks/projectinfo#readme",
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.24",
|
||||
"@gitzone/tsrun": "^1.2.12",
|
||||
"@gitzone/tstest": "^1.0.33",
|
||||
"@pushrocks/tapbundle": "^3.2.1",
|
||||
"@types/node": "^14.0.6",
|
||||
"tslint": "^6.1.2",
|
||||
"@gitzone/tsbuild": "^2.1.61",
|
||||
"@gitzone/tsrun": "^1.2.32",
|
||||
"@gitzone/tstest": "^1.0.70",
|
||||
"@pushrocks/tapbundle": "^5.0.3",
|
||||
"@types/node": "^17.0.25",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smartfile": "^7.0.12",
|
||||
"@pushrocks/smartpath": "^4.0.3",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"@pushrocks/smartstring": "^3.0.18"
|
||||
"@pushrocks/smartfile": "^9.0.6",
|
||||
"@pushrocks/smartpath": "^5.0.5",
|
||||
"@pushrocks/smartpromise": "^3.1.7",
|
||||
"@pushrocks/smartstring": "^4.0.2"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
|
51
readme.md
Normal file
51
readme.md
Normal file
@ -0,0 +1,51 @@
|
||||
# @pushrocks/projectinfo
|
||||
gather information about projects. supports npm, git etc.
|
||||
|
||||
## Availabililty and Links
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/projectinfo)
|
||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/projectinfo)
|
||||
* [github.com (source mirror)](https://github.com/pushrocks/projectinfo)
|
||||
* [docs (typedoc)](https://pushrocks.gitlab.io/projectinfo/)
|
||||
|
||||
## Status for master
|
||||
|
||||
Status Category | Status Badge
|
||||
-- | --
|
||||
GitLab Pipelines | [](https://lossless.cloud)
|
||||
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
||||
npm | [](https://lossless.cloud)
|
||||
Snyk | [](https://lossless.cloud)
|
||||
TypeScript Support | [](https://lossless.cloud)
|
||||
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
Code Style | [](https://lossless.cloud)
|
||||
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
||||
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
||||
|
||||
## Usage
|
||||
|
||||
Use TypeScript for best in class instellisense.
|
||||
|
||||
```javascript
|
||||
import { ProjectInfo } from 'projectinfo';
|
||||
|
||||
let myProjectInfo = new ProjectInfo('/some/path/to/proejct');
|
||||
let npmName = myProjectInfo.npm.name; // returns npm name from package.json
|
||||
let npmVersion = myProjectInfo.npm.version; // returns version from package.json
|
||||
let gitRepo = myProjectInfo.git.gitrepo; // returns the name of the gitrepo
|
||||
let gitRemotes = myProjectInfo.git.remotes; // returns array with registered remotes
|
||||
|
||||
// for more info check out the module in your IDE with TypeScript intellisense enabled
|
||||
```
|
||||
|
||||
## 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). :)
|
||||
|
||||
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)
|
||||
|
||||
[](https://maintainedby.lossless.com)
|
@ -2,6 +2,7 @@
|
||||
"name": "testpackage",
|
||||
"version": "1.0.0",
|
||||
"description": "some test",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/someuser/somerepo.git"
|
||||
|
22
test/test.ts
22
test/test.ts
@ -1,31 +1,33 @@
|
||||
import { tap, expect } from '@pushrocks/tapbundle';
|
||||
import projectinfo = require('../ts/index');
|
||||
import * as smartpath from '@pushrocks/smartpath';
|
||||
import * as projectinfo from '../ts/index.js';
|
||||
|
||||
let path = require('path');
|
||||
let testBasePath = path.resolve(__dirname);
|
||||
|
||||
import * as path from 'path';
|
||||
let testBasePath = path.resolve(smartpath.get.dirnameFromImportMetaUrl(import.meta.url));
|
||||
|
||||
let myNpm = new projectinfo.ProjectinfoNpm(testBasePath, { gitAccessToken: 'sometoken' });
|
||||
tap.test('should have .packageJson', async () => {
|
||||
expect(myNpm.packageJson).have.property('version', '1.0.0');
|
||||
expect(myNpm.packageJson).have.property('name', 'testpackage');
|
||||
expect(myNpm.packageJson).property('version').toEqual('1.0.0');
|
||||
expect(myNpm.packageJson).property('name').toEqual('testpackage');
|
||||
});
|
||||
|
||||
tap.test('should have .version', async () => {
|
||||
expect(myNpm).have.property('version', '1.0.0');
|
||||
expect(myNpm).property('version').toEqual('1.0.0');
|
||||
});
|
||||
|
||||
tap.test('should have .name', async () => {
|
||||
expect(myNpm).have.property('name', 'testpackage');
|
||||
expect(myNpm).property('name').toEqual('testpackage');
|
||||
});
|
||||
|
||||
tap.test('should have .license', async () => {
|
||||
expect(myNpm).have.property('license', 'MIT');
|
||||
expect(myNpm).property('license').toEqual('MIT');
|
||||
});
|
||||
tap.test('should have .git', async () => {
|
||||
expect(myNpm.git.httpsUrl).equal('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)).equal('testpackage');
|
||||
expect(projectinfo.getNpmNameForDir(testBasePath)).toEqual('testpackage');
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
10
ts/index.ts
10
ts/index.ts
@ -1,12 +1,12 @@
|
||||
import plugins = require('./projectinfo.plugins');
|
||||
import * as plugins from './projectinfo.plugins.js'
|
||||
|
||||
// direct access to classes
|
||||
export * from './projectinfo.classes.git';
|
||||
export * from './projectinfo.classes.npm';
|
||||
export * from './projectinfo.classes.projectinfo';
|
||||
export * from './projectinfo.classes.git.js';
|
||||
export * from './projectinfo.classes.npm.js';
|
||||
export * from './projectinfo.classes.projectinfo.js';
|
||||
|
||||
// npm
|
||||
import { ProjectinfoNpm } from './projectinfo.classes.npm';
|
||||
import { ProjectinfoNpm } from './projectinfo.classes.npm.js';
|
||||
|
||||
// quick functions
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as plugins from './projectinfo.plugins';
|
||||
import * as plugins from './projectinfo.plugins.js';
|
||||
|
||||
export class ProjectinfoGit {
|
||||
isGit: boolean;
|
||||
|
@ -1,4 +1,5 @@
|
||||
import plugins = require('./projectinfo.plugins');
|
||||
import * as plugins from './projectinfo.plugins.js';
|
||||
|
||||
export class ProjectinfoNpm {
|
||||
isNpm: boolean = false;
|
||||
packageJson: any;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as plugins from './projectinfo.plugins';
|
||||
import { ProjectinfoNpm } from './projectinfo.classes.npm';
|
||||
import { ProjectinfoGit } from './projectinfo.classes.git';
|
||||
import * as plugins from './projectinfo.plugins.js';
|
||||
import { ProjectinfoNpm } from './projectinfo.classes.npm.js';
|
||||
import { ProjectinfoGit } from './projectinfo.classes.git.js';
|
||||
export type TProjectType = 'git' | 'npm';
|
||||
|
||||
/**
|
||||
|
9
tsconfig.json
Normal file
9
tsconfig.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"useDefineForClassFields": false,
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"moduleResolution": "nodenext"
|
||||
}
|
||||
}
|
17
tslint.json
17
tslint.json
@ -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"
|
||||
}
|
Reference in New Issue
Block a user