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/v3.0.12'
Browse files Browse the repository at this point in the history
  • Loading branch information
manuth committed Dec 17, 2021
2 parents 91cb7b5 + 10e5a5c commit e714ad6
Show file tree
Hide file tree
Showing 15 changed files with 146 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ steps:
api_key:
from_secret: github_publish_token
files:
- "./*.tgz"
- "*.tgz"
title: .releaseTitle.md
note: .releaseNotes.md
when:
Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## TSProjectGenerator [Unreleased]

[Show differences](https://github.com/manuth/TSProjectGenerator/compare/v3.0.11...dev)
[Show differences](https://github.com/manuth/TSProjectGenerator/compare/v3.0.12...dev)

## TSProjectGenerator v3.0.12
### Fixed
- Broken drone pipeline creation
- Incorrect `test` npm script
- Creation of vscode debug settings

[Show differences](https://github.com/manuth/TSProjectGenerator/compare/v3.0.11...v3.0.12)

## TSProjectGenerator v3.0.11
### Fixed
Expand Down
23 changes: 12 additions & 11 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"devDependencies": {
"@manuth/eslint-plugin-typescript": "^3.2.6",
"@manuth/package-json-editor": "^2.2.5",
"@tsd/typescript": "npm:nop@^1.0.0",
"@types/diff": "^5.0.1",
"@types/fs-extra": "^9.0.13",
Expand Down
6 changes: 3 additions & 3 deletions packages/generator-my-ts-project/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@manuth/generator-my-ts-project",
"version": "3.0.11",
"version": "3.0.12",
"description": "Generates TypeScript-Projects with custom additions",
"author": "Manuel Thalmann <[email protected]>",
"license": "MIT",
Expand Down Expand Up @@ -35,7 +35,7 @@
},
"dependencies": {
"@manuth/extended-yo-generator": "^11.0.6",
"@manuth/generator-ts-project": "^3.0.11",
"@manuth/generator-ts-project": "^3.0.12",
"@manuth/package-json-editor": "2.2.5",
"comment-json": "^4.1.1",
"detect-newline": "^3.1.0",
Expand All @@ -45,7 +45,7 @@
},
"devDependencies": {
"@manuth/extended-yo-generator-test": "^11.0.6",
"@manuth/generator-ts-project-test": "^3.0.11",
"@manuth/generator-ts-project-test": "^3.0.12",
"@manuth/temp-files": "^2.0.8",
"@types/dedent": "^0.7.0",
"@types/fs-extra": "^9.0.13",
Expand Down
9 changes: 2 additions & 7 deletions packages/generator-my-ts-project/src/DroneFileMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,13 @@ export class DroneFileMapping<TSettings extends ITSProjectSettings, TOptions ext
{
let command = commands[j];

if (/\b--workspaces\b/.test(command))
if (/\s+--workspaces\b/.test(command))
{
document.setIn(
[stepsKey, i, commandsKey, j],
command.replace(/\b--workspaces\b/, ""));
command.replace(/\s+--workspaces\b/, ""));
}
}

if (step.image === "plugins/github-release")
{
document.setIn([stepsKey, i, "settings", "files", "0"], "*.tgz");
}
}

return [document];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,15 @@ export function DroneFileMappingTests(context: TestContext<MyTSModuleGenerator>)
nameof<DroneFileMapping<any, any>>((fileMapping) => fileMapping.Transform),
() =>
{
test(
"Checking whether `publish` commands are replaced correctly…",
async function()
{
this.timeout(2 * 1000);
this.slow(1 * 1000);
ok(await AssertCommand((command) => command.startsWith("npm publish")));
ok(await AssertCommand((command) => !command.startsWith("npx lerna publish"), true));
});
let workspaceArg = "--workspaces";

test(
"Checking whether `lerna exec` commands are replaced correctly…",
`Checking whether \`${workspaceArg}\` arguments of commands are stripped away…`,
async function()
{
this.timeout(2 * 1000);
this.slow(1 * 1000);
ok(await AssertCommand((command) => !command.startsWith("npx lerna exec"), true));
ok(await AssertCommand((command) => !command.includes(workspaceArg)));
});

test(
Expand Down Expand Up @@ -131,34 +123,6 @@ export function DroneFileMappingTests(context: TestContext<MyTSModuleGenerator>)
});
}));
});

