@form8ion/gitea-workflows 1.0.0-beta.2 → 1.0.0-beta.3

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/lib/index.js CHANGED
@@ -10,5 +10,9 @@ async function scaffold({projectRoot}) {
10
10
  return {};
11
11
  }
12
12
 
13
- export { scaffold };
13
+ function test({projectRoot}) {
14
+ return directoryExists(`${projectRoot}/.gitea/workflows`);
15
+ }
16
+
17
+ export { scaffold, test };
14
18
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/scaffolder.js"],"sourcesContent":["import {promises as fs} from 'node:fs';\nimport {directoryExists} from '@form8ion/core';\n\nexport default async function scaffold({projectRoot}) {\n if (await directoryExists(`${projectRoot}/.gitea`)) {\n await fs.mkdir(`${projectRoot}/.gitea/workflows`);\n await fs.writeFile(`${projectRoot}/.gitea/workflows/.gitkeep`, '');\n }\n\n return {};\n}\n"],"names":["fs"],"mappings":";;;AAGe,eAAe,QAAQ,CAAC,CAAC,WAAW,CAAC,EAAE;AACtD,EAAE,IAAI,MAAM,eAAe,CAAC,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE;AACtD,IAAI,MAAMA,QAAE,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAC;AACrD,IAAI,MAAMA,QAAE,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,0BAA0B,CAAC,EAAE,EAAE,CAAC;AACtE,EAAE;;AAEF,EAAE,OAAO,EAAE;AACX;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/scaffolder.js","../src/tester.js"],"sourcesContent":["import {promises as fs} from 'node:fs';\nimport {directoryExists} from '@form8ion/core';\n\nexport default async function scaffold({projectRoot}) {\n if (await directoryExists(`${projectRoot}/.gitea`)) {\n await fs.mkdir(`${projectRoot}/.gitea/workflows`);\n await fs.writeFile(`${projectRoot}/.gitea/workflows/.gitkeep`, '');\n }\n\n return {};\n}\n","import {directoryExists} from '@form8ion/core';\n\nexport default function test({projectRoot}) {\n return directoryExists(`${projectRoot}/.gitea/workflows`);\n}\n"],"names":["fs"],"mappings":";;;AAGe,eAAe,QAAQ,CAAC,CAAC,WAAW,CAAC,EAAE;AACtD,EAAE,IAAI,MAAM,eAAe,CAAC,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE;AACtD,IAAI,MAAMA,QAAE,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAC;AACrD,IAAI,MAAMA,QAAE,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,0BAA0B,CAAC,EAAE,EAAE,CAAC;AACtE,EAAE;;AAEF,EAAE,OAAO,EAAE;AACX;;ACRe,SAAS,IAAI,CAAC,CAAC,WAAW,CAAC,EAAE;AAC5C,EAAE,OAAO,eAAe,CAAC,CAAC,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAC;AAC3D;;;;"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@form8ion/gitea-workflows",
3
3
  "description": "form8ion plugin for managing Gitea workflows",
4
4
  "license": "MIT",
5
- "version": "1.0.0-beta.2",
5
+ "version": "1.0.0-beta.3",
6
6
  "type": "module",
7
7
  "author": "Matt Travi <npm@travi.org> (https://matt.travi.org)",
8
8
  "repository": "form8ion/gitea-workflows",
package/src/index.js CHANGED
@@ -1 +1,2 @@
1
1
  export {default as scaffold} from './scaffolder.js';
2
+ export {default as test} from './tester.js';
package/src/tester.js ADDED
@@ -0,0 +1,5 @@
1
+ import {directoryExists} from '@form8ion/core';
2
+
3
+ export default function test({projectRoot}) {
4
+ return directoryExists(`${projectRoot}/.gitea/workflows`);
5
+ }
@@ -0,0 +1,25 @@
1
+ import {directoryExists} from '@form8ion/core';
2
+
3
+ import {describe, vi, it, expect} from 'vitest';
4
+ import {when} from 'vitest-when';
5
+ import any from '@travi/any';
6
+
7
+ import projectUsesGiteaWorkflows from './tester.js';
8
+
9
+ vi.mock('@form8ion/core');
10
+
11
+ describe('predicate', () => {
12
+ const projectRoot = any.string();
13
+
14
+ it('should return `true` when the workflows directory exists', async () => {
15
+ when(directoryExists).calledWith(`${projectRoot}/.gitea/workflows`).thenResolve(true);
16
+
17
+ expect(await projectUsesGiteaWorkflows({projectRoot})).toBe(true);
18
+ });
19
+
20
+ it('should return `false` when the workflows directory does not exist', async () => {
21
+ when(directoryExists).calledWith(`${projectRoot}/.gitea/workflows`).thenResolve(false);
22
+
23
+ expect(await projectUsesGiteaWorkflows({projectRoot})).toBe(false);
24
+ });
25
+ });