=====================================================================

Excited to bring V5 to life. This includes some BREAKING CHANGES to
several aspects of ZSH-type scwrypts. Please refer to the readme
for upgrade details (specifically docs/upgrade/v4-to-v5.md)

--- New Features -------------------------

- ZSH testing library with basic mock capabilities

- new scwrypts environment file format includes metadata and more
  advanced features like optional parent env overrides, selection
  inheritence, and improved structurual flexibility

- speedup cache for non-CI runs of ZSH-type scwrypts

- ${scwryptsmodule} syntax now allows a consistent unique-naming
  scheme for functions in ZSH-type scwrypts while providing better
  insight into origin of API calls in other modules

- reusable, case-statement-driven argument parsers in ZSH-type scwrypts

--- Changes ------------------------------

- several utility function renames in ZSH-type scwrypts to improve
  consistency

- documentation comments included in ZSH libraries

- ZSH-type scwrypts now allow library modules to live alongside
  executables
  (zsh/lib still supported; autodetection determines default)

--- Bug Fixes ----------------------------

- hardened environment checking for REQUIRED_ENV variables; this removes
  the ability to overwrite variables in local function contexts
This commit is contained in:
2024-05-10 13:32:02 -06:00
committed by Wryn (yage) Wagner
parent 1b4060dd1c
commit 7f14edd039
271 changed files with 11459 additions and 10516 deletions

View File

@@ -1,19 +1,26 @@
{
"name": "scwrypts",
"main": "dist/index.js",
"type": "module",
"files": [
"dist"
],
"author": "Wryn (yage) Wagner",
"description": "scwrypts integration for typescript",
"license": "GPL-3.0",
"type": "module",
"packageManager": "pnpm@9.4.0",
"scripts": {
"build": "rm -rf ./dist && tsc",
"test": "jest",
"lint": "eslint . && prettier --check src/",
"format": "prettier --write src/"
},
"author": "Wryn (yage) Wagner",
"license": "GPL-3.0",
"main": "dist/index.js",
"files": [
"dist"
],
"exports": {
".": {
"types": "./dist/index.d.js",
"import": "./dist/index.d.js"
}
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@types/jest": "^29.5.12",
@@ -29,6 +36,9 @@
"typescript": "^5.3.3",
"uuid": "^9.0.1"
},
"dependencies": {
"execa": "^8.0.1"
},
"eslintConfig": {
"ignorePatterns": [
"dist",
@@ -93,8 +103,5 @@
"moduleNameMapper": {
"^(\\.{1,2}/.*)\\.js$": "$1"
}
},
"dependencies": {
"execa": "^8.0.1"
}
}

3698
zx/lib/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1 @@
export * from './scwrypts/scwrypts.js';
export { ScwryptsLogLevel } from './scwrypts/types.js';
export type { ScwryptsOptions } from './scwrypts/types.js';
export * from './scwrypts/index.js';

View File

@@ -2,11 +2,11 @@
import { describe, expect, test, beforeEach, jest } from '@jest/globals';
import { v4 as uuid } from 'uuid';
import * as parseCLIArgs from './parse-cli-args.js';
import * as Module_parseCLIArgs from '../parse-cli-args.js';
import { getScwryptsLookup, Errors } from './get-scwrypts-lookup.js';
import { getScwryptsLookup, Errors } from '../get-scwrypts-lookup.js';
import type { ScwryptsOptions } from './types.js';
import type { ScwryptsOptions } from '../type.scwrypts-options.js';
let sample: any;
beforeEach(() => {
@@ -15,7 +15,7 @@ beforeEach(() => {
spy: {},
};
sample.spy.parseCLIArgs = jest.spyOn(parseCLIArgs, 'parseCLIArgs');
sample.spy.parseCLIArgs = jest.spyOn(Module_parseCLIArgs, 'parseCLIArgs');
sample.spy.parseCLIArgs.mockReturnValue(sample.parsedCLIArgs);
});

View File

@@ -2,7 +2,7 @@
import { describe, expect, test, beforeEach } from '@jest/globals';
import { v4 as uuid } from 'uuid';
import { parseCLIArgs } from './parse-cli-args.js';
import { parseCLIArgs } from '../parse-cli-args.js';
let sample: any;
beforeEach(() => {

View File

@@ -3,11 +3,11 @@ import { describe, expect, test, beforeEach, jest } from '@jest/globals';
import { v4 as uuid } from 'uuid';
import { execa } from 'execa';
import * as Module_getScwryptsLookup from './get-scwrypts-lookup.js';
import * as Module_parseCLIArgs from './parse-cli-args.js';
import { ScwryptsLogLevel } from './types.js';
import * as Module_getScwryptsLookup from '../get-scwrypts-lookup.js';
import * as Module_parseCLIArgs from '../parse-cli-args.js';
import { ScwryptsLogLevel } from '../type.scwrypts-log-level.js';
import { scwrypts } from './scwrypts.js';
import { scwrypts } from '../scwrypts.js';
jest.mock('execa', () => ({
execa: jest.fn(() => Promise.resolve()),

View File

@@ -1,6 +1,6 @@
import { parseCLIArgs } from './parse-cli-args.js';
import type { ScwryptsOptions } from './types.js';
import type { ScwryptsOptions } from './type.scwrypts-options.js';
export type ScwryptsLookupOptions =
| {

View File

@@ -0,0 +1,4 @@
export * from './scwrypts.js';
export * from './type.scwrypts-log-level.js';
export * from './type.scwrypts-options.js';

View File

@@ -3,7 +3,7 @@ import { execa } from 'execa';
import { getScwryptsLookup } from './get-scwrypts-lookup.js';
import { parseCLIArgs } from './parse-cli-args.js';
import type { ScwryptsOptions } from './types.js';
import type { ScwryptsOptions } from './type.scwrypts-options.js';
export const scwrypts = async (options: ScwryptsOptions) => {
const lookup = getScwryptsLookup(options);

View File

@@ -0,0 +1,7 @@
export enum ScwryptsLogLevel {
SILENT = 0,
QUIET = 1,
NORMAL = 2,
WARNING = 3,
DEBUG = 4,
}

View File

@@ -0,0 +1,10 @@
import type { ScwryptsLogLevel } from './type.scwrypts-log-level.js';
export type ScwryptsOptions = {
name?: string | undefined;
group?: string | undefined;
type?: string | undefined;
patterns?: string[] | undefined;
log_level?: ScwryptsLogLevel | undefined;
args?: string | string[] | undefined;
};

View File

@@ -1,16 +0,0 @@
export type ScwryptsOptions = {
name: string | undefined;
group: string | undefined;
type: string | undefined;
patterns: string[] | undefined;
log_level: ScwryptsLogLevel | undefined;
args: string | string[] | undefined;
};
export enum ScwryptsLogLevel {
SILENT = 0,
QUIET = 1,
NORMAL = 2,
WARNING = 3,
DEBUG = 4,
}

View File

@@ -14,5 +14,5 @@
"strict": true
},
"include": ["src"],
"exclude": ["node_modules", "dist", "extensions", "**/*.test.ts"]
"exclude": ["node_modules", "dist", "**/__tests__/*"]
}