Skip to content

Commit 9191746

Browse files
committed
feature: @putout/cli-staged: migrate to ESM
1 parent ebcefac commit 9191746

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

packages/cli-staged/lib/staged.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
'use strict';
2-
3-
const {join} = require('node:path');
4-
const {spawnSync: _spawnSync} = require('node:child_process');
5-
6-
const _porcelain = require('@putout/git-status-porcelain');
7-
8-
const fullstore = require('fullstore');
1+
import {join} from 'node:path';
2+
import {spawnSync as _spawnSync} from 'node:child_process';
3+
import _porcelain from '@putout/git-status-porcelain';
4+
import fullstore from 'fullstore';
95

106
const namesStore = fullstore([]);
117

@@ -23,7 +19,7 @@ const findGit = async ({findUp}) => {
2319

2420
const joinDir = (a) => (b) => join(a, b);
2521

26-
module.exports.get = async function get(overrides = {}) {
22+
export const get = async function get(overrides = {}) {
2723
const {
2824
findUp,
2925
isSupported,
@@ -45,7 +41,7 @@ module.exports.get = async function get(overrides = {}) {
4541
return names.map(joinDir(dir));
4642
};
4743

48-
module.exports.set = async function set(overrides = {}) {
44+
export const set = async function set(overrides = {}) {
4945
const {
5046
findUp,
5147
porcelain = _porcelain,

packages/cli-staged/lib/staged.spec.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
'use strict';
2-
3-
const tryToCatch = require('try-to-catch');
4-
const {test, stub} = require('supertape');
5-
const {get, set} = require('./staged');
1+
import tryToCatch from 'try-to-catch';
2+
import {test, stub} from 'supertape';
3+
import {get, set} from './staged.js';
64

75
test('putout: cli: staged', async (t) => {
86
const findUp = stub().returns('.');

packages/cli-staged/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@putout/cli-staged",
33
"version": "1.1.0",
4-
"type": "commonjs",
4+
"type": "module",
55
"author": "coderaiser <[email protected]> (https://github.com/coderaiser)",
66
"description": "handle staged",
77
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/cli-staged#readme",
@@ -47,7 +47,7 @@
4747
},
4848
"license": "MIT",
4949
"engines": {
50-
"node": ">=16"
50+
"node": ">=20"
5151
},
5252
"publishConfig": {
5353
"access": "public"

0 commit comments

Comments
 (0)