Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/v1.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
manuth committed Nov 16, 2018
2 parents 4c4f110 + 63c8be3 commit 40f372b
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 21 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## TSGeneratorGenerator v1.2.2
- Improved the creation of the `package.json`-file
- Removed unnecessary dependencies

[Show differences][v1.2.2]

## TSGeneratorGenerator v1.2.1
- Rework unit-test templates

Expand Down Expand Up @@ -34,4 +40,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[v1.0.0]: https://github.com/manuth/TSGeneratorGenerator/compare/e6fdb5a...v1.0.0
[v1.0.1]: https://github.com/manuth/TSGeneratorGenerator/compare/v1.0.0...v1.0.1
[v1.2.0]: https://github.com/manuth/TSGeneratorGenerator/compare/v1.0.1...v1.2.0
[v1.2.1]: https://github.com/manuth/TSGeneratorGenerator/compare/v1.2.0...v1.2.1
[v1.2.1]: https://github.com/manuth/TSGeneratorGenerator/compare/v1.2.0...v1.2.1
[v1.2.2]: https://github.com/manuth/TSGeneratorGenerator/compare/v1.2.1...v1.2.2
11 changes: 1 addition & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generator-ts-generator",
"version": "1.2.1",
"version": "1.2.2",
"description": "A Generator for Yeoman Generators Written in TypeScript.",
"scripts": {
"watch": "tsc -p . --watch",
Expand All @@ -19,10 +19,7 @@
"Generator",
"TypeScript"
],
"author": {
"name": "Manuel Thalmann",
"email": "[email protected]"
},
"author": "Manuel Thalmann <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/manuth/TSGeneratorGenerator/issues"
Expand All @@ -31,11 +28,11 @@
"devDependencies": {
"@types/dedent": "^0.7.0",
"@types/fs-extra": "^5.0.4",
"@types/inquirer": "0.0.43",
"@types/lodash.camelcase": "^4.3.4",
"@types/lodash.kebabcase": "^4.1.4",
"@types/mocha": "^5.2.5",
"@types/node": "^10.12.1",
"@types/npm": "^2.0.29",
"@types/yeoman-generator": "^3.0.0",
"@types/yeoman-test": "^1.7.4",
"@types/yosay": "0.0.29",
Expand All @@ -51,6 +48,7 @@
"chalk": "^2.4.1",
"dedent": "^0.7.0",
"fs-extra": "^7.0.0",
"inquirer": "^6.2.0",
"lodash.camelcase": "^4.3.0",
"lodash.kebabcase": "^4.1.1",
"yeoman-generator": "^3.1.1",
Expand Down
71 changes: 68 additions & 3 deletions src/generators/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,18 +330,83 @@ class AppGenerator extends Generator<IAppSettings>
*/
protected GetPackageJSON = (): {} =>
{

let scripts = [
"watch",
"compile",
"lint",
"test",
"prepare"
];

let dependencies = [
"inquirer",
"yeoman-generator"
];

let devDependencies = [
"@types/inquirer",
"@types/mocha",
"@types/node",
"@types/yeoman-generator",
"mocha",
"tslint",
"typescript",
"typescript-tslint-plugin",
"yo"
];

if (
this.Settings[GeneratorSetting.Components].includes(AppComponent.GeneratorExample) ||
this.Settings[GeneratorSetting.Components].includes(AppComponent.SubGeneratorExample))
{
dependencies.push(
"chalk",
"dedent",
"yosay");

devDependencies.push(
"@types/dedent",
"@types/yosay");
}

let result: any = {};
let packageJSON = require(Path.join("..", "..", "..", "package.json"));
result.name = this.Settings[AppSetting.ModuleName];
result.version = "0.0.0";
result.description = this.Settings[AppSetting.Description];
result.scripts = packageJSON.scripts;
result.scripts = {};
result.author = {
name: this.user.git.name(),
email: this.user.git.email()
};
result.devDependencies = packageJSON.devDependencies;
result.dependencies = packageJSON.dependencies;
result.devDependencies = {};
result.dependencies = {};

for (let script of scripts)
{
if (script in packageJSON.scripts)
{
result.scripts[script] = packageJSON.scripts[script];
}
}

for (let devDependency of devDependencies.sort())
{
if (devDependency in packageJSON.devDependencies)
{
result.devDependencies[devDependency] = packageJSON.devDependencies[devDependency];
}
}

for (let dependency of dependencies.sort())
{
if (dependency in packageJSON.dependencies)
{
result.dependencies[dependency] = packageJSON.dependencies[dependency];
}
}

return result;
}
}
Expand Down
1 change: 0 additions & 1 deletion src/tests/Generators/GeneratorGenerator.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Assert = require("assert");
import ChildProcess = require("child_process");
import FileSystem = require("fs-extra");
import NPM = require("npm");
import Path = require("path");
import TS = require("typescript");
import { promisify } from "util";
Expand Down

0 comments on commit 40f372b

Please sign in to comment.