redput 2.1.0 → 2.2.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,12 @@
1
+ 2024.01.09, v2.2.0
2
+
3
+ fix:
4
+ - 1453d1e redput: nested: writeNestedTests: nestedPluginName
5
+
6
+ feature:
7
+ - d4343b5 redput: c8 v9.0.0
8
+ - 3da8937 redput: add-rule: add support of ESM
9
+
1
10
  2023.12.19, v2.1.0
2
11
 
3
12
  feature:
@@ -1,4 +1,5 @@
1
1
  import {access} from 'node:fs/promises';
2
+ import tryToCatch from 'try-to-catch';
2
3
  import {
3
4
  updateNestedIndex,
4
5
  updateOverallNestedFixtures,
@@ -12,7 +13,6 @@ import {
12
13
  writeRule,
13
14
  writeTests,
14
15
  } from './simple.js';
15
- import tryToCatch from 'try-to-catch';
16
16
 
17
17
  export const writePlugin = async (name, {rule, fixture, report, options}) => {
18
18
  const [isNested] = await tryToCatch(access, './package.json');
@@ -1,11 +1,13 @@
1
1
  import putout from 'putout';
2
2
  import * as insertGetRulePlugin from './plugin-insert-get-rule/index.js';
3
3
  import pluginPutout from '@putout/plugin-putout';
4
+ import nodejs from '@putout/plugin-nodejs';
4
5
  import removeUnusedVariables from '@putout/plugin-remove-unused-variables';
5
6
 
6
7
  export const addRule = (name, source, ruleOptions) => {
7
8
  const {code} = putout(source, {
8
9
  rules: {
10
+ 'nodejs/convert-esm-to-commonjs': 'on',
9
11
  'add-rule': ['on', {
10
12
  name,
11
13
  ruleOptions,
@@ -15,6 +17,7 @@ export const addRule = (name, source, ruleOptions) => {
15
17
  }],
16
18
  },
17
19
  plugins: [
20
+ ['nodejs', nodejs],
18
21
  ['putout', pluginPutout],
19
22
  ['remove-unused-variables', removeUnusedVariables],
20
23
  ['add-rule', insertGetRulePlugin],
@@ -36,7 +36,7 @@ export const writeNestedFixtures = async (name, data) => {
36
36
  export const writeNestedTests = async (name, report) => {
37
37
  const templatePath = new URL('../../../templates/plugin.js', import.meta.url).pathname;
38
38
  const template = await readFile(templatePath, 'utf8');
39
- const nestedPluginName = basename(dirname(join(process.cwd(), '..')));
39
+ const nestedPluginName = basename(dirname(join(process.cwd())));
40
40
  const nested = nestedPluginName.replace('plugin-', '');
41
41
 
42
42
  await writeFile(`./${name}/index.spec.js`, rendy(template, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redput",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "CLI tool to convert source from 🐊Putout Editor to files",
5
5
  "main": "lib/redput.js",
6
6
  "bin": {
@@ -59,6 +59,7 @@
59
59
  "dependencies": {
60
60
  "@putout/plugin-convert-esm-to-commonjs": "^6.0.0",
61
61
  "@putout/plugin-declare": "^2.0.1",
62
+ "@putout/plugin-nodejs": "^10.3.0",
62
63
  "@putout/plugin-putout": "^18.0.0",
63
64
  "@putout/plugin-remove-unused-variables": "^8.0.0",
64
65
  "node-fetch": "^3.3.2",
@@ -70,7 +71,7 @@
70
71
  },
71
72
  "devDependencies": {
72
73
  "@putout/test": "^8.0.0",
73
- "c8": "^8.0.0",
74
+ "c8": "^9.0.0",
74
75
  "escover": "^4.0.1",
75
76
  "eslint": "^8.0.0",
76
77
  "eslint-plugin-n": "^16.0.1",