@silgi/module-builder 0.4.5 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/chunks/build.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { existsSync, promises } from 'node:fs';
|
2
|
-
import {
|
2
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
3
3
|
import { join } from 'node:path';
|
4
4
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
5
5
|
import { defineCommand } from 'citty';
|
@@ -15,7 +15,7 @@ import { pkgDir } from 'silgi/runtime/meta';
|
|
15
15
|
import { parse } from 'tsconfck';
|
16
16
|
import { convertCompilerOptionsFromJson } from 'typescript';
|
17
17
|
import { scanExports } from 'unimport';
|
18
|
-
import { v as version, n as name } from '../shared/silgi-module-builder.
|
18
|
+
import { v as version, n as name } from '../shared/silgi-module-builder.DBFpoaAC.mjs';
|
19
19
|
|
20
20
|
const srcDir = fileURLToPath(new URL("src", import.meta.url));
|
21
21
|
const subpaths = [
|
@@ -57,6 +57,47 @@ const build = defineCommand({
|
|
57
57
|
const jiti = createJiti(cwd);
|
58
58
|
const outDir = context.args.outDir || "dist";
|
59
59
|
const rootPkg = await readPackageJSON(join(pkgDir, "package.json"));
|
60
|
+
const isDataFolder = existsSync(join(cwd, "src", "data"));
|
61
|
+
const isRuntimeFolder = existsSync(join(cwd, "src", "runtime"));
|
62
|
+
const isTypesFolder = existsSync(join(cwd, "src", "types"));
|
63
|
+
const isCoreFolder = existsSync(join(cwd, "src", "core"));
|
64
|
+
const entries = [];
|
65
|
+
if (isCoreFolder) {
|
66
|
+
entries.push({
|
67
|
+
input: "src/core",
|
68
|
+
outDir: `${outDir}/core`,
|
69
|
+
builder: "rollup"
|
70
|
+
});
|
71
|
+
}
|
72
|
+
if (isDataFolder) {
|
73
|
+
entries.push({
|
74
|
+
input: "src/data/",
|
75
|
+
outDir: `${outDir}/data`,
|
76
|
+
builder: "rollup"
|
77
|
+
});
|
78
|
+
}
|
79
|
+
if (isRuntimeFolder) {
|
80
|
+
entries.push({
|
81
|
+
input: "src/runtime/",
|
82
|
+
outDir: `${outDir}/runtime`,
|
83
|
+
addRelativeDeclarationExtensions: true,
|
84
|
+
ext: "js",
|
85
|
+
pattern: [
|
86
|
+
"**",
|
87
|
+
"!**/*.stories.{js,cts,mts,ts,jsx,tsx}",
|
88
|
+
// ignore storybook files
|
89
|
+
"!**/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}"
|
90
|
+
// ignore tests
|
91
|
+
]
|
92
|
+
});
|
93
|
+
}
|
94
|
+
if (isTypesFolder) {
|
95
|
+
entries.push({
|
96
|
+
input: "src/types/index.ts",
|
97
|
+
outDir: `${outDir}/types`,
|
98
|
+
builder: "rollup"
|
99
|
+
});
|
100
|
+
}
|
60
101
|
await build(cwd, false, {
|
61
102
|
declaration: "node16",
|
62
103
|
sourcemap: context.args.sourcemap,
|
@@ -64,48 +105,10 @@ const build = defineCommand({
|
|
64
105
|
outDir,
|
65
106
|
// eslint-disable-next-line ts/ban-ts-comment
|
66
107
|
// @ts-ignore
|
67
|
-
ignoreConditions: ["silgi", "silgiTypes", "pckSilgi", "pckSilgiTypes", ...packageData
|
108
|
+
ignoreConditions: ["silgi", "silgiTypes", "pckSilgi", "pckSilgiTypes", ...packageData?.config?.ignoreConditions || []],
|
68
109
|
entries: [
|
69
110
|
"src/module",
|
70
|
-
|
71
|
-
input: "src/data/",
|
72
|
-
outDir: `${outDir}/data`,
|
73
|
-
addRelativeDeclarationExtensions: true,
|
74
|
-
ext: "js",
|
75
|
-
pattern: [
|
76
|
-
"**",
|
77
|
-
"!**/*.stories.{js,cts,mts,ts,jsx,tsx}",
|
78
|
-
// ignore storybook files
|
79
|
-
"!**/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}"
|
80
|
-
// ignore tests
|
81
|
-
]
|
82
|
-
},
|
83
|
-
{
|
84
|
-
input: "src/runtime/",
|
85
|
-
outDir: `${outDir}/runtime`,
|
86
|
-
addRelativeDeclarationExtensions: true,
|
87
|
-
ext: "js",
|
88
|
-
pattern: [
|
89
|
-
"**",
|
90
|
-
"!**/*.stories.{js,cts,mts,ts,jsx,tsx}",
|
91
|
-
// ignore storybook files
|
92
|
-
"!**/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}"
|
93
|
-
// ignore tests
|
94
|
-
]
|
95
|
-
},
|
96
|
-
{
|
97
|
-
input: "src/types/index.ts",
|
98
|
-
outDir: `${outDir}/types`,
|
99
|
-
addRelativeDeclarationExtensions: true,
|
100
|
-
ext: "js",
|
101
|
-
pattern: [
|
102
|
-
"**",
|
103
|
-
"!**/*.stories.{js,cts,mts,ts,jsx,tsx}",
|
104
|
-
// ignore storybook files
|
105
|
-
"!**/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}"
|
106
|
-
// ignore tests
|
107
|
-
]
|
108
|
-
}
|
111
|
+
...entries
|
109
112
|
],
|
110
113
|
rollup: {
|
111
114
|
esbuild: {
|
@@ -127,8 +130,9 @@ const build = defineCommand({
|
|
127
130
|
...Object.keys(rootPkg.peerDependencies || {})
|
128
131
|
],
|
129
132
|
hooks: {
|
130
|
-
"mkdist:entry:options": async function(_ctx, entry,
|
131
|
-
|
133
|
+
"mkdist:entry:options": async function(_ctx, entry, mkdistOptions) {
|
134
|
+
mkdistOptions.addRelativeDeclarationExtensions = true;
|
135
|
+
mkdistOptions.typescript = defu(mkdistOptions.typescript, {
|
132
136
|
compilerOptions: await loadTSCompilerOptions(entry.input)
|
133
137
|
});
|
134
138
|
},
|
@@ -216,14 +220,6 @@ const build = defineCommand({
|
|
216
220
|
await promises.writeFile(metaFile, JSON.stringify(moduleMeta, null, 2), "utf8");
|
217
221
|
await writeTypes(ctx.options, ctx.options.stub);
|
218
222
|
},
|
219
|
-
"build:prepare": async function(_ctx) {
|
220
|
-
for (const subpath of subpaths) {
|
221
|
-
await writeFile(
|
222
|
-
`./${subpath}.d.mts`,
|
223
|
-
`export * from './dist/${subpath}/index';`
|
224
|
-
);
|
225
|
-
}
|
226
|
-
},
|
227
223
|
"build:done": async function(ctx) {
|
228
224
|
const logs = [...ctx.warnings].filter((l) => l.startsWith("Potential missing package.json files:"));
|
229
225
|
if (logs.filter((l) => l.match(/\.d\.ts/)).length > 0) {
|
package/dist/cli.mjs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
2
|
import { defineCommand, runMain } from 'citty';
|
3
3
|
import { consola } from 'consola';
|
4
|
-
import { v as version, d as description, n as name } from './shared/silgi-module-builder.
|
4
|
+
import { v as version, d as description, n as name } from './shared/silgi-module-builder.DBFpoaAC.mjs';
|
5
5
|
|
6
6
|
const _rDefault = (r) => r && typeof r === "object" && "default" in r ? r.default : r;
|
7
7
|
const main = defineCommand({
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@silgi/module-builder",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.4.
|
4
|
+
"version": "0.4.7",
|
5
5
|
"private": false,
|
6
6
|
"description": "Complete solution for building Silgi modules",
|
7
7
|
"exports": {
|
@@ -37,6 +37,9 @@
|
|
37
37
|
"publishConfig": {
|
38
38
|
"access": "public"
|
39
39
|
},
|
40
|
+
"resolutions": {
|
41
|
+
"@silgi/module-builder": "link:."
|
42
|
+
},
|
40
43
|
"scripts": {
|
41
44
|
"build": "unbuild",
|
42
45
|
"dev:prepare": "unbuild --stub && pnpm -r dev:prepare",
|