sapegin / mrm-core Goto Github PK
View Code? Open in Web Editor NEWUtilities to make tasks for Mrm
Home Page: https://github.com/sapegin/mrm
License: MIT License
Utilities to make tasks for Mrm
Home Page: https://github.com/sapegin/mrm
License: MIT License
Try to use comment-json to read and write JSON files in json module to preserve comments when updating.
The file generated by example of ini
misses the line root = true
. This line is never generated by editorconfig
neither.
const { ini } = require('mrm-core');
ini('.editorconfig', 'editorconfig.org')
.set('root', true)
.set('*', {
indent_style: 'tab',
end_of_line: 'lf'
})
.save();
{
"scripts": {
"test": "npm run test:jest"
}
}
// replaceScript('test', 'npm run lint')
{
"scripts": {
"test": "npm run lint"
}
}
{
"scripts": {
"test": "npm run test:jest"
}
}
// prependScript('test', 'npm run lint')
{
"scripts": {
"test": "npm run lint && npm run lint"
}
}
{
"scripts": {
"test": "npm run test:jest"
}
}
// appendScript('test', 'npm run lint')
{
"scripts": {
"test": "npm run lint && npm run lint"
}
}
When I tried the simple script with updating .travis.yml
file, I've got many formatting changes which are pretty annoying.
So the script could be like this
const { yaml } = require('mrm-core');
function task() {
yaml('.travis.yml')
.merge({ 'before_script': [
'./cc-test-reporter before-build'
]})
.save();
};
task.description = 'Update CodeClimate usage on Travis CI';
module.exports = task;
And a result I have:
provider: <5 spaces> s3
--> provider:<1 space> s3
on:
--> 'on':
# also update .node_version
-->
Is it possible to quickly update the YML parser at the project to mitigate this side-effects?
Thanks!
To test Node 4 projects, package.json engines
should include Node 4. Related build: https://travis-ci.org/webpack-contrib/file-loader/jobs/207915269 .
It would be more complete if we could also delete files in tasks.
Hey hey. Would love to have a flag added that would run all tasks available. Perhaps --all
?
With the directory structure...
.mrm
├── config.json
├── editorconfig
│ └── index.js
├── package.json
└── yarn.lock
... and editorconfig/index.js
consisting of (the example from this repo):
const { ini } = require('mrm-core')
ini('.editorconfig', 'editorconfig.org')
.set('_global', { root: true })
.set('*', {
indent_style: 'tab',
end_of_line: 'lf',
})
.save()
I get the .editorconfig
I would expect as output—but, with the following error:
👻 ➜ .mrm git:(master) ✗ mrm editorconfig
Running editorconfig...
Create .editorconfig
/Users/me/.config/yarn/global/node_modules/mrm/bin/mrm.js:36
throw err;
^
TypeError: module is not a function
at /Users/me/.config/yarn/global/node_modules/mrm/src/index.js:136:19
at new Promise (<anonymous>)
at runTask (/Users/me/.config/yarn/global/node_modules/mrm/src/index.js:121:9)
at run (/Users/me/.config/yarn/global/node_modules/mrm/src/index.js:81:9)
at /Users/me/.config/yarn/global/node_modules/mrm/src/index.js:71:12
at /Users/me/.config/yarn/global/node_modules/mrm/src/index.js:55:30
I think problem here
Line 11 in f21ca5b
The code on this line checks for the base script
to exist, when creating pre
and post
scripts.
However, scripts like prePublishOnly
can exists, without publishOnly
.
Do you think we should maintain a list of whitelisted scripts or remove the check for base script to exist?
lines.add()
appends new line at the end of the file. Sometimes line order matters and need to put a line before others. How about add a new method, or add option to current add()
, to insert new line(s) at head of file?
json('.eslintrc').delete()
Despite the install method is very handy, I found the version management a bit too restrictive.
It's nice to install latest, but it would be really nice to be able to specify a range to be able to install specific version / version range into a project.
Currently that "latest only" makes ht feature unusable for my use case and I ll have to rewrite this myself...
Package defines "memfs": "^2.6.0"
.
If ignore package-lock.json
, latest [email protected] will be installed. Test cases fail with [email protected]:
FAIL src/files/__tests__/packageJson.spec.js
● packageJson() › should create package.json file
expect(value).toMatchSnapshot()
Received value does not match stored snapshot 1.
- Snapshot
+ Received
Object {
+ "/": null,
"/package.json": "{}",
}
at Object.it (src/files/__tests__/packageJson.spec.js:37:24)
at new Promise (<anonymous>)
at <anonymous>
at process._tickCallback (../../../../../internal/process/next_tick.js:188:7)
master
branch failed. 🚨I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.
You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.
Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master
branch. You can also manually restart the failed CI job that runs semantic-release.
If you are not sure how to resolve this, here is some links that can help you:
If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.
The npm token configured in the NPM_TOKEN
environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/
.
If you are using Two-Factor Authentication, make configure the auth-only
level is supported. semantic-release cannot publish with the default auth-and-writes
level.
Please make sure to set the NPM_TOKEN
environment variable in your CI with the exact value of the npm token.
Good luck with your project ✨
Your semantic-release bot 📦🚀
I was curious if there is a chance of making the prettify step within the save function of ini files configurable?
This is how I would imagine the api.
ini('file.ini').save({ prettify: false });
I would be willing to implement, just asking ahead not to waste time.
PS. Thanks so much for this awesome project :)
All file related API's accepts the argument to the define file name/path.
json('foo.json')
If the path is absolute
, then it simply writes to that absolute path, which silently opens up the possibility to write contents to different directory by passing absolute paths.
json(join(someBasePath, 'foo.json'))
However, this is not possible with the packageJson
file. Do you think, we can accept the 2nd argument as the filePath?
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.