Compare commits
43 Commits
Author | SHA1 | Date | |
---|---|---|---|
bc79a9ae42 | |||
b82b6de5f5 | |||
b27c069177 | |||
b25be551f6 | |||
47da0afd4b | |||
f9296f1f26 | |||
d013fbad50 | |||
d5f72a76d9 | |||
d26a8b02db | |||
9b3db5daca | |||
75d94111a9 | |||
4f425dfc93 | |||
0f2af7219e | |||
9abe15f871 | |||
27aa9f7166 | |||
0a1063e6c8 | |||
f606dd6e6d | |||
5c608dd675 | |||
b4f8093230 | |||
aa903ec93e | |||
187721a511 | |||
c457cbff6a | |||
6fbc179fcb | |||
c17db19b9f | |||
481ab58d02 | |||
9030619046 | |||
fcd559090a | |||
f946d5b1d8 | |||
4fee4ec822 | |||
94a431ef33 | |||
142cc52f95 | |||
040120d034 | |||
0618e46cd8 | |||
c255f08ea6 | |||
a7035a56fc | |||
bb926b7319 | |||
9edcf5140d | |||
e43322defd | |||
ed0c947a2e | |||
3c9dd787b3 | |||
e4ef9bf97a | |||
d394588fff | |||
a5baae60c9 |
25
.gitignore
vendored
25
.gitignore
vendored
@ -1,7 +1,20 @@
|
|||||||
.idea/
|
.nogit/
|
||||||
coverage/
|
|
||||||
node_modules
|
|
||||||
|
|
||||||
ts/**/*.js
|
# artifacts
|
||||||
ts/**/*.js.map
|
coverage/
|
||||||
ts/typings/
|
public/
|
||||||
|
pages/
|
||||||
|
|
||||||
|
# installs
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# caches
|
||||||
|
.yarn/
|
||||||
|
.cache/
|
||||||
|
.rpt2_cache
|
||||||
|
|
||||||
|
# builds
|
||||||
|
dist/
|
||||||
|
dist_*/
|
||||||
|
|
||||||
|
# custom
|
127
.gitlab-ci.yml
Normal file
127
.gitlab-ci.yml
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
# gitzone ci_default
|
||||||
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- .npmci_cache/
|
||||||
|
key: '$CI_BUILD_STAGE'
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- security
|
||||||
|
- test
|
||||||
|
- release
|
||||||
|
- metadata
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# 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 npm prepare
|
||||||
|
- npmci node install stable
|
||||||
|
- npmci npm install
|
||||||
|
- npmci npm test
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
|
tags:
|
||||||
|
- lossless
|
||||||
|
- docker
|
||||||
|
- priv
|
||||||
|
|
||||||
|
testBuild:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- 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 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
|
12
.travis.yml
12
.travis.yml
@ -1,12 +0,0 @@
|
|||||||
language: node_js
|
|
||||||
node_js:
|
|
||||||
- 'v4.2.6'
|
|
||||||
- 'stable'
|
|
||||||
deploy:
|
|
||||||
provider: npm
|
|
||||||
email: npm@lossless.digital
|
|
||||||
api_key:
|
|
||||||
secure: G2ZQYeDEokGCWQcXeT9SJ4aUF0uZ41B1kM9WD7hZKMGM5hzbGSTXjd/bLWf2HfujvN9FWQYVv0y5OpbRck4xTuEDBPmC5AqXCfrtNj77n151VLO0cF4+Ya1l8OQWvw13hX+cux8UfxRVHUAxUt7CoW3q6FBO/vt1Mvo9u9ucxKdB4QHXmPdq8TwuFusPJYC+l2LdWiaSCEz2LpnyrDf6OjLl2Bt+8rID3Ikbi+5yXWv/n7bfiXyIlpJX/i4Efh/mqsSWp+ziVWaSdKdpYMFPxqyOfqQ/kjbzLCwdR72cD3+UoJPdGQ46Vq3ncZRq3KighWkYRzN76EOTI/quzfcAoz5CekETPh419lPuqs2w8wEeE2oP0yCCSH1SG1ljH8ASrADWsoHzWyVa8c/ovzWMOc3hgLey6xgbYVar0sC94bjjqJh8Y5qOak4idOpI/SXf0UT1TkirZTGfdSgRzg/E1Zqj262sxLeIv0yHsbnzgwUduj6PjfLztgLVAGO13csxksUSiKxT8Mbbqozv1sdz/0SgoZTMYfZSO5kYdBCqguJkJdEj1Dr4tM/0ca+mugHibavQxPJiWqnfNqxdlmywpzPHPHe5G2wzba2W62l3yPHF4rJBJuUi35ddWWOkAN1g9D2NHlByWfqF+WYRuTv1DPlw7ZpmgEVPPUlBPhC5YO8=
|
|
||||||
on:
|
|
||||||
tags: true
|
|
||||||
repo: pushrocks/projectinfo
|
|
29
.vscode/launch.json
vendored
Normal file
29
.vscode/launch.json
vendored
Normal 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
26
.vscode/settings.json
vendored
Normal 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"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
16
dist/index.js
vendored
16
dist/index.js
vendored
@ -1,16 +0,0 @@
|
|||||||
var projectinfo = {};
|
|
||||||
//classes
|
|
||||||
var ProjectinfoNPM = require("./projectinfo.npm");
|
|
||||||
projectinfo.npm = function (cwdArg) {
|
|
||||||
return new ProjectinfoNPM(cwdArg);
|
|
||||||
};
|
|
||||||
//quick functions
|
|
||||||
projectinfo.getName = function (cwdArg) {
|
|
||||||
var localNpm = projectinfo.npm(cwdArg);
|
|
||||||
if (localNpm.status === "ok") {
|
|
||||||
return localNpm.name;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
module.exports = projectinfo;
|
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLElBQUksV0FBVyxHQUFPLEVBQUUsQ0FBQztBQUV6QixTQUFTO0FBQ1QsSUFBTyxjQ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gaWYgKGxvY2FsTnBtLnN0YXR1cyA9PT0gXCJva1wiKXtcbiAgICAgICAgcmV0dXJuIGxvY2FsTnBtLm5hbWU7XG4gICAgfVxufTtcblxuLyogVE9ET1xucHJvamVjdGluZm8uZ2l0ID0gZnVuY3Rpb24oKXtcblxufTtcblxucHJvamVjdGluZm8ubW9qbyA9IGZ1bmN0aW9uKCl7XG5cbn07XG4qL1xuXG5leHBvcnQgPSBwcm9qZWN0aW5mbzsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
|
14
dist/projectinfo.npm.js
vendored
14
dist/projectinfo.npm.js
vendored
@ -1,14 +0,0 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
|
||||||
var plugins = require("./projectinfo.plugins");
|
|
||||||
var ProjectinfoNPM = (function () {
|
|
||||||
function ProjectinfoNPM(cwdArg) {
|
|
||||||
this.packageJson = plugins.smartfile.readFileToObject(plugins.path.join(plugins.path.resolve(cwdArg), "package.json"));
|
|
||||||
this.name = this.packageJson.name;
|
|
||||||
this.version = this.packageJson.version;
|
|
||||||
this.status = "ok";
|
|
||||||
}
|
|
||||||
return ProjectinfoNPM;
|
|
||||||
})();
|
|
||||||
module.exports = ProjectinfoNPM;
|
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInByb2plY3RpbmZvLm5wbS50cyJdLCJuYW1lcyI6WyJQcm9qZWN0aW5mb05QTSIsIlByb2plY3RpbmZvTlBNLmNvbnN0cnVjdG9yIl0sIm1hcHBpbmdzIjoiQUFBQSw0Q0FBNEM7QUFDNUMsSUFBTyxPQUFPLFdBQVcsdUJBQXVCLENBQUMsQ0FBQztBQUNsRDtJQU1JQSx3QkFBWUEsTUFBYUE7UUFDckJDLElBQUlBLENBQUNBLFdBQVdBLEdBQUdBLE9BQU9BLENBQUNBLFNBQVNBLENBQUNBLGdCQUFnQkEsQ0FDakRBLE9BQU9BLENBQUNBLElBQUlBL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ICAgICAgICAgICAgKVxuICAgICAgICApO1xuICAgICAgICB0aGlzLm5hbWUgPSB0aGlzLnBhY2thZ2VKc29uLm5hbWU7XG4gICAgICAgIHRoaXMudmVyc2lvbiA9IHRoaXMucGFja2FnZUpzb24udmVyc2lvbjtcbiAgICAgICAgdGhpcy5zdGF0dXMgPSBcIm9rXCI7XG4gICAgfVxufVxuXG5leHBvcnQgPSBQcm9qZWN0aW5mb05QTTsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
|
9
dist/projectinfo.plugins.js
vendored
9
dist/projectinfo.plugins.js
vendored
@ -1,9 +0,0 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
|
||||||
var plugins = {
|
|
||||||
path: require("path"),
|
|
||||||
Q: require("q"),
|
|
||||||
smartfile: require("smartfile")
|
|
||||||
};
|
|
||||||
module.exports = plugins;
|
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInByb2plY3RpbmZvLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsNENBQTRDO0FBQzVDLElBQUksT0FBTyxHQUFHO0lBQ1YsSUFBSSxFQUFFLE9BQU8sQ0FBQyxNQUFNLENBQUM7SUFDckIsQ0FBQyxFQUFFLE9BQU8sQ0FBQyxHQUFHLENBQUM7SUFDZixTQUFTLEVBQUUsT0FBTyxDQUFDLFdBQVcsQ0FBQztDQUNsQyxDQUFDO0FBRUYsaUJBQVMsT0FBTyxDQUFDIiwiZmlsZSI6InByb2plY3RpbmZvLnBsdWdpbnMuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLy8gPHJlZmVyZW5jZSBwYXRoPVwiLi90eXBpbmdzL21haW4uZC50c1wiIC8+XG52YXIgcGx1Z2lucyA9IHtcbiAgICBwYXRoOiByZXF1aXJlKFwicGF0aFwiKSxcbiAgICBROiByZXF1aXJlKFwicVwiKSxcbiAgICBzbWFydGZpbGU6IHJlcXVpcmUoXCJzbWFydGZpbGVcIilcbn07XG5cbmV4cG9ydCA9IHBsdWdpbnM7Il0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9
|
|
17
npmextra.json
Normal file
17
npmextra.json
Normal 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
4705
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
46
package.json
46
package.json
@ -1,14 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "projectinfo",
|
"name": "@pushrocks/projectinfo",
|
||||||
"version": "0.0.4",
|
"version": "4.0.5",
|
||||||
|
"private": false,
|
||||||
"description": "gather information about projects. supports npm, git etc.",
|
"description": "gather information about projects. supports npm, git etc.",
|
||||||
"main": "dist/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
"typings": "dist_ts/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts)"
|
"test": "(tstest test/)",
|
||||||
|
"build": "(tsbuild --web)"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/pushrocks/projectinfo.git"
|
"url": "git+https://gitlab.com/pushrocks/projectinfo.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"project",
|
"project",
|
||||||
@ -20,15 +23,34 @@
|
|||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/pushrocks/projectinfo/issues"
|
"url": "https://gitlab.com/pushrocks/projectinfo/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/pushrocks/projectinfo#readme",
|
"homepage": "https://gitlab.com/pushrocks/projectinfo#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"npmts": "^3.1.2",
|
"@gitzone/tsbuild": "^2.1.24",
|
||||||
"should": "^8.2.2"
|
"@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": {
|
"dependencies": {
|
||||||
"q": "^1.4.1",
|
"@pushrocks/smartfile": "^7.0.12",
|
||||||
"smartfile": "0.0.11"
|
"@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
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,10 @@
|
|||||||
"name": "testpackage",
|
"name": "testpackage",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "some test",
|
"description": "some test",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/someuser/somerepo.git"
|
||||||
|
},
|
||||||
"main": "test.js",
|
"main": "test.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
32
test/test.js
32
test/test.js
@ -1,32 +0,0 @@
|
|||||||
/// <reference path="../ts/typings/main.d.ts" />
|
|
||||||
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);
|
|
||||||
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("name", "testpackage");
|
|
||||||
});
|
|
||||||
it("should have .name", function () {
|
|
||||||
myNpm
|
|
||||||
.should.have.property("name", "testpackage");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe(".getName()", function () {
|
|
||||||
it("should return a name", function () {
|
|
||||||
projectinfo.getName(testBasePath)
|
|
||||||
.should.equal("testpackage");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksV0FBVyxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzlDLElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztBQUMvQixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUM7QUFDM0IsSUFBSSxZQUFZLEdBQUcsSUFBSSxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FBQztBQUUzQyxRQUFRLENBQUMsYUFBYSxFQUFDO0lBQ25CLFFBQVEsQ0FBQyxlQUFlLEVBQUM7UUFDckIsSUFBSSxLQUFLLEdBQUcsV0FBVyxDQUFDLEdBQUcsQ0FBQyxZQUFZLENBQUMsQ0FBQztRQUMxQyxFQUFFLENBQUMsMEJBQTBCLEVBQUM7WUFDMUIsS0FBSyxDQUFDLFdBQVc7aUJBQ2IsTUFBTSxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsU0FBUyxFQUFDLE9BQU8sQ0FBQyxDQUFDO1lBQzVDLEtBQUssQ0FBQyxXQUFXO2lCQUNiLE1BQU0sQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLE1BQU0sRUFBQyxhQUFhLENBQUMsQ0FBQztRQUNuRCxDQUFDLENBQUMsQ0FBQztRQUVILEVBQUUsQ0FBQyxzQkFBc0IsRUFBQztZQUN0QixLQUFLO2lCQUNBLE1BQU0sQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLE1BQU0sRUFBQyxhQUFhLENBQUMsQ0FBQTtRQUNuRCxDQUFDLENB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AgICAgICAgICAgLnNob3VsZC5oYXZlLnByb3BlcnR5KFwidmVyc2lvblwiLFwiMS4wLjBcIik7XG4gICAgICAgICAgICBteU5wbS5wYWNrYWdlSnNvblxuICAgICAgICAgICAgICAgLnNob3VsZC5oYXZlLnByb3BlcnR5KFwibmFtZVwiLFwidGVzdHBhY2thZ2VcIik7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGl0KFwic2hvdWxkIGhhdmUgLnZlcnNpb25cIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgbXlOcG1cbiAgICAgICAgICAgICAgICAuc2hvdWxkLmhhdmUucHJvcGVydHkoXCJuYW1lXCIsXCJ0ZXN0cGFja2FnZVwiKVxuICAgICAgICB9KTtcblxuICAgICAgICBpdChcInNob3VsZCBoYXZlIC5uYW1lXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIG15TnBtXG4gICAgICAgICAgICAgICAgLnNob3VsZC5oYXZlLnByb3BlcnR5KFwibmFtZVwiLFwidGVzdHBhY2thZ2VcIik7XG4gICAgICAgIH0pO1xuXG4gICAgfSk7XG5cbiAgICBkZXNjcmliZShcIi5nZXROYW1lKClcIixmdW5jdGlvbigpe1xuICAgICAgICBpdChcInNob3VsZCByZXR1cm4gYSBuYW1lXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHByb2plY3RpbmZvLmdldE5hbWUodGVzdEJhc2VQYXRoKVxuICAgICAgICAgICAgICAgIC5zaG91bGQuZXF1YWwoXCJ0ZXN0cGFja2FnZVwiKTtcbiAgICAgICAgfSk7XG4gICAgfSlcbn0pOyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
|
|
@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,IAAI,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC9C,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC/B,IAAI,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3B,IAAI,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAE3C,QAAQ,CAAC,aAAa,EAAC;IACnB,QAAQ,CAAC,eAAe,EAAC;QACrB,IAAI,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC1C,EAAE,CAAC,0BAA0B,EAAC;YAC1B,KAAK,CAAC,WAAW;iBACb,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAC,OAAO,CAAC,CAAC;YAC5C,KAAK,CAAC,WAAW;iBACb,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAC,aAAa,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,sBAAsB,EAAC;YACtB,KAAK;iBACA,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAC,aAAa,CAAC,CAAA;QACnD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mBAAmB,EAAC;YACnB,KAAK;iBACA,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAC,aAAa,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IAEP,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,YAAY,EAAC;QAClB,EAAE,CAAC,sBAAsB,EAAC;YACtB,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC;iBAC5B,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAC"}
|
|
56
test/test.ts
56
test/test.ts
@ -1,35 +1,31 @@
|
|||||||
/// <reference path="../ts/typings/main.d.ts" />
|
import { tap, expect } from '@pushrocks/tapbundle';
|
||||||
var projectinfo = require("../dist/index.js");
|
import projectinfo = require('../ts/index');
|
||||||
var should = require("should");
|
|
||||||
var path = require("path");
|
|
||||||
var testBasePath = path.resolve(__dirname);
|
|
||||||
|
|
||||||
describe("projectinfo",function(){
|
let path = require('path');
|
||||||
describe(".npm() return",function(){
|
let testBasePath = path.resolve(__dirname);
|
||||||
var myNpm = projectinfo.npm(testBasePath);
|
|
||||||
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(){
|
let myNpm = new projectinfo.ProjectinfoNpm(testBasePath, { gitAccessToken: 'sometoken' });
|
||||||
myNpm
|
tap.test('should have .packageJson', async () => {
|
||||||
.should.have.property("name","testpackage")
|
expect(myNpm.packageJson).have.property('version', '1.0.0');
|
||||||
});
|
expect(myNpm.packageJson).have.property('name', 'testpackage');
|
||||||
|
});
|
||||||
|
|
||||||
it("should have .name",function(){
|
tap.test('should have .version', async () => {
|
||||||
myNpm
|
expect(myNpm).have.property('version', '1.0.0');
|
||||||
.should.have.property("name","testpackage");
|
});
|
||||||
});
|
|
||||||
|
|
||||||
});
|
tap.test('should have .name', async () => {
|
||||||
|
expect(myNpm).have.property('name', 'testpackage');
|
||||||
|
});
|
||||||
|
|
||||||
describe(".getName()",function(){
|
tap.test('should have .license', async () => {
|
||||||
it("should return a name",function(){
|
expect(myNpm).have.property('license', 'MIT');
|
||||||
projectinfo.getName(testBasePath)
|
});
|
||||||
.should.equal("testpackage");
|
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();
|
||||||
|
46
ts/index.ts
46
ts/index.ts
@ -1,29 +1,21 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
import plugins = require('./projectinfo.plugins');
|
||||||
import plugins = require("./projectinfo.plugins");
|
|
||||||
var projectinfo:any = {};
|
|
||||||
|
|
||||||
//classes
|
// direct access to classes
|
||||||
import ProjectinfoNPM = require("./projectinfo.npm");
|
export * from './projectinfo.classes.git';
|
||||||
projectinfo.npm = function(cwdArg){
|
export * from './projectinfo.classes.npm';
|
||||||
return new ProjectinfoNPM(cwdArg);
|
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
|
|
||||||
projectinfo.getName = function(cwdArg){
|
|
||||||
var localNpm = projectinfo.npm(cwdArg);
|
|
||||||
if (localNpm.status === "ok"){
|
|
||||||
return localNpm.name;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* TODO
|
|
||||||
projectinfo.git = function(){
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
projectinfo.mojo = function(){
|
|
||||||
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
export = projectinfo;
|
|
29
ts/projectinfo.classes.git.ts
Normal file
29
ts/projectinfo.classes.git.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
31
ts/projectinfo.classes.npm.ts
Normal file
31
ts/projectinfo.classes.npm.ts
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
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 } = {}) {
|
||||||
|
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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
20
ts/projectinfo.classes.projectinfo.ts
Normal file
20
ts/projectinfo.classes.projectinfo.ts
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
@ -1,22 +0,0 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
|
||||||
import plugins = require("./projectinfo.plugins");
|
|
||||||
class ProjectinfoNPM {
|
|
||||||
packageJson;
|
|
||||||
name:string;
|
|
||||||
version:string;
|
|
||||||
status:string;
|
|
||||||
|
|
||||||
constructor(cwdArg:string){
|
|
||||||
this.packageJson = plugins.smartfile.readFileToObject(
|
|
||||||
plugins.path.join(
|
|
||||||
plugins.path.resolve(cwdArg),
|
|
||||||
"package.json"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
this.name = this.packageJson.name;
|
|
||||||
this.version = this.packageJson.version;
|
|
||||||
this.status = "ok";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export = ProjectinfoNPM;
|
|
@ -1,8 +1,7 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
import * as path from 'path';
|
||||||
var plugins = {
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
path: require("path"),
|
import * as smartfile from '@pushrocks/smartfile';
|
||||||
Q: require("q"),
|
import * as smartstring from '@pushrocks/smartstring';
|
||||||
smartfile: require("smartfile")
|
import * as smartpath from '@pushrocks/smartpath';
|
||||||
};
|
|
||||||
|
|
||||||
export = plugins;
|
export { path, smartpromise, smartfile, smartstring, smartpath };
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"ambientDependencies": {
|
|
||||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts",
|
|
||||||
"mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts",
|
|
||||||
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts"
|
|
||||||
}
|
|
||||||
}
|
|
17
tslint.json
Normal file
17
tslint.json
Normal 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"
|
||||||
|
}
|
Reference in New Issue
Block a user