redput 1.7.0 → 1.9.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,17 @@
1
+ 2023.08.30, v1.9.0
2
+
3
+ feature:
4
+ - 2ea4171 redput: add -v, --version
5
+
6
+ 2023.08.28, v1.8.0
7
+
8
+ feature:
9
+ - 00f012e redput: plugins: prepare to ESM: direct import instead of async
10
+ - 9d29ea2 package: @putout/plugin-declare v2.0.1
11
+ - 84f823b package: @putout/plugin-convert-esm-to-commonjs v6.0.0
12
+ - fcf48ac package: @putout/plugin-remove-unused-variables v6.0.2
13
+ - d584a26 package: @putout/plugin-putout v14.8.0
14
+
1
15
  2023.08.23, v1.7.0
2
16
 
3
17
  feature:
package/bin/redput.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import process from 'node:process';
3
4
  import {redput} from '../lib/redput.js';
4
5
 
5
6
  const {GITHUB_TOKEN} = process.env;
@@ -10,6 +11,12 @@ if (!url) {
10
11
  process.exit(1);
11
12
  }
12
13
 
14
+ if (url === '-v' || url === '--version') {
15
+ const {version} = await import('../lib/version.js');
16
+ console.log(await version());
17
+ process.exit();
18
+ }
19
+
13
20
  const [error, result] = await redput(url, {
14
21
  token: GITHUB_TOKEN,
15
22
  });
package/lib/version.js ADDED
@@ -0,0 +1,11 @@
1
+ import {readFile} from 'node:fs/promises';
2
+
3
+ const {parse} = JSON;
4
+ const {pathname} = new URL('../package.json', import.meta.url);
5
+
6
+ export const version = async () => {
7
+ const data = await readFile(pathname, 'utf8');
8
+ const {version} = parse(data);
9
+
10
+ return `v${version}`;
11
+ };
@@ -1,4 +1,4 @@
1
- import {access} from 'fs/promises';
1
+ import {access} from 'node:fs/promises';
2
2
  import {
3
3
  updateNestedIndex,
4
4
  updateOverallNestedFixtures,
@@ -1,5 +1,7 @@
1
1
  import putout from 'putout';
2
2
  import * as insertGetRulePlugin from './plugin-insert-get-rule/index.js';
3
+ import pluginPutout from '@putout/plugin-putout';
4
+ import removeUnusedVariables from '@putout/plugin-remove-unused-variables';
3
5
 
4
6
  export const addRule = (name, source) => {
5
7
  const {code} = putout(source, {
@@ -9,8 +11,8 @@ export const addRule = (name, source) => {
9
11
  }],
10
12
  },
11
13
  plugins: [
12
- 'putout',
13
- 'remove-unused-variables',
14
+ ['putout', pluginPutout],
15
+ ['remove-unused-variables', removeUnusedVariables],
14
16
  ['add-rule', insertGetRulePlugin],
15
17
  ],
16
18
  });
@@ -2,13 +2,14 @@ import {
2
2
  mkdir,
3
3
  readFile,
4
4
  writeFile,
5
- } from 'fs/promises';
5
+ } from 'node:fs/promises';
6
6
  import {
7
7
  basename,
8
8
  dirname,
9
9
  join,
10
- } from 'path';
10
+ } from 'node:path';
11
11
  import rendy from 'rendy';
12
+ import process from 'node:process';
12
13
  import {addRule} from './add-rule/add-rule.js';
13
14
  import {insertTest} from './insert-test/insert-test.js';
14
15
  import {prepareRule} from './prepare-rule/prepare-rule.js';
@@ -1,11 +1,14 @@
1
1
  import putout from 'putout';
2
+ import convertESMToCommonjs from '@putout/plugin-convert-esm-to-commonjs';
3
+ import putoutPlugin from '@putout/plugin-putout';
4
+ import declare from '@putout/plugin-declare';
2
5
 
3
6
  export const prepareRule = (source) => {
4
7
  const {code} = putout(source, {
5
8
  plugins: [
6
- 'declare',
7
- 'convert-esm-to-commonjs',
8
- 'putout',
9
+ ['declare', declare],
10
+ ['convert-esm-to-commonjs', convertESMToCommonjs],
11
+ ['putout', putoutPlugin],
9
12
  ],
10
13
  });
11
14
 
@@ -2,13 +2,14 @@ import {
2
2
  mkdir,
3
3
  readFile,
4
4
  writeFile,
5
- } from 'fs/promises';
5
+ } from 'node:fs/promises';
6
6
  import {
7
7
  basename,
8
8
  dirname,
9
9
  join,
10
- } from 'path';
10
+ } from 'node:path';
11
11
  import rendy from 'rendy';
12
+ import process from 'node:process';
12
13
 
13
14
  export const writeRule = async (name, data) => {
14
15
  await mkdir(`./lib`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redput",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "CLI tool to convert source from 🐊Putout Editor to files",
5
5
  "main": "lib/redput.js",
6
6
  "bin": {
@@ -57,6 +57,10 @@
57
57
  "node": ">=16"
58
58
  },
59
59
  "dependencies": {
60
+ "@putout/plugin-convert-esm-to-commonjs": "^6.0.0",
61
+ "@putout/plugin-declare": "^2.0.1",
62
+ "@putout/plugin-putout": "^14.8.0",
63
+ "@putout/plugin-remove-unused-variables": "^6.0.2",
60
64
  "node-fetch": "^3.3.2",
61
65
  "octokit": "^3.1.0",
62
66
  "putout": "^31.1.0",