redput 1.3.0 → 1.4.0

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 CHANGED
@@ -1,3 +1,10 @@
1
+ 2023.08.16, v1.4.0
2
+
3
+ feature:
4
+ - 6812e73 redput: prepare rule before write
5
+ - 49939c1 write: nested: convert to commonjs
6
+ - 52145ff write: nested: optional
7
+
1
8
  2023.08.16, v1.3.0
2
9
 
3
10
  feature:
@@ -17,13 +17,12 @@ import tryToCatch from 'try-to-catch';
17
17
  export const writePlugin = async (name, {rule, fixture, report}) => {
18
18
  const [isNested] = await tryToCatch(access, './package.json');
19
19
 
20
- if (isNested) {
20
+ if (isNested)
21
21
  return await writeNested(name, {
22
22
  rule,
23
23
  fixture,
24
24
  report,
25
25
  });
26
- }
27
26
 
28
27
  await writeSimple(name, {
29
28
  rule,
@@ -36,6 +35,13 @@ export const writeNested = async (name, {rule, fixture, report}) => {
36
35
  await writeNestedRule(name, rule);
37
36
  await writeNestedFixtures(name, fixture);
38
37
  await writeNestedTests(name, report);
38
+
39
+ await tryToCatch(writeNestedOptional, name, {
40
+ fixture,
41
+ });
42
+ };
43
+
44
+ export const writeNestedOptional = async (name, {fixture}) => {
39
45
  await updateNestedIndex(name);
40
46
  await updateOverallNestedFixtures(name, fixture);
41
47
  await updateOverallNestedTest(name);
@@ -0,0 +1,13 @@
1
+ import putout from 'putout';
2
+
3
+ export const prepareRule = (source) => {
4
+ const {code} = putout(source, {
5
+ plugins: [
6
+ 'declare',
7
+ 'convert-esm-to-commonjs',
8
+ 'putout',
9
+ ],
10
+ });
11
+
12
+ return code;
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redput",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "CLI tool to convert source from 🐊Putout Editor to files",
5
5
  "main": "lib/redput.js",
6
6
  "bin": {