fix(ci): update
This commit is contained in:
22
ts/index.ts
22
ts/index.ts
@ -1,24 +1,24 @@
|
||||
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'
|
||||
export * from './projectinfo.classes.git';
|
||||
export * from './projectinfo.classes.npm';
|
||||
export * from './projectinfo.classes.projectinfo';
|
||||
|
||||
// npm
|
||||
import { ProjectinfoNpm } from './projectinfo.classes.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
|
||||
}
|
||||
}
|
||||
export let getNpmNameForDir = function(cwdArg) {
|
||||
let localNpm = new ProjectinfoNpm(cwdArg);
|
||||
if (localNpm.status === 'ok') {
|
||||
return localNpm.name;
|
||||
}
|
||||
};
|
||||
|
||||
/* TODO
|
||||
projectinfo.git = function(){
|
||||
|
@ -1,29 +1,29 @@
|
||||
import * as plugins from './projectinfo.plugins'
|
||||
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()
|
||||
}
|
||||
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 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)
|
||||
}
|
||||
/**
|
||||
* get git info from remote url
|
||||
*/
|
||||
getGitInfoFromRemote(remoteUrlArg: string) {
|
||||
let gitRepoParsed = new plugins.smartstring.GitRepo(remoteUrlArg);
|
||||
}
|
||||
}
|
||||
|
@ -1,31 +1,31 @@
|
||||
import plugins = require('./projectinfo.plugins')
|
||||
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
|
||||
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)
|
||||
};
|
||||
}
|
||||
};
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +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'
|
||||
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)
|
||||
}
|
||||
}
|
||||
type: TProjectType;
|
||||
npm: ProjectinfoNpm;
|
||||
git: ProjectinfoGit;
|
||||
/**
|
||||
* constructor of class ProjectInfo
|
||||
*/
|
||||
constructor(cwdArg: string) {
|
||||
this.npm = new ProjectinfoNpm(cwdArg);
|
||||
this.git = new ProjectinfoGit(cwdArg);
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,4 @@ import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartstring from '@pushrocks/smartstring';
|
||||
import * as smartpath from '@pushrocks/smartpath';
|
||||
|
||||
export {
|
||||
path,
|
||||
smartpromise,
|
||||
smartfile,
|
||||
smartstring,
|
||||
smartpath
|
||||
}
|
||||
export { path, smartpromise, smartfile, smartstring, smartpath };
|
||||
|
Reference in New Issue
Block a user