@reliverse/dler 1.7.38 → 1.7.40
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/README.md +32 -2
- package/bin/app/build/postbuild.js +7 -8
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-define.d.ts +9 -9
- package/bin/libs/sdk/sdk-impl/config/info.js +1 -1
- package/bin/libs/sdk/sdk-impl/magic/ms-apply.d.ts +22 -0
- package/bin/libs/sdk/sdk-impl/utils/resolve-cross-libs.d.ts +2 -2
- package/bin/libs/sdk/sdk-impl/utils/resolve-cross-libs.js +25 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -631,7 +631,35 @@ bun dler rename ...
|
|
|
631
631
|
|
|
632
632
|
### 14. `magic`
|
|
633
633
|
|
|
634
|
-
|
|
634
|
+
**programmatic usage:**
|
|
635
|
+
|
|
636
|
+
```ts
|
|
637
|
+
function main() {
|
|
638
|
+
// may be useful when your cli is a project bootstrapper tool like @reliverse/rse
|
|
639
|
+
// so you can apply spells to each bootstrapped by you cli project's file
|
|
640
|
+
await applyMagicSpells(["my-target-dir"]);
|
|
641
|
+
}
|
|
642
|
+
await main();
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
**or, call it from dler config's hook**:
|
|
646
|
+
|
|
647
|
+
```ts
|
|
648
|
+
{
|
|
649
|
+
hooksAfterBuild: [
|
|
650
|
+
async () => {
|
|
651
|
+
// useful when you want to apply spells right after dler's build
|
|
652
|
+
await applyMagicSpells(["dist-jsr", "dist-npm", "dist-libs"]);
|
|
653
|
+
}
|
|
654
|
+
],
|
|
655
|
+
}
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
**or, use `dler magic`**:
|
|
659
|
+
|
|
660
|
+
```bash
|
|
661
|
+
dler magic --targets "my-target-dir"
|
|
662
|
+
```
|
|
635
663
|
|
|
636
664
|
**available spell types:**
|
|
637
665
|
|
|
@@ -700,6 +728,8 @@ files: [] // means all files
|
|
|
700
728
|
|
|
701
729
|
p.s. [see how rse cli uses hooked=true](https://github.com/reliverse/rse/blob/main/src/postbuild.ts)
|
|
702
730
|
|
|
731
|
+
> Contributors: Please check the [docs/cmds/SPELLS.md](./docs/cmds/SPELLS.md) file for more technical details.
|
|
732
|
+
|
|
703
733
|
### 15. `split`
|
|
704
734
|
|
|
705
735
|
splits your code/text file into multiple files.
|
|
@@ -856,7 +886,7 @@ special thanks to the project that inspired `@reliverse/dler`:
|
|
|
856
886
|
- [ ] support auto migration from `build.config.ts`
|
|
857
887
|
- [ ] support configuration via `.config/rse.{ts,jsonc}` 🤔
|
|
858
888
|
- [ ] make config file fully optional with sensible defaults
|
|
859
|
-
- [ ] use `dler remdn` ([@reliverse/remdn](https://github.com/reliverse/remdn)) to generate npm/jsr docs and
|
|
889
|
+
- [ ] use `dler remdn` ([@reliverse/remdn](https://github.com/reliverse/remdn)) to generate npm/jsr specific readme and a single `docs` dir for a whole project (only readmes will be published, docs are only stored in project's source cpde and can be deployed to user's website)
|
|
860
890
|
- [x] allow plugins to extend dler's `defineconfig` (`hooksBeforeBuild` and `hooksAfterBuild` are now available, plugin's options can be passed directly to plugin's params, e.g. `hooksBeforeBuild: [ async () => { await myCoolPlugin({ /* plugin's options */ }); } ],`)
|
|
861
891
|
- [ ] at the moment any bundler like `mkdist` can be called using `bun`, but bun's own bundler is not yet fully supported
|
|
862
892
|
- [ ] support all well-known package managers (currently only bun is fully supported)
|
|
@@ -48,13 +48,7 @@ async function copyNonBuildFiles(srcDir, distDir, preExtensions, templatesDir) {
|
|
|
48
48
|
onlyDirectories: true,
|
|
49
49
|
absolute: true
|
|
50
50
|
});
|
|
51
|
-
const
|
|
52
|
-
const relativePath = path.relative(srcDir, dir);
|
|
53
|
-
const parts = relativePath.split(path.sep);
|
|
54
|
-
const templatesIndex = parts.indexOf(templatesDir);
|
|
55
|
-
return templatesIndex === parts.length - 1;
|
|
56
|
-
});
|
|
57
|
-
for (const templateDir of topLevelTemplatesDirs) {
|
|
51
|
+
for (const templateDir of templatesDirs) {
|
|
58
52
|
const relativePath = path.relative(srcDir, templateDir);
|
|
59
53
|
const templatesDestPath = path.join(distDir, "bin", relativePath);
|
|
60
54
|
await fs.ensureDir(path.dirname(templatesDestPath));
|
|
@@ -125,7 +119,12 @@ async function compareFileStructures(srcDir, distDir) {
|
|
|
125
119
|
export async function dlerPostBuild(isDev, debugDontCopyNonBuildFiles) {
|
|
126
120
|
relinka("info", "\u2014 \u2014 \u2014 dlerPostBuild \u2014 \u2014 \u2014");
|
|
127
121
|
const config = await getConfigDler();
|
|
128
|
-
await resolveAllCrossLibs(
|
|
122
|
+
await resolveAllCrossLibs(
|
|
123
|
+
ALIAS_TO_REPLACE,
|
|
124
|
+
["npm", "jsr"],
|
|
125
|
+
config.buildPreExtensions,
|
|
126
|
+
config.buildTemplatesDir
|
|
127
|
+
);
|
|
129
128
|
if (!debugDontCopyNonBuildFiles) {
|
|
130
129
|
await wrapper_CopyNonBuildFiles(config);
|
|
131
130
|
}
|
|
@@ -10,11 +10,11 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
10
10
|
projectDomain?: string | undefined;
|
|
11
11
|
projectGitService?: "none" | "github" | "gitlab" | "bitbucket" | undefined;
|
|
12
12
|
projectDeployService?: "none" | "vercel" | "netlify" | "railway" | "deno" | undefined;
|
|
13
|
-
projectPackageManager?: "
|
|
13
|
+
projectPackageManager?: "npm" | "bun" | "yarn" | "pnpm" | undefined;
|
|
14
14
|
projectState?: "created" | "creating" | undefined;
|
|
15
|
-
projectCategory?: "
|
|
15
|
+
projectCategory?: "cli" | "unknown" | "website" | "vscode" | "browser" | "library" | "mobile" | undefined;
|
|
16
16
|
projectSubcategory?: "unknown" | "e-commerce" | "tool" | undefined;
|
|
17
|
-
projectFramework?: "npm-jsr" | "unknown" | "vscode" | "nextjs" | "vite" | "svelte" | "remix" | "astro" | "nuxt" | "solid" | "qwik" | "
|
|
17
|
+
projectFramework?: "rempts" | "npm-jsr" | "vue" | "unknown" | "vscode" | "nextjs" | "vite" | "svelte" | "remix" | "astro" | "nuxt" | "solid" | "qwik" | "wxt" | "lynx" | "react-native" | "expo" | "capacitor" | "ionic" | "electron" | "tauri" | "neutralino" | "citty" | "commander" | "cac" | "meow" | "yargs" | "webextension" | "browser-extension" | undefined;
|
|
18
18
|
projectTemplate?: "unknown" | "blefnk/relivator-nextjs-template" | "blefnk/relivator-docker-template" | "blefnk/next-react-ts-src-minimal" | "blefnk/all-in-one-nextjs-template" | "blefnk/create-t3-app" | "blefnk/create-next-app" | "blefnk/astro-starlight-template" | "blefnk/versator-nextjs-template" | "blefnk/relivator-lynxjs-template" | "blefnk/relivator-react-native-template" | "reliverse/template-browser-extension" | "microsoft/vscode-extension-samples" | "microsoft/vscode-extension-template" | "rsetarter-template" | "blefnk/deno-cli-tutorial" | undefined;
|
|
19
19
|
projectTemplateDate?: string | undefined;
|
|
20
20
|
features?: {
|
|
@@ -34,6 +34,7 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
34
34
|
} | undefined;
|
|
35
35
|
preferredLibraries?: {
|
|
36
36
|
search?: "unknown" | "algolia" | undefined;
|
|
37
|
+
cdn?: "unknown" | "cloudflare" | undefined;
|
|
37
38
|
i18n?: "unknown" | "next-intl" | undefined;
|
|
38
39
|
analytics?: "unknown" | "vercel" | undefined;
|
|
39
40
|
authentication?: "unknown" | "better-auth" | "clerk" | "next-auth" | "supabase-auth" | "auth0" | undefined;
|
|
@@ -41,10 +42,10 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
41
42
|
testing?: "bun" | "unknown" | "vitest" | "jest" | "playwright" | "cypress" | undefined;
|
|
42
43
|
stateManagement?: "unknown" | "zustand" | "jotai" | "redux-toolkit" | undefined;
|
|
43
44
|
formManagement?: "unknown" | "react-hook-form" | "formik" | undefined;
|
|
44
|
-
styling?: "unknown" | "tailwind" | "styled-components" | "css-modules" |
|
|
45
|
+
styling?: "sass" | "unknown" | "tailwind" | "styled-components" | "css-modules" | undefined;
|
|
45
46
|
uiComponents?: "unknown" | "shadcn-ui" | "chakra-ui" | "material-ui" | undefined;
|
|
46
47
|
databaseLibrary?: "unknown" | "drizzle" | "prisma" | "supabase" | undefined;
|
|
47
|
-
databaseProvider?: "
|
|
48
|
+
databaseProvider?: "sqlite" | "unknown" | "pg" | "mysql" | "mongodb" | undefined;
|
|
48
49
|
linting?: "eslint" | "unknown" | undefined;
|
|
49
50
|
formatting?: "biome" | "unknown" | undefined;
|
|
50
51
|
payment?: "unknown" | "stripe" | undefined;
|
|
@@ -59,7 +60,6 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
59
60
|
mail?: "unknown" | "resend" | undefined;
|
|
60
61
|
cache?: "unknown" | "redis" | undefined;
|
|
61
62
|
storage?: "unknown" | "cloudflare" | undefined;
|
|
62
|
-
cdn?: "unknown" | "cloudflare" | undefined;
|
|
63
63
|
cms?: "unknown" | "contentlayer" | undefined;
|
|
64
64
|
seo?: "unknown" | "next-seo" | undefined;
|
|
65
65
|
motion?: "unknown" | "framer" | undefined;
|
|
@@ -75,7 +75,7 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
75
75
|
indentStyle?: "space" | "tab" | undefined;
|
|
76
76
|
quoteMark?: "single" | "double" | undefined;
|
|
77
77
|
semicolons?: boolean | undefined;
|
|
78
|
-
trailingComma?: "
|
|
78
|
+
trailingComma?: "none" | "all" | "es5" | undefined;
|
|
79
79
|
bracketSpacing?: boolean | undefined;
|
|
80
80
|
arrowParens?: "always" | "avoid" | undefined;
|
|
81
81
|
tabWidth?: number | undefined;
|
|
@@ -96,7 +96,7 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
96
96
|
importSymbol?: string | undefined;
|
|
97
97
|
} | undefined;
|
|
98
98
|
monorepo?: {
|
|
99
|
-
type?: "
|
|
99
|
+
type?: "none" | "bun" | "pnpm" | "turborepo" | "nx" | undefined;
|
|
100
100
|
packages?: string[] | undefined;
|
|
101
101
|
sharedPackages?: string[] | undefined;
|
|
102
102
|
} | undefined;
|
|
@@ -113,7 +113,7 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
113
113
|
repoBranch?: string | undefined;
|
|
114
114
|
repoPrivacy?: "unknown" | "public" | "private" | undefined;
|
|
115
115
|
projectArchitecture?: "unknown" | "fullstack" | "separated" | undefined;
|
|
116
|
-
projectRuntime?: "
|
|
116
|
+
projectRuntime?: "node" | "bun" | "deno" | undefined;
|
|
117
117
|
skipPromptsUseAutoBehavior?: boolean | undefined;
|
|
118
118
|
deployBehavior?: "prompt" | "autoYes" | "autoNo" | undefined;
|
|
119
119
|
depsBehavior?: "prompt" | "autoYes" | "autoNo" | undefined;
|
|
@@ -30,6 +30,28 @@ export interface ApplyMagicSpellsResult {
|
|
|
30
30
|
* Processes files in specified output directories by applying magic directives
|
|
31
31
|
* For dist targets, first scans src directory for files with magic directives, then processes corresponding output files
|
|
32
32
|
* For custom targets, processes magic directives directly in the target files
|
|
33
|
+
*
|
|
34
|
+
* !! Users should call this function manually in their codebase (dler doesn't call it automatically) !!
|
|
35
|
+
* To call it:
|
|
36
|
+
* ```ts
|
|
37
|
+
* // may be useful when your cli is a project bootstrapper tool like @reliverse/rse
|
|
38
|
+
* // so you can apply spells to each bootstrapped by you cli project's file
|
|
39
|
+
* await applyMagicSpells(["my-target-dir"]);
|
|
40
|
+
* ```
|
|
41
|
+
* Or, in dler config's hook:
|
|
42
|
+
* ```ts
|
|
43
|
+
* hooksAfterBuild: [
|
|
44
|
+
* async () => {
|
|
45
|
+
* // useful when you want to apply spells right after dler's build
|
|
46
|
+
* await applyMagicSpells(["dist-jsr", "dist-npm", "dist-libs"]);
|
|
47
|
+
* }
|
|
48
|
+
* ]
|
|
49
|
+
* ```
|
|
50
|
+
* Or, use `dler magic` command:
|
|
51
|
+
* ```bash
|
|
52
|
+
* dler magic --targets "my-target-dir"
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
33
55
|
* @param targets Array of output targets in format "dist-npm", "dist-jsr", "dist-libs" or "dist-libs/lib-name" or any custom path
|
|
34
56
|
* @param options Configuration options for processing
|
|
35
57
|
* @returns Object containing arrays of processed files and processed .d.ts files
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare function resolveCrossLibs(libBinDir: string, alias
|
|
2
|
-
declare function resolveAllCrossLibs(alias
|
|
1
|
+
declare function resolveCrossLibs(libBinDir: string, alias: string | undefined, subFolders: ("npm" | "jsr")[] | undefined, buildPreExtensions: string[], buildTemplatesDir: string): Promise<string[]>;
|
|
2
|
+
declare function resolveAllCrossLibs(alias: string | undefined, subFolders: ("npm" | "jsr")[] | undefined, buildPreExtensions: string[], buildTemplatesDir: string): Promise<string[]>;
|
|
3
3
|
export { resolveCrossLibs, resolveAllCrossLibs };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { relinka } from "@reliverse/relinka";
|
|
2
2
|
import { promises as fs } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
|
|
5
|
-
async function resolveCrossLibs(libBinDir, alias = "~", subFolders = ["npm", "jsr"]) {
|
|
4
|
+
async function resolveCrossLibs(libBinDir, alias = "~", subFolders = ["npm", "jsr"], buildPreExtensions, buildTemplatesDir) {
|
|
6
5
|
const normalizedPath = libBinDir.replace(/\\/g, "/");
|
|
7
6
|
if (!normalizedPath.startsWith("dist-libs") && !normalizedPath.startsWith("dist-jsr") && !normalizedPath.startsWith("dist-npm")) {
|
|
8
7
|
throw new Error(
|
|
@@ -17,7 +16,7 @@ async function resolveCrossLibs(libBinDir, alias = "~", subFolders = ["npm", "js
|
|
|
17
16
|
);
|
|
18
17
|
}
|
|
19
18
|
const currentLib = pathParts[1];
|
|
20
|
-
const files = await findSourceFiles(libBinDir);
|
|
19
|
+
const files = await findSourceFiles(libBinDir, buildPreExtensions, buildTemplatesDir);
|
|
21
20
|
const modifiedFiles = [];
|
|
22
21
|
await Promise.all(
|
|
23
22
|
files.map(async (filePath) => {
|
|
@@ -34,19 +33,30 @@ async function resolveCrossLibs(libBinDir, alias = "~", subFolders = ["npm", "js
|
|
|
34
33
|
}
|
|
35
34
|
return [];
|
|
36
35
|
}
|
|
37
|
-
async function findSourceFiles(dir) {
|
|
36
|
+
async function findSourceFiles(dir, buildPreExtensions, buildTemplatesDir) {
|
|
38
37
|
const files = [];
|
|
39
38
|
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
40
39
|
await Promise.all(
|
|
41
40
|
entries.map(async (entry) => {
|
|
42
41
|
const fullPath = path.join(dir, entry.name);
|
|
43
42
|
if (entry.isDirectory()) {
|
|
44
|
-
const subFiles = await findSourceFiles(fullPath);
|
|
43
|
+
const subFiles = await findSourceFiles(fullPath, buildPreExtensions, buildTemplatesDir);
|
|
45
44
|
files.push(...subFiles);
|
|
46
45
|
} else if (entry.isFile()) {
|
|
47
|
-
const ext = path.extname(entry.name);
|
|
46
|
+
const ext = path.extname(entry.name).slice(1);
|
|
48
47
|
const isDts = entry.name.endsWith(".d.ts");
|
|
49
|
-
|
|
48
|
+
const isInTemplatesDir = fullPath.includes(`/${buildTemplatesDir}/`);
|
|
49
|
+
if (isInTemplatesDir) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (isDts) {
|
|
53
|
+
files.push(fullPath);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (!buildPreExtensions.includes(ext)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (ext === "js" || ext === "ts") {
|
|
50
60
|
files.push(fullPath);
|
|
51
61
|
}
|
|
52
62
|
}
|
|
@@ -157,7 +167,7 @@ async function directoryExists(dirPath) {
|
|
|
157
167
|
throw error;
|
|
158
168
|
}
|
|
159
169
|
}
|
|
160
|
-
async function resolveAllCrossLibs(alias = "~", subFolders = ["npm", "jsr"]) {
|
|
170
|
+
async function resolveAllCrossLibs(alias = "~", subFolders = ["npm", "jsr"], buildPreExtensions, buildTemplatesDir) {
|
|
161
171
|
const distLibsDir = "dist-libs";
|
|
162
172
|
const allModifiedFiles = [];
|
|
163
173
|
const distLibsExists = await directoryExists(distLibsDir);
|
|
@@ -171,7 +181,13 @@ async function resolveAllCrossLibs(alias = "~", subFolders = ["npm", "jsr"]) {
|
|
|
171
181
|
const binDirExists = await directoryExists(binDir);
|
|
172
182
|
if (binDirExists) {
|
|
173
183
|
try {
|
|
174
|
-
const modifiedFiles = await resolveCrossLibs(
|
|
184
|
+
const modifiedFiles = await resolveCrossLibs(
|
|
185
|
+
binDir,
|
|
186
|
+
alias,
|
|
187
|
+
subFolders,
|
|
188
|
+
buildPreExtensions,
|
|
189
|
+
buildTemplatesDir
|
|
190
|
+
);
|
|
175
191
|
allModifiedFiles.push(...modifiedFiles);
|
|
176
192
|
} catch (error) {
|
|
177
193
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
package/package.json
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"p-all": "^5.0.0",
|
|
37
37
|
"p-map": "^7.0.3",
|
|
38
38
|
"pkg-types": "^2.1.0",
|
|
39
|
-
"postcss": "^8.5.
|
|
39
|
+
"postcss": "^8.5.6",
|
|
40
40
|
"postcss-nested": "^7.0.2",
|
|
41
41
|
"pretty-bytes": "^7.0.0",
|
|
42
42
|
"pretty-ms": "^9.2.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"license": "MIT",
|
|
54
54
|
"name": "@reliverse/dler",
|
|
55
55
|
"type": "module",
|
|
56
|
-
"version": "1.7.
|
|
56
|
+
"version": "1.7.40",
|
|
57
57
|
"keywords": [
|
|
58
58
|
"reliverse",
|
|
59
59
|
"cli",
|