@baeta/plugin-gitignore 0.1.4 → 1.0.8
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 +18 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @baeta/plugin-gitignore
|
|
2
2
|
|
|
3
|
+
## 1.0.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#189](https://github.com/andreisergiu98/baeta/pull/189) [`d500378`](https://github.com/andreisergiu98/baeta/commit/d500378198e0a9c48298c4242913bca8ad348228) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - add jsdocs
|
|
8
|
+
|
|
9
|
+
- [#165](https://github.com/andreisergiu98/baeta/pull/165) [`1334c2a`](https://github.com/andreisergiu98/baeta/commit/1334c2a866676c88f0f3d380b22133d81c4e98bc) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - mark as stable
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`d500378`](https://github.com/andreisergiu98/baeta/commit/d500378198e0a9c48298c4242913bca8ad348228), [`1334c2a`](https://github.com/andreisergiu98/baeta/commit/1334c2a866676c88f0f3d380b22133d81c4e98bc)]:
|
|
12
|
+
- @baeta/generator-sdk@1.0.0
|
|
13
|
+
|
|
14
|
+
## 0.1.5
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`bf2d1a3`](https://github.com/andreisergiu98/baeta/commit/bf2d1a326235e5f34e723a5acc81cd7b974b913b)]:
|
|
19
|
+
- @baeta/generator-sdk@0.1.5
|
|
20
|
+
|
|
3
21
|
## 0.1.4
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import * as _baeta_generator_sdk from '@baeta/generator-sdk';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Configuration options for the gitignore plugin.
|
|
5
|
+
*/
|
|
3
6
|
interface GitignoreOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Array of file tags to exclude from .gitignore.
|
|
9
|
+
* File tags are identifiers assigned to generated files
|
|
10
|
+
* to categorize them by their plugin or purpose.
|
|
11
|
+
*/
|
|
4
12
|
ignoreTags?: string[];
|
|
5
13
|
}
|
|
14
|
+
interface GitignoreOptions {
|
|
15
|
+
ignoreTags?: string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A plugin that adds .gitignore entries for generated files.
|
|
19
|
+
*
|
|
20
|
+
* @param options - Plugin configuration options
|
|
21
|
+
* @returns A Baeta generator plugin
|
|
22
|
+
*/
|
|
6
23
|
declare function gitignorePlugin(options?: GitignoreOptions): _baeta_generator_sdk.GeneratorPluginV1<unknown>;
|
|
7
24
|
|
|
8
25
|
export { type GitignoreOptions, gitignorePlugin };
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// index.ts
|
|
2
2
|
import { relative, resolve } from "node:path";
|
|
3
3
|
import { FileBlock, createPluginV1 } from "@baeta/generator-sdk";
|
|
4
|
-
var
|
|
4
|
+
var defaultIgnoredTags = ["cloudflare"];
|
|
5
5
|
function gitignorePlugin(options) {
|
|
6
6
|
return createPluginV1({
|
|
7
7
|
name: "gitignore-plugin",
|
|
8
8
|
actionName: "add generated files to .gitignore",
|
|
9
9
|
generate: async (ctx, next) => {
|
|
10
10
|
await next();
|
|
11
|
-
const ignoredTags = [...options?.ignoreTags ?? [], ...
|
|
11
|
+
const ignoredTags = [...options?.ignoreTags ?? [], ...defaultIgnoredTags];
|
|
12
12
|
const modulesDir = ctx.generatorOptions.modulesDir;
|
|
13
13
|
const moduleDefinitionName = ctx.generatorOptions.moduleDefinitionName;
|
|
14
14
|
const filePaths = ctx.fileManager.files.filter((file2) => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../index.ts"],"sourcesContent":["import { relative, resolve } from 'node:path';\nimport { FileBlock, createPluginV1 } from '@baeta/generator-sdk';\n\nexport interface GitignoreOptions {\n\tignoreTags?: string[];\n}\n\nconst
|
|
1
|
+
{"version":3,"sources":["../index.ts"],"sourcesContent":["import { relative, resolve } from 'node:path';\nimport { FileBlock, createPluginV1 } 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\tignoreTags?: string[];\n}\nexport interface GitignoreOptions {\n\tignoreTags?: string[];\n}\n\nconst defaultIgnoredTags = ['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 ignoredTags = [...(options?.ignoreTags ?? []), ...defaultIgnoredTags];\n\n\t\t\tconst modulesDir = ctx.generatorOptions.modulesDir;\n\t\t\tconst moduleDefinitionName = ctx.generatorOptions.moduleDefinitionName;\n\n\t\t\tconst filePaths = ctx.fileManager.files\n\t\t\t\t.filter((file) => {\n\t\t\t\t\treturn !file.filename.endsWith(moduleDefinitionName) && !ignoredTags.includes(file.tag);\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\tgeneratedPaths.push(\n\t\t\t\t`${relative(ctx.generatorOptions.cwd, modulesDir)}/**/${moduleDefinitionName}`,\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":";AAAA,SAAS,UAAU,eAAe;AAClC,SAAS,WAAW,sBAAsB;AAiB1C,IAAM,qBAAqB,CAAC,YAAY;AAQjC,SAAS,gBAAgB,SAA4B;AAC3D,SAAO,eAAe;AAAA,IACrB,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,UAAU,OAAO,KAAK,SAAS;AAC9B,YAAM,KAAK;AAEX,YAAM,cAAc,CAAC,GAAI,SAAS,cAAc,CAAC,GAAI,GAAG,kBAAkB;AAE1E,YAAM,aAAa,IAAI,iBAAiB;AACxC,YAAM,uBAAuB,IAAI,iBAAiB;AAElD,YAAM,YAAY,IAAI,YAAY,MAChC,OAAO,CAACA,UAAS;AACjB,eAAO,CAACA,MAAK,SAAS,SAAS,oBAAoB,KAAK,CAAC,YAAY,SAASA,MAAK,GAAG;AAAA,MACvF,CAAC,EACA,IAAI,CAACA,UAASA,MAAK,QAAQ;AAE7B,YAAM,iBAAiB,UACrB,IAAI,CAACA,UAAS,SAAS,IAAI,iBAAiB,KAAKA,KAAI,CAAC,EACtD,OAAO,CAACA,UAAS,CAACA,MAAK,SAAS,oBAAoB,CAAC;AAEvD,qBAAe;AAAA,QACd,GAAG,SAAS,IAAI,iBAAiB,KAAK,UAAU,CAAC,OAAO,oBAAoB;AAAA,MAC7E;AAEA,qBAAe,KAAK,CAAC,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;AAEhD,YAAM,iBAAiB;AACvB,YAAM,iBAAiB,eAAe,KAAK,IAAI;AAC/C,YAAM,eAAe;AAErB,YAAM,OAAO,IAAI;AAAA,QAChB,QAAQ,IAAI,iBAAiB,KAAK,YAAY;AAAA,QAC9C;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAEA,UAAI,YAAY,IAAI,IAAI;AAAA,IACzB;AAAA,EACD,CAAC;AACF;","names":["file"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baeta/plugin-gitignore",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"baeta",
|
|
6
6
|
"graphql",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"types": "tsc --noEmit"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@baeta/generator-sdk": "^0.
|
|
46
|
+
"@baeta/generator-sdk": "^1.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@baeta/builder": "^0.0.0",
|
|
@@ -77,6 +77,12 @@
|
|
|
77
77
|
"./index.ts"
|
|
78
78
|
],
|
|
79
79
|
"readme": "none",
|
|
80
|
-
"tsconfig": "./tsconfig.json"
|
|
80
|
+
"tsconfig": "./tsconfig.json",
|
|
81
|
+
"sort": [
|
|
82
|
+
"kind",
|
|
83
|
+
"instance-first",
|
|
84
|
+
"required-first",
|
|
85
|
+
"alphabetical-ignoring-documents"
|
|
86
|
+
]
|
|
81
87
|
}
|
|
82
88
|
}
|