Skip to content

Commit

Permalink
vx: add next release process
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed Nov 10, 2021
1 parent f721b2d commit 5e9194f
Show file tree
Hide file tree
Showing 11 changed files with 250 additions and 140 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- release
- integration
- integration-*
- next-*

jobs:
build:
Expand Down Expand Up @@ -40,6 +41,7 @@ jobs:
env:
RELEASE_BRANCH: release
INTEGRATION_BRANCH: integration
NEXT_BRANCH: next
STABLE_BRANCH: stable
LATEST_BRANCH: latest
PUBLIC_REPO_TOKEN: ${{secrets.PUBLIC_REPO_TOKEN}}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ packages/n4s/compose/
packages/vest/classnames/
packages/vest/promisify/
packages/vest/parser/
packages/vest/enforce-compose/
packages/anyone/all/
packages/anyone/any/
packages/anyone/none/
Expand Down
7 changes: 0 additions & 7 deletions packages/n4s/compose/package.json

This file was deleted.

299 changes: 202 additions & 97 deletions packages/n4s/types/n4s.d.ts
Original file line number Diff line number Diff line change
@@ -1,135 +1,240 @@
type DropFirst<T extends unknown[]> = T extends [
unknown,
...infer U
] ? U : never;
type TRuleReturn = boolean | {
pass: boolean;
message?: string | (() => string);
type TEnforceContext = null | {
meta: Record<string, any>;
value: any;
parent: () => TEnforceContext;
};
type DropFirst<T extends unknown[]> = T extends [unknown, ...infer U]
? U
: never;
type TStringable = string | ((...args: any[]) => string);
type TRuleReturn =
| boolean
| {
pass: boolean;
message?: TStringable;
};
type TRuleDetailedResult = {
pass: boolean;
message?: string;
pass: boolean;
message?: string;
};
type TLazyRules = TRules<TLazyRuleMethods>;
type TLazy = TLazyRules & TLazyRuleMethods;
type TShapeObject = Record<any, TLazy>;
type TLazyRuleMethods = TLazyRuleRunners & {
message: (message: TLazyMessage) => TLazy;
message: (message: TLazyMessage) => TLazy;
};
type TLazyRuleRunners = {
test: (value: unknown) => boolean;
run: (value: unknown) => TRuleDetailedResult;
test: (value: unknown) => boolean;
run: (value: unknown) => TRuleDetailedResult;
};
type TLazyMessage = string | ((value: unknown, originalMessage?: TStringable) => string);
type TLazyMessage =
| string
| ((value: unknown, originalMessage?: TStringable) => string);
declare function allOf(value: unknown, ...rules: TLazy[]): TRuleDetailedResult;
declare function anyOf(value: unknown, ...rules: TLazy[]): TRuleDetailedResult;
declare function noneOf(value: unknown, ...rules: TLazy[]): TRuleDetailedResult;
declare function oneOf(value: unknown, ...rules: TLazy[]): TRuleDetailedResult;
};
function failing(): TRuleReturn;
function passing(): TRuleReturn;
function anyOf(value: unknown, ...rules: TLazyRuleMethods[]): TRuleDetailedResult;
function noneOf(value: unknown, ...rules: TLazyRuleMethods[]): TRuleDetailedResult;
function oneOf(value: unknown, ...rules: TLazyRuleMethods[]): TRuleDetailedResult;
function allOf(value: unknown, ...rules: TLazyRuleMethods[]): TRuleDetailedResult;
}
declare function optional(value: any, ruleChain: TLazy): TRuleDetailedResult;
declare function compounds(): {
allOf: typeof allOf;
anyOf: typeof anyOf;
noneOf: typeof noneOf;
oneOf: typeof oneOf;
optional: typeof optional;
};
type TCompounds = ReturnType<typeof compounds>;
type KCompounds = keyof TCompounds;
type TArgs = any[];
type TRuleValue = any;
type TRuleBase = (value: TRuleValue, ...args: TArgs) => TRuleReturn;
type TRule = Record<string, TRuleBase>;
type TBaseRules = typeof baseRules;
type KBaseRules = keyof TBaseRules;
declare function condition(
value: any,
callback: (value: any) => TRuleReturn
): TRuleReturn;
declare function endsWith(value: string, arg1: string): boolean;
declare function equals(value: unknown, arg1: unknown): boolean;
declare function greaterThan(value: number | string, gt: number | string): boolean;
declare function greaterThanOrEquals(value: string | number, gte: string | number): boolean;
declare function greaterThan(
value: number | string,
gt: number | string
): boolean;
declare function greaterThanOrEquals(
value: string | number,
gte: string | number
): boolean;
declare function inside(value: unknown, arg1: string | unknown[]): boolean;
// The module is named "isArrayValue" since it
// is conflicting with a nested npm dependency.
// We may need to revisit this in the future.
declare function isArray(value: unknown): value is Array<unknown>;
declare function isBetween(value: number | string, min: number | string, max: number | string): boolean;
declare function isBetween(
value: number | string,
min: number | string,
max: number | string
): boolean;
declare function isBlank(value: unknown): boolean;
declare function isBoolean(value: unknown): value is boolean;
declare function isEmpty(value: unknown): boolean;
declare function isNaN(value: unknown): boolean;
declare function isNegative(value: number | string): boolean;
declare function isNull(value: unknown): value is null;
declare function isNumber(value: unknown): value is number;
declare function isNumeric(value: string | number): boolean;
declare function isStringValue(v: unknown): v is string;
declare function isTruthy(value: unknown): boolean;
declare function isUndefined(value?: unknown): boolean;
declare function lengthEquals(value: string | unknown[], arg1: string | number): boolean;
declare function lengthEquals(
value: string | unknown[],
arg1: string | number
): boolean;
declare function lessThan(value: string | number, lt: string | number): boolean;
declare function lessThanOrEquals(value: string | number, lte: string | number): boolean;
declare function longerThan(value: string | unknown[], arg1: string | number): boolean;
declare function longerThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
declare function lessThanOrEquals(
value: string | number,
lte: string | number
): boolean;
declare function longerThan(
value: string | unknown[],
arg1: string | number
): boolean;
declare function longerThanOrEquals(
value: string | unknown[],
arg1: string | number
): boolean;
declare function matches(value: string, regex: RegExp | string): boolean;
declare function numberEquals(value: string | number, eq: string | number): boolean;
declare function shorterThan(value: string | unknown[], arg1: string | number): boolean;
declare function shorterThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
declare function numberEquals(
value: string | number,
eq: string | number
): boolean;
declare function shorterThan(
value: string | unknown[],
arg1: string | number
): boolean;
declare function shorterThanOrEquals(
value: string | unknown[],
arg1: string | number
): boolean;
declare function startsWith(value: string, arg1: string): boolean;
declare function shape(
inputObject: Record<string, any>,
shapeObject: TShapeObject
): TRuleDetailedResult;
declare function loose(
inputObject: Record<string, any>,
shapeObject: TShapeObject
): TRuleDetailedResult;
declare function isArrayOf(
inputArray: any[],
currentRule: TLazy
): TRuleDetailedResult;
declare const baseRules: {
doesNotEndWith: (value: string, arg1: string) => boolean;
doesNotStartWith: (value: string, arg1: string) => boolean;
endsWith: typeof endsWith;
equals: typeof equals;
greaterThan: typeof greaterThan;
greaterThanOrEquals: typeof greaterThanOrEquals;
gt: typeof greaterThan;
gte: typeof greaterThanOrEquals;
inside: typeof inside;
isArray: typeof isArray;
isBetween: typeof isBetween;
isBoolean: typeof default;
isEmpty: typeof isEmpty;
isEven: (value: any) => boolean;
isFalsy: (value: unknown) => boolean;
isNaN: typeof isNaN;
isNegative: typeof isNegative;
isNotArray: (value: unknown) => boolean;
isNotBetween: (value: string | number, min: string | number, max: string | number) => boolean;
isNotBoolean: (value: unknown) => boolean;
isNotEmpty: (value: unknown) => boolean;
isNotNaN: (value: unknown) => boolean;
isNotNull: (value: unknown) => boolean;
isNotNumber: (value: unknown) => boolean;
isNotNumeric: (value: string | number) => boolean;
isNotString: (v: unknown) => boolean;
isNotUndefined: (value?: unknown) => boolean;
isNull: typeof isNull;
isNumber: typeof isNumber;
isNumeric: typeof isNumeric;
isOdd: (value: any) => boolean;
isPositive: (value: string | number) => boolean;
isString: typeof default;
isTruthy: typeof isTruthy;
isUndefined: typeof isUndefined;
lengthEquals: typeof lengthEquals;
lengthNotEquals: (value: string | unknown[], arg1: string | number) => boolean;
lessThan: typeof lessThan;
lessThanOrEquals: typeof lessThanOrEquals;
longerThan: typeof longerThan;
longerThanOrEquals: typeof longerThanOrEquals;
lt: typeof lessThan;
lte: typeof lessThanOrEquals;
matches: typeof matches;
notEquals: (value: unknown, arg1: unknown) => boolean;
notInside: (value: unknown, arg1: string | unknown[]) => boolean;
notMatches: (value: string, regex: string | RegExp) => boolean;
numberEquals: typeof numberEquals;
numberNotEquals: (value: string | number, eq: string | number) => boolean;
shorterThan: typeof shorterThan;
shorterThanOrEquals: typeof shorterThanOrEquals;
startsWith: typeof startsWith;
};
declare function EnforceBase(value: TRuleValue): TEaegerRules;
declare const enforce: TEnforce;
type TEaegerRules = {
[P in keyof typeof compounds]: (...args: DropFirst<Parameters<typeof compounds[P]>>) => TEaegerRules;
condition: typeof condition;
doesNotEndWith: (value: string, arg1: string) => boolean;
doesNotStartWith: (value: string, arg1: string) => boolean;
endsWith: typeof endsWith;
equals: typeof equals;
greaterThan: typeof greaterThan;
greaterThanOrEquals: typeof greaterThanOrEquals;
gt: typeof greaterThan;
gte: typeof greaterThanOrEquals;
inside: typeof inside;
isArray: typeof isArray;
isBetween: typeof isBetween;
isBlank: typeof isBlank;
isBoolean: typeof isBoolean;
isEmpty: typeof isEmpty;
isEven: (value: any) => boolean;
isFalsy: (value: unknown) => boolean;
isNaN: typeof isNaN;
isNegative: typeof isNegative;
isNotArray: (value: unknown) => boolean;
isNotBetween: (
value: string | number,
min: string | number,
max: string | number
) => boolean;
isNotBlank: (value: unknown) => boolean;
isNotBoolean: (value: unknown) => boolean;
isNotEmpty: (value: unknown) => boolean;
isNotNaN: (value: unknown) => boolean;
isNotNull: (value: unknown) => boolean;
isNotNumber: (value: unknown) => boolean;
isNotNumeric: (value: string | number) => boolean;
isNotString: (v: unknown) => boolean;
isNotUndefined: (value?: unknown) => boolean;
isNull: typeof isNull;
isNumber: typeof isNumber;
isNumeric: typeof isNumeric;
isOdd: (value: any) => boolean;
isPositive: (value: string | number) => boolean;
isString: typeof isStringValue;
isTruthy: typeof isTruthy;
isUndefined: typeof isUndefined;
lengthEquals: typeof lengthEquals;
lengthNotEquals: (
value: string | unknown[],
arg1: string | number
) => boolean;
lessThan: typeof lessThan;
lessThanOrEquals: typeof lessThanOrEquals;
longerThan: typeof longerThan;
longerThanOrEquals: typeof longerThanOrEquals;
lt: typeof lessThan;
lte: typeof lessThanOrEquals;
matches: typeof matches;
notEquals: (value: unknown, arg1: unknown) => boolean;
notInside: (value: unknown, arg1: string | unknown[]) => boolean;
notMatches: (value: string, regex: string | RegExp) => boolean;
numberEquals: typeof numberEquals;
numberNotEquals: (value: string | number, eq: string | number) => boolean;
shorterThan: typeof shorterThan;
shorterThanOrEquals: typeof shorterThanOrEquals;
startsWith: typeof startsWith;
} & {
[P in keyof typeof baseRules]: (...args: DropFirst<Parameters<typeof baseRules[P]>>) => TEaegerRules;
};
type TLazyRules = {
[P in keyof typeof compounds]: (...args: DropFirst<Parameters<typeof compounds[P]>> | TArgs) => TLazyRules & TLazyRuleMethods;
allOf: typeof allOf;
anyOf: typeof anyOf;
noneOf: typeof noneOf;
oneOf: typeof oneOf;
optional: typeof optional;
} & {
[P in keyof typeof baseRules]: (...args: DropFirst<Parameters<typeof baseRules[P]>> | TArgs) => TLazyRules & TLazyRuleMethods;
shape: typeof shape;
loose: typeof loose;
isArrayOf: typeof isArrayOf;
};
/* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/no-empty-interface */
declare global {
namespace n4s {
interface EnforceCustomMatchers<R> {}
}
}
type TRules<E = Record<string, unknown>> = n4s.EnforceCustomMatchers<
TRules & E
> &
Record<string, (...args: TArgs) => TRules & E> &
{
[P in KCompounds]: (
...args: DropFirst<Parameters<TCompounds[P]>> | TArgs
) => TRules & E;
} &
{
[P in KBaseRules]: (
...args: DropFirst<Parameters<TBaseRules[P]>> | TArgs
) => TRules & E;
};
declare function enforceEager(value: TRuleValue): TRules;
type TEnforceEager = typeof enforceEager;
// Help needed improving the typings of this file.
// Ideally, we'd be able to extend TShapeObject, but that's not possible.
declare function partial<T extends Record<any, any>>(shapeObject: T): T;
declare function modifiers(): {
partial: typeof partial;
};
type TModifiers = ReturnType<typeof modifiers>;
declare const enforce: TEnforce;
type TEnforce = TEnforceEager & TLazyRules & TEnforceMethods;
type TEnforceMethods = TModifiers & {
context: () => TEnforceContext;
extend: (customRules: TRule) => void;
};
type TEnforce = typeof EnforceBase & TLazyRules & {
extend: (customRules: TRule) => void;
} & TLazyRuleMethods;
export { enforce as default };
//# sourceMappingURL=n4s.d.ts.map
8 changes: 4 additions & 4 deletions vx/commands/release.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
const isReleaseBranch = require('../scripts/release/isReleaseBranch');
const pushToLatestBranch = require('../scripts/release/steps/pushToLatestBranch');

const logger = require('vx/logger');
const packagesToRelease = require('vx/scripts/release/packagesToRelease');
const releasePackage = require('vx/scripts/release/releasePackage');
const integrationBranch = require('vx/util/integrationBranch');
const { isReleaseBranch } = require('vx/util/taggedBranch');
const { targetPackage } = require('vx/util/taggedBranch');
const { usePackage } = require('vx/vxContext');
const ctx = require('vx/vxContext');
require('../scripts/genTsConfig');

function release() {
const pkg = usePackage() || integrationBranch.targetPackage;
const pkg = usePackage() || targetPackage;
if (pkg) {
return ctx.withPackage(pkg, releasePackage);
} else {
Expand All @@ -29,7 +29,7 @@ async function releaseAll() {
ctx.withPackage(name, release);
});

if (!isReleaseBranch()) {
if (!isReleaseBranch) {
logger.info(`❌ Not in release branch. Not pushing changes to git.`);
return;
}
Expand Down
Loading

0 comments on commit 5e9194f

Please sign in to comment.