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.0' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
manuth committed Oct 17, 2020
2 parents b4e08e5 + d316fdf commit ab02ee2
Show file tree
Hide file tree
Showing 106 changed files with 1,710 additions and 1,901 deletions.
8 changes: 4 additions & 4 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ steps:
image: node
commands:
- npm run test
- name: publish module to npm
- name: publish package to npm
image: node
environment:
NPM_TOKEN:
Expand All @@ -32,7 +32,7 @@ steps:
- tag
ref:
- refs/tags/v[0-9].[0-9].[0-9]
- name: publish module to github
- name: publish package to github
image: node
environment:
GITHUB_TOKEN:
Expand All @@ -50,7 +50,7 @@ steps:
image: node
commands:
- npx lerna exec --no-private -- npm pack
- npm install escape-string-regexp
- npm install escape-string-regexp --no-save
- node -e "console.log(require('escape-string-regexp')('${DRONE_TAG}'))" > TagName.txt
when:
event:
Expand All @@ -68,7 +68,7 @@ steps:
when:
event:
- tag
- name: publish
- name: publish release
image: plugins/github-release
commands: []
settings:
Expand Down
6 changes: 3 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const path = require("path");
const { join } = require("path");

module.exports = {
extends: [
require.resolve("./packages/generator-ts-project/.eslintrc.js")
],
parserOptions: {
project: [
path.join(__dirname, "tsconfig.json"),
path.join(__dirname, "tsconfig.eslint.json")
join(__dirname, "tsconfig.json"),
join(__dirname, "tsconfig.eslint.json")
]
}
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ typings/
packages/*/templates/.github/
packages/*/.npmignore
packages/*/.drone.yml
packages/*/templates/CHANGELOG.md.ejs
packages/*/LICENSE
packages/generator-ts-project/templates/.gitignore.ejs

Expand Down
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,8 @@ dist
# Unit-Tests
[Ll]ib/tests/

# GitHub configuration
.github/

# Drone configuration
.drone.yml
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ 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).

## TSProjectGenerator [Unreleased]
### Added
- A feature for creating `CHANGELOG` files for new projects
- A feature to set the default package-name to the name of the existing package
- New unit-tests

### Updated
- The development environment
- The format of transformed JSON and YAML files
- All dependencies
- The typescript-configuration for tests
- The `.npmignore` file to exclude the `.github` directory
- `.json` and `.yml`-filemappings to include new lines at the end of files

[Show differences](https://github.com/manuth/TSProjectGenerator/compare/v1.1.4...dev)

Expand Down
17 changes: 13 additions & 4 deletions gulp/ApplyPatch.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import { applyPatch, parsePatch } from "diff";
import { readFile } from "fs-extra";
import { obj } from "through2";
import Vinyl = require("vinyl");
import File = require("vinyl");

export = (patchPath: string): NodeJS.ReadWriteStream =>
/**
* Applies a patch to the stream.
*
* @param patchPath
* The path to the patch to apply.
*
* @returns
* The resulting stream.
*/
export function ApplyPatch(patchPath: string): NodeJS.ReadWriteStream
{
return obj(
async (vinylFile: Vinyl, encoding, callback) =>
async (vinylFile: File, encoding, callback) =>
{
if (vinylFile.isBuffer())
{
Expand All @@ -25,4 +34,4 @@ export = (patchPath: string): NodeJS.ReadWriteStream =>
callback(new Error("Only buffers are supported."));
}
});
};
}
5 changes: 3 additions & 2 deletions gulp/gitignore.diff
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
diff --git a/.gitignore b/.gitignore
index e833b71..347d0b8 100644
index c465a7b..347d0b8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -68,13 +68,6 @@ typings/
@@ -68,14 +68,6 @@ typings/
# Output of 'npm pack'
*.tgz

-# Redundant files
-packages/*/templates/.github/
-packages/*/.npmignore
-packages/*/.drone.yml
-packages/*/templates/CHANGELOG.md.ejs
-packages/*/LICENSE
-packages/generator-ts-project/templates/.gitignore.ejs
-
Expand Down
7 changes: 5 additions & 2 deletions gulp/npmignore.diff
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
diff --git a/.npmignore b/.npmignore
index 9d3909d..e8a353f 100644
index 74af7d7..e8a353f 100644
--- a/.npmignore
+++ b/.npmignore
@@ -123,6 +123,3 @@ tsconfig.*.json
@@ -123,9 +123,3 @@ tsconfig.*.json

# Visual Studio Code-Environment
.vscode/
-
-# GitHub configuration
-.github/
-
-# Drone configuration
-.drone.yml
41 changes: 39 additions & 2 deletions gulpfile.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import glob = require("glob");
import { EOL } from "os";
import { glob } from "glob";
import { dest, parallel, series, src, watch } from "gulp";
import rename = require("gulp-rename");
import replace = require("gulp-replace");
import merge = require("merge-stream");
import minimist = require("minimist");
import { basename, dirname, join, relative } from "upath";
import ApplyPatch = require("./gulp/ApplyPatch");
import { ApplyPatch } from "./gulp/ApplyPatch";

let projectGeneratorName = "generator-ts-project";
let customProjectGeneratorName = "generator-my-ts-project";
let gitIgnoreFile = join(__dirname, ".gitignore");
let npmIgnoreFile = join(__dirname, ".npmignore");
let droneFile = join(__dirname, ".drone.yml");
let changelogFile = join(__dirname, "CHANGELOG.md");
let licenseFile = join(__dirname, "LICENSE");
let gitDiffFile = GulpPath("gitignore.diff");
let npmDiffFile = CommonTemplatePath(projectGeneratorName, "npmignore.diff");
Expand Down Expand Up @@ -74,6 +77,7 @@ export let CopyFiles =
CopyGitIgnore,
CopyNPMIgnore,
CopyDroneFile,
CopyChangelogFile,
CopyLicenseFile,
CopyDependabotFile
]),
Expand Down Expand Up @@ -103,6 +107,12 @@ export let CopyFiles =
],
CopyDroneFile);

watch(
[
changelogFile
],
CopyChangelogFile);

watch(
[
licenseFile
Expand Down Expand Up @@ -192,6 +202,33 @@ export function CopyDroneFile(): NodeJS.ReadWriteStream

CopyDroneFile.description = `Copies the \`${basename(droneFile)}\` file to the mono-repo packages.`;

/**
* Copies the `CHANGELOG` file to the mono-repo packages.
*
* @returns
* The task.
*/
export function CopyChangelogFile(): NodeJS.ReadWriteStream
{
return src(changelogFile).pipe(
replace(
/(# Changelog[\s\S]*?[\n$])##[\s\S]*$/g,
[
"$1## <%- Name %> [Unreleased]",
" - Initial release",
""
].join(EOL)
)).pipe(
rename(
(parsed) =>
{
parsed.extname += ".ejs";
})
).pipe(
dest(CommonTemplatePath(projectGeneratorName))
);
}

/**
* Copies the `LICENSE` file to the mono-repo packages.
*
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.1.4",
"version": "1.2.0",
"packages": [
"./packages/*"
],
Expand Down
Loading

0 comments on commit ab02ee2

Please sign in to comment.