@form8ion/mise 1.0.0-beta.1 → 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
@@ -1,11 +1,16 @@
1
1
  import { promises } from 'node:fs';
2
2
  import { stringify } from 'smol-toml';
3
+ import { fileExists } from '@form8ion/core';
3
4
 
4
5
  async function scaffold({projectRoot}) {
5
- await promises.writeFile(`${projectRoot}/mise.toml`, stringify({lockfile: true}));
6
+ await promises.writeFile(`${projectRoot}/mise.toml`, stringify({settings: {lockfile: true}}));
6
7
 
7
8
  return {};
8
9
  }
9
10
 
10
- export { scaffold };
11
+ function test({projectRoot}) {
12
+ return fileExists(`${projectRoot}/mise.toml`);
13
+ }
14
+
15
+ export { scaffold, test };
11
16
  //# 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 {stringify} from 'smol-toml';\n\nexport default async function scaffold({projectRoot}) {\n await fs.writeFile(`${projectRoot}/mise.toml`, stringify({lockfile: true}));\n\n return {};\n}\n"],"names":["fs"],"mappings":";;;AAGe,eAAe,QAAQ,CAAC,CAAC,WAAW,CAAC,EAAE;AACtD,EAAE,MAAMA,QAAE,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;;AAE7E,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 {stringify} from 'smol-toml';\n\nexport default async function scaffold({projectRoot}) {\n await fs.writeFile(`${projectRoot}/mise.toml`, stringify({settings: {lockfile: true}}));\n\n return {};\n}\n","import {fileExists} from '@form8ion/core';\n\nexport default function test({projectRoot}) {\n return fileExists(`${projectRoot}/mise.toml`);\n}\n"],"names":["fs"],"mappings":";;;;AAGe,eAAe,QAAQ,CAAC,CAAC,WAAW,CAAC,EAAE;AACtD,EAAE,MAAMA,QAAE,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;;AAEzF,EAAE,OAAO,EAAE;AACX;;ACLe,SAAS,IAAI,CAAC,CAAC,WAAW,CAAC,EAAE;AAC5C,EAAE,OAAO,UAAU,CAAC,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;AAC/C;;;;"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@form8ion/mise",
3
3
  "description": "form8ion plugin for managing mise",
4
4
  "license": "MIT",
5
- "version": "1.0.0-beta.1",
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/mise",
@@ -46,13 +46,13 @@
46
46
  "src/"
47
47
  ],
48
48
  "publishConfig": {
49
- "access": "public"
49
+ "access": "public",
50
+ "provenance": true
50
51
  },
51
52
  "packageManager": "npm@11.14.1+sha512.6a8a4d67478497a2dbc6815cad72e64c43f33413717e242756047d466241ab39bee61e691683a64658e94496ec5f1a1c05e4a5ec62dcc773280dfd949443a367",
52
53
  "devDependencies": {
53
54
  "@cucumber/cucumber": "12.8.3",
54
55
  "@form8ion/commitlint-config": "2.0.14",
55
- "@form8ion/core": "4.11.1",
56
56
  "@form8ion/eslint-config": "7.0.16",
57
57
  "@form8ion/eslint-config-cucumber": "1.4.1",
58
58
  "@form8ion/eslint-config-vitest": "1.1.0",
@@ -76,6 +76,7 @@
76
76
  "vitest-when": "0.10.0"
77
77
  },
78
78
  "dependencies": {
79
+ "@form8ion/core": "^4.11.1",
79
80
  "smol-toml": "^1.6.1"
80
81
  }
81
82
  }
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/scaffolder.js CHANGED
@@ -2,7 +2,7 @@ import {promises as fs} from 'node:fs';
2
2
  import {stringify} from 'smol-toml';
3
3
 
4
4
  export default async function scaffold({projectRoot}) {
5
- await fs.writeFile(`${projectRoot}/mise.toml`, stringify({lockfile: true}));
5
+ await fs.writeFile(`${projectRoot}/mise.toml`, stringify({settings: {lockfile: true}}));
6
6
 
7
7
  return {};
8
8
  }
@@ -14,7 +14,7 @@ describe('mise scaffolder', () => {
14
14
  it('should scaffold the mise configuration file', async () => {
15
15
  const projectRoot = any.string();
16
16
  const serializedConfig = any.string();
17
- when(stringify).calledWith({lockfile: true}).thenReturn(serializedConfig);
17
+ when(stringify).calledWith({settings: {lockfile: true}}).thenReturn(serializedConfig);
18
18
 
19
19
  expect(await scaffoldMise({projectRoot})).toEqual({});
20
20
 
package/src/tester.js ADDED
@@ -0,0 +1,5 @@
1
+ import {fileExists} from '@form8ion/core';
2
+
3
+ export default function test({projectRoot}) {
4
+ return fileExists(`${projectRoot}/mise.toml`);
5
+ }
@@ -0,0 +1,25 @@
1
+ import {fileExists} from '@form8ion/core';
2
+
3
+ import {describe, it, expect, vi} from 'vitest';
4
+ import {when} from 'vitest-when';
5
+ import any from '@travi/any';
6
+
7
+ import miseInUse from './tester.js';
8
+
9
+ vi.mock('@form8ion/core');
10
+
11
+ describe('mise predicate', () => {
12
+ const projectRoot = any.string();
13
+
14
+ it('should return `true` when the mise config file is found', async () => {
15
+ when(fileExists).calledWith(`${projectRoot}/mise.toml`).thenResolve(true);
16
+
17
+ expect(await miseInUse({projectRoot})).toBe(true);
18
+ });
19
+
20
+ it('should return `false` when the mise config file is found', async () => {
21
+ when(fileExists).calledWith(`${projectRoot}/mise.toml`).thenResolve(false);
22
+
23
+ expect(await miseInUse({projectRoot})).toBe(false);
24
+ });
25
+ });