Skip to content

Commit 6434227

Browse files
authored
Release 0.2.1
* Publish config * Refactoring of BaseCommand approach * Bump version to 0.2.1
1 parent 76fed35 commit 6434227

File tree

12 files changed

+45
-19
lines changed

12 files changed

+45
-19
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Thumbs.db
3131

3232
# Ignore built ts files
3333
dist/**/*
34+
lib/**/*
35+
*.tgz
3436

3537
# yarn
3638
.yarn/cache

bundles/@yarnpkg/plugin-enhanced-workspaces.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
{
22
"name": "yarn-plugin-enhanced-workspaces",
3-
"version": "0.1.0",
3+
"version": "0.2.1",
44
"description": "Yarn plugin enhancing workspaces commands",
55
"author": "Dmitry Ruban @RuBAN-GT",
66
"license": "MIT",
77
"main": "./src/index.ts",
8+
"publishConfig": {
9+
"main": "./lib/index.js",
10+
"typings": "./lib/index.d.ts"
11+
},
812
"files": [
913
"bundles",
10-
"src",
14+
"lib",
1115
"README.md"
1216
],
1317
"scripts": {
1418
"lint": "eslint . --ext .ts --config .eslintrc.js",
1519
"build": "builder build plugin",
1620
"build:watch": "nodemon --watch src -e ts --exec builder build plugin",
21+
"prepack": "tsc",
22+
"publish": "run build && run prepack && yarn npm publish",
1723
"test": "jest",
1824
"test:watch": "jest --watch"
1925
},
2026
"dependencies": {
2127
"@yarnpkg/builder": "^3.1.0",
28+
"@yarnpkg/cli": "^3.1.0",
2229
"@yarnpkg/core": "^3.1.0",
2330
"@yarnpkg/fslib": "^2.6.0",
2431
"@yarnpkg/plugin-version": "^3.1.0",

src/commands/workspaces/changed/chunks.command.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { CommandContext, Project } from '@yarnpkg/core';
1+
import { Project } from '@yarnpkg/core';
22
import { Command, Option, Usage } from 'clipanion';
3+
import { BaseCommand } from '@yarnpkg/cli';
34
import { Configuration } from '@yarnpkg/core';
45
import { applyCascade, isAtLeast, isNumber, isEnum } from 'typanion';
56

@@ -8,7 +9,7 @@ import { GroupManager, groupsJsonReportConverter } from '../../../core/group-man
89
import { getMapValues, getAvailableProcessesCount } from '../../../utils';
910
import { ChangeDetectionStrategy } from '../../../types/configuration';
1011

11-
export class ChunksCommand extends Command<CommandContext> {
12+
export class ChunksCommand extends BaseCommand {
1213
// Meta
1314
public static paths: string[][] = [['workspaces', 'changed', 'chunks']];
1415
public static usage: Usage = Command.Usage({

src/commands/workspaces/changed/list.command.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { CommandContext, Project } from '@yarnpkg/core';
1+
import { Project } from '@yarnpkg/core';
22
import { Command, Option, Usage } from 'clipanion';
3+
import { BaseCommand } from '@yarnpkg/cli';
34
import { Configuration } from '@yarnpkg/core';
45
import { isEnum } from 'typanion';
56

@@ -8,7 +9,7 @@ import { GroupManager } from '../../../core/group-manager';
89
import { getMapValues } from '../../../utils';
910
import { ChangeDetectionStrategy } from '../../../types/configuration';
1011

11-
export class ListCommand extends Command<CommandContext> {
12+
export class ListCommand extends BaseCommand {
1213
// Meta
1314
public static paths: string[][] = [['workspaces', 'changed', 'list']];
1415
public static usage: Usage = Command.Usage({

src/commands/workspaces/foreach/foreach.command.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { CommandContext, Project } from '@yarnpkg/core';
1+
import { Project } from '@yarnpkg/core';
22
import { Command, Option, Usage, UsageError } from 'clipanion';
3+
import { BaseCommand } from '@yarnpkg/cli';
34
import { Configuration } from '@yarnpkg/core';
45
import { applyCascade, isAtLeast, isEnum, isNumber } from 'typanion';
56

@@ -9,7 +10,7 @@ import { WORKSPACE_PLUGIN_NAME } from './foreach.consts';
910
import { ChangeDetectionStrategy } from '../../../types/configuration';
1011
import { getMapValues, getAvailableProcessesCount } from '../../../utils';
1112

12-
export class ForeachCommand extends Command<CommandContext> {
13+
export class ForeachCommand extends BaseCommand {
1314
// Meta
1415
public static paths: string[][] = [['workspaces', 'changed', 'foreach']];
1516
public static usage: Usage = Command.Usage({

src/commands/workspaces/graph/graph.command.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { CommandContext, Project } from '@yarnpkg/core';
1+
import { Project } from '@yarnpkg/core';
2+
import { BaseCommand } from '@yarnpkg/cli';
23
import { Command, Option, Usage } from 'clipanion';
34
import { Configuration } from '@yarnpkg/core';
45
import { asTree } from 'treeify';
@@ -12,7 +13,7 @@ import {
1213
WorkspaceNode,
1314
} from '../../../core/workspace-tree';
1415

15-
export class GraphCommand extends Command<CommandContext> {
16+
export class GraphCommand extends BaseCommand {
1617
// Meta
1718
public static paths: string[][] = [['workspaces', 'graph']];
1819
public static usage: Usage = Command.Usage({

src/core/change-detection-manager/utils/find-changed-files.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export async function findChangedFiles(
1414
commitHash?: string | undefined | null,
1515
): Promise<PortablePath[]> {
1616
const root = project.configuration.projectCwd as PortablePath;
17-
const excludedList: string[] = project.configuration.get('changesetIgnorePatterns') || [];
17+
const excludedList: string[] = (project.configuration.get('changesetIgnorePatterns') as string[]) || [];
1818
const options = { cwd: root, strict: true };
1919

2020
// Get tracked files

src/core/workspace-tree/tree.utils.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import TreeModel from 'tree-model';
2+
3+
// TSC `default` workaround
4+
export default TreeModel;

src/core/workspace-tree/workspace-tree.manager.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Workspace, Locator } from '@yarnpkg/core';
2-
import TreeModel, { Node } from 'tree-model';
2+
import { Node } from 'tree-model';
33

44
import { WorkspaceNode } from './models/workspace.node';
5+
import TreeModel from './tree.utils';
56

67
export class WorkspaceTreeManager {
78
public readonly root: WorkspaceNode;
@@ -26,7 +27,6 @@ export class WorkspaceTreeManager {
2627
}
2728

2829
protected parseWorkspaceNode(rootNode: WorkspaceNode): Node<WorkspaceNode> {
29-
const treeManager = new TreeModel();
30-
return treeManager.parse(rootNode);
30+
return new TreeModel().parse(rootNode);
3131
}
3232
}

tsconfig.json

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
{
22
"compilerOptions": {
33
"allowSyntheticDefaultImports": true,
4+
"baseUrl": "./",
45
"declaration": true,
6+
"esModuleInterop": true,
57
"experimentalDecorators": true,
8+
"forceConsistentCasingInFileNames": true,
69
"importHelpers": true,
10+
"isolatedModules": true,
11+
"lib": ["es2019"],
712
"module": "commonjs",
8-
"moduleResolution": "node",
9-
"outDir": "dist",
13+
"noImplicitReturns": true,
14+
"outDir": "lib",
1015
"rootDir": "src",
16+
"skipLibCheck": true,
1117
"strict": true,
12-
"target": "es2017"
18+
"target": "es2019",
19+
"useUnknownInCatchVariables": true
1320
},
21+
"exclude": ["lib/**"],
1422
"include": ["src/**/*"]
1523
}

yarn.lock

+1
Original file line numberDiff line numberDiff line change
@@ -8104,6 +8104,7 @@ resolve@^1.20.0:
81048104
"@typescript-eslint/eslint-plugin": ^4.33.0
81058105
"@typescript-eslint/parser": ^4.33.0
81068106
"@yarnpkg/builder": ^3.1.0
8107+
"@yarnpkg/cli": ^3.1.0
81078108
"@yarnpkg/core": ^3.1.0
81088109
"@yarnpkg/fslib": ^2.6.0
81098110
"@yarnpkg/plugin-version": ^3.1.0

0 commit comments

Comments
 (0)