@magicspace/core
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -25,4 +25,7 @@ import type * as x from 'x-value'; | ||
} | ||
export type BoilerplateCallback<TOptions extends object> = (options: TOptions) => Promise<BoilerplateOptions>; | ||
export type BoilerplateBuilder<TOptions extends object> = (options: TOptions) => Promise<Boilerplate>; | ||
export interface BoilerplateBuilderContext { | ||
projectDir: string; | ||
} | ||
export type BoilerplateCallback<TOptions extends object> = (options: TOptions, context: BoilerplateBuilderContext) => Promise<BoilerplateOptions>; | ||
export type BoilerplateBuilder<TOptions extends object> = (options: TOptions, context: BoilerplateBuilderContext) => Promise<Boilerplate>; | ||
export declare function boilerplate<TOptions extends object>(builder: BoilerplateCallback<TOptions>): BoilerplateBuilder<TOptions>; |
@@ -31,3 +31,3 @@ import * as x from 'x-value'; | ||
export declare function resolveBoilerplateModule(specifier: string, dir: string): BoilerplateModule; | ||
export declare function resolveMagicspaceConfig(magicspaceDir: string): Promise<MagicspaceConfig>; | ||
export declare function resolveMagicspaceConfig(magicspaceDir: string, projectDir: string): Promise<MagicspaceConfig>; | ||
export declare function buildConfigSchema(Options: x.XTypeOfValue<object>): JSONSchema; |
@@ -49,3 +49,3 @@ "use strict"; | ||
exports.resolveBoilerplateModule = resolveBoilerplateModule; | ||
async function resolveMagicspaceConfig(magicspaceDir) { | ||
async function resolveMagicspaceConfig(magicspaceDir, projectDir) { | ||
const { path: configPath, module: configExport } = await resolveMagicspaceBoilerplateConfig(magicspaceDir); | ||
@@ -62,3 +62,3 @@ const configs = Array.isArray(configExport) ? configExport : [configExport]; | ||
} | ||
boilerplates.push(await boilerplateBuilder(options)); | ||
boilerplates.push(await boilerplateBuilder(options, { projectDir })); | ||
} | ||
@@ -65,0 +65,0 @@ const aggregatedBoilerplateComposables = []; |
@@ -10,3 +10,3 @@ import type { File, FileGenerics } from './file'; | ||
file: File<TFile['TContent'], TFile['TComposeOptions']>; | ||
possibleOutputPath: string; | ||
outputPath: string; | ||
composableModulePath: string; | ||
@@ -13,0 +13,0 @@ } |
@@ -26,3 +26,3 @@ /// <reference types="node" /> | ||
export interface FileContext { | ||
possibleOutputPath: string; | ||
outputPath: string; | ||
} |
@@ -39,3 +39,3 @@ "use strict"; | ||
file = space.createFileObject(path, { | ||
possibleOutputPath: Path.join(space.dir, Path.relative(this.dir, path)), | ||
outputPath: Path.join(space.dir, Path.relative(this.dir, path)), | ||
}, composable.type); | ||
@@ -42,0 +42,0 @@ fileMap.set(path, file); |
{ | ||
"name": "@magicspace/core", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"publishConfig": { | ||
@@ -36,3 +36,3 @@ "access": "public" | ||
}, | ||
"gitHead": "3914d872302611105b943f9ccad91cc87b009f2a" | ||
"gitHead": "587109091e67968bef40c9f3435b1c2f225b91ae" | ||
} |
@@ -34,4 +34,9 @@ import getCallerFile from 'get-caller-file'; | ||
export interface BoilerplateBuilderContext { | ||
projectDir: string; | ||
} | ||
export type BoilerplateCallback<TOptions extends object> = ( | ||
options: TOptions, | ||
context: BoilerplateBuilderContext, | ||
) => Promise<BoilerplateOptions>; | ||
@@ -41,2 +46,3 @@ | ||
options: TOptions, | ||
context: BoilerplateBuilderContext, | ||
) => Promise<Boilerplate>; | ||
@@ -43,0 +49,0 @@ |
@@ -101,2 +101,3 @@ import * as Path from 'path'; | ||
magicspaceDir: string, | ||
projectDir: string, | ||
): Promise<MagicspaceConfig> { | ||
@@ -126,3 +127,3 @@ const {path: configPath, module: configExport} = | ||
boilerplates.push(await boilerplateBuilder(options)); | ||
boilerplates.push(await boilerplateBuilder(options, {projectDir})); | ||
} | ||
@@ -129,0 +130,0 @@ |
@@ -12,3 +12,3 @@ import type {File, FileGenerics} from './file'; | ||
file: File<TFile['TContent'], TFile['TComposeOptions']>; | ||
possibleOutputPath: string; | ||
outputPath: string; | ||
composableModulePath: string; | ||
@@ -15,0 +15,0 @@ } |
@@ -70,3 +70,3 @@ import * as FSExtra from 'fs-extra'; | ||
export interface FileContext { | ||
possibleOutputPath: string; | ||
outputPath: string; | ||
} |
@@ -33,6 +33,3 @@ import * as Path from 'path'; | ||
{ | ||
possibleOutputPath: Path.join( | ||
space.dir, | ||
Path.relative(this.dir, path), | ||
), | ||
outputPath: Path.join(space.dir, Path.relative(this.dir, path)), | ||
}, | ||
@@ -39,0 +36,0 @@ composable.type, |
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
132302
2881