xaviergonz / makfy Goto Github PK
View Code? Open in Web Editor NEWmakfy - npm scripts on steroids!
License: MIT License
makfy - npm scripts on steroids!
License: MIT License
When using makfy in an environment where the SHELL
environment variable is not defined, will exit with the error "[ERROR] The "file" argument must be of type string. Received undefined". This is because on this line the assumption is made that SHELL
is always defined. However, this is not defined in Github Actions containers.
I'd suggest falling back to sh
if process.env.SHELL
is not defined, since that seems to work fine at least in the github actions case.
FYI you can use act to create a local github actions container in case you want to experiment with it yourself.
I'd like to autogenerate my package.json
from makfy
, including adding the makfy
scripts into it.
To do that, I would need to read the current makfyfile
, but I don't necessarily know where that it, so it would be nice if there was a getCommands()
function which simply returns the current configuration…
makfy is just what I've been looking for! There are a couple of things its missing to make it perfect for me but I'm happy to contribute.
Many of my commands are simple one-liners with not much else. The rest simply call other commands in series and parallel. This makes the full syntax quite verbose in places.
Could users optionally just set the command to array of commands which get passed straight to await exec(...)
? It appears this would still work even with stacked series/parallel arrays or commands.
module.exports = {
commands: {
clean: {
run: async (exec) => {
await exec('del-cli ./dist/**');
}
},
build: {
run: async (exec) => {
await exec('tsc --pretty');
}
}
}
};
becomes:
module.exports = {
commands: {
clean: ['del-cli ./dist/**'],
build: ['tsc --pretty']
}
};
Since right now async/await is only supported by node 7.6+, would it be interesting if makfy automatically babelized (if the file ends in .es6) and/or compiled using typescript (if the file ends in .ts) the makfyfile at runtime?
Or should we just assume node 8 will soon come and leave it up to users to babelize/typescript compile the file if they are using node 6.
Alternatively, using typescript could be cool since the whole thing already uses typescript and could export its types to make sure the makfyfile.ts file is well formed without having to run the program...
Thoughts?
When running makfy
from the global binary, the list of commands will always be empty. I looked at the code and it appears the global makfy
installation requires the local makfyfile.(js|ts), which in turn requires the local makfy
installation. So the global makfy
installation is never actually required by it and no commands are registered on it.
This might be fixable with something like intercepting require
calls to the local makfy installation and re-routing them to whichever instance is handling the current CLI call. Or maybe even requiring the local makfy installation and copying its commands back to the global one.
Would it be easy to make makfy
behave the same as makfy --list
? Having to type --list
is inconvenient…
when I run
await exec(
util.setEnvVar('NODE_ENV', 'development'),
args.inspect ? util.setEnvVar('DEBUG_SERVER', 'true') : null,
// TODO find a wp plugin that clears the output dir before writing
`rimraf ${buildPath}`,
`webpack --config ${wpConfPath} --watch --color`
)
with the --inspect
arg given, I get the error [ERROR] only one command can be run at the same time
. Without --inspect
it works fine.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.