@form8ion/gitea-workflows 1.0.0-beta.2 → 1.0.0-beta.4
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 +11 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.js +2 -0
- package/src/lifter.js +7 -0
- package/src/lifter.test.js +18 -0
- package/src/tester.js +5 -0
- package/src/tester.test.js +25 -0
package/lib/index.js
CHANGED
|
@@ -10,5 +10,15 @@ async function scaffold({projectRoot}) {
|
|
|
10
10
|
return {};
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
function test({projectRoot}) {
|
|
14
|
+
return directoryExists(`${projectRoot}/.gitea/workflows`);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async function lift({projectRoot}) {
|
|
18
|
+
await promises.rm(`${projectRoot}/.gitea/.gitkeep`, {force: true});
|
|
19
|
+
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { lift, scaffold, test };
|
|
14
24
|
//# 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","../src/lifter.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","import {promises as fs} from 'node:fs';\n\nexport default async function lift({projectRoot}) {\n await fs.rm(`${projectRoot}/.gitea/.gitkeep`, {force: true});\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;;ACRe,SAAS,IAAI,CAAC,CAAC,WAAW,CAAC,EAAE;AAC5C,EAAE,OAAO,eAAe,CAAC,CAAC,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAC;AAC3D;;ACFe,eAAe,IAAI,CAAC,CAAC,WAAW,CAAC,EAAE;AAClD,EAAE,MAAMA,QAAE,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;;AAE9D,EAAE,OAAO,EAAE;AACX;;;;"}
|
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.
|
|
5
|
+
"version": "1.0.0-beta.4",
|
|
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
package/src/lifter.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {promises as fs} from 'node:fs';
|
|
2
|
+
|
|
3
|
+
import {describe, it, vi, expect} from 'vitest';
|
|
4
|
+
import any from '@travi/any';
|
|
5
|
+
|
|
6
|
+
import liftWorkflows from './lifter.js';
|
|
7
|
+
|
|
8
|
+
vi.mock('node:fs');
|
|
9
|
+
|
|
10
|
+
describe('gitea workflows lifter', () => {
|
|
11
|
+
it('should lift workflow details', async () => {
|
|
12
|
+
const projectRoot = any.string();
|
|
13
|
+
|
|
14
|
+
expect(await liftWorkflows({projectRoot})).toEqual({});
|
|
15
|
+
|
|
16
|
+
expect(fs.rm).toHaveBeenCalledWith(`${projectRoot}/.gitea/.gitkeep`, {force: true});
|
|
17
|
+
});
|
|
18
|
+
});
|
package/src/tester.js
ADDED
|
@@ -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
|
+
});
|