@sewing-kit/config
Advanced tools
Comparing version 0.0.4 to 0.0.5
export { Runtime } from '@sewing-kit/types'; | ||
export * from './package'; | ||
export * from './service'; | ||
export * from './web-app'; | ||
export * from './workspace'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -9,2 +9,4 @@ "use strict"; | ||
__export(require("./package")); | ||
__export(require("./service")); | ||
__export(require("./web-app")); | ||
__export(require("./workspace")); |
@@ -14,2 +14,3 @@ "use strict"; | ||
if (await fs_extra_1.pathExists(path_1.join(root, 'sewing-kit.config.ts'))) { | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
require('@babel/register')({ | ||
@@ -27,5 +28,6 @@ extensions: ['.mjs', '.js', '.ts', '.tsx'], | ||
async function loadConfigFile(file, { allowRootPlugins = false }) { | ||
// eslint-disable-next-line typescript/no-var-requires | ||
var _a; | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const exports = require(file); | ||
const normalized = (exports && exports.default) || exports; | ||
const normalized = (_a = exports) === null || _a === void 0 ? void 0 : _a.default; | ||
if (normalized == null) { | ||
@@ -32,0 +34,0 @@ throw new ui_1.DiagnosticError({ |
import { Runtime, Plugin, PackageCreateOptions, PackageEntryCreateOptions, PackageBinaryCreateOptions } from '@sewing-kit/types'; | ||
import { OptionBuilder } from './types'; | ||
declare class PackageCreator { | ||
private readonly builder; | ||
constructor(builder: Partial<PackageCreateOptions>); | ||
constructor(builder: OptionBuilder<PackageCreateOptions>); | ||
runtime(defaultRuntime: Runtime): void; | ||
@@ -10,4 +11,4 @@ entry(entry: PackageEntryCreateOptions): void; | ||
} | ||
export declare function createPackage(create: (pkg: PackageCreator) => void | Promise<void>): () => Promise<Partial<PackageCreateOptions>>; | ||
export declare function createPackage(create: (pkg: PackageCreator) => void | Promise<void>): () => Promise<OptionBuilder<PackageCreateOptions>>; | ||
export {}; | ||
//# sourceMappingURL=package.d.ts.map |
@@ -11,11 +11,16 @@ "use strict"; | ||
entry(entry) { | ||
this.builder.entries = this.builder.entries || []; | ||
this.builder.entries.push(Object.assign({ runtime: this.builder.runtime }, entry)); | ||
var _a; | ||
this.builder.entries = (_a = this.builder.entries, (_a !== null && _a !== void 0 ? _a : [])); | ||
this.builder.entries.push(Object.assign(Object.assign({ runtime: this.builder.runtime }, entry), { root: typeof entry.root === 'string' && entry.root.startsWith('/') | ||
? entry.root.slice(1) | ||
: entry.root })); | ||
} | ||
binary(binary) { | ||
this.builder.binaries = this.builder.binaries || []; | ||
var _a; | ||
this.builder.binaries = (_a = this.builder.binaries, (_a !== null && _a !== void 0 ? _a : [])); | ||
this.builder.binaries.push(binary); | ||
} | ||
plugin(...plugins) { | ||
this.builder.plugins = this.builder.plugins || []; | ||
var _a; | ||
this.builder.plugins = (_a = this.builder.plugins, (_a !== null && _a !== void 0 ? _a : [])); | ||
this.builder.plugins.push(...plugins); | ||
@@ -22,0 +27,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { Plugin, PluginTarget } from '@sewing-kit/types'; | ||
import { Plugin } from '@sewing-kit/types'; | ||
interface WorkspaceCreateOptions { | ||
@@ -8,5 +8,3 @@ plugins: Plugin[]; | ||
constructor(builder: Partial<WorkspaceCreateOptions>); | ||
plugin(...plugins: (Plugin & { | ||
target: PluginTarget.Root; | ||
})[]): void; | ||
plugin(...plugins: Plugin[]): void; | ||
} | ||
@@ -13,0 +11,0 @@ export declare function createWorkspace(create: (pkg: WorkspaceCreator) => void | Promise<void>): () => Promise<Partial<WorkspaceCreateOptions>>; |
@@ -10,2 +10,3 @@ "use strict"; | ||
plugin(...plugins) { | ||
var _a; | ||
const nonRootPlugins = plugins.filter((plugin) => plugin.target !== types_1.PluginTarget.Root); | ||
@@ -19,3 +20,3 @@ if (nonRootPlugins.length > 0) { | ||
} | ||
this.builder.plugins = this.builder.plugins || []; | ||
this.builder.plugins = (_a = this.builder.plugins, (_a !== null && _a !== void 0 ? _a : [])); | ||
this.builder.plugins.push(...plugins); | ||
@@ -22,0 +23,0 @@ } |
@@ -1,1 +0,1 @@ | ||
module.exports = require("./build/cjs/index"); | ||
module.exports = require("./src/index"); |
@@ -1,1 +0,1 @@ | ||
module.exports = require("./build/cjs/load"); | ||
module.exports = require("./src/load"); |
{ | ||
"name": "@sewing-kit/config", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"sideEffects": false, | ||
@@ -10,7 +10,8 @@ "publishConfig": { | ||
"dependencies": { | ||
"@sewing-kit/types": "^0.0.1", | ||
"@sewing-kit/ui": "^0.0.5", | ||
"@babel/register": "^7.7.4", | ||
"@sewing-kit/types": "^0.0.2", | ||
"@sewing-kit/ui": "^0.0.6", | ||
"fs-extra": "^8.1.0" | ||
}, | ||
"gitHead": "4ddaab39cb6342ab22a21d46997be82e626d48ac" | ||
"gitHead": "1fc44608f952bd67cfe6f98006e1e510ec2ce82b" | ||
} |
export {Runtime} from '@sewing-kit/types'; | ||
export * from './package'; | ||
export * from './service'; | ||
export * from './web-app'; | ||
export * from './workspace'; |
import {join} from 'path'; | ||
import {pathExists} from 'fs-extra'; | ||
@@ -17,2 +18,3 @@ import {Plugin, PluginTarget, PLUGIN} from '@sewing-kit/types'; | ||
if (await pathExists(join(root, 'sewing-kit.config.ts'))) { | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
require('@babel/register')({ | ||
@@ -32,5 +34,5 @@ extensions: ['.mjs', '.js', '.ts', '.tsx'], | ||
async function loadConfigFile(file: string, {allowRootPlugins = false}) { | ||
// eslint-disable-next-line typescript/no-var-requires | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const exports = require(file); | ||
const normalized = (exports && exports.default) || exports; | ||
const normalized = exports?.default; | ||
@@ -37,0 +39,0 @@ if (normalized == null) { |
@@ -9,4 +9,6 @@ import { | ||
import {OptionBuilder} from './types'; | ||
class PackageCreator { | ||
constructor(private readonly builder: Partial<PackageCreateOptions>) {} | ||
constructor(private readonly builder: OptionBuilder<PackageCreateOptions>) {} | ||
@@ -18,6 +20,10 @@ runtime(defaultRuntime: Runtime) { | ||
entry(entry: PackageEntryCreateOptions) { | ||
this.builder.entries = this.builder.entries || []; | ||
this.builder.entries = this.builder.entries ?? []; | ||
this.builder.entries.push({ | ||
runtime: this.builder.runtime, | ||
...entry, | ||
root: | ||
typeof entry.root === 'string' && entry.root.startsWith('/') | ||
? entry.root.slice(1) | ||
: entry.root, | ||
}); | ||
@@ -27,3 +33,3 @@ } | ||
binary(binary: PackageBinaryCreateOptions) { | ||
this.builder.binaries = this.builder.binaries || []; | ||
this.builder.binaries = this.builder.binaries ?? []; | ||
this.builder.binaries.push(binary); | ||
@@ -33,4 +39,4 @@ } | ||
plugin(...plugins: Plugin[]) { | ||
this.builder.plugins = this.builder.plugins || []; | ||
(this.builder.plugins as any).push(...plugins); | ||
this.builder.plugins = this.builder.plugins ?? []; | ||
this.builder.plugins.push(...plugins); | ||
} | ||
@@ -43,3 +49,3 @@ } | ||
return async () => { | ||
const options: Partial<PackageCreateOptions> = {}; | ||
const options: OptionBuilder<PackageCreateOptions> = {}; | ||
const creator = new PackageCreator(options); | ||
@@ -46,0 +52,0 @@ await create(creator); |
@@ -11,3 +11,3 @@ import {Plugin, PluginTarget} from '@sewing-kit/types'; | ||
plugin(...plugins: (Plugin & {target: PluginTarget.Root})[]) { | ||
plugin(...plugins: Plugin[]) { | ||
const nonRootPlugins = plugins.filter( | ||
@@ -27,3 +27,3 @@ (plugin) => plugin.target !== PluginTarget.Root, | ||
this.builder.plugins = this.builder.plugins || []; | ||
this.builder.plugins = this.builder.plugins ?? []; | ||
this.builder.plugins.push(...plugins); | ||
@@ -30,0 +30,0 @@ } |
@@ -6,8 +6,3 @@ { | ||
"baseUrl": "src", | ||
"rootDir": "src", | ||
"typeRoots": [ | ||
"./config/typescript/typings", | ||
"./node_modules/@types", | ||
"../../node_modules/@types" | ||
] | ||
"rootDir": "src" | ||
}, | ||
@@ -14,0 +9,0 @@ "include": ["src/**/*.ts"], |
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
35
3
257857
4
503
+ Added@babel/register@^7.7.4
+ Added@ampproject/remapping@2.3.0(transitive)
+ Added@babel/code-frame@7.26.2(transitive)
+ Added@babel/compat-data@7.26.8(transitive)
+ Added@babel/core@7.26.9(transitive)
+ Added@babel/generator@7.26.9(transitive)
+ Added@babel/helper-compilation-targets@7.26.5(transitive)
+ Added@babel/helper-module-imports@7.25.9(transitive)
+ Added@babel/helper-module-transforms@7.26.0(transitive)
+ Added@babel/helper-string-parser@7.25.9(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@babel/helper-validator-option@7.25.9(transitive)
+ Added@babel/helpers@7.26.9(transitive)
+ Added@babel/parser@7.26.9(transitive)
+ Added@babel/register@7.25.9(transitive)
+ Added@babel/template@7.26.9(transitive)
+ Added@babel/traverse@7.26.9(transitive)
+ Added@babel/types@7.26.9(transitive)
+ Added@jridgewell/gen-mapping@0.3.8(transitive)
+ Added@jridgewell/resolve-uri@3.1.2(transitive)
+ Added@jridgewell/set-array@1.2.1(transitive)
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@jridgewell/trace-mapping@0.3.25(transitive)
+ Added@sewing-kit/types@0.0.2(transitive)
+ Added@sewing-kit/ui@0.0.6(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedbrowserslist@4.24.4(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedcaniuse-lite@1.0.30001700(transitive)
+ Addedchalk@3.0.0(transitive)
+ Addedclone-deep@4.0.1(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedcommondir@1.0.1(transitive)
+ Addedconvert-source-map@2.0.0(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addedelectron-to-chromium@1.5.103(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedexeca@3.4.0(transitive)
+ Addedfind-cache-dir@2.1.0(transitive)
+ Addedfind-up@3.0.0(transitive)
+ Addedgensync@1.0.0-beta.2(transitive)
+ Addedglobals@11.12.0(transitive)
+ Addedhuman-signals@1.1.1(transitive)
+ Addedis-plain-object@2.0.4(transitive)
+ Addedisobject@3.0.1(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjsesc@3.1.0(transitive)
+ Addedjson5@2.2.3(transitive)
+ Addedkind-of@6.0.3(transitive)
+ Addedlocate-path@3.0.0(transitive)
+ Addedlru-cache@5.1.1(transitive)
+ Addedmake-dir@2.1.0(transitive)
+ Addedms@2.1.3(transitive)
+ Addednode-releases@2.0.19(transitive)
+ Addednpm-run-path@4.0.1(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@3.0.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedpath-exists@3.0.0(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpify@4.0.1(transitive)
+ Addedpirates@4.0.6(transitive)
+ Addedpkg-dir@3.0.0(transitive)
+ Addedsemver@5.7.26.3.1(transitive)
+ Addedshallow-clone@3.0.1(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedsource-map-support@0.5.21(transitive)
+ Addedtapable@1.1.3(transitive)
+ Addedupdate-browserslist-db@1.1.2(transitive)
+ Addedyallist@3.1.1(transitive)
- Removed@sewing-kit/types@0.0.1(transitive)
- Removed@sewing-kit/ui@0.0.5(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedexeca@2.1.0(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removednpm-run-path@3.1.0(transitive)
- Removedsupports-color@5.5.0(transitive)
Updated@sewing-kit/types@^0.0.2
Updated@sewing-kit/ui@^0.0.6