Coder Social home page Coder Social logo

electrode-io / xarc-run Goto Github PK

View Code? Open in Web Editor NEW
42.0 4.0 8.0 347 KB

npm run scripts concurrently and serially, and more.

License: Apache License 2.0

JavaScript 99.98% Shell 0.02%
npm scripts build tool task tasks executor runner javascript nodejs namespace serial concurrent

xarc-run's People

Contributors

friederbluemle avatar jchip avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

xarc-run's Issues

xrun doesnt support ESM modules

When trying to use xrun in an environment set to 'Module', xrun will throw an error about using require() instead of import.

[16:17:21] Unable to load ./xrun-tasks.ts: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: ./xrun-tasks.ts
require() of ES modules is not supported.
require() of ./xrun-tasks.ts from ./node_modules/.pnpm/@[email protected]/node_modules/@xarc/run/cli/parse-cmd-args.js is an ES module file as it is a .ts file whose nearest parent package.json contains "type": "module" which defines all .ts files in that package scope as ES modules.
Instead change the requiring code to use import(), or remove "type": "module" from ./package.json.

Use Case:
Building a TypeScript package that is set to use ESM ('type': 'module') and including xrun tasks for setting how to run Mocha tests causes the xrun tasks to fail.

Solution:

  • parse-cmd-args.js should be updated to use dynamic imports, rather than require

Work Around:

  • Bypass xrun tasks, and run the command directly.
  • TS_NODE_PROJECT='./tsconfig.test.json' NODE_OPTIONS='--loader ts-node/esm --no-warnings' mocha results in a successful pass of the tests.

Support list of arguments for task options

First of all I want to thank you guys for that awesome work you are doing. I am currently using xclap in combination with nix-clap in a bunch of projects. And everything worked fine... till now.
Currently I have to provide a list of args for a specific task option. It seams that xclap does not support that out of the box.

Expected Behaviour
clap <task> --foo value1 value2 --bar
Task option foo gets list of values.

Current Behaviour
value1 gets interpreted as new task.
Error Message: No task namespace value1 exists.

Just execute npm scripts

I'm just trying to run npm scripts from my package.json, but xrun is always complaining about missing xrun-tasks.js.

Looking at the documentation, calling

npx xrun -s i18n-mf:en i18n-mf:de

should work, but gives me an error:

[10:23:43] No xrun-tasks.js found - @xarc/run has nothing to do
    Please create xrun-tasks.js - sample: https://www.npmjs.com/package/@xarc/run#a-simple-example

Adding an option -n or --npm does not change anything.

What am I doing wrong?

Support vinyl-fs?

Gulp being the most used build tool and having a large set of already available plugins, mostly I see gulp extensions they depend on vinyl-fs stream pattern. If xclap could provide an extension so that the gulp users can easily migrate their gulp tasks to xclap with same streaming pattern will be very useful.

I understand that this is achievable by directly importing vinyl-fs in xclap build file, was wondering if xclap has a different plan in achieving the similar goal.

// similar to gulp
xclap.src(["./src/**/*.js"]).pipe(babel(opts)).pipe(xclap.dest("./dest"));

`stopOnError` inside `xclap.js` does nothing

There is a repository to reproduce this error https://github.com/theVeid/xclap-soe-issue

There are two tasks, that are running concurrently and both of them exit with process code not equal 0. When defining xclap.stopOnError = 'soft' inside xclap.js, it is expected that after first task exits xclap will wait until the second task finish too, but it is not the case until one define --soe soft flag for xclap cli launch

Expected Behaviour

Same result expected for both no-flag and flag command, as stopOnError is defined inside xclap.js file

Current Behaviour

no-flag command will stop fully after error in first exited task, no matter that stopOnError is defined with soft inside xclap.js

hint on task to continue execution of array of tasks

use case: failed test coverage, want to define a post-cov task that offers a link to the HTML report (i.e. . this post cov task cannot be run if the coverage task fails (which is the point to see the HTML report).. open to PR?

Doc and code inconsistency

This page of doc: https://github.com/jchip/xclap/blob/HEAD/REFERENCE.md says

Then function can return:

-   `string` - `clap` will treat the string as a shell command to be spawned.

But the actual code appears to treat a single string return as a target to invoke. See the text in xclap.spec.js named should exe task name return by function.

I'm not sure which is correct. Personally, the doc seems the more uniform behavior, since if I want a task executed, I merely need to say return [ 'taskname' ];

why did task order change from npm, pkg and files to file, npm and pkg?

The order changed from npm, pkg ,files(electrode) to file(electrode), npm, pkg in 0.2.21.
Scripts are dependent on this order, which order should we follow?

example
In 0.2.21

    "_nsOrder": {
        "_namespaces": [
            "electrode",
            "npm",
            "pkg"
        ],
        "_overrides": {
            "electrode": {
                "value": 1,
                "others": []
            },
            "npm": {
                "value": 1,
                "others": []
            },
            "pkg": {
                "value": 1,
                "others": []
            }
        }
    },

In 0.2.20

    "_nsOrder": {
        "_namespaces": [
            "npm",
            "pkg",
            "electrode"
        ],
        "_overrides": {
            "npm": {
                "value": 1,
                "others": []
            },
            "pkg": {
                "value": 1,
                "others": []
            },
            "electrode": {
                "value": 1,
                "others": []
            }
        }
    }

Simple example isn't working

I've created an xclap.js with the contents:

const xclap = require(`xclap`);
const tasks = {
  hello: `echo hello world`,
  js: () => console.log(`JS hello world`),
  both: {
    desc: `invoke tasks hello and js in serial order`,
    task: [`hello`, `js`]
  }
};
xclap.load(tasks);

And this is the output:

โžœ clap -f
[15:26:44] xclap version 0.2.12 at /Users/jwhitmarsh/.npm-packages/lib/node_modules/xclap
[15:26:44] NodeJS version v8.3.0 at /usr/local/bin/node
[15:26:44] CWD is /Users/jwhitmarsh/src/test-proj
[15:26:44] Loaded CWD/xclap.js
[15:26:44] No tasks found - please load some.

Usage: clap [options] [--] [task1 [task options] task2 [task options] ...]
 Help: clap -h  Example: clap build

jest's interactive --watch doesn't work

Jest's interactive --watch mode doesn't work when run with clap

To Reproduce:
Create clap task that runs jest --watch.

Expected: Watch mode gives you interactive menu to continue with
Outcome: watch mode just stalls after running tests

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.