test(
"Checking whether the `test`-step is adjusted correctly…",
async function()
{
this.timeout(2 * 1000);
this.slow(1 * 1000);

ok(
(await tester.ParseOutput()).every(
(document) =>
{
let steps: any[] = document.toJSON().steps;

return steps.every(
(step) =>
{
if (step.name === "test")
{
return !(step.image as string).endsWith(":lts");
}
else
{
return true;
}
});
}));
});
});
});
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ok } from "assert";
import { ok, strictEqual } from "assert";
import { GeneratorOptions } from "@manuth/extended-yo-generator";
import { FileMappingTester, TestContext } from "@manuth/extended-yo-generator-test";
import { ITSProjectSettings, TSProjectPackageFileMapping } from "@manuth/generator-ts-project";
Expand Down Expand Up @@ -97,7 +97,7 @@ export function MyTSProjectPackageFileMappingTests(context: TestContext<TestTSMo
let patchScriptName = "patch-ts";

ok(npmPackage.Scripts.Get(prepareScriptName).includes(patchScriptName));
ok(npmPackage.Scripts.Has(patchScriptName));
strictEqual(npmPackage.Scripts.Get(patchScriptName), "ts-patch install");
});
});

Expand Down
4 changes: 2 additions & 2 deletions packages/generator-ts-project-test/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@manuth/generator-ts-project-test",
"version": "3.0.11",
"version": "3.0.12",
"description": "Provides the functionality to test `TSProjectGenerator`-components",
"author": "Manuel Thalmann <[email protected]>",
"license": "MIT",
Expand Down Expand Up @@ -33,7 +33,7 @@
"dependencies": {
"@manuth/extended-yo-generator": "^11.0.6",
"@manuth/extended-yo-generator-test": "^11.0.6",
"@manuth/generator-ts-project": "^3.0.11",
"@manuth/generator-ts-project": "^3.0.12",
"@manuth/package-json-editor": "^2.2.5",
"@manuth/temp-files": "^2.0.8",
"@stdlib/utils-escape-regexp-string": "^0.0.7",
Expand Down
4 changes: 2 additions & 2 deletions packages/generator-ts-project/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@manuth/generator-ts-project",
"version": "3.0.11",
"version": "3.0.12",
"description": "A Set of Generators for Creating Projects Written in TypeScript",
"author": "Manuel Thalmann <[email protected]>",
"license": "MIT",
Expand Down Expand Up @@ -70,7 +70,7 @@
"devDependencies": {
"@manuth/eslint-plugin-typescript": "^3.2.6",
"@manuth/extended-yo-generator-test": "^11.0.6",
"@manuth/generator-ts-project-test": "^3.0.11",
"@manuth/generator-ts-project-test": "^3.0.12",
"@manuth/tsconfig": "^3.0.0",
"@types/dedent": "^0.7.0",
"@types/diff": "^5.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,30 @@ export class TSProjectPackageFileMapping<TSettings extends ITSProjectSettings, T
*/
public get MiscScripts(): Array<IScriptMapping<TSettings, TOptions> | string>
{
let testScriptName = "test";
let prepareScriptName = "prepare";

return [
"test",
{
Source: testScriptName,
Destination: testScriptName,
Processor: async (script) =>
{
let separator = " && ";
let commands = script.split(separator);
let filtered: string[] = [];

for (let command of commands)
{
if (command !== "tsd")
{
filtered.push(command);
}
}

return filtered.join(separator);
}
},
{
Source: "initialize",
Destination: prepareScriptName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ export class TSProjectLaunchSettingsProcessor<TSettings extends ITSProjectSettin
*/
protected override async FilterDebugConfig(debugConfig: DebugConfiguration): Promise<boolean>
{
return (debugConfig.program ?? "").includes(this.GetWorkspaceFolderDirective("TSProjectGenerator")) &&
let workspaceDirective = this.GetWorkspaceFolderDirective("TSProjectGenerator");

return (
(debugConfig.args as string[])?.[0]?.includes(workspaceDirective) ||
(debugConfig.cwd as string)?.includes(workspaceDirective)) &&
!(normalize(debugConfig.program ?? "").toLowerCase().endsWith(join("node_modules", "yo", "lib", "cli.js")));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export function TSProjectPackageFileMappingTests(context: TestContext<TSProjectG
lintCodeScript,
lintScript));

await AssertScriptCopy("test");
await tester.AssertScript("test", (script) => !script.includes("tsd"));

await tester.AssertScript(
"prepare",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export function TSProjectLaunchSettingsProcessorTests(context: TestContext<TSPro
{
this.timeout(4 * 1000);
this.slow(2 * 1000);
let workspaceDirective = processor.GetWorkspaceFolderDirective(generatorName);

strictEqual(
(await processor.Process(
Expand All @@ -100,7 +101,24 @@ export function TSProjectLaunchSettingsProcessorTests(context: TestContext<TSPro
name: "",
request: "",
type: "",
program: processor.GetWorkspaceFolderDirective(generatorName)
cwd: workspaceDirective
}
]
})).configurations.length,
1);

strictEqual(
(await processor.Process(
{
version: "",
configurations: [
{
name: "",
request: "",
type: "",
args: [
workspaceDirective
]
}
]
})).configurations.length,
Expand Down
Loading

0 comments on commit e714ad6

Please sign in to comment.