update to meet newest standards
This commit is contained in:
parent
fcd559090a
commit
9030619046
@ -3,7 +3,8 @@ image: hosttoday/ht-docker-node:npmts
|
|||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
- release
|
- release
|
||||||
- page
|
- trigger
|
||||||
|
- pages
|
||||||
|
|
||||||
testLEGACY:
|
testLEGACY:
|
||||||
stage: test
|
stage: test
|
||||||
@ -35,3 +36,24 @@ release:
|
|||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
stage: trigger
|
||||||
|
script:
|
||||||
|
- npmci trigger
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
pages:
|
||||||
|
image: hosttoday/ht-docker-node:npmpage
|
||||||
|
stage: pages
|
||||||
|
script:
|
||||||
|
- npmci command npmpage --host gitlab
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
paths:
|
||||||
|
- public
|
||||||
|
13
dist/index.d.ts
vendored
13
dist/index.d.ts
vendored
@ -1,5 +1,8 @@
|
|||||||
import "typings-global";
|
import 'typings-global';
|
||||||
import { ProjectinfoNpm } from "./projectinfo.classes.npm";
|
export * from './projectinfo.classes.git';
|
||||||
export { ProjectinfoNpm } from "./projectinfo.classes.npm";
|
export * from './projectinfo.classes.npm';
|
||||||
export declare let npm: (cwdArg: any, optionsArg: any) => ProjectinfoNpm;
|
export * from './projectinfo.classes.projectinfo';
|
||||||
export declare let getName: (cwdArg: any) => string;
|
/**
|
||||||
|
* gets the name from package.json in a specified directory
|
||||||
|
*/
|
||||||
|
export declare let getNpmNameForDir: (cwdArg: any) => string;
|
||||||
|
23
dist/index.js
vendored
23
dist/index.js
vendored
@ -1,16 +1,21 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
function __export(m) {
|
||||||
|
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||||
|
}
|
||||||
require("typings-global");
|
require("typings-global");
|
||||||
|
// direct access to classes
|
||||||
|
__export(require("./projectinfo.classes.git"));
|
||||||
|
__export(require("./projectinfo.classes.npm"));
|
||||||
|
__export(require("./projectinfo.classes.projectinfo"));
|
||||||
// npm
|
// npm
|
||||||
const projectinfo_classes_npm_1 = require("./projectinfo.classes.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
|
// quick functions
|
||||||
exports.getName = function (cwdArg) {
|
/**
|
||||||
var localNpm = new projectinfo_classes_npm_1.ProjectinfoNpm(cwdArg);
|
* gets the name from package.json in a specified directory
|
||||||
if (localNpm.status === "ok") {
|
*/
|
||||||
|
exports.getNpmNameForDir = function (cwdArg) {
|
||||||
|
let localNpm = new projectinfo_classes_npm_1.ProjectinfoNpm(cwdArg);
|
||||||
|
if (localNpm.status === 'ok') {
|
||||||
return localNpm.name;
|
return localNpm.name;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -23,4 +28,4 @@ projectinfo.mojo = function(){
|
|||||||
|
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBR3ZCLEtBQUs7QUFDTCx1RUFBeUQ7QUFDekQscUVBQXlEO0FBQWpELG1EQUFBLGNBQWMsQ0FBQTtBQUNYLFFBQ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s7Ozs7OztFQVFFIn0=
|
6
dist/projectinfo.classes.git.d.ts
vendored
6
dist/projectinfo.classes.git.d.ts
vendored
@ -1 +1,5 @@
|
|||||||
import "typings-global";
|
import 'typings-global';
|
||||||
|
export declare class ProjectinfoGit {
|
||||||
|
isGit: boolean;
|
||||||
|
constructor();
|
||||||
|
}
|
||||||
|
7
dist/projectinfo.classes.git.js
vendored
7
dist/projectinfo.classes.git.js
vendored
@ -1,3 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-global");
|
require("typings-global");
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8uY2xhc3Nlcy5naXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9wcm9qZWN0aW5mby5jbGFzc2VzLmdpdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCIn0=
|
class ProjectinfoGit {
|
||||||
|
constructor() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.ProjectinfoGit = ProjectinfoGit;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8uY2xhc3Nlcy5naXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9wcm9qZWN0aW5mby5jbGFzc2VzLmdpdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBRXZCO0lBRUk7SUFFQSxDQUFDO0NBQ0o7QUFMRCx3Q0FLQyJ9
|
3
dist/projectinfo.classes.npm.d.ts
vendored
3
dist/projectinfo.classes.npm.d.ts
vendored
@ -1,5 +1,6 @@
|
|||||||
import "typings-global";
|
import 'typings-global';
|
||||||
export declare class ProjectinfoNpm {
|
export declare class ProjectinfoNpm {
|
||||||
|
isNpm: boolean;
|
||||||
packageJson: any;
|
packageJson: any;
|
||||||
name: string;
|
name: string;
|
||||||
version: string;
|
version: string;
|
||||||
|
11
dist/projectinfo.classes.npm.js
vendored
11
dist/projectinfo.classes.npm.js
vendored
@ -3,17 +3,22 @@ require("typings-global");
|
|||||||
const plugins = require("./projectinfo.plugins");
|
const plugins = require("./projectinfo.plugins");
|
||||||
class ProjectinfoNpm {
|
class ProjectinfoNpm {
|
||||||
constructor(cwdArg, optionsArg = {}) {
|
constructor(cwdArg, optionsArg = {}) {
|
||||||
this.packageJson = plugins.smartfile.fs.toObjectSync(plugins.path.join(plugins.path.resolve(cwdArg), "package.json"), "json");
|
this.isNpm = false;
|
||||||
|
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.name = this.packageJson.name;
|
||||||
this.version = this.packageJson.version;
|
this.version = this.packageJson.version;
|
||||||
this.status = "ok";
|
this.status = 'ok';
|
||||||
this.license = this.packageJson.license;
|
this.license = this.packageJson.license;
|
||||||
if (this.packageJson.repository) {
|
if (this.packageJson.repository) {
|
||||||
this.git = new plugins.smartstring.GitRepo(this.packageJson.repository.url, optionsArg.gitAccessToken);
|
this.git = new plugins.smartstring.GitRepo(this.packageJson.repository.url, optionsArg.gitAccessToken);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
exports.ProjectinfoNpm = ProjectinfoNpm;
|
exports.ProjectinfoNpm = ProjectinfoNpm;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8uY2xhc3Nlcy5ucG0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9wc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FDLENBQUMsSUFBSSxDQUFDLFdBQVcsQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFDO2dCQUM5QixJQUFJLENBQUMsR0FBRyxHQUFHLElBQUksT0FBTyxDQUFDLFdBQVcsQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLFdBQVcsQ0FBQyxVQUFVLENBQUMsR0FBRyxFQUFFLFVBQVUsQ0FBQyxjQUFjLENBQUMsQ0FBQTtZQUMxRyxDQUFDO1lBQUEsQ0FBQztRQUNOLENBQUM7SUFDTCxDQUFDO0lBQUEsQ0FBQztDQUNMO0FBN0JELHdDQTZCQyJ9
|
13
dist/projectinfo.classes.projectinfo.d.ts
vendored
Normal file
13
dist/projectinfo.classes.projectinfo.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { ProjectinfoNpm } from './projectinfo.classes.npm';
|
||||||
|
export declare type TProjectType = 'git' | 'npm';
|
||||||
|
/**
|
||||||
|
* class projectinfo automatically examines a given directory and exposes relevant info about it
|
||||||
|
*/
|
||||||
|
export declare class ProjectInfo {
|
||||||
|
type: TProjectType;
|
||||||
|
npm: ProjectinfoNpm;
|
||||||
|
/**
|
||||||
|
* this constructor
|
||||||
|
*/
|
||||||
|
constructor(cwdArg: string);
|
||||||
|
}
|
15
dist/projectinfo.classes.projectinfo.js
vendored
Normal file
15
dist/projectinfo.classes.projectinfo.js
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
"use strict";
|
||||||
|
const projectinfo_classes_npm_1 = require("./projectinfo.classes.npm");
|
||||||
|
/**
|
||||||
|
* class projectinfo automatically examines a given directory and exposes relevant info about it
|
||||||
|
*/
|
||||||
|
class ProjectInfo {
|
||||||
|
/**
|
||||||
|
* this constructor
|
||||||
|
*/
|
||||||
|
constructor(cwdArg) {
|
||||||
|
this.npm = new projectinfo_classes_npm_1.ProjectinfoNpm(cwdArg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.ProjectInfo = ProjectInfo;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8uY2xhc3Nlcy5wcm9qZWN0aW5mby5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3Byb2plY3RpbmZvLmNsYXNzZXMucHJvamVjdGluZm8udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLHVFQUEwRDtBQUkxRDs7R0FFRztBQUNIO0lBR0k7O09BRUc7SUFDSCxZQUFZLE1BQWM7UUFDdEIsSUFBSSxDQUFDLEdBQUcsR0FBRyxJQUFJLHdDQUFjLENBQUMsTUFBTSxDQUFDLENBQUE7SUFDekMsQ0FBQztDQUlKO0FBWkQsa0NBWUMifQ==
|
6
dist/projectinfo.plugins.d.ts
vendored
6
dist/projectinfo.plugins.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
import "typings-global";
|
import 'typings-global';
|
||||||
export declare let path: any;
|
export declare let path: any;
|
||||||
export declare let Q: any;
|
export declare let Q: any;
|
||||||
export import smartfile = require("smartfile");
|
export import smartfile = require('smartfile');
|
||||||
export import smartstring = require("smartstring");
|
export import smartstring = require('smartstring');
|
||||||
|
6
dist/projectinfo.plugins.js
vendored
6
dist/projectinfo.plugins.js
vendored
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-global");
|
require("typings-global");
|
||||||
exports.path = require("path");
|
exports.path = require('path');
|
||||||
exports.Q = require("q");
|
exports.Q = require('q');
|
||||||
exports.smartfile = require("smartfile");
|
exports.smartfile = require("smartfile");
|
||||||
exports.smartstring = require("smartstring");
|
exports.smartstring = require("smartstring");
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8ucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3Byb2plY3RpbmZvLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF1QjtBQUNaLFFBQUEsSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQztBQUN2QixRQUFBLENBQUMsR0FBSSxPQUFPLENBQUMsR0FBRyxDQUFDLENBQUM7QUFDN0IseUNBQStDO0FBQy9DLDZDQUFtRCJ9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdGluZm8ucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3Byb2plY3RpbmZvLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF1QjtBQUNaLFFBQUEsSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQTtBQUN0QixRQUFBLENBQUMsR0FBSSxPQUFPLENBQUMsR0FBRyxDQUFDLENBQUE7QUFDNUIseUNBQThDO0FBQzlDLDZDQUFrRCJ9
|
11
npmextra.json
Normal file
11
npmextra.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"npmts": {
|
||||||
|
"mode": "default",
|
||||||
|
"coverageTreshold": 80
|
||||||
|
},
|
||||||
|
"npmci": {
|
||||||
|
"globalNpmTools": [
|
||||||
|
"npmts"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -25,14 +25,14 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/projectinfo#readme",
|
"homepage": "https://gitlab.com/pushrocks/projectinfo#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"npmts-g": "^5.2.8",
|
"npmts-g": "^5.2.10",
|
||||||
"should": "^11.1.1",
|
"should": "^11.1.1",
|
||||||
"typings-test": "^1.0.3"
|
"typings-test": "^1.0.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"q": "^1.4.1",
|
"q": "^1.4.1",
|
||||||
"smartfile": "4.1.0",
|
"smartfile": "4.1.0",
|
||||||
"smartstring": "2.0.17",
|
"smartstring": "2.0.22",
|
||||||
"typings-global": "^1.0.14"
|
"typings-global": "^1.0.14"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
test/test.d.ts
vendored
2
test/test.d.ts
vendored
@ -1 +1 @@
|
|||||||
import "typings-test";
|
import 'typings-test';
|
||||||
|
51
test/test.js
51
test/test.js
@ -1,40 +1,33 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-test");
|
require("typings-test");
|
||||||
var projectinfo = require("../dist/index.js");
|
const projectinfo = require("../dist/index");
|
||||||
var should = require("should");
|
let should = require('should');
|
||||||
var path = require("path");
|
let path = require('path');
|
||||||
var testBasePath = path.resolve(__dirname);
|
let testBasePath = path.resolve(__dirname);
|
||||||
describe("projectinfo", function () {
|
describe('projectinfo', function () {
|
||||||
describe(".npm() return", function () {
|
describe('.npm() return', function () {
|
||||||
var myNpm = projectinfo.npm(testBasePath, { gitAccessToken: "sometoken" });
|
let myNpm = new projectinfo.ProjectinfoNpm(testBasePath, { gitAccessToken: 'sometoken' });
|
||||||
it("should have .packageJson", function () {
|
it('should have .packageJson', function () {
|
||||||
myNpm.packageJson
|
should(myNpm.packageJson).have.property('version', '1.0.0');
|
||||||
.should.have.property("version", "1.0.0");
|
should(myNpm.packageJson).have.property('name', 'testpackage');
|
||||||
myNpm.packageJson
|
|
||||||
.should.have.property("name", "testpackage");
|
|
||||||
});
|
});
|
||||||
it("should have .version", function () {
|
it('should have .version', function () {
|
||||||
myNpm
|
should(myNpm).have.property('version', '1.0.0');
|
||||||
.should.have.property("version", "1.0.0");
|
|
||||||
});
|
});
|
||||||
it("should have .name", function () {
|
it('should have .name', function () {
|
||||||
myNpm
|
should(myNpm).have.property('name', 'testpackage');
|
||||||
.should.have.property("name", "testpackage");
|
|
||||||
});
|
});
|
||||||
it("should have .license", function () {
|
it('should have .license', function () {
|
||||||
myNpm
|
should(myNpm).have.property('license', 'MIT');
|
||||||
.should.have.property("license", "MIT");
|
|
||||||
});
|
});
|
||||||
it("should have .git", function () {
|
it('should have .git', function () {
|
||||||
myNpm.git.httpsUrl
|
should(myNpm.git.httpsUrl).equal('https://sometoken@github.com/someuser/somerepo.git');
|
||||||
.should.equal("https://sometoken@github.com/someuser/somerepo.git");
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe(".getName()", function () {
|
describe('.getNpmNameForDir()', function () {
|
||||||
it("should return a name", function () {
|
it('should return a name', function () {
|
||||||
projectinfo.getName(testBasePath)
|
should(projectinfo.getNpmNameForDir(testBasePath)).equal('testpackage');
|
||||||
.should.equal("testpackage");
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFzQjtBQUN0QixJQUFJLFdBQVcsR0FBRyxPQUFPLENBQUMsa0JBQWtCLENBQUMsQ0FBQztBQUM5QyxJQUFJLE1BQU0sR0FBRyxPQUFPLENBQUMsUUFBUSxDQUFDLENBQUM7QUFDL0IsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0FBQzNCLElBQUksWUFBWSxHQUFHLElBQUksQ0FBQyxPQUFPLENBQUMsU0FBUyxDQUFDLENBQUM7QUFFM0MsUUFBUSxDQUFDLGFBQWEsRUFBQztJQUNuQixRQUFRLENBQUMsZUFBZSxFQUFDO1FBQ3JCLElBQUksS0FBSyxHQUFHLFdBQVcsQ0FBQyxHQUFHLENBQUMsWUFBWSxFQUFDLEVBQUMsY0FBYyxFQUFDLFdBQVcsRUFBQyxDQUFDLENBQUM7UUFDdkUsRU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yxzQkFBc0IsRUFBQztZQUN0QixNQUFNLENBQUMsS0FBSyxDQUFDLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxTQUFTLEVBQUMsT0FBTyxDQUFDLENBQUE7UUFDbEQsQ0FBQyxDQUFDLENBQUE7UUFFRixFQUFFLENBQUMsbUJBQW1CLEVBQUM7WUFDbkIsTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsTUFBTSxFQUFDLGFBQWEsQ0FBQyxDQUFBO1FBQ3JELENBQUMsQ0FBQyxDQUFBO1FBRUYsRUFBRSxDQUFDLHNCQUFzQixFQUFDO1lBQ3RCLE1BQU0sQ0FBQyxLQUFLLENBQUMsQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLFNBQVMsRUFBQyxLQUFLLENBQUMsQ0FBQTtRQUNoRCxDQUFDLENBQUMsQ0FBQTtRQUNGLEVBQUUsQ0FBQyxrQkFBa0IsRUFBQztZQUNsQixNQUFNLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxRQUFRLENBQUMsQ0FBQyxLQUFLLENBQUMsb0RBQW9ELENBQUMsQ0FBQTtRQUMxRixDQUFDLENBQUMsQ0FBQTtJQUVOLENBQUMsQ0FBQyxDQUFBO0lBRUYsUUFBUSxDQUFDLHFCQUFxQixFQUFDO1FBQzNCLEVBQUUsQ0FBQyxzQkFBc0IsRUFBQztZQUN0QixNQUFNLENBQUMsV0FBVyxDQUFDLGdCQUFnQixDQUFDLFlBQVksQ0FBQyxDQUM1QyxDQUFDLEtBQUssQ0FBQyxhQUFhLENBQUMsQ0FBQTtRQUM5QixDQUFDLENBQUMsQ0FBQTtJQUNOLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ==
|
78
test/test.ts
78
test/test.ts
@ -1,44 +1,38 @@
|
|||||||
import "typings-test";
|
import 'typings-test'
|
||||||
var projectinfo = require("../dist/index.js");
|
import projectinfo = require('../dist/index')
|
||||||
var should = require("should");
|
let should = require('should')
|
||||||
var path = require("path");
|
let path = require('path')
|
||||||
var testBasePath = path.resolve(__dirname);
|
let testBasePath = path.resolve(__dirname)
|
||||||
|
|
||||||
describe("projectinfo",function(){
|
describe('projectinfo',function(){
|
||||||
describe(".npm() return",function(){
|
describe('.npm() return',function(){
|
||||||
var myNpm = projectinfo.npm(testBasePath,{gitAccessToken:"sometoken"});
|
let myNpm = new projectinfo.ProjectinfoNpm(testBasePath,{gitAccessToken: 'sometoken'})
|
||||||
it("should have .packageJson",function(){
|
it('should have .packageJson',function(){
|
||||||
myNpm.packageJson
|
should(myNpm.packageJson).have.property('version','1.0.0')
|
||||||
.should.have.property("version","1.0.0");
|
should(myNpm.packageJson).have.property('name','testpackage')
|
||||||
myNpm.packageJson
|
})
|
||||||
.should.have.property("name","testpackage");
|
|
||||||
});
|
it('should have .version',function(){
|
||||||
|
should(myNpm).have.property('version','1.0.0')
|
||||||
it("should have .version",function(){
|
})
|
||||||
myNpm
|
|
||||||
.should.have.property("version","1.0.0")
|
it('should have .name',function(){
|
||||||
});
|
should(myNpm).have.property('name','testpackage')
|
||||||
|
})
|
||||||
it("should have .name",function(){
|
|
||||||
myNpm
|
it('should have .license',function(){
|
||||||
.should.have.property("name","testpackage");
|
should(myNpm).have.property('license','MIT')
|
||||||
});
|
})
|
||||||
|
it('should have .git',function(){
|
||||||
it("should have .license",function(){
|
should(myNpm.git.httpsUrl).equal('https://sometoken@github.com/someuser/somerepo.git')
|
||||||
myNpm
|
})
|
||||||
.should.have.property("license","MIT");
|
|
||||||
});
|
})
|
||||||
it("should have .git",function(){
|
|
||||||
myNpm.git.httpsUrl
|
describe('.getNpmNameForDir()',function(){
|
||||||
.should.equal("https://sometoken@github.com/someuser/somerepo.git");
|
it('should return a name',function(){
|
||||||
});
|
should(projectinfo.getNpmNameForDir(testBasePath)
|
||||||
|
).equal('testpackage')
|
||||||
});
|
})
|
||||||
|
})
|
||||||
describe(".getName()",function(){
|
|
||||||
it("should return a name",function(){
|
|
||||||
projectinfo.getName(testBasePath)
|
|
||||||
.should.equal("testpackage");
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
});
|
|
29
ts/index.ts
29
ts/index.ts
@ -1,20 +1,25 @@
|
|||||||
import "typings-global"
|
import 'typings-global'
|
||||||
import plugins = require("./projectinfo.plugins");
|
import plugins = require('./projectinfo.plugins')
|
||||||
|
|
||||||
|
// direct access to classes
|
||||||
|
export * from './projectinfo.classes.git'
|
||||||
|
export * from './projectinfo.classes.npm'
|
||||||
|
export * from './projectinfo.classes.projectinfo'
|
||||||
|
|
||||||
// npm
|
// npm
|
||||||
import {ProjectinfoNpm} from "./projectinfo.classes.npm";
|
import { ProjectinfoNpm } from './projectinfo.classes.npm'
|
||||||
export {ProjectinfoNpm} from "./projectinfo.classes.npm";
|
|
||||||
export let npm = function(cwdArg,optionsArg){
|
|
||||||
return new ProjectinfoNpm(cwdArg,optionsArg);
|
|
||||||
};
|
|
||||||
|
|
||||||
// quick functions
|
// quick functions
|
||||||
export let getName = function(cwdArg){
|
|
||||||
var localNpm = new ProjectinfoNpm(cwdArg);
|
/**
|
||||||
if (localNpm.status === "ok"){
|
* gets the name from package.json in a specified directory
|
||||||
return localNpm.name;
|
*/
|
||||||
|
export let getNpmNameForDir = function(cwdArg){
|
||||||
|
let localNpm = new ProjectinfoNpm(cwdArg)
|
||||||
|
if (localNpm.status === 'ok') {
|
||||||
|
return localNpm.name
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
projectinfo.git = function(){
|
projectinfo.git = function(){
|
||||||
|
@ -1 +1,8 @@
|
|||||||
import "typings-global"
|
import 'typings-global'
|
||||||
|
|
||||||
|
export class ProjectinfoGit {
|
||||||
|
isGit: boolean
|
||||||
|
constructor() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,28 +1,32 @@
|
|||||||
import "typings-global"
|
import 'typings-global'
|
||||||
import plugins = require("./projectinfo.plugins");
|
import plugins = require('./projectinfo.plugins')
|
||||||
export class ProjectinfoNpm {
|
export class ProjectinfoNpm {
|
||||||
packageJson;
|
isNpm: boolean = false
|
||||||
name:string;
|
packageJson: any
|
||||||
version:string;
|
name: string
|
||||||
status:string;
|
version: string
|
||||||
license:string;
|
status: string
|
||||||
git;
|
license: string
|
||||||
|
git
|
||||||
|
|
||||||
constructor(cwdArg: string, optionsArg: { gitAccessToken?: string } = {}) {
|
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(
|
this.packageJson = plugins.smartfile.fs.toObjectSync(
|
||||||
plugins.path.join(
|
plugins.path.join(
|
||||||
plugins.path.resolve(cwdArg),
|
resolvedCwd,
|
||||||
"package.json"
|
'package.json'
|
||||||
),
|
),
|
||||||
"json"
|
'json'
|
||||||
);
|
)
|
||||||
this.name = this.packageJson.name;
|
this.name = this.packageJson.name
|
||||||
this.version = this.packageJson.version;
|
this.version = this.packageJson.version
|
||||||
this.status = "ok";
|
this.status = 'ok'
|
||||||
this.license = this.packageJson.license;
|
this.license = this.packageJson.license
|
||||||
if (this.packageJson.repository) {
|
if (this.packageJson.repository) {
|
||||||
this.git = new plugins.smartstring.GitRepo(this.packageJson.repository.url,optionsArg.gitAccessToken);
|
this.git = new plugins.smartstring.GitRepo(this.packageJson.repository.url, optionsArg.gitAccessToken)
|
||||||
};
|
};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
21
ts/projectinfo.classes.projectinfo.ts
Normal file
21
ts/projectinfo.classes.projectinfo.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import * as plugins from './projectinfo.plugins'
|
||||||
|
import { ProjectinfoNpm } from './projectinfo.classes.npm'
|
||||||
|
|
||||||
|
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
|
||||||
|
/**
|
||||||
|
* this constructor
|
||||||
|
*/
|
||||||
|
constructor(cwdArg: string) {
|
||||||
|
this.npm = new ProjectinfoNpm(cwdArg)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
import "typings-global"
|
import 'typings-global'
|
||||||
export let path = require("path");
|
export let path = require('path')
|
||||||
export let Q = require("q");
|
export let Q = require('q')
|
||||||
export import smartfile = require("smartfile");
|
export import smartfile = require('smartfile')
|
||||||
export import smartstring = require("smartstring");
|
export import smartstring = require('smartstring')
|
||||||
|
3
tslint.json
Normal file
3
tslint.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "tslint-config-standard"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user