Comparing version 1.0.0-0 to 1.0.0
@@ -14,3 +14,4 @@ #!/usr/bin/env node | ||
logger: Logger; | ||
yarn?: boolean; | ||
} | ||
export declare type VerbFilesFunction = (options: Options, files: string[], fix?: boolean) => Promise<boolean>; |
#!/usr/bin/env node | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Copyright 2017 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
const path = require("path"); | ||
@@ -9,2 +24,3 @@ const meow = require("meow"); | ||
const clean_1 = require("./clean"); | ||
const util_1 = require("./util"); | ||
const packageJson = require('../../package.json'); | ||
@@ -27,3 +43,4 @@ const logger = console; | ||
-n, --no Assume a no answer for every prompt. | ||
--dry-run Don't make any acutal changes. | ||
--dry-run Don't make any actual changes. | ||
--yarn Use yarn instead of npm. | ||
@@ -41,2 +58,3 @@ Examples | ||
'dry-run': { type: 'boolean' }, | ||
yarn: { type: 'boolean' }, | ||
}, | ||
@@ -59,2 +77,3 @@ }); | ||
logger, | ||
yarn: cli.flags.yarn || util_1.isYarnUsed(), | ||
}; | ||
@@ -61,0 +80,0 @@ // Linting/formatting depend on typescript. We don't want to load the |
import { Options } from './cli'; | ||
import { PackageJson } from '@npm/types'; | ||
export interface Bag<T> { | ||
[script: string]: T; | ||
} | ||
export interface PackageJson { | ||
version?: string; | ||
devDependencies?: Bag<string>; | ||
scripts?: Bag<string>; | ||
name?: string; | ||
description?: string; | ||
main?: string; | ||
types?: string; | ||
files?: string[]; | ||
license?: string; | ||
keywords?: string[]; | ||
} | ||
export declare function addScripts(packageJson: PackageJson, options: Options): Promise<boolean>; | ||
@@ -18,0 +7,0 @@ export declare function addDependencies(packageJson: PackageJson, options: Options): Promise<boolean>; |
@@ -18,3 +18,2 @@ "use strict"; | ||
*/ | ||
const chalk_1 = require("chalk"); | ||
const cp = require("child_process"); | ||
@@ -24,2 +23,3 @@ const inquirer = require("inquirer"); | ||
const util_1 = require("./util"); | ||
const chalk_1 = require("chalk"); | ||
const pkg = require('../../package.json'); | ||
@@ -57,2 +57,3 @@ const DEFAULT_PACKAGE_JSON = { | ||
let edits = false; | ||
const pkgManager = util_1.getPkgManagerName(options.yarn); | ||
const scripts = { | ||
@@ -63,5 +64,5 @@ check: `gts check`, | ||
fix: `gts fix`, | ||
prepare: `npm run compile`, | ||
pretest: `npm run compile`, | ||
posttest: `npm run check`, | ||
prepare: `${pkgManager} run compile`, | ||
pretest: `${pkgManager} run compile`, | ||
posttest: `${pkgManager} run check`, | ||
}; | ||
@@ -137,3 +138,3 @@ if (!packageJson.scripts) { | ||
linterOptions: { | ||
exclude: ['*.json', '**/*.json'], | ||
exclude: ['**/*.json'], | ||
}, | ||
@@ -148,3 +149,3 @@ }; | ||
compilerOptions: { rootDir: '.', outDir: 'build' }, | ||
include: ['src/*.ts', 'src/**/*.ts', 'test/*.ts', 'test/**/*.ts'], | ||
include: ['src/**/*.ts', 'test/**/*.ts'], | ||
}); | ||
@@ -219,3 +220,3 @@ return generateConfigFile(options, './tsconfig.json', config); | ||
// source files yet. | ||
cp.spawnSync('npm', ['install', '--ignore-scripts'], { stdio: 'inherit' }); | ||
cp.spawnSync(util_1.getPkgManagerName(options.yarn), ['install', '--ignore-scripts'], { stdio: 'inherit' }); | ||
} | ||
@@ -222,0 +223,0 @@ return true; |
@@ -16,2 +16,4 @@ /** | ||
*/ | ||
/// <reference types="node" /> | ||
import * as fs from 'fs'; | ||
export declare const readFilep: (...args: any[]) => Promise<any>; | ||
@@ -43,1 +45,8 @@ export declare const rimrafp: (...args: any[]) => Promise<any>; | ||
} | ||
/** | ||
* Automatically defines npm or yarn is going to be used: | ||
* - If only yarn.lock exists, use yarn | ||
* - If only package-lock.json or both exist, use npm | ||
*/ | ||
export declare function isYarnUsed(existsSync?: typeof fs.existsSync): boolean; | ||
export declare function getPkgManagerName(isYarnUsed?: boolean): 'yarn' | 'npm'; |
@@ -89,2 +89,18 @@ "use strict"; | ||
} | ||
/** | ||
* Automatically defines npm or yarn is going to be used: | ||
* - If only yarn.lock exists, use yarn | ||
* - If only package-lock.json or both exist, use npm | ||
*/ | ||
function isYarnUsed(existsSync = fs.existsSync) { | ||
if (existsSync('package-lock.json')) { | ||
return false; | ||
} | ||
return existsSync('yarn.lock'); | ||
} | ||
exports.isYarnUsed = isYarnUsed; | ||
function getPkgManagerName(isYarnUsed) { | ||
return isYarnUsed ? 'yarn' : 'npm'; | ||
} | ||
exports.getPkgManagerName = getPkgManagerName; | ||
//# sourceMappingURL=util.js.map |
{ | ||
"name": "gts", | ||
"version": "1.0.0-0", | ||
"version": "1.0.0", | ||
"description": "Google TypeScript Style", | ||
@@ -31,3 +31,3 @@ "repository": "google/gts", | ||
"prepare": "npm run compile", | ||
"test": "nyc ava build/test/test*.js", | ||
"test": "nyc mocha build/test", | ||
"pretest": "npm run compile", | ||
@@ -57,8 +57,10 @@ "posttest": "npm run lint && npm run format-check && npm run license-check", | ||
"devDependencies": { | ||
"@npm/types": "^1.0.1", | ||
"@types/diff": "^4.0.0", | ||
"@types/entities": "^1.1.0", | ||
"@types/execa": "^0.9.0", | ||
"@types/glob": "^7.0.0", | ||
"@types/inquirer": "^0.0.43", | ||
"@types/make-dir": "^1.0.3", | ||
"@types/inquirer": "^6.0.0", | ||
"@types/meow": "^5.0.0", | ||
"@types/mocha": "^5.2.6", | ||
"@types/ncp": "^2.0.1", | ||
@@ -69,25 +71,18 @@ "@types/node": "^10.0.3", | ||
"@types/rimraf": "^2.0.2", | ||
"@types/tmp": "^0.0.34", | ||
"@types/tmp": "^0.1.0", | ||
"@types/update-notifier": "^2.2.0", | ||
"ava": "^1.0.0", | ||
"codecov": "^3.0.1", | ||
"execa": "^1.0.0", | ||
"inline-fixtures": "^1.0.0", | ||
"js-green-licenses": "^0.5.0", | ||
"make-dir": "^2.0.0", | ||
"mocha": "^6.0.0", | ||
"ncp": "^2.0.0", | ||
"nyc": "^13.0.0", | ||
"nyc": "^14.0.0", | ||
"source-map-support": "^0.5.5", | ||
"tmp": "0.0.33", | ||
"typescript": "~3.3.0" | ||
"tmp": "0.1.0", | ||
"typescript": "~3.4.0" | ||
}, | ||
"peerDependencies": { | ||
"typescript": "^3.0.0" | ||
}, | ||
"ava": { | ||
"require": [ | ||
"source-map-support/register" | ||
] | ||
}, | ||
"publishConfig": { | ||
"tag": "next" | ||
} | ||
} |
@@ -56,2 +56,14 @@ { | ||
"switch-default": true, | ||
"trailing-comma": [ | ||
true, | ||
{ | ||
"multiline": { | ||
"objects": "always", | ||
"arrays": "always", | ||
"functions": "never", | ||
"typeLiterals": "ignore" | ||
}, | ||
"esSpecCompliant": true | ||
} | ||
], | ||
"triple-equals": [true, "allow-null-check"], | ||
@@ -58,0 +70,0 @@ "use-isnan": true, |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
64604
864
1
25
2