Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ioffice/tc-builder

Package Overview
Dependencies
Maintainers
2
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ioffice/tc-builder - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0-beta.1804251446

projectFiles/.editorconfig.tpl

2

Compiler.d.ts
import { TypedObject, IProjectResults, IFileMessages } from './Interfaces';
import * as ts from 'typescript';
declare function compile(program: ts.Program, tsOptions: ts.CompilerOptions, lintOptions?: any, verbose?: boolean): TypedObject<IFileMessages>;
declare function compile(program: ts.Program, tsOptions: ts.CompilerOptions, tsLintConfigPath?: string, verbose?: boolean): TypedObject<IFileMessages>;
declare function compileProject(tsConfigPath: string, tsLintConfigPath?: string, verbose?: boolean): IProjectResults;
declare function compileCLI(tsconfigPath: string, tslintPath?: string, verbose?: boolean): number;
export { compile, compileProject, compileCLI };

@@ -8,3 +8,2 @@ "use strict";

var ProgressBar = require("progress");
var Util_1 = require("./Util");
var Formatter_1 = require("./Formatter");

@@ -25,3 +24,3 @@ function cout(msg, verbose) {

}
function compile(program, tsOptions, lintOptions, verbose) {
function compile(program, tsOptions, tsLintConfigPath, verbose) {
var results = {};

@@ -63,5 +62,8 @@ var outDirectory = tsOptions.outDir || '.';

}
if (lintOptions) {
if (tsLintConfigPath) {
console.log('got the path:', tsLintConfigPath);
var linter = new Lint.Linter(options, program);
var configFile = Lint.Configuration.parseConfigFile(lintOptions);
console.log('uhuh...');
var configFile = Lint.Configuration.loadConfigurationFromPath(tsLintConfigPath);
console.log('configFile:', configFile);
linter.lint(fileName, '', configFile);

@@ -142,4 +144,4 @@ var lintResults = linter.getResult();

var program = ts.createProgram(parsed.fileNames, parsed.options, host);
var lintOptions = Util_1.readJSON(tsLintConfigPath || 'tslint.json');
var results = compile(program, project.config.compilerOptions || {}, lintOptions, verbose);
console.log('about to compile:', tsLintConfigPath);
var results = compile(program, project.config.compilerOptions || {}, tsLintConfigPath || 'tslint.json', verbose);
var output = {

@@ -146,0 +148,0 @@ results: results,

import { TCBuilder, resolution } from './TCBuilder';
import { compile, compileProject } from './Compiler';
import { move, changePackageVersion, readJSON } from './Util';
import { move, replaceStrings, changePackageVersion, readJSON } from './Util';
import { formatResults } from './Formatter';
export { resolution, TCBuilder, compile, compileProject, move, changePackageVersion, readJSON, formatResults };
export { resolution, TCBuilder, compile, compileProject, move, replaceStrings, changePackageVersion, readJSON, formatResults };

@@ -10,2 +10,3 @@ "use strict";

exports.move = Util_1.move;
exports.replaceStrings = Util_1.replaceStrings;
exports.changePackageVersion = Util_1.changePackageVersion;

@@ -12,0 +13,0 @@ exports.readJSON = Util_1.readJSON;

{
"name": "@ioffice/tc-builder",
"version": "1.0.0",
"version": "1.1.0-beta.1804251446",
"description": "iOFFICE TeamCity Builder",

@@ -20,2 +20,3 @@ "main": "index.js",

"devDependencies": {
"@ioffice/tslint-config-ioffice": "^0.0.1-beta.1804251410",
"@types/chai": "4.1.2",

@@ -22,0 +23,0 @@ "@types/mocha": "2.2.48",

# tc-builder
[![NPM Version](https://img.shields.io/npm/v/@ioffice/tc-builder.svg)](https://www.npmjs.com/package/@ioffice/tc-builder)
iOFFICE provides the transpiled code, so that its open source projects may be managed by

@@ -4,0 +6,0 @@ [TeamCity](https://www.jetbrains.com/teamcity/). iOFFICE is not responsible for any

@@ -1,2 +0,2 @@

declare function setupFiles(pkgName: string): void;
declare function setupFiles(pkgName: string, fileName?: string): void;
export { setupFiles };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var utils_1 = require("tslint/lib/utils");
var fs = require("fs");
function setupFiles(pkgName) {
var path = require("path");
var Util_1 = require("./Util");
var rel = function (x) { return path.resolve(__dirname, x); };
function safeMkDir(directory) {
if (!fs.existsSync(directory)) {
fs.mkdirSync(directory);
}
}
function getFileContents(fileName, replacements) {
var contents = fs.readFileSync(rel("./projectFiles/" + fileName + ".tpl"));
return Util_1.replaceStrings(contents.toString(), replacements);
}
function verifySourceDirectory() {
var files = ['src/main/index.ts', 'src/test/index.ts'];
safeMkDir('src');
safeMkDir('src/main');
safeMkDir('src/test');
files.forEach(function (fileName) {
if (fs.existsSync(fileName)) {
console.log('[SKIP]: ', fileName);
}
else {
console.log('[WRITING]: ', fileName);
fs.writeFileSync(fileName, '\n');
}
});
}
function setupFiles(pkgName, fileName) {
var _a = pkgName.split('/'), repoName = _a[1];
var files = {
'CHANGELOG.md': utils_1.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n # Change Log\n\n ## [0.0.1] - Date of release\n\n Description\n\n [0.0.1]: https://github.com/ioffice/", "/compare/<hash/tag>...0.0.1\n "], ["\n # Change Log\n\n ## [0.0.1] - Date of release\n\n Description\n\n [0.0.1]: https://github.com/ioffice/", "/compare/<hash/tag>...0.0.1\n "])), repoName),
'.editorconfig': utils_1.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n ## ", " EDITORCONFIG ##\n\n\n ### TOP MOST EDITORCONFIG FILE ###\n root = true\n\n\n ### DEFAULT GLOBAL SETTINGS FOR ALL FILES ###\n [*]\n charset = utf-8\n trim_trailing_whitespace = true\n insert_final_newline = true\n end_of_line = lf\n indent_style = space\n indent_size = 2\n\n\n ### MAKEFILE ###\n [Makefile]\n indent_style = tab\n "], ["\n ## ", " EDITORCONFIG ##\n\n\n ### TOP MOST EDITORCONFIG FILE ###\n root = true\n\n\n ### DEFAULT GLOBAL SETTINGS FOR ALL FILES ###\n [*]\n charset = utf-8\n trim_trailing_whitespace = true\n insert_final_newline = true\n end_of_line = lf\n indent_style = space\n indent_size = 2\n\n\n ### MAKEFILE ###\n [Makefile]\n indent_style = tab\n "])), pkgName.toLocaleUpperCase()),
'.gitignore': utils_1.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n .idea\n build/\n docs/\n node_modules/\n src/**/*.js\n version.json\n "], ["\n .idea\n build/\n docs/\n node_modules/\n src/**/*.js\n version.json\n "]))),
'.npmignore': utils_1.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n .idea\n build\n node_modules\n src\n .editorconfig\n .gitignore\n .npmignore\n Makefile\n tsconfig.json\n tslint.json\n CHANGELOG.md\n version.json\n *.build.cmd\n "], ["\n .idea\n build\n node_modules\n src\n .editorconfig\n .gitignore\n .npmignore\n Makefile\n tsconfig.json\n tslint.json\n CHANGELOG.md\n version.json\n *.build.cmd\n "]))),
'Makefile': utils_1.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n ## Tasks\n\n test: tcBuild\n\n preRelease: build\n PRERELEASE=true tc-builder run\n\n tcBuild: info build\n tc-builder run\n\n docs: FORCE\n cd src; ../node_modules/.bin/typedoc --out ../docs main --target es6 --ignoreCompilerErrors --mode modules --module commonjs --hideGenerator --excludePrivate --name '", " $(VERSION)'\n\n serveDocs:\n cd docs; python -m SimpleHTTPServer 8000\n\n ## Dependencies\n\n build: FORCE\n tc-builder build\n\n clean:\n rm -rf build\n\n info:\n node --version\n npm --version\n tsc --version\n typedoc --version\n\n FORCE:\n "], ["\n ## Tasks\n\n test: tcBuild\n\n preRelease: build\n PRERELEASE=true tc-builder run\n\n tcBuild: info build\n tc-builder run\n\n docs: FORCE\n cd src; ../node_modules/.bin/typedoc --out ../docs main --target es6 --ignoreCompilerErrors --mode modules --module commonjs --hideGenerator --excludePrivate --name '", " $(VERSION)'\n\n serveDocs:\n cd docs; python -m SimpleHTTPServer 8000\n\n ## Dependencies\n\n build: FORCE\n tc-builder build\n\n clean:\n rm -rf build\n\n info:\n node --version\n npm --version\n tsc --version\n typedoc --version\n\n FORCE:\n "])), pkgName),
'tsconfig.json': utils_1.dedent(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n {\n \"compilerOptions\": {\n \"skipDefaultLibCheck\": true,\n \"skipLibCheck\": true,\n \"noImplicitAny\": true,\n \"suppressImplicitAnyIndexErrors\": true,\n \"strictNullChecks\": true,\n \"strictPropertyInitialization\": true,\n \"noUnusedLocals\": true,\n \"noUnusedParameters\": true,\n \"emitDecoratorMetadata\": true,\n \"experimentalDecorators\": true,\n \"noEmitHelpers\": true,\n \"importHelpers\": true,\n \"target\": \"es5\",\n \"declaration\": true,\n \"noEmit\": false,\n \"outDir\": \"./build\"\n },\n \"files\": [\n \"src/main/index.ts\",\n \"src/test/index.ts\",\n ],\n \"exclude\": [\n \"build\",\n \"node_modules\"\n ]\n }\n "], ["\n {\n \"compilerOptions\": {\n \"skipDefaultLibCheck\": true,\n \"skipLibCheck\": true,\n \"noImplicitAny\": true,\n \"suppressImplicitAnyIndexErrors\": true,\n \"strictNullChecks\": true,\n \"strictPropertyInitialization\": true,\n \"noUnusedLocals\": true,\n \"noUnusedParameters\": true,\n \"emitDecoratorMetadata\": true,\n \"experimentalDecorators\": true,\n \"noEmitHelpers\": true,\n \"importHelpers\": true,\n \"target\": \"es5\",\n \"declaration\": true,\n \"noEmit\": false,\n \"outDir\": \"./build\"\n },\n \"files\": [\n \"src/main/index.ts\",\n \"src/test/index.ts\",\n ],\n \"exclude\": [\n \"build\",\n \"node_modules\"\n ]\n }\n "]))),
'tslint.json': utils_1.dedent(templateObject_7 || (templateObject_7 = tslib_1.__makeTemplateObject(["\n {\n \"rulesDirectory\": [\n \"node_modules/tslint-eslint-rules/dist/rules\"\n ],\n \"rules\": {\n \"array-bracket-spacing\": [\n true,\n \"never\"\n ],\n \"no-trailing-whitespace\": true,\n \"class-name\": true,\n \"brace-style\": [true, \"1tbs\", {\n \"allowSingleLine\": false\n }],\n \"block-spacing\": [true],\n \"ter-prefer-arrow-callback\": [true, {\n \"allowNamedFunctions\": true,\n \"allowUnboundThis\": false\n }],\n \"object-curly-spacing\": [\n true,\n \"always\"\n ]\n }\n }\n "], ["\n {\n \"rulesDirectory\": [\n \"node_modules/tslint-eslint-rules/dist/rules\"\n ],\n \"rules\": {\n \"array-bracket-spacing\": [\n true,\n \"never\"\n ],\n \"no-trailing-whitespace\": true,\n \"class-name\": true,\n \"brace-style\": [true, \"1tbs\", {\n \"allowSingleLine\": false\n }],\n \"block-spacing\": [true],\n \"ter-prefer-arrow-callback\": [true, {\n \"allowNamedFunctions\": true,\n \"allowUnboundThis\": false\n }],\n \"object-curly-spacing\": [\n true,\n \"always\"\n ]\n }\n }\n "]))),
'src/main/index.ts': '\n',
'src/test/index.ts': '\n',
var replacements = {
pkgName: pkgName,
repoName: repoName,
upperCasePkgName: pkgName.toLocaleUpperCase(),
};
if (!fs.existsSync('src')) {
fs.mkdirSync('src');
var projectFiles = [
'.editorconfig',
'.gitignore',
'.npmignore',
'CHANGELOG.md',
'CONTRIBUTING.md',
'Makefile',
'tsconfig.json',
'tslint.json',
];
if (fileName) {
if (projectFiles.indexOf(fileName) === -1) {
console.log('[ERROR]: invalid file ', fileName);
}
else {
console.log(getFileContents(fileName, replacements));
}
return;
}
if (!fs.existsSync('src/main')) {
fs.mkdirSync('src/main');
}
if (!fs.existsSync('src/test')) {
fs.mkdirSync('src/test');
}
Object.keys(files).forEach(function (fileName) {
var contents = files[fileName].split('\n').slice(1).join('\n');
projectFiles.forEach(function (fileName) {
var contents = getFileContents(fileName, replacements);
if (fs.existsSync(fileName)) {

@@ -38,4 +67,4 @@ console.log('[SKIP]: ', fileName);

});
verifySourceDirectory();
}
exports.setupFiles = setupFiles;
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;

@@ -8,3 +8,3 @@ #!/usr/bin/env node

var commands = ['setup', 'compile', 'run'];
var options = ['--no-lint', '--verbose', '--help', '-h', '--version', '-v'];
var options = ['--no-lint', '--verbose', '--help', '-h', '--version', '-v', '-f'];
var _a = commands.map(function (x) { return process.argv.indexOf(x) > -1; }), setup = _a[0], compile = _a[1], run = _a[2];

@@ -14,3 +14,3 @@ var _b = options.map(function (x) { return process.argv.indexOf(x) > -1; }), noLint = _b[0], verbose = _b[1], help = _b[2], h = _b[3], version = _b[4], v = _b[5];

var pkgVersion = pkg['version'];
var usage = "usage: tc-builder <command> [--options]\n\nThe following commands are supported:\n\n - setup: Installs all the same dependencies as the ones in the tc-builder and creates\n configuration files if they do not exists. This command should be run when starting\n a new project or updating tc-builder.\n - compile: Looks at the 'tsconfig.json' file to compile the project. By default it will also\n lint the files unless we use the '--no-lint' option.\n - run: Main command to be run in team city. It will make sure to run all the tests and publish\n to npm if necessary.\n\nOptions:\n\n --no-lint: Skip linting.\n --verbose: Print messages of the steps for the 'compile' command.\n --help, -h: Print this message.\n --version, -v: Print the version.\n\ntc-builder@" + pkgVersion + "\n";
var usage = "usage: tc-builder <command> [--options]\n\nThe following commands are supported:\n\n - setup: Installs all the same dependencies as the ones in the tc-builder and creates\n configuration files if they do not exists. This command should be run when starting\n a new project or updating tc-builder.\n\n If there are any new updates to the configuration files and you wish to see them you\n can provide the name of the file right after the command.\n - compile: Looks at the 'tsconfig.json' file to compile the project. By default it will also\n lint the files unless we use the '--no-lint' option.\n - run: Main command to be run in team city. It will make sure to run all the tests and publish\n to npm if necessary.\n\nOptions:\n\n --no-lint: Skip linting.\n --verbose: Print messages of the steps for the 'compile' command.\n --help, -h: Print this message.\n --version, -v: Print the version.\n\ntc-builder@" + pkgVersion + "\n";
var exitNumber = 0;

@@ -30,8 +30,14 @@ if (help || h) {

if (projectPkg) {
var devDeps_1 = pkg['devDependencies'];
var depsArray = Object.keys(devDeps_1).map(function (x) { return x + "@" + devDeps_1[x]; });
var cmd = "npm i -D " + depsArray.join(' ');
console.log('Running: ', cmd);
child_process_1.execSync(cmd);
Setup_1.setupFiles(projectPkg['name']);
var fileName = process.argv[process.argv.indexOf('setup') + 1];
if (fileName) {
Setup_1.setupFiles(projectPkg['name'], fileName);
}
else {
var devDeps_1 = pkg['devDependencies'];
var depsArray = Object.keys(devDeps_1).map(function (x) { return x + "@" + devDeps_1[x]; });
var cmd = "npm i -D " + depsArray.join(' ');
console.log('Running: ', cmd);
child_process_1.execSync(cmd);
Setup_1.setupFiles(projectPkg['name']);
}
}

@@ -38,0 +44,0 @@ else {

@@ -12,2 +12,6 @@ declare function changePackageVersion(version: string): void;

declare function readJSON(name: string, path?: string): object | null;
export { move, changePackageVersion, readJSON };
/**
* Quick dirty function to replace strings with a certain format.
*/
declare function replaceStrings(template: string, properties: object): string;
export { move, changePackageVersion, readJSON, replaceStrings };

@@ -84,1 +84,13 @@ "use strict";

exports.readJSON = readJSON;
/**
* Quick dirty function to replace strings with a certain format.
*/
function replaceStrings(template, properties) {
var result = template;
Object.keys(properties).forEach(function (key) {
var reg = new RegExp("%{" + key + "}", 'g');
result = result.replace(reg, properties[key]);
});
return result;
}
exports.replaceStrings = replaceStrings;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc