Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
bluelovers committed Aug 26, 2022
1 parent 3484e07 commit dafc19c
Show file tree
Hide file tree
Showing 26 changed files with 138 additions and 28 deletions.
12 changes: 6 additions & 6 deletions packages/@yarn-tool/changelog/bin/changelog.js

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

6 changes: 3 additions & 3 deletions packages/@yarn-tool/changelog/bin/changelog.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env node

import yargs, { Argv, Omit } from 'yargs';
import setupToYargs from '../lib/yargs-setting';
import { setupToYargs } from '../lib/yargs-setting';
import { IOptionsWithType, IOptionsUpdateChangelog } from '..';
import updateChangelogByCwd from '../lib/lerna/from-list';
import { updateChangelogByCwd } from '../lib/lerna/from-list';
import { createDependencyTable } from '@yarn-tool/table';
import pathIsSame from 'path-is-same';
import { pathIsSame } from 'path-is-same';
import { join } from 'path';
import { colorizeDiff } from '@yarn-tool/semver-diff';

Expand Down
17 changes: 16 additions & 1 deletion packages/@yarn-tool/fix-all/lib/pkg/index.js

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

25 changes: 24 additions & 1 deletion packages/@yarn-tool/fix-all/lib/pkg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { packageJsonDependenciesFields } from '@ts-type/package-dts/lib/package-
import { normalizeDepsValue } from '@yarn-tool/normalize-deps-value';
import { getRootCopyStaticFilesAuto } from '@yarn-tool/static-file/lib/root/getRootCopyStaticFiles';
import { copyStaticFiles } from '@yarn-tool/static-file';
import { defaultPkgScripts } from '@yarn-tool/pkg-entry-util/lib/preset/pkg-scripts';
import { pathIsSame } from 'path-is-same';

export function _handler(cwd: string, ...argv: Parameters<IOptionsPkgListable["handler"]>)
{
Expand Down Expand Up @@ -53,7 +55,7 @@ export function _runEachPackagesAsync(list: IEntry[],
})
.mapSeries(async (row) =>
{
//console.dir(row);
console.dir(row);

const err = new AggregateErrorExtra();

Expand Down Expand Up @@ -103,6 +105,27 @@ export function _runEachPackagesAsync(list: IEntry[],
})
;

pkg.data.scripts = {
...defaultPkgScripts(),
...(pkg.data.scripts ?? {}),
};

if (pathIsSame(rootData.root, row.location))
{
if (pathIsSame(rootData.ws, row.location))
{

}
else
{

}
}
else
{

}

pkg.data = sortPackageJson(pkg.data);

pkg.autofix();
Expand Down
4 changes: 2 additions & 2 deletions packages/@yarn-tool/ncu/lib/update/npmCheckUpdates.js

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

2 changes: 1 addition & 1 deletion packages/@yarn-tool/ncu/lib/update/npmCheckUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { stringifySemverFull } from '@lazy-node/semver-simple-parse/lib/stringif
import { IWrapDedupeCache } from '@yarn-tool/yarnlock/lib/types';
import { ITSRequireAtLeastOne } from 'ts-type';
import { getCache } from '@yarn-tool/pkg-version-query';
import toDependencyTable from '@yarn-tool/table/lib/deps-table';
import { toDependencyTable } from '@yarn-tool/table/lib/deps-table';

export async function npmCheckUpdates<C extends IWrapDedupeCache>(cache: Partial<C>,
ncuOptions: ITSRequireAtLeastOne<IOptionsNpmCheckUpdates, 'json_old' | 'packageData'>,
Expand Down
3 changes: 2 additions & 1 deletion packages/@yarn-tool/pkg-entry-util/lib/field/scripts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export declare const enum EnumScriptsEntry {
JEST_TEST = "jest --passWithNoTests",
NO_TEST_SPECIFIED = "echo \"Error: no test specified\"",
NO_TEST_SPECIFIED_EXIT = "echo \"Error: no test specified\" && exit 1",
BUILD_DTS_BUNDLE = "ynpx dts-bundle-generator -o ./dist/index.d.ts ./src/index.ts --no-banner --inline-declare-global & echo build:dts:bundle"
BUILD_DTS_BUNDLE = "ynpx dts-bundle-generator -o ./dist/index.d.ts ./src/index.ts --no-banner --inline-declare-global & echo build:dts:bundle",
preversion = "yarn run test"
}
export declare function scriptsEntryIsNoTestSpecified(value: string): value is EnumScriptsEntry.NO_TEST_SPECIFIED_EXIT | EnumScriptsEntry.NO_TEST_SPECIFIED;
1 change: 1 addition & 0 deletions packages/@yarn-tool/pkg-entry-util/lib/field/scripts.js

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

2 changes: 2 additions & 0 deletions packages/@yarn-tool/pkg-entry-util/lib/field/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export const enum EnumScriptsEntry
NO_TEST_SPECIFIED = "echo \"Error: no test specified\"",
NO_TEST_SPECIFIED_EXIT = "echo \"Error: no test specified\" && exit 1",
BUILD_DTS_BUNDLE = "ynpx dts-bundle-generator -o ./dist/index.d.ts ./src/index.ts --no-banner --inline-declare-global & echo build:dts:bundle",

preversion = "yarn run test",
}

export function scriptsEntryIsNoTestSpecified(value: string): value is EnumScriptsEntry.NO_TEST_SPECIFIED_EXIT | EnumScriptsEntry.NO_TEST_SPECIFIED
Expand Down
3 changes: 2 additions & 1 deletion packages/@yarn-tool/pkg-entry-util/lib/preset/dummy.js

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

3 changes: 2 additions & 1 deletion packages/@yarn-tool/pkg-entry-util/lib/preset/dummy.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { ITSArrayListMaybeReadonly } from 'ts-type/lib/type/base';
import { _dummyEchoPrefix } from '../util/scripts/dummy';

export function _fillDummyScriptsCore<T extends Record<string, string>>(scripts: T, prefix: string, fields: ITSArrayListMaybeReadonly<string>)
{
// @ts-ignore
scripts ??= {};

let text = `echo ${prefix ?? ''}`.trim();
let text = _dummyEchoPrefix(prefix);

fields.forEach(k =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { EnumScriptsEntry } from '../field/scripts';
export declare function defaultPkgScripts(): {
"test:jest": EnumScriptsEntry;
"test:snapshot": string;
"test:jest:snapshot": string;
};
export declare function defaultPkgNotOldExists(): {
"test:mocha": string;
Expand All @@ -20,4 +21,5 @@ export declare function defaultPkgNotOldExists(): {
coverage: string;
"test:jest": EnumScriptsEntry;
"test:snapshot": string;
"test:jest:snapshot": string;
};

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

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export function defaultPkgScripts()
return {
"test:jest": EnumScriptsEntry.JEST_TEST,
"test:snapshot": "yarn run test -- -u",
"test:jest:snapshot": "yarn run test:jest -- -u",
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export declare function defaultRootScripts(): {
"install:frozenLockfile": string;
"test:jest": import("../field/scripts").EnumScriptsEntry;
"test:snapshot": string;
"test:jest:snapshot": string;
};
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { EnumScriptsEntry } from '../field/scripts';
export declare function defaultWorkspaceRootScripts(): {
"test:all": string;
"test:since": string;
"build:all": string;
"review:all": string;
"coverage:all": string;
"lint:all": string;
preversion: string;
preversion: EnumScriptsEntry;
postversion: string;
"lerna:publish": string;
"lerna:publish:yes": string;
Expand Down

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

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defaultSharedRootScripts } from './shared-root-scripts';
import { EnumScriptsEntry } from '../field/scripts';

export function defaultWorkspaceRootScripts()
{
Expand All @@ -10,7 +11,7 @@ export function defaultWorkspaceRootScripts()
"review:all": "yarn-tool ws run review --concurrency 1",
"coverage:all": "yarn-tool ws run coverage --concurrency 1",
"lint:all": "yarn-tool ws run lint --concurrency 1",
"preversion": "yarn run test",
"preversion": EnumScriptsEntry.preversion,
"postversion": "yarn-tool fix-all",
"lerna:publish": "yarn run prepublishOnly:root && lerna publish && yarn run postpublishOnly",
"lerna:publish:yes": "yarn run prepublishOnly:root && lerna publish --yes --bump patch && yarn run postpublishOnly",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export declare function _dummyEchoPrefix(prefix: string): string;
export declare function _dummyEchoTextCore(pre: string, text: string): string;
export declare function _dummyEchoText(prefix: string, text: string): string;
export declare function isDummyEchoMaybe(value: string): boolean;
export declare function isDummyEchoMaybeOrEmpty(value: string): boolean;
24 changes: 24 additions & 0 deletions packages/@yarn-tool/pkg-entry-util/lib/util/scripts/dummy.js

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

24 changes: 24 additions & 0 deletions packages/@yarn-tool/pkg-entry-util/lib/util/scripts/dummy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export function _dummyEchoPrefix(prefix: string)
{
return `echo ${prefix ?? ''}`.trim();
}

export function _dummyEchoTextCore(pre: string, text: string)
{
return `${pre} ${text}`.trim();
}

export function _dummyEchoText(prefix: string, text: string)
{
return _dummyEchoTextCore(_dummyEchoPrefix(prefix), text)
}

export function isDummyEchoMaybe(value: string)
{
return value?.length && value.startsWith('echo ') && !value.includes('&')
}

export function isDummyEchoMaybeOrEmpty(value: string)
{
return !value?.length || (value.startsWith('echo ') && !value.includes('&'))
}
3 changes: 1 addition & 2 deletions packages/@yarn-tool/static-file/lib/copyStaticFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { dirname, resolve } from 'path';
import { defaultCopyStaticFiles } from './const';
import { parseStaticMap } from './parseStaticMap';
import { copyStaticFilesEntry } from './copyStaticFilesEntry';
import __root from '../__root';
import { default as __root } from '../__root';

export function copyStaticFiles<K extends string>(options: ICopyStaticFilesOptions<K>)
{
Expand Down Expand Up @@ -34,4 +34,3 @@ export function copyStaticFiles<K extends string>(options: ICopyStaticFilesOptio
})
;
}

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IStaticFilesMapArrayEntry } from './types';
import { dirname, resolve } from 'path';
import { copySync, ensureDirSync, existsSync } from 'fs-extra';
import __root from '../__root';
import { default as __root } from '../__root';

export function copyStaticFilesEntry(entry: IStaticFilesMapArrayEntry<string>,
cwd: string,
Expand Down
3 changes: 3 additions & 0 deletions packages/create-yarn-workspaces/lib/util.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
/**
* @deprecated
*/
export declare function isSamePath(p1: string, p2: string): boolean;
8 changes: 5 additions & 3 deletions packages/create-yarn-workspaces/lib/util.js

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

Loading

0 comments on commit dafc19c

Please sign in to comment.