26 Commits

Author SHA1 Message Date
bc79a9ae42 4.0.5 2020-06-01 22:57:09 +00:00
b82b6de5f5 fix(core): update 2020-06-01 22:57:08 +00:00
b27c069177 4.0.4 2020-06-01 22:45:54 +00:00
b25be551f6 fix(core): update 2020-06-01 22:45:54 +00:00
47da0afd4b 4.0.3 2020-06-01 22:45:46 +00:00
f9296f1f26 fix(core): update 2020-06-01 22:45:45 +00:00
d013fbad50 4.0.2 2018-09-02 14:24:45 +02:00
d5f72a76d9 fix(package.json): fix private param 2018-09-02 14:24:45 +02:00
d26a8b02db 4.0.1 2018-09-02 14:21:05 +02:00
9b3db5daca fix(ci): update 2018-09-02 14:21:05 +02:00
75d94111a9 4.0.0 2018-09-02 14:12:36 +02:00
4f425dfc93 BREAKING CHANGE(scope): change scope 2018-09-02 14:12:36 +02:00
0f2af7219e 3.0.5 2018-09-02 14:08:15 +02:00
9abe15f871 fix(dependencies): update 2018-09-02 14:08:15 +02:00
27aa9f7166 3.0.4 2017-09-22 23:53:26 +02:00
0a1063e6c8 update ci 2017-09-22 23:52:28 +02:00
f606dd6e6d 3.0.3 2017-09-22 23:46:46 +02:00
5c608dd675 update dependencies 2017-09-22 23:46:43 +02:00
b4f8093230 3.0.2 2017-02-27 22:46:15 +01:00
aa903ec93e update deps and readme 2017-02-27 22:46:12 +01:00
187721a511 3.0.1 2016-11-27 00:09:09 +01:00
c457cbff6a update README 2016-11-27 00:09:04 +01:00
6fbc179fcb 3.0.0 2016-11-26 23:18:46 +01:00
c17db19b9f added ProjectInfo main class 2016-11-26 23:18:33 +01:00
481ab58d02 2.0.0 2016-11-26 14:46:01 +01:00
9030619046 update to meet newest standards 2016-11-26 14:45:56 +01:00
27 changed files with 5127 additions and 265 deletions

23
.gitignore vendored
View File

@ -1,9 +1,20 @@
.nogit/
# artifacts
coverage/
docs/
public/
pages/
# installs
node_modules/
pages/
public
ts/**/*.js
ts/**/*.js.map
ts/typings/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_*/
# custom

View File

@ -1,37 +1,127 @@
image: hosttoday/ht-docker-node:npmts
# gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: '$CI_BUILD_STAGE'
stages:
- test
- release
- page
- security
- test
- release
- metadata
testLEGACY:
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci git mirror
tags:
- lossless
- docker
- notpriv
audit:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high
tags:
- lossless
- docker
- notpriv
# ====================
# test stage
# ====================
testStable:
stage: test
script:
- npmci test legacy
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
allow_failure: true
- priv
testLTS:
testBuild:
stage: test
script:
- npmci test lts
tags:
- docker
testSTABLE:
stage: test
script:
- npmci test stable
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- notpriv
release:
stage: release
script:
- npmci publish
- npmci node install stable
- npmci npm publish
only:
- tags
tags:
- lossless
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
allow_failure: true
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- lossless
- docker
- priv
trigger:
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- lossless
- docker
- notpriv
pages:
stage: metadata
script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
tags:
- lossless
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true

29
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "current file",
"type": "node",
"request": "launch",
"args": [
"${relativeFile}"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
}
]
}

26
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm"]
}
}
}
}
}
}
]
}

View File

