Socket
Socket
Sign inDemoInstall

gts

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gts - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

6

build/src/cli.d.ts
export interface Logger {
log: (...args: any[]) => void;
error: (...args: any[]) => void;
dir: (obj: any, options?: any) => void;
log: (...args: Array<{}>) => void;
error: (...args: Array<{}>) => void;
dir: (obj: {}, options?: {}) => void;
}

@@ -6,0 +6,0 @@ export interface Options {

import { Options } from './cli';
export interface Bag<T> {
[script: string]: T;
}
export interface PackageJson {
version?: string;
devDependencies?: Bag<string>;
scripts?: Bag<string>;
}
export declare function init(options: Options): Promise<boolean>;

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

var util_1 = require("./util");
var pkg = require('../../package.json');
function query(message, question, defaultVal, options) {

@@ -135,3 +136,3 @@ return __awaiter(this, void 0, void 0, function () {

edits = false;
deps = { 'gts': 'latest', 'typescript': '^2.4.1' };
deps = { 'gts': "^" + pkg.version, 'typescript': '^2.6.1' };
if (!packageJson.devDependencies) {

@@ -170,5 +171,10 @@ packageJson.devDependencies = {};

}
function formatJson(object) {
// TODO: preserve the indent from the input file.
var json = JSON.stringify(object, null, ' ');
return json + "\n";
}
function writePackageJson(packageJson, options) {
return __awaiter(this, void 0, void 0, function () {
var err_1, preview;
var preview;
return __generator(this, function (_a) {

@@ -178,14 +184,8 @@ switch (_a.label) {

options.logger.log('Writing package.json...');
if (!!options.dryRun) return [3 /*break*/, 4];
_a.label = 1;
if (!!options.dryRun) return [3 /*break*/, 2];
return [4 /*yield*/, util_1.writeFileAtomicp('./package.json', formatJson(packageJson))];
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, util_1.writeFileAtomicp('./package.json', JSON.stringify(packageJson, null, ' '))];
_a.sent();
_a.label = 2;
case 2:
_a.sent();
return [3 /*break*/, 4];
case 3:
err_1 = _a.sent();
throw err_1;
case 4:
preview = {

@@ -203,3 +203,3 @@ scripts: packageJson.scripts,

return __awaiter(this, void 0, void 0, function () {
var existing, err_2, baseConfig, tsconfig, writeTsConfig, err_3;
var existing, err_1, baseConfig, tsconfig, writeTsConfig;
return __generator(this, function (_a) {

@@ -214,8 +214,8 @@ switch (_a.label) {

case 2:
err_2 = _a.sent();
if (err_2.code === 'ENOENT') {
err_1 = _a.sent();
if (err_1.code === 'ENOENT') {
/* not found, create it. */
}
else {
throw new Error("Unknown error reading tsconfig.json: " + err_2.message);
throw new Error("Unknown error reading tsconfig.json: " + err_1.message);
}

@@ -226,3 +226,3 @@ return [3 /*break*/, 3];

path.relative(options.targetRootDir, path.resolve(options.gtsRootDir, 'tsconfig-google.json'));
tsconfig = JSON.stringify({
tsconfig = formatJson({
extends: baseConfig,

@@ -232,3 +232,3 @@ compilerOptions: { rootDir: '.', outDir: 'build' },

exclude: ['node_modules']
}, null, ' ');
});
writeTsConfig = true;

@@ -245,19 +245,13 @@ if (!(existing && existing === tsconfig)) return [3 /*break*/, 4];

case 6:
if (!writeTsConfig) return [3 /*break*/, 11];
if (!writeTsConfig) return [3 /*break*/, 9];
options.logger.log('Writing tsconfig.json...');
if (!!options.dryRun) return [3 /*break*/, 10];
_a.label = 7;
if (!!options.dryRun) return [3 /*break*/, 8];
return [4 /*yield*/, util_1.writeFileAtomicp('./tsconfig.json', tsconfig)];
case 7:
_a.trys.push([7, 9, , 10]);
return [4 /*yield*/, util_1.writeFileAtomicp('./tsconfig.json', tsconfig)];
_a.sent();
_a.label = 8;
case 8:
_a.sent();
return [3 /*break*/, 10];
case 9:
err_3 = _a.sent();
throw err_3;
case 10:
options.logger.dir(JSON.parse(tsconfig));
_a.label = 11;
case 11: return [2 /*return*/];
_a.label = 9;
case 9: return [2 /*return*/];
}

@@ -269,3 +263,3 @@ });

return __awaiter(this, void 0, void 0, function () {
var packageJson, err_4, generate, err2_1, addedDeps, addedScripts;
var packageJson, err_2, generate, err2_1, addedDeps, addedScripts;
return __generator(this, function (_a) {

@@ -280,5 +274,5 @@ switch (_a.label) {

case 2:
err_4 = _a.sent();
if (err_4.code !== 'ENOENT') {
throw new Error("Unable to open package.json file: " + err_4.message);
err_2 = _a.sent();
if (err_2.code !== 'ENOENT') {
throw new Error("Unable to open package.json file: " + err_2.message);
}

@@ -285,0 +279,0 @@ return [4 /*yield*/, query(chalk_1.default.bold('package.json') + " does not exist.", "Generate", true, options)];

@@ -6,3 +6,3 @@ export declare const readFilep: (...args: any[]) => Promise<any>;

export interface ReadFileP {
(path: string, encoding: string): Promise<any>;
(path: string, encoding: string): Promise<string>;
}

@@ -14,2 +14,2 @@ export declare function nop(): void;

*/
export declare function getTSConfig(rootDir: string, customReadFilep?: ReadFileP): Promise<any>;
export declare function getTSConfig(rootDir: string, customReadFilep?: ReadFileP): Promise<{}>;
{
"name": "gts",
"version": "0.4.1",
"version": "0.5.0",
"description": "Google TypeScript Style",

@@ -28,4 +28,4 @@ "repository": "google/ts-style",

"format": "clang-format -i -style='{Language: JavaScript, BasedOnStyle: Google, ColumnLimit: 80}' src/*.ts test/*.ts",
"lint": "tslint -c tslint.json --project . --type-check -t codeFrame",
"lint-fix": "tslint -c tslint.json --project . --type-check -t codeFrame --fix",
"lint": "tslint -c tslint.json --project . -t codeFrame",
"lint-fix": "tslint -c tslint.json --project . -t codeFrame --fix",
"prepare": "npm run compile",

@@ -42,3 +42,3 @@ "test": "npm run compile && nyc ava build/test/test*.js",

"dependencies": {
"chalk": "^2.2.0",
"chalk": "^2.3.0",
"clang-format": "^1.0.53",

@@ -49,3 +49,3 @@ "inquirer": "^3.2.1",

"rimraf": "^2.6.1",
"tslint": "^5.5.0",
"tslint": "^5.8.0",
"update-notifier": "^2.2.0",

@@ -60,3 +60,3 @@ "write-file-atomic": "^2.1.0"

"@types/ncp": "^2.0.0",
"@types/node": "^8.0.17",
"@types/node": "^8.0.47",
"@types/pify": "3.0.0",

@@ -73,6 +73,6 @@ "@types/rimraf": "2.0.2",

"tmp": "0.0.31",
"typescript": "^2.4.1"
"typescript": "~2.6.1"
},
"peerDependencies": {
"typescript": "^2.4.1"
"typescript": "^2.6.1"
},

@@ -79,0 +79,0 @@ "ava": {

{
"rules": {
"array-type": [true, "array-simple"],
"arrow-return-shorthand": true,
"ban": [true,
{"name": "parseInt", "message": "tsstyle#type-coercion"},
{"name": "parseFloat", "message": "tsstyle#type-coercion"},
{"name": "Array", "message": "tsstyle#array-constructor"}
],
"ban-types": [true,
["Object", "Use {} instead."],
["String", "Use 'string' instead."],
["Number", "Use 'number' instead."],
["Boolean", "Use 'boolean' instead."]
],
"class-name": true,
"comment-format": [true, "check-space"],
"curly": [true, "ignore-same-line"],
"eofline": true,
"forin": true,
"indent": [true, "spaces"],
"interface-name": [true, "never-prefix"],
"jsdoc-format": true,
"label-position": true,
"member-access": [true, "no-public"],
"new-parens": true,
"no-angle-bracket-type-assertion": true,
"no-any": true,
"no-arg": true,

@@ -14,2 +33,3 @@ "no-conditional-assignment": true,

"no-debugger": true,
"no-default-export": true,
"no-duplicate-variable": true,

@@ -19,3 +39,6 @@ "no-empty": true,

"no-internal-module": true,
"no-namespace": [true, "allow-declarations"],
"no-reference": true,
"no-shadowed-variable": true,
"no-string-throw": true,
"no-switch-case-fall-through": true,

@@ -26,9 +49,19 @@ "no-trailing-whitespace": true,

"no-var-keyword": true,
"object-literal-shorthand": true,
"only-arrow-functions": [true, "allow-declarations", "allow-named-functions"],
"prefer-const": true,
"quotemark": [true, "single"],
"radix": true,
"semicolon": [true, "always"],
"semicolon": [true, "always", "ignore-bound-class-methods"],
"switch-default": true,
"triple-equals": [true, "allow-null-check"],
"variable-name": [true, "check-format", "ban-keywords"]
"use-isnan": true,
"variable-name": [
true,
"check-format",
"ban-keywords",
"allow-leading-underscore",
"allow-trailing-underscore"
]
}
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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