Skip to content

putout v23.8.0

Choose a tag to compare

@coderaiser coderaiser released this 11 Jan 20:03
· 12329 commits to master since this release

New ways of working with AST

image

Too many steps have been taken
returning to the root and the source.
Better to have been blind and deaf
from the beginning!
Dwelling in one's true abode,
unconcerned with and without -
The river flows tranquilly on
and the flowers are red
(c) Zen Ten Bulls

Hi folks! New day, new release 😄!

findProperty

If you want to iterate over object searching for a property with a key, this method do this for you.
Let's suppose you have an object:

{
    "test": "npm test"
}

Here is how you can remove property with a name test:

import {operate} from 'putout';
const {getExportDefault} = operate;

const testPath = findProperty(path, 'test');
testPath.remove();

getExportDefault

When you need to get export default this method will help you out!

import {operate} from 'putout';
const {getExportDefault} = operate;

const exportPath = getExportDefault(path);
exportPath.remove();

How it's related to plugins?

The thing is two new rules added to @putout/plugin-madrun that improves using madly comfortable script runner madrun.

Both of them using methods described earlier to convert code like this:

export default {
    'test': () => [env, 'npm test'],
    'test:only': () => 'npm test',
-   'coverage': async () => [env, await run('test')],
-   'coverage:only': async () => [env, await cutEnv('test:only')],
+   'coverage': async () => [env, await cutEnv('test')],
+   'coverage:only': async () => [env, await run('test:only')],
};

That's all for today! Have I nice day 🦉!

🔥 feature

  • (package) @putout/plugin-madrun v12.0.0
  • (@putout/plugin-madrun) drop support of putout < 23
  • (@putout/operate) add getExportDefault
  • (@putout/plugin-madrun) add convert-cut-env-to-run
  • (@putout/plugin-madrun) add convert-run-to-cut-env
  • (@putout/plugin-remove-useless-spread) exclude comments