Skip to content
This repository has been archived by the owner on May 2, 2020. It is now read-only.

Commit

Permalink
closes #639
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptPilot authored and scriptPilot committed Oct 30, 2017
1 parent 7100453 commit 2fa0966
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

> This page is part of the [App Framework Documentation](DOCUMENTATION.md)
## Next version

### New features

- [x] [#639 - Add .editorconfig file](https://github.com/scriptPilot/app-framework/issues/639) ([read the docs](https://github.com/scriptPilot/app-framework/blob/master/docs/software.md))

## Version 1.16.18

Released on 2017-10-29
Expand Down
14 changes: 14 additions & 0 deletions config-scheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,20 @@
"type": "boolean",
"default": false
},
"editorConfig": {
"type": "object",
"default": {
"root": "true",
"[*]": null,
"indent_style": "space",
"indent_size": "2",
"charset": "utf-8",
"trim_trailing_whitespace": "true",
"insert_final_newline": "true",
"end_of_line": "lf",
"max_line_length": "null"
}
},
"eslint": {
"props": {
"extends": {
Expand Down
11 changes: 11 additions & 0 deletions demo/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@
"resetLocalStorageOnVersionChange": false,
"preloadImages": true,
"buildSourcemaps": false,
"editorConfig": {
"root": "true",
"[*]": null,
"indent_style": "space",
"indent_size": "2",
"charset": "utf-8",
"trim_trailing_whitespace": "true",
"insert_final_newline": "true",
"end_of_line": "lf",
"max_line_length": "null"
},
"eslint": {
"extends": "standard",
"rules": {}
Expand Down
1 change: 1 addition & 0 deletions docs/software.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ First of all, you need a code editor. We really recommend Atom, which is open so
6. Search for package `language-vue-component` and click on *install*
7. Close the settings tab and Atom itself

An *.editorconfig* file will be created / updated automatically. You can configure it in the *app/config.json* file, item `editorConfig`. To write a line without value, for example `[*]`, assign value `null`, else assign value as string or number.

## Node.js

Expand Down
3 changes: 2 additions & 1 deletion scripts/update-ignore-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const gitIgnore = {
'zip files (deprecated)': '*.zip',
'database backups (deprecated)': 'database-backup.json',
'FTP config file': 'ftp-config.json',
'ESLint configuration file': '.eslintrc'
'ESLint configuration file': '.eslintrc',
'Editor configuration file': '.editorconfig'
}

const npmIgnore = JSON.parse(JSON.stringify(gitIgnore))
Expand Down
23 changes: 23 additions & 0 deletions scripts/updateEditorConfigFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Purpose: Update .editorconfig file according app/config.json

// Import modules
const env = require('./env')
const fs = require('fs-extra')
const path = require('path')

// Check availability of the config
if (!env.cfg.editorConfig) throw new Error('Missing editorConfig item in config.json file.')

// Create file content
let content = ''

// Loop config options
for (let item in env.cfg.editorConfig) {
content = content + item + (env.cfg.editorConfig[item] ? ' = ' + env.cfg.editorConfig[item] : '') + '\n'
}

// Create/update .editorconfig file
fs.writeFile(path.resolve(env.app, '.editorconfig'), content, (err) => {
if (err) throw err
console.log('.editorconfig file updated.')
})

0 comments on commit 2fa0966

Please sign in to comment.