@baeta/plugin-gitignore 2.0.0-next.10 → 2.0.0-next.12
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/CHANGELOG.md +4 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -6
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as _baeta_generator_sdk0 from "@baeta/generator-sdk";
|
|
1
|
+
import * as _$_baeta_generator_sdk0 from "@baeta/generator-sdk";
|
|
2
2
|
|
|
3
3
|
//#region index.d.ts
|
|
4
4
|
/**
|
|
@@ -25,7 +25,7 @@ interface GitignoreOptions {
|
|
|
25
25
|
* @param options - Plugin configuration options
|
|
26
26
|
* @returns A Baeta generator plugin
|
|
27
27
|
*/
|
|
28
|
-
declare function gitignorePlugin(options?: GitignoreOptions): _baeta_generator_sdk0.GeneratorPluginV1<unknown>;
|
|
28
|
+
declare function gitignorePlugin(options?: GitignoreOptions): _$_baeta_generator_sdk0.GeneratorPluginV1<unknown>;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { GitignoreOptions, gitignorePlugin };
|
|
31
31
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { relative, resolve } from "node:path";
|
|
2
2
|
import { FileBlock, createPluginV1, micromatch } from "@baeta/generator-sdk";
|
|
3
|
-
|
|
4
3
|
//#region index.ts
|
|
5
4
|
const defaultSkipTags = ["cloudflare"];
|
|
6
5
|
/**
|
|
@@ -17,11 +16,11 @@ function gitignorePlugin(options) {
|
|
|
17
16
|
await next();
|
|
18
17
|
const modulesDir = ctx.generatorOptions.modulesDir;
|
|
19
18
|
const moduleDefinitionName = ctx.generatorOptions.moduleDefinitionName;
|
|
20
|
-
const
|
|
19
|
+
const skippedTags = new Set([...options?.skipTags ?? [], ...defaultSkipTags]);
|
|
21
20
|
const skippedFilesGlobs = [...(options?.skipFilesGlobs ?? []).map((glob) => resolve(ctx.generatorOptions.cwd, glob))];
|
|
22
|
-
const generatedPaths = ctx.fileManager.files.filter((file
|
|
23
|
-
return !file
|
|
24
|
-
}).map((file
|
|
21
|
+
const generatedPaths = ctx.fileManager.files.filter((file) => {
|
|
22
|
+
return !file.filename.endsWith(moduleDefinitionName) && !skippedTags.has(file.tag) && !skippedFilesGlobs.some((skippedFile) => micromatch.isMatch(file.filename, skippedFile)) && file.options?.disableOverwrite !== true;
|
|
23
|
+
}).map((file) => file.filename).map((file) => relative(ctx.generatorOptions.cwd, file)).filter((file) => !file.endsWith(moduleDefinitionName));
|
|
25
24
|
if (!skippedFilesGlobs.some((skippedFile) => micromatch.isMatch(`${modulesDir}/**/${moduleDefinitionName}`, skippedFile))) generatedPaths.push(`${relative(ctx.generatorOptions.cwd, modulesDir)}/**/${moduleDefinitionName}`);
|
|
26
25
|
generatedPaths.sort((a, b) => a.localeCompare(b));
|
|
27
26
|
const gitignoreStart = "# Generated by Baeta - Begin";
|
|
@@ -31,7 +30,7 @@ function gitignorePlugin(options) {
|
|
|
31
30
|
}
|
|
32
31
|
});
|
|
33
32
|
}
|
|
34
|
-
|
|
35
33
|
//#endregion
|
|
36
34
|
export { gitignorePlugin };
|
|
35
|
+
|
|
37
36
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../index.ts"],"sourcesContent":["import { relative, resolve } from 'node:path';\nimport { createPluginV1, FileBlock, micromatch } from '@baeta/generator-sdk';\n\n/**\n * Configuration options for the gitignore plugin.\n */\nexport interface GitignoreOptions {\n\t/**\n\t * Array of file tags to exclude from .gitignore.\n\t * File tags are identifiers assigned to generated files\n\t * to categorize them by their plugin or purpose.\n\t */\n\tskipTags?: string[];\n\n\t/**\n\t * Array of files to exclude from .gitignore.\n\t */\n\tskipFilesGlobs?: string[];\n}\nexport interface GitignoreOptions {\n\tskipTags?: string[];\n}\n\nconst defaultSkipTags = ['cloudflare'];\n\n/**\n * A plugin that adds .gitignore entries for generated files.\n *\n * @param options - Plugin configuration options\n * @returns A Baeta generator plugin\n */\nexport function gitignorePlugin(options?: GitignoreOptions) {\n\treturn createPluginV1({\n\t\tname: 'gitignore-plugin',\n\t\tactionName: 'add generated files to .gitignore',\n\t\tgenerate: async (ctx, next) => {\n\t\t\tawait next();\n\n\t\t\tconst modulesDir = ctx.generatorOptions.modulesDir;\n\t\t\tconst moduleDefinitionName = ctx.generatorOptions.moduleDefinitionName;\n\n\t\t\tconst skippedTags = new Set([...(options?.skipTags ?? []), ...defaultSkipTags]);\n\t\t\tconst skippedFilesGlobs = [\n\t\t\t\t...(options?.skipFilesGlobs ?? []).map((glob) => resolve(ctx.generatorOptions.cwd, glob)),\n\t\t\t];\n\n\t\t\tconst filePaths = ctx.fileManager.files\n\t\t\t\t.filter((file) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t!file.filename.endsWith(moduleDefinitionName) &&\n\t\t\t\t\t\t!skippedTags.has(file.tag) &&\n\t\t\t\t\t\t!skippedFilesGlobs.some((skippedFile) =>\n\t\t\t\t\t\t\tmicromatch.isMatch(file.filename, skippedFile),\n\t\t\t\t\t\t) &&\n\t\t\t\t\t\tfile.options?.disableOverwrite !== true\n\t\t\t\t\t);\n\t\t\t\t})\n\t\t\t\t.map((file) => file.filename);\n\n\t\t\tconst generatedPaths = filePaths\n\t\t\t\t.map((file) => relative(ctx.generatorOptions.cwd, file))\n\t\t\t\t.filter((file) => !file.endsWith(moduleDefinitionName));\n\n\t\t\tif (\n\t\t\t\t!skippedFilesGlobs.some((skippedFile) =>\n\t\t\t\t\tmicromatch.isMatch(`${modulesDir}/**/${moduleDefinitionName}`, skippedFile),\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tgeneratedPaths.push(\n\t\t\t\t\t`${relative(ctx.generatorOptions.cwd, modulesDir)}/**/${moduleDefinitionName}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tgeneratedPaths.sort((a, b) => a.localeCompare(b));\n\n\t\t\tconst gitignoreStart = '# Generated by Baeta - Begin';\n\t\t\tconst gitignoreInner = generatedPaths.join('\\n');\n\t\t\tconst gitignoreEnd = '# Generated by Baeta - End';\n\n\t\t\tconst file = new FileBlock(\n\t\t\t\tresolve(ctx.generatorOptions.cwd, '.gitignore'),\n\t\t\t\tgitignoreInner,\n\t\t\t\tgitignoreStart,\n\t\t\t\tgitignoreEnd,\n\t\t\t\t'gitignore',\n\t\t\t);\n\n\t\t\tctx.fileManager.add(file);\n\t\t},\n\t});\n}\n"],"mappings":";;;AAuBA,MAAM,kBAAkB,CAAC,aAAa;;;;;;;AAQtC,SAAgB,gBAAgB,SAA4B;AAC3D,QAAO,eAAe;EACrB,MAAM;EACN,YAAY;EACZ,UAAU,OAAO,KAAK,SAAS;AAC9B,SAAM,MAAM;GAEZ,MAAM,aAAa,IAAI,iBAAiB;GACxC,MAAM,uBAAuB,IAAI,iBAAiB;GAElD,MAAM,cAAc,IAAI,IAAI,CAAC,GAAI,SAAS,YAAY,EAAE,EAAG,GAAG,gBAAgB,CAAC;GAC/E,MAAM,oBAAoB,CACzB,IAAI,SAAS,kBAAkB,EAAE,EAAE,KAAK,SAAS,QAAQ,IAAI,iBAAiB,KAAK,KAAK,CAAC,CACzF;GAeD,MAAM,iBAbY,IAAI,YAAY,MAChC,QAAQ,SAAS;AACjB,WACC,CAAC,KAAK,SAAS,SAAS,qBAAqB,IAC7C,CAAC,YAAY,IAAI,KAAK,IAAI,IAC1B,CAAC,kBAAkB,MAAM,gBACxB,WAAW,QAAQ,KAAK,UAAU,YAAY,CAC9C,IACD,KAAK,SAAS,qBAAqB;KAEnC,CACD,KAAK,SAAS,KAAK,SAAS,CAG5B,KAAK,SAAS,SAAS,IAAI,iBAAiB,KAAK,KAAK,CAAC,CACvD,QAAQ,SAAS,CAAC,KAAK,SAAS,qBAAqB,CAAC;AAExD,OACC,CAAC,kBAAkB,MAAM,gBACxB,WAAW,QAAQ,GAAG,WAAW,MAAM,wBAAwB,YAAY,CAC3E,CAED,gBAAe,KACd,GAAG,SAAS,IAAI,iBAAiB,KAAK,WAAW,CAAC,MAAM,uBACxD;AAGF,kBAAe,MAAM,GAAG,MAAM,EAAE,cAAc,EAAE,CAAC;GAEjD,MAAM,iBAAiB;GACvB,MAAM,iBAAiB,eAAe,KAAK,KAAK;GAGhD,MAAM,OAAO,IAAI,UAChB,QAAQ,IAAI,iBAAiB,KAAK,aAAa,EAC/C,gBACA,gBALoB,8BAOpB,YACA;AAED,OAAI,YAAY,IAAI,KAAK;;EAE1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baeta/plugin-gitignore",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.12",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"baeta",
|
|
6
6
|
"graphql",
|
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
],
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "builder build",
|
|
41
|
+
"check:deps": "builder check-deps",
|
|
41
42
|
"prepack": "builder prepare",
|
|
42
|
-
"postpack": "builder prepare --
|
|
43
|
+
"postpack": "builder prepare --restore",
|
|
43
44
|
"test": "builder test",
|
|
44
45
|
"test:circular": "builder test-circular",
|
|
45
46
|
"types": "tsc --noEmit"
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
"@baeta/builder": "^0.0.0",
|
|
57
58
|
"@baeta/testing": "^0.0.0",
|
|
58
59
|
"@baeta/tsconfig": "^0.0.0",
|
|
59
|
-
"@types/node": "^22.19.
|
|
60
|
+
"@types/node": "^22.19.13",
|
|
60
61
|
"typescript": "^5.9.3"
|
|
61
62
|
},
|
|
62
63
|
"engines": {
|