@sketch-hq/sketch-assistant-utils
Advanced tools
Comparing version 5.0.0-next.14 to 5.0.0-next.15
# @sketch-hq/sketch-assistant-utils | ||
## 5.0.0-next.15 | ||
### Major Changes | ||
- e76fabd: Introduction of the Assistants CLI. | ||
### Patch Changes | ||
- Updated dependencies [e76fabd] | ||
- @sketch-hq/sketch-assistant-types@5.0.0-next.15 | ||
## 5.0.0-next.14 | ||
@@ -4,0 +15,0 @@ |
@@ -13,2 +13,3 @@ "use strict"; | ||
const test_helpers_1 = require("../../test-helpers"); | ||
const sketch_assistant_types_1 = require("@sketch-hq/sketch-assistant-types"); | ||
const __1 = require("../"); | ||
@@ -85,3 +86,3 @@ describe('assign', () => { | ||
locale: 'en', | ||
platform: 'sketch', | ||
runtime: sketch_assistant_types_1.AssistantRuntime.Sketch, | ||
}; | ||
@@ -88,0 +89,0 @@ test('prepares a single assistant function', () => __awaiter(void 0, void 0, void 0, function* () { |
@@ -1,3 +0,14 @@ | ||
import { AssistantDefinition, Assistant, AssistantEnv, Maybe, RuleDefinition } from '@sketch-hq/sketch-assistant-types'; | ||
import { AssistantDefinition, AssistantEnv, Maybe, RuleDefinition } from '@sketch-hq/sketch-assistant-types'; | ||
/** | ||
* Prepare an assistant package. That is, un-roll its exported value into a flat list of assistant | ||
* functions, invoke and await them to obtain a flat list of concrete assistant definitions which is | ||
* then merged to form a final/single assistant definition. | ||
* | ||
* Assistant preparation is performed at runtime by an assistant runner. | ||
* | ||
* @param source The assistant package to prepare | ||
* @param context The env within which the assistant package is being prepared | ||
*/ | ||
declare const prepare: (pkg: unknown, env: AssistantEnv) => Promise<AssistantDefinition>; | ||
/** | ||
* Merge assistant definitions together to form a single assistant definition, with a syntax similar | ||
@@ -15,13 +26,2 @@ * to Object.assign(). Assistants are merged from the right-most argument to the left into | ||
/** | ||
* Prepare an assistant. That is, un-roll its exported value into a flat list of assistant functions, | ||
* invoke and await them to obtain a flat list of concrete assistant definitions which is then merged | ||
* to form a final/single assistant definition. | ||
* | ||
* Assistant preparation is performed at runtime by an assistant runner. | ||
* | ||
* @param source The assistant package to prepare | ||
* @param context The env within which the assistant package is being prepared | ||
*/ | ||
declare const prepare: (pkgExport: import("@sketch-hq/sketch-assistant-types").MaybeESModule<import("@sketch-hq/sketch-assistant-types").ValueOrArray<import("@sketch-hq/sketch-assistant-types").MaybeESModule<Assistant>>>, env: AssistantEnv) => Promise<AssistantDefinition>; | ||
/** | ||
* Lookup a rule definition by rule name. | ||
@@ -28,0 +28,0 @@ */ |
@@ -13,2 +13,27 @@ "use strict"; | ||
/** | ||
* Assistant packages should be exported on the default export. However the shape of that export | ||
* differs depending on the esModuleInterop strategy. This function should consistently return | ||
* the inner AssistantPackage value either way. | ||
*/ | ||
const getDefaultExport = (target) => '__esModule' in target ? target.default : target; | ||
/** | ||
* Prepare an assistant package. That is, un-roll its exported value into a flat list of assistant | ||
* functions, invoke and await them to obtain a flat list of concrete assistant definitions which is | ||
* then merged to form a final/single assistant definition. | ||
* | ||
* Assistant preparation is performed at runtime by an assistant runner. | ||
* | ||
* @param source The assistant package to prepare | ||
* @param context The env within which the assistant package is being prepared | ||
*/ | ||
const prepare = (pkg, env) => __awaiter(void 0, void 0, void 0, function* () { | ||
pkg = getDefaultExport(pkg); | ||
const definitions = yield Promise.all((Array.isArray(pkg) ? pkg : [pkg]) | ||
.flat(Infinity) | ||
.map(getDefaultExport) | ||
.map((f) => f(env))); | ||
return assign(...definitions); | ||
}); | ||
exports.prepare = prepare; | ||
/** | ||
* Merge assistant definitions together to form a single assistant definition, with a syntax similar | ||
@@ -37,28 +62,2 @@ * to Object.assign(). Assistants are merged from the right-most argument to the left into | ||
/** | ||
* Prepare an assistant. That is, un-roll its exported value into a flat list of assistant functions, | ||
* invoke and await them to obtain a flat list of concrete assistant definitions which is then merged | ||
* to form a final/single assistant definition. | ||
* | ||
* Assistant preparation is performed at runtime by an assistant runner. | ||
* | ||
* @param source The assistant package to prepare | ||
* @param context The env within which the assistant package is being prepared | ||
*/ | ||
const prepare = (pkgExport, env) => __awaiter(void 0, void 0, void 0, function* () { | ||
const assistant = '__esModule' in pkgExport ? pkgExport.default : pkgExport; | ||
const definitions = yield Promise.all((Array.isArray(assistant) ? assistant : [assistant]) | ||
.flat(Infinity) | ||
.map((item) => { | ||
if ('__esModule' in item) { | ||
return item.default; | ||
} | ||
else { | ||
return item; | ||
} | ||
}) | ||
.map((f) => f(env))); | ||
return assign(...definitions); | ||
}); | ||
exports.prepare = prepare; | ||
/** | ||
* Lookup a rule definition by rule name. | ||
@@ -65,0 +64,0 @@ */ |
@@ -16,2 +16,3 @@ "use strict"; | ||
const node_stream_zip_1 = __importDefault(require("node-stream-zip")); | ||
const path_1 = require("path"); | ||
/** | ||
@@ -30,2 +31,7 @@ * Given a path to a Sketch file on the file system, this function unzips the | ||
const pages = document.pages.map((page) => JSON.parse(archive.entryDataSync(`${page._ref}.json`).toString())); | ||
const workspace = Object.keys(archive.entries()) | ||
.filter((key) => key.startsWith('workspace/')) | ||
.reduce((acc, key) => { | ||
return Object.assign(Object.assign({}, acc), { [path_1.basename(key, '.json')]: JSON.parse(archive.entryDataSync(key).toString()) }); | ||
}, {}); | ||
resolve({ | ||
@@ -35,2 +41,4 @@ document: Object.assign(Object.assign({}, document), { pages }), | ||
user: JSON.parse(archive.entryDataSync('user.json').toString()), | ||
// @ts-ignore TODO: Fix this, `assistants` prop should be optional in the file format | ||
workspace, | ||
}); | ||
@@ -37,0 +45,0 @@ }); |
@@ -10,4 +10,4 @@ export * from './assistant'; | ||
export * from './rule-utils'; | ||
export * from './run-assistant'; | ||
export * from './run'; | ||
export * from './test-helpers'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -15,3 +15,3 @@ "use strict"; | ||
__export(require("./rule-utils")); | ||
__export(require("./run-assistant")); | ||
__export(require("./run")); | ||
__export(require("./test-helpers")); |
@@ -182,2 +182,3 @@ "use strict"; | ||
"objectId": "9AD22B94-A05B-4F49-8EDD-A38D62BD6181", | ||
"objectName": "Page 1", | ||
"pointer": "/document/pages/0", | ||
@@ -184,0 +185,0 @@ "ruleName": "foo", |
@@ -105,2 +105,7 @@ "use strict"; | ||
: null, | ||
objectName: item.object | ||
? 'name' in item.object | ||
? item.object.name || null | ||
: null | ||
: null, | ||
}; | ||
@@ -107,0 +112,0 @@ })); |
@@ -19,3 +19,3 @@ "use strict"; | ||
expect(res.violations).toHaveLength(0); | ||
expect(res.errors).toHaveLength(0); | ||
expect(res.ruleErrors).toHaveLength(0); | ||
})); | ||
@@ -33,3 +33,3 @@ test('can return violations', () => __awaiter(void 0, void 0, void 0, function* () { | ||
expect(res.violations).toHaveLength(1); | ||
expect(res.errors).toHaveLength(0); | ||
expect(res.ruleErrors).toHaveLength(0); | ||
})); | ||
@@ -57,3 +57,3 @@ test('works when passed an array of extendable Assistants', () => __awaiter(void 0, void 0, void 0, function* () { | ||
expect(res.violations).toHaveLength(1); | ||
expect(res.errors).toHaveLength(0); | ||
expect(res.ruleErrors).toHaveLength(0); | ||
})); | ||
@@ -73,3 +73,3 @@ test('can return rule errors', () => __awaiter(void 0, void 0, void 0, function* () { | ||
expect(res.violations).toHaveLength(0); | ||
expect(res.errors).toHaveLength(1); | ||
expect(res.ruleErrors).toHaveLength(1); | ||
})); | ||
@@ -76,0 +76,0 @@ test('throws when an unavailable rule is configured', () => __awaiter(void 0, void 0, void 0, function* () { |
@@ -1,6 +0,6 @@ | ||
import { FileFormat, Assistant, RuleOptionsCreator, RuleFunction, RuleDefinition, AssistantDefinition, AssistantConfig, ViolationSeverity, RuleConfigGroup, AssistantEnv, AssistantResult, RuleConfig } from '@sketch-hq/sketch-assistant-types'; | ||
import { FileFormat, Assistant, RuleOptionsCreator, RuleFunction, RuleDefinition, AssistantDefinition, AssistantConfig, ViolationSeverity, RuleConfigGroup, AssistantEnv, AssistantSuccessResult, RuleConfig, AssistantRuntime } from '@sketch-hq/sketch-assistant-types'; | ||
/** | ||
* Create a dummy rule definition. | ||
*/ | ||
declare const createRule: ({ title, description, rule, getOptions, name, debug, platform, }?: { | ||
declare const createRule: ({ title, description, rule, getOptions, name, debug, runtime, }?: { | ||
title?: string | ((ruleConfig: RuleConfig) => string) | undefined; | ||
@@ -12,3 +12,3 @@ description?: string | ((ruleConfig: RuleConfig) => string) | undefined; | ||
debug?: boolean | undefined; | ||
platform?: "sketch" | "node" | undefined; | ||
runtime?: AssistantRuntime | undefined; | ||
}) => RuleDefinition; | ||
@@ -43,4 +43,4 @@ /** | ||
declare const createDummyRect: () => FileFormat.Rect; | ||
export declare const testRule: (filepath: string, assistant: import("@sketch-hq/sketch-assistant-types").MaybeESModule<import("@sketch-hq/sketch-assistant-types").ValueOrArray<import("@sketch-hq/sketch-assistant-types").MaybeESModule<Assistant>>>, ruleName: string, ruleConfig?: RuleConfig, env?: AssistantEnv) => Promise<AssistantResult>; | ||
export declare const testRule: (filepath: string, assistant: import("@sketch-hq/sketch-assistant-types").ValueOrArray<Assistant>, ruleName: string, ruleConfig?: RuleConfig, env?: AssistantEnv) => Promise<AssistantSuccessResult>; | ||
export { createRule, createDummyRect, createAssistantConfig, createAssistant, createAssistantDefinition, }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -12,6 +12,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const sketch_assistant_types_1 = require("@sketch-hq/sketch-assistant-types"); | ||
const from_file_1 = require("../from-file"); | ||
const process_1 = require("../process"); | ||
const assistant_1 = require("../assistant"); | ||
const run_assistant_1 = require("../run-assistant"); | ||
const run_assistant_1 = require("../run/run-assistant"); | ||
const get_image_metadata_1 = require("../get-image-metadata"); | ||
@@ -21,3 +22,3 @@ /** | ||
*/ | ||
const createRule = ({ title, description, rule, getOptions, name, debug, platform, } = {}) => ({ | ||
const createRule = ({ title, description, rule, getOptions, name, debug, runtime, } = {}) => ({ | ||
name: name !== null && name !== void 0 ? name : 'dummy-assistant/dummy-rule', | ||
@@ -29,3 +30,3 @@ title: title !== null && title !== void 0 ? title : 'Dummy Rule', | ||
debug, | ||
platform, | ||
runtime, | ||
}); | ||
@@ -61,3 +62,3 @@ exports.createRule = createRule; | ||
exports.createDummyRect = createDummyRect; | ||
exports.testRule = (filepath, assistant, ruleName, ruleConfig = { active: true }, env = { locale: 'en', platform: 'node' }) => __awaiter(void 0, void 0, void 0, function* () { | ||
exports.testRule = (filepath, assistant, ruleName, ruleConfig = { active: true }, env = { locale: 'en', runtime: sketch_assistant_types_1.AssistantRuntime.Node }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const file = yield from_file_1.fromFile(filepath); | ||
@@ -64,0 +65,0 @@ const op = { cancelled: false }; |
@@ -11,2 +11,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { createAssistantDefinition, createRule, createAssistant } from '../../test-helpers'; | ||
import { AssistantRuntime, } from '@sketch-hq/sketch-assistant-types'; | ||
import { prepare, assign } from '../'; | ||
@@ -83,3 +84,3 @@ describe('assign', () => { | ||
locale: 'en', | ||
platform: 'sketch', | ||
runtime: AssistantRuntime.Sketch, | ||
}; | ||
@@ -86,0 +87,0 @@ test('prepares a single assistant function', () => __awaiter(void 0, void 0, void 0, function* () { |
@@ -1,3 +0,14 @@ | ||
import { AssistantDefinition, Assistant, AssistantEnv, Maybe, RuleDefinition } from '@sketch-hq/sketch-assistant-types'; | ||
import { AssistantDefinition, AssistantEnv, Maybe, RuleDefinition } from '@sketch-hq/sketch-assistant-types'; | ||
/** | ||
* Prepare an assistant package. That is, un-roll its exported value into a flat list of assistant | ||
* functions, invoke and await them to obtain a flat list of concrete assistant definitions which is | ||
* then merged to form a final/single assistant definition. | ||
* | ||
* Assistant preparation is performed at runtime by an assistant runner. | ||
* | ||
* @param source The assistant package to prepare | ||
* @param context The env within which the assistant package is being prepared | ||
*/ | ||
declare const prepare: (pkg: unknown, env: AssistantEnv) => Promise<AssistantDefinition>; | ||
/** | ||
* Merge assistant definitions together to form a single assistant definition, with a syntax similar | ||
@@ -15,13 +26,2 @@ * to Object.assign(). Assistants are merged from the right-most argument to the left into | ||
/** | ||
* Prepare an assistant. That is, un-roll its exported value into a flat list of assistant functions, | ||
* invoke and await them to obtain a flat list of concrete assistant definitions which is then merged | ||
* to form a final/single assistant definition. | ||
* | ||
* Assistant preparation is performed at runtime by an assistant runner. | ||
* | ||
* @param source The assistant package to prepare | ||
* @param context The env within which the assistant package is being prepared | ||
*/ | ||
declare const prepare: (pkgExport: import("@sketch-hq/sketch-assistant-types").MaybeESModule<import("@sketch-hq/sketch-assistant-types").ValueOrArray<import("@sketch-hq/sketch-assistant-types").MaybeESModule<Assistant>>>, env: AssistantEnv) => Promise<AssistantDefinition>; | ||
/** | ||
* Lookup a rule definition by rule name. | ||
@@ -28,0 +28,0 @@ */ |
@@ -11,2 +11,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
/** | ||
* Assistant packages should be exported on the default export. However the shape of that export | ||
* differs depending on the esModuleInterop strategy. This function should consistently return | ||
* the inner AssistantPackage value either way. | ||
*/ | ||
const getDefaultExport = (target) => '__esModule' in target ? target.default : target; | ||
/** | ||
* Prepare an assistant package. That is, un-roll its exported value into a flat list of assistant | ||
* functions, invoke and await them to obtain a flat list of concrete assistant definitions which is | ||
* then merged to form a final/single assistant definition. | ||
* | ||
* Assistant preparation is performed at runtime by an assistant runner. | ||
* | ||
* @param source The assistant package to prepare | ||
* @param context The env within which the assistant package is being prepared | ||
*/ | ||
const prepare = (pkg, env) => __awaiter(void 0, void 0, void 0, function* () { | ||
pkg = getDefaultExport(pkg); | ||
const definitions = yield Promise.all((Array.isArray(pkg) ? pkg : [pkg]) | ||
.flat(Infinity) | ||
.map(getDefaultExport) | ||
.map((f) => f(env))); | ||
return assign(...definitions); | ||
}); | ||
/** | ||
* Merge assistant definitions together to form a single assistant definition, with a syntax similar | ||
@@ -34,27 +58,2 @@ * to Object.assign(). Assistants are merged from the right-most argument to the left into | ||
/** | ||
* Prepare an assistant. That is, un-roll its exported value into a flat list of assistant functions, | ||
* invoke and await them to obtain a flat list of concrete assistant definitions which is then merged | ||
* to form a final/single assistant definition. | ||
* | ||
* Assistant preparation is performed at runtime by an assistant runner. | ||
* | ||
* @param source The assistant package to prepare | ||
* @param context The env within which the assistant package is being prepared | ||
*/ | ||
const prepare = (pkgExport, env) => __awaiter(void 0, void 0, void 0, function* () { | ||
const assistant = '__esModule' in pkgExport ? pkgExport.default : pkgExport; | ||
const definitions = yield Promise.all((Array.isArray(assistant) ? assistant : [assistant]) | ||
.flat(Infinity) | ||
.map((item) => { | ||
if ('__esModule' in item) { | ||
return item.default; | ||
} | ||
else { | ||
return item; | ||
} | ||
}) | ||
.map((f) => f(env))); | ||
return assign(...definitions); | ||
}); | ||
/** | ||
* Lookup a rule definition by rule name. | ||
@@ -61,0 +60,0 @@ */ |
@@ -11,2 +11,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import StreamZip from 'node-stream-zip'; | ||
import { basename } from 'path'; | ||
/** | ||
@@ -25,2 +26,7 @@ * Given a path to a Sketch file on the file system, this function unzips the | ||
const pages = document.pages.map((page) => JSON.parse(archive.entryDataSync(`${page._ref}.json`).toString())); | ||
const workspace = Object.keys(archive.entries()) | ||
.filter((key) => key.startsWith('workspace/')) | ||
.reduce((acc, key) => { | ||
return Object.assign(Object.assign({}, acc), { [basename(key, '.json')]: JSON.parse(archive.entryDataSync(key).toString()) }); | ||
}, {}); | ||
resolve({ | ||
@@ -30,2 +36,4 @@ document: Object.assign(Object.assign({}, document), { pages }), | ||
user: JSON.parse(archive.entryDataSync('user.json').toString()), | ||
// @ts-ignore TODO: Fix this, `assistants` prop should be optional in the file format | ||
workspace, | ||
}); | ||
@@ -32,0 +40,0 @@ }); |
@@ -10,4 +10,4 @@ export * from './assistant'; | ||
export * from './rule-utils'; | ||
export * from './run-assistant'; | ||
export * from './run'; | ||
export * from './test-helpers'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -10,3 +10,3 @@ export * from './assistant'; | ||
export * from './rule-utils'; | ||
export * from './run-assistant'; | ||
export * from './run'; | ||
export * from './test-helpers'; |
@@ -180,2 +180,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
"objectId": "9AD22B94-A05B-4F49-8EDD-A38D62BD6181", | ||
"objectName": "Page 1", | ||
"pointer": "/document/pages/0", | ||
@@ -182,0 +183,0 @@ "ruleName": "foo", |
@@ -96,2 +96,7 @@ import mem from 'mem'; | ||
: null, | ||
objectName: item.object | ||
? 'name' in item.object | ||
? item.object.name || null | ||
: null | ||
: null, | ||
}; | ||
@@ -98,0 +103,0 @@ })); |
@@ -17,3 +17,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
expect(res.violations).toHaveLength(0); | ||
expect(res.errors).toHaveLength(0); | ||
expect(res.ruleErrors).toHaveLength(0); | ||
})); | ||
@@ -31,3 +31,3 @@ test('can return violations', () => __awaiter(void 0, void 0, void 0, function* () { | ||
expect(res.violations).toHaveLength(1); | ||
expect(res.errors).toHaveLength(0); | ||
expect(res.ruleErrors).toHaveLength(0); | ||
})); | ||
@@ -55,3 +55,3 @@ test('works when passed an array of extendable Assistants', () => __awaiter(void 0, void 0, void 0, function* () { | ||
expect(res.violations).toHaveLength(1); | ||
expect(res.errors).toHaveLength(0); | ||
expect(res.ruleErrors).toHaveLength(0); | ||
})); | ||
@@ -71,3 +71,3 @@ test('can return rule errors', () => __awaiter(void 0, void 0, void 0, function* () { | ||
expect(res.violations).toHaveLength(0); | ||
expect(res.errors).toHaveLength(1); | ||
expect(res.ruleErrors).toHaveLength(1); | ||
})); | ||
@@ -74,0 +74,0 @@ test('throws when an unavailable rule is configured', () => __awaiter(void 0, void 0, void 0, function* () { |
@@ -1,6 +0,6 @@ | ||
import { FileFormat, Assistant, RuleOptionsCreator, RuleFunction, RuleDefinition, AssistantDefinition, AssistantConfig, ViolationSeverity, RuleConfigGroup, AssistantEnv, AssistantResult, RuleConfig } from '@sketch-hq/sketch-assistant-types'; | ||
import { FileFormat, Assistant, RuleOptionsCreator, RuleFunction, RuleDefinition, AssistantDefinition, AssistantConfig, ViolationSeverity, RuleConfigGroup, AssistantEnv, AssistantSuccessResult, RuleConfig, AssistantRuntime } from '@sketch-hq/sketch-assistant-types'; | ||
/** | ||
* Create a dummy rule definition. | ||
*/ | ||
declare const createRule: ({ title, description, rule, getOptions, name, debug, platform, }?: { | ||
declare const createRule: ({ title, description, rule, getOptions, name, debug, runtime, }?: { | ||
title?: string | ((ruleConfig: RuleConfig) => string) | undefined; | ||
@@ -12,3 +12,3 @@ description?: string | ((ruleConfig: RuleConfig) => string) | undefined; | ||
debug?: boolean | undefined; | ||
platform?: "sketch" | "node" | undefined; | ||
runtime?: AssistantRuntime | undefined; | ||
}) => RuleDefinition; | ||
@@ -43,4 +43,4 @@ /** | ||
declare const createDummyRect: () => FileFormat.Rect; | ||
export declare const testRule: (filepath: string, assistant: import("@sketch-hq/sketch-assistant-types").MaybeESModule<import("@sketch-hq/sketch-assistant-types").ValueOrArray<import("@sketch-hq/sketch-assistant-types").MaybeESModule<Assistant>>>, ruleName: string, ruleConfig?: RuleConfig, env?: AssistantEnv) => Promise<AssistantResult>; | ||
export declare const testRule: (filepath: string, assistant: import("@sketch-hq/sketch-assistant-types").ValueOrArray<Assistant>, ruleName: string, ruleConfig?: RuleConfig, env?: AssistantEnv) => Promise<AssistantSuccessResult>; | ||
export { createRule, createDummyRect, createAssistantConfig, createAssistant, createAssistantDefinition, }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
import { AssistantRuntime, } from '@sketch-hq/sketch-assistant-types'; | ||
import { fromFile } from '../from-file'; | ||
import { process } from '../process'; | ||
import { prepare, getRuleDefinition } from '../assistant'; | ||
import { runAssistant } from '../run-assistant'; | ||
import { runAssistant } from '../run/run-assistant'; | ||
import { getImageMetadata } from '../get-image-metadata'; | ||
@@ -19,3 +20,3 @@ /** | ||
*/ | ||
const createRule = ({ title, description, rule, getOptions, name, debug, platform, } = {}) => ({ | ||
const createRule = ({ title, description, rule, getOptions, name, debug, runtime, } = {}) => ({ | ||
name: name !== null && name !== void 0 ? name : 'dummy-assistant/dummy-rule', | ||
@@ -27,3 +28,3 @@ title: title !== null && title !== void 0 ? title : 'Dummy Rule', | ||
debug, | ||
platform, | ||
runtime, | ||
}); | ||
@@ -54,3 +55,3 @@ /** | ||
}); | ||
export const testRule = (filepath, assistant, ruleName, ruleConfig = { active: true }, env = { locale: 'en', platform: 'node' }) => __awaiter(void 0, void 0, void 0, function* () { | ||
export const testRule = (filepath, assistant, ruleName, ruleConfig = { active: true }, env = { locale: 'en', runtime: AssistantRuntime.Node }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const file = yield fromFile(filepath); | ||
@@ -57,0 +58,0 @@ const op = { cancelled: false }; |
{ | ||
"name": "@sketch-hq/sketch-assistant-utils", | ||
"version": "5.0.0-next.14", | ||
"version": "5.0.0-next.15", | ||
"module": "dist/esm/index", | ||
@@ -24,3 +24,3 @@ "main": "dist/cjs/index", | ||
"@json-schema-spec/json-pointer": "0.1.2", | ||
"@sketch-hq/sketch-assistant-types": "5.0.0-next.11", | ||
"@sketch-hq/sketch-assistant-types": "5.0.0-next.15", | ||
"ajv": "6.12.2", | ||
@@ -27,0 +27,0 @@ "humps": "2.0.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
623197
155
5843
+ Added@sketch-hq/sketch-assistant-types@5.0.0-next.15(transitive)
- Removed@sketch-hq/sketch-assistant-types@5.0.0-next.11(transitive)