@ -1,16 +0,0 @@
# projectinfo
returns a projectoinfo object for a directory path. TypeScript ready.
## Status
[![build status](https://gitlab.com/pushrocks/projectinfo/badges/master/build.svg)](https://gitlab.com/pushrocks/projectinfo/commits/master)
[![Dependency Status](https://david-dm.org/pushrocks/projectinfo.svg)](https://david-dm.org/pushrocks/projectinfo)
[![devDependency Status](https://david-dm.org/pushrocks/projectinfo/dev-status.svg)](https://david-dm.org/pushrocks/projectinfo#info=devDependencies)
## Usage
```TypeScript
var projectinfo = require("projectinfo")
myProject = new ProjectinfoNpm("/somepath/to/projectroot");
myProject.version // displays version
```

5
dist/index.d.ts vendored
View File

@ -1,5 +0,0 @@
import "typings-global";
import { ProjectinfoNpm } from "./projectinfo.classes.npm";
export { ProjectinfoNpm } from "./projectinfo.classes.npm";
export declare let npm: (cwdArg: any, optionsArg: any) => ProjectinfoNpm;
export declare let getName: (cwdArg: any) => string;

26
dist/index.js vendored
View File

@ -1,26 +0,0 @@
"use strict";
require("typings-global");
//npm
const projectinfo_classes_npm_1 = require("./projectinfo.classes.npm");
var projectinfo_classes_npm_2 = require("./projectinfo.classes.npm");
exports.ProjectinfoNpm = projectinfo_classes_npm_2.ProjectinfoNpm;
exports.npm = function (cwdArg, optionsArg) {
return new projectinfo_classes_npm_1.ProjectinfoNpm(cwdArg, optionsArg);
};
//quick functions
exports.getName = function (cwdArg) {
var localNpm = new projectinfo_classes_npm_1.ProjectinfoNpm(cwdArg);
if (localNpm.status === "ok") {
return localNpm.name;
}
};
/* TODO
projectinfo.git = function(){
};
projectinfo.mojo = function(){
};
*/
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBR3ZCLEtBQUs7QUFDTCx1RUFBeUQ7QUFDekQscUVBQXlEO0FBQWpELG1EQUFBLGNBQWMsQ0FBQTtBQUNYLFFBQUEsR0FBRyxHQUFHLFVBQVMsTUFBTSxFQUFDLFVBQVU7SUFDdkMsTUFBTSxDQUFDLElBQUksd0NBQWMsQ0FBQyxNQUFNLEVBQUMsVUFBVSxDQUFDLENBQUM7QUFDakQsQ0FBQyxDQUFDO0FBRUYsaUJBQWlCO0FBQ04sUUFBQSxPQUFPLEdBQUcsVUFBUyxNQUFNO0lBQ2hDLElBQUksUUFBUSxHQUFHLElBQUksd0NBQWMsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUMxQyxFQUFFLENBQUMsQ0FBQyxRQUFRLENBQUMsTUFBTSxLQUFLLElBQUksQ0FBQyxDQUFBLENBQUM7UUFDMUIsTUFBTSxDQUFDLFFBQVEsQ0FBQyxJQUFJLENBQUM7SUFDekIsQ0FBQztBQUNMLENBQUMsQ0FBQztBQUVGOzs7Ozs7OztFQVFFIn0=

View File

@ -1 +0,0 @@
import "typings-global";

View File

@ -1,3 +0,0 @@
"use strict";
require("typings-global");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8uY2xhc3Nlcy5naXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9wcm9qZWN0aW5mby5jbGFzc2VzLmdpdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCIn0=

View File

@ -1,12 +0,0 @@
import "typings-global";
export declare class ProjectinfoNpm {
packageJson: any;
name: string;
version: string;
status: string;
license: string;
git: any;
constructor(cwdArg: string, optionsArg?: {
gitAccessToken?: string;
});
}

View File

@ -1,19 +0,0 @@
"use strict";
require("typings-global");
const plugins = require("./projectinfo.plugins");
class ProjectinfoNpm {
constructor(cwdArg, optionsArg = {}) {
this.packageJson = plugins.smartfile.fs.toObjectSync(plugins.path.join(plugins.path.resolve(cwdArg), "package.json"), "json");
this.name = this.packageJson.name;
this.version = this.packageJson.version;
this.status = "ok";
this.license = this.packageJson.license;
if (this.packageJson.repository) {
this.git = new plugins.smartstring.GitRepo(this.packageJson.repository.url, optionsArg.gitAccessToken);
}
;
}
;
}
exports.ProjectinfoNpm = ProjectinfoNpm;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8uY2xhc3Nlcy5ucG0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9wcm9qZWN0aW5mby5jbGFzc2VzLm5wbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLGlEQUFrRDtBQUNsRDtJQVFJLFlBQVksTUFBYSxFQUFDLGFBQXNDLEVBQUU7UUFDOUQsSUFBSSxDQUFDLFdBQVcsR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLEVBQUUsQ0FBQyxZQUFZLENBQ2hELE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUNiLE9BQU8sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLE1BQU0sQ0FBQyxFQUM1QixjQUFjLENBQ2pCLEVBQ0QsTUFBTSxDQUNULENBQUM7UUFDRixJQUFJLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQyxXQUFXLENBQUMsSUFBSSxDQUFDO1FBQ2xDLElBQUksQ0FBQyxPQUFPLEdBQUcsSUFBSSxDQUFDLFdBQVcsQ0FBQyxPQUFPLENBQUM7UUFDeEMsSUFBSSxDQUFDLE1BQU0sR0FBRyxJQUFJLENBQUM7UUFDbkIsSUFBSSxDQUFDLE9BQU8sR0FBRyxJQUFJLENBQUMsV0FBVyxDQUFDLE9BQU8sQ0FBQztRQUN4QyxFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLFVBQVUsQ0FBQyxDQUFBLENBQUM7WUFDN0IsSUFBSSxDQUFDLEdBQUcsR0FBSSxJQUFJLE9BQU8sQ0FBQyxXQUFXLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxXQUFXLENBQUMsVUFBVSxDQUFDLEdBQUcsRUFBQyxVQUFVLENBQUMsY0FBYyxDQUFDLENBQUM7UUFDM0csQ0FBQztRQUFBLENBQUM7SUFFTixDQUFDO0lBQUEsQ0FBQztDQUNMO0FBekJELHdDQXlCQyJ9

View File

@ -1,5 +0,0 @@
import "typings-global";
export declare let path: any;
export declare let Q: any;
export import smartfile = require("smartfile");
export import smartstring = require("smartstring");

View File

@ -1,7 +0,0 @@
"use strict";
require("typings-global");
exports.path = require("path");
exports.Q = require("q");
exports.smartfile = require("smartfile");
exports.smartstring = require("smartstring");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8ucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3Byb2plY3RpbmZvLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF1QjtBQUNaLFFBQUEsSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQztBQUN2QixRQUFBLENBQUMsR0FBSSxPQUFPLENBQUMsR0FBRyxDQUFDLENBQUM7QUFDN0IseUNBQStDO0FBQy9DLDZDQUFtRCJ9

17
npmextra.json Normal file
View File

@ -0,0 +1,17 @@
{
"npmci": {
"npmGlobalTools": [],
"npmAccessLevel": "public"
},
"gitzone": {
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",
"gitrepo": "projectinfo",
"shortDescription": "gather information about projects. supports npm, git etc.",
"npmPackagename": "@pushrocks/projectinfo",
"license": "MIT"
}
}
}

4705
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,13 @@
{
"name": "projectinfo",
"version": "1.0.4",
"name": "@pushrocks/projectinfo",
"version": "4.0.5",
"private": false,
"description": "gather information about projects. supports npm, git etc.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"scripts": {
"test": "(npmts)"
"test": "(tstest test/)",
"build": "(tsbuild --web)"
},
"repository": {
"type": "git",
@ -25,14 +27,30 @@
},
"homepage": "https://gitlab.com/pushrocks/projectinfo#readme",
"devDependencies": {
"npmts-g": "^5.2.8",
"should": "^11.1.1",
"typings-test": "^1.0.3"
"@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",
"tslint-config-prettier": "^1.18.0"
},
"dependencies": {
"q": "^1.4.1",
"smartfile": "4.1.0",
"smartstring": "2.0.17",
"typings-global": "^1.0.14"
}
"@pushrocks/smartfile": "^7.0.12",
"@pushrocks/smartpath": "^4.0.3",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartstring": "^3.0.18"
},
"files": [
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
]
}

51
readme.md Normal file
View 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 | [![pipeline status](https://gitlab.com/pushrocks/projectinfo/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/projectinfo/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/projectinfo)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/projectinfo)](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/projectinfo)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/projectinfo)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/projectinfo)](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
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)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

1
test/test.d.ts vendored
View File

@ -1 +0,0 @@
import "typings-test";

View File

@ -1,40 +0,0 @@
"use strict";
require("typings-test");
var projectinfo = require("../dist/index.js");
var should = require("should");
var path = require("path");
var testBasePath = path.resolve(__dirname);
describe("projectinfo", function () {
describe(".npm() return", function () {
var myNpm = projectinfo.npm(testBasePath, { gitAccessToken: "sometoken" });
it("should have .packageJson", function () {
myNpm.packageJson
.should.have.property("version", "1.0.0");
myNpm.packageJson
.should.have.property("name", "testpackage");
});
it("should have .version", function () {
myNpm
.should.have.property("version", "1.0.0");
});
it("should have .name", function () {
myNpm
.should.have.property("name", "testpackage");
});
it("should have .license", function () {
myNpm
.should.have.property("license", "MIT");
});
it("should have .git", function () {
myNpm.git.httpsUrl
.should.equal("https://sometoken@github.com/someuser/somerepo.git");
});
});
describe(".getName()", function () {
it("should return a name", function () {
projectinfo.getName(testBasePath)
.should.equal("testpackage");
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaW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/index.js");
var should = require("should");
var path = require("path");
var testBasePath = path.resolve(__dirname);
import { tap, expect } from '@pushrocks/tapbundle';
import projectinfo = require('../ts/index');
describe("projectinfo",function(){
describe(".npm() return",function(){
var myNpm = projectinfo.npm(testBasePath,{gitAccessToken:"sometoken"});
it("should have .packageJson",function(){
myNpm.packageJson
.should.have.property("version","1.0.0");
myNpm.packageJson
.should.have.property("name","testpackage");
});
let path = require('path');
let testBasePath = path.resolve(__dirname);
it("should have .version",function(){
myNpm
.should.have.property("version","1.0.0")
});
it("should have .name",function(){
myNpm
.should.have.property("name","testpackage");
});
it("should have .license",function(){
myNpm
.should.have.property("license","MIT");
});
it("should have .git",function(){
myNpm.git.httpsUrl
.should.equal("https://sometoken@github.com/someuser/somerepo.git");
});
});
describe(".getName()",function(){
it("should return a name",function(){
projectinfo.getName(testBasePath)
.should.equal("testpackage");
});
})
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');
});
tap.test('should have .version', async () => {
expect(myNpm).have.property('version', '1.0.0');
});
tap.test('should have .name', async () => {
expect(myNpm).have.property('name', 'testpackage');
});
tap.test('should have .license', async () => {
expect(myNpm).have.property('license', 'MIT');
});
tap.test('should have .git', async () => {
expect(myNpm.git.httpsUrl).equal('https://sometoken@github.com/someuser/somerepo.git');
});
tap.test('should return a name', async () => {
expect(projectinfo.getNpmNameForDir(testBasePath)).equal('testpackage');
});
tap.start();

View File

@ -1,27 +1,21 @@
import "typings-global"
import plugins = require("./projectinfo.plugins");
import plugins = require('./projectinfo.plugins');
//npm
import {ProjectinfoNpm} from "./projectinfo.classes.npm";
export {ProjectinfoNpm} from "./projectinfo.classes.npm";
export let npm = function(cwdArg,optionsArg){
return new ProjectinfoNpm(cwdArg,optionsArg);
// direct access to classes
export * from './projectinfo.classes.git';
export * from './projectinfo.classes.npm';
export * from './projectinfo.classes.projectinfo';
// npm
import { ProjectinfoNpm } from './projectinfo.classes.npm';
// quick functions
/**
* gets the name from package.json in a specified directory
*/
export let getNpmNameForDir = function(cwdArg) {
let localNpm = new ProjectinfoNpm(cwdArg);
if (localNpm.status === 'ok') {
return localNpm.name;
}
};
//quick functions
export let getName = function(cwdArg){
var localNpm = new ProjectinfoNpm(cwdArg);
if (localNpm.status === "ok"){
return localNpm.name;
}
};
/* TODO
projectinfo.git = function(){
};
projectinfo.mojo = function(){
};
*/

View File

@ -1 +1,29 @@
import "typings-global"
import * as plugins from './projectinfo.plugins';
export class ProjectinfoGit {
isGit: boolean;
githost: string;
gituser: string;
gitrepo: string;
cwd: string;
constructor(cwdArg: string) {
this.cwd = cwdArg;
this.getGitInfoFromPath();
}
/**
* get git info from path
*/
getGitInfoFromPath() {
let localSmartpath = new plugins.smartpath.Smartpath(this.cwd);
this.gitrepo = localSmartpath.pathLevelsBackwards[0];
this.gituser = localSmartpath.pathLevelsBackwards[1];
}
/**
* get git info from remote url
*/
getGitInfoFromRemote(remoteUrlArg: string) {
let gitRepoParsed = new plugins.smartstring.GitRepo(remoteUrlArg);
}
}

View File

@ -1,28 +1,31 @@
import "typings-global"
import plugins = require("./projectinfo.plugins");
export class ProjectinfoNpm {
packageJson;
name:string;
version:string;
status:string;
license:string;
git;
import plugins = require('./projectinfo.plugins');
export class ProjectinfoNpm {
isNpm: boolean = false;
packageJson: any;
name: string;
version: string;
status: string;
license: string;
git: plugins.smartstring.GitRepo;
constructor(cwdArg:string,optionsArg:{gitAccessToken?:string} = {}){
this.packageJson = plugins.smartfile.fs.toObjectSync(
plugins.path.join(
plugins.path.resolve(cwdArg),
"package.json"
),
"json"
constructor(cwdArg: string, optionsArg: { gitAccessToken?: string } = {}) {
let resolvedCwd = plugins.path.resolve(cwdArg);
if (plugins.smartfile.fs.fileExists(plugins.path.join(resolvedCwd, 'package.json'))) {
this.isNpm = true;
this.packageJson = plugins.smartfile.fs.toObjectSync(
plugins.path.join(resolvedCwd, 'package.json'),
'json'
);
this.name = this.packageJson.name;
this.version = this.packageJson.version;
this.status = 'ok';
this.license = this.packageJson.license;
if (this.packageJson.repository) {
this.git = new plugins.smartstring.GitRepo(
this.packageJson.repository.url,
optionsArg.gitAccessToken
);
this.name = this.packageJson.name;
this.version = this.packageJson.version;
this.status = "ok";
this.license = this.packageJson.license;
if (this.packageJson.repository){
this.git = new plugins.smartstring.GitRepo(this.packageJson.repository.url,optionsArg.gitAccessToken);
};
};
}
}
}
}

View File

@ -0,0 +1,20 @@
import * as plugins from './projectinfo.plugins';
import { ProjectinfoNpm } from './projectinfo.classes.npm';
import { ProjectinfoGit } from './projectinfo.classes.git';
export type TProjectType = 'git' | 'npm';
/**
* class projectinfo automatically examines a given directory and exposes relevant info about it
*/
export class ProjectInfo {
type: TProjectType;
npm: ProjectinfoNpm;
git: ProjectinfoGit;
/**
* constructor of class ProjectInfo
*/
constructor(cwdArg: string) {
this.npm = new ProjectinfoNpm(cwdArg);
this.git = new ProjectinfoGit(cwdArg);
}
}

View File

@ -1,5 +1,7 @@
import "typings-global"
export let path = require("path");
export let Q = require("q");
export import smartfile = require("smartfile");
export import smartstring = require("smartstring");
import * as path from 'path';
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartfile from '@pushrocks/smartfile';
import * as smartstring from '@pushrocks/smartstring';
import * as smartpath from '@pushrocks/smartpath';
export { path, smartpromise, smartfile, smartstring, smartpath };

17
tslint.json Normal file
View File

@ -0,0 +1,17 @@
{
"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"
}