madrun 8.8.12 → 8.10.1

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,31 @@
1
+ 2022.01.14, v8.10.1
2
+
3
+ fix:
4
+ - (madrun) windows support
5
+
6
+ 2022.01.14, v8.10.0
7
+
8
+ feature:
9
+ - (madrun) get rid of simport
10
+ - (package) @putout/formatter-json v2.0.0
11
+ - (package) @putout/formatter-dump v3.0.2
12
+
13
+
14
+ 2022.01.12, v8.9.1
15
+
16
+ feature:
17
+ - (package) eslint-plugin-putout v13.0.0
18
+ - (package) putout v24.0.0
19
+
20
+ 2021.12.21, v8.9.0
21
+
22
+ feature:
23
+ - (package) putout v23.0.0
24
+ - (package) yargs-parser v21.0.0
25
+ - (package) @putout/plugin-madrun v11.0.0
26
+ - (package) eslint-plugin-putout v12.2.0
27
+
28
+
1
29
  2021.11.10, v8.8.12
2
30
 
3
31
  feature:
package/bin/init.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import {createRequire} from 'module';
1
2
  import {join} from 'path';
2
3
  import {
3
4
  writeFile,
@@ -6,13 +7,13 @@ import {
6
7
 
7
8
  import tryToCatch from 'try-to-catch';
8
9
  import montag from 'montag';
9
- import {createSimport} from 'simport';
10
+
11
+ const require = createRequire(import.meta.url);
10
12
 
11
13
  const {stringify} = JSON;
12
14
  const {keys} = Object;
13
15
 
14
- const simport = createSimport(import.meta.url);
15
- const supported = await simport('../supported.json');
16
+ const supported = require('../supported.json');
16
17
 
17
18
  export const createMadrun = async (cwd, info) => {
18
19
  let name = await findMadrun(cwd);
@@ -40,7 +41,7 @@ export const createMadrun = async (cwd, info) => {
40
41
  };
41
42
 
42
43
  export const patchPackage = async (name, info) => {
43
- const {default: content} = await simport(name);
44
+ const {default: content} = await import(name);
44
45
 
45
46
  const updatedScripts = updatePackage(content);
46
47
  const prepared = preparePackage(info, updatedScripts);
package/bin/madrun.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import {createRequire} from 'module';
3
4
  import {
4
5
  dirname,
5
6
  basename,
@@ -8,12 +9,10 @@ import {
8
9
  import findUp from 'find-up';
9
10
  import tryToCatch from 'try-to-catch';
10
11
  import yargsParser from 'yargs-parser';
11
- import {createSimport} from 'simport';
12
12
 
13
13
  import {series} from '../lib/madrun.js';
14
14
  import check from '../lib/check.js';
15
-
16
- const simport = createSimport(import.meta.url);
15
+ const require = createRequire(import.meta.url);
17
16
 
18
17
  const {exit} = process;
19
18
  const {
@@ -47,13 +46,13 @@ const {
47
46
  } = args;
48
47
 
49
48
  if (help) {
50
- const {help} = await simport('../lib/help.js');
49
+ const {help} = require('../lib/help.js');
51
50
  console.log(help());
52
51
  process.exit();
53
52
  }
54
53
 
55
54
  if (version) {
56
- const {version} = await simport('../package.json');
55
+ const {version} = require('../package.json');
57
56
  console.log(`v${version}`);
58
57
  process.exit();
59
58
  }
@@ -62,11 +61,11 @@ if (init) {
62
61
  const {
63
62
  createMadrun,
64
63
  patchPackage,
65
- } = await simport('./init');
64
+ } = await import('./init.mjs');
66
65
 
67
66
  fix = true;
68
67
 
69
- const [errorPackage, info] = await tryToCatch(simport, `${cwd}/package.json`);
68
+ const [errorPackage, info] = await tryToCatch(require, `${cwd}/package.json`);
70
69
 
71
70
  if (errorPackage)
72
71
  console.error(errorPackage);
@@ -130,8 +129,8 @@ function getOutput({cmd, cwd}) {
130
129
  }
131
130
 
132
131
  async function execute(cmd) {
133
- const {execSync} = await simport('child_process');
134
- const tryCatch = await simport('try-catch');
132
+ const {execSync} = await import('child_process');
133
+ const tryCatch = (await import('try-catch')).default;
135
134
 
136
135
  const [error] = tryCatch(execSync, cmd, {
137
136
  stdio: [0, 1, 2],
@@ -152,7 +151,8 @@ function getOptions(args) {
152
151
  }
153
152
 
154
153
  async function getScript() {
155
- const supported = await simport('../supported.json');
154
+ const {pathToFileURL} = require('url');
155
+ const supported = require('../supported.json');
156
156
  const path = findUp.sync(supported);
157
157
 
158
158
  if (!path) {
@@ -160,7 +160,8 @@ async function getScript() {
160
160
  process.exit(1);
161
161
  }
162
162
 
163
- const esm = await simport(path);
163
+ // always convert path to url on windows
164
+ const esm = await import(pathToFileURL(path));
164
165
 
165
166
  return [
166
167
  dirname(path),
@@ -170,14 +171,14 @@ async function getScript() {
170
171
 
171
172
  async function putoutMadrun(dir, {fix}) {
172
173
  const name = `${dir}/.madrun.js`;
173
- const {runPutout} = await simport('../lib/fix');
174
+ const {runPutout} = await import('../lib/fix.mjs');
174
175
  const {
175
176
  readFile,
176
177
  writeFile,
177
178
  } = await import('fs/promises');
178
179
 
179
180
  const data = await readFile(name, 'utf8');
180
- const {places, code} = runPutout(data);
181
+ const {places, code} = await runPutout(data);
181
182
 
182
183
  if (fix)
183
184
  await writeFile(name, code);
package/lib/fix.mjs CHANGED
@@ -1,12 +1,13 @@
1
1
  import putout, {
2
2
  initReport,
3
3
  } from 'putout';
4
+
4
5
  import dumpFormatter from '@putout/formatter-dump';
5
6
  import madrun from '@putout/plugin-madrun';
6
7
 
7
8
  const report = initReport();
8
9
 
9
- export const runPutout = (data, options) => {
10
+ export const runPutout = async (data, options) => {
10
11
  const {code, places} = putout(data, {
11
12
  ...options,
12
13
  plugins: [{
@@ -16,7 +17,7 @@ export const runPutout = (data, options) => {
16
17
 
17
18
  return {
18
19
  code,
19
- places: report(dumpFormatter, {
20
+ places: await report(dumpFormatter, {
20
21
  name: '.madrun.js',
21
22
  places,
22
23
  }),
package/lib/madrun.js CHANGED
@@ -3,7 +3,6 @@
3
3
  const keys = require('all-object-keys');
4
4
  const jessy = require('jessy');
5
5
  const findUp = require('find-up');
6
- const {createSimport} = require('simport');
7
6
 
8
7
  const wildcard = require('./wildcard');
9
8
  const check = require('./check');
@@ -12,15 +11,13 @@ const supported = require('../supported');
12
11
  const isStr = (a) => typeof a === 'string';
13
12
  const {isArray} = Array;
14
13
 
15
- const simport = createSimport(__filename);
16
-
17
14
  async function getScripts() {
18
15
  const path = findUp.sync(supported);
19
16
 
20
17
  if (!path)
21
18
  throw Error('.madrun.js is missing!');
22
19
 
23
- return await simport(path);
20
+ return (await import(path)).default;
24
21
  }
25
22
 
26
23
  module.exports.cutEnv = async (names, opts = '', env, scripts) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "madrun",
3
- "version": "8.8.12",
3
+ "version": "8.10.1",
4
4
  "description": "CLI tool to run multiple npm-scripts in a madly comfortable way",
5
5
  "main": "lib/madrun.js",
6
6
  "type": "commonjs",
@@ -54,27 +54,27 @@
54
54
  "node": ">=14"
55
55
  },
56
56
  "dependencies": {
57
- "@putout/formatter-dump": "^2.0.1",
58
- "@putout/plugin-madrun": "^10.0.0",
57
+ "@putout/formatter-dump": "^3.0.2",
58
+ "@putout/plugin-madrun": "^11.0.0",
59
59
  "all-object-keys": "^2.0.0",
60
60
  "find-up": "^5.0.0",
61
61
  "jessy": "^3.0.0",
62
62
  "mapsome": "^1.0.0",
63
63
  "montag": "^1.0.0",
64
64
  "once": "^1.4.0",
65
- "putout": "^22.0.0",
66
- "simport": "^1.0.3",
65
+ "putout": "^24.0.0",
67
66
  "try-catch": "^3.0.0",
68
67
  "try-to-catch": "^3.0.0",
69
- "yargs-parser": "^20.0.0"
68
+ "yargs-parser": "^21.0.0"
70
69
  },
71
70
  "devDependencies": {
72
71
  "@cloudcmd/stub": "^3.1.0",
73
- "@putout/formatter-json": "^1.0.2",
72
+ "@putout/formatter-json": "^2.0.0",
74
73
  "c8": "^7.3.5",
75
- "eslint": "^8.0.0-beta.1",
74
+ "escover": "^1.1.6",
75
+ "eslint": "^8.0.0",
76
76
  "eslint-plugin-node": "^11.0.0",
77
- "eslint-plugin-putout": "^11.0.0",
77
+ "eslint-plugin-putout": "^13.0.0",
78
78
  "mock-import": "^2.1.1",
79
79
  "mock-require": "^3.0.3",
80
80
  "nodemon": "^2.0.0",