Permalink
Browse files

closes #707

  • Loading branch information...
scriptPilot committed Nov 1, 2017
1 parent d0ef3b1 commit 6fdef14177aa20c74ac3538432173923bbf13e67
View
@@ -1,38 +1,14 @@
# This file is updated automatically - Please do not change!
# This file is updated automatically, please add or remove files in the configuration file.
# Exclude Allway Sync folder
_SYNCAPP/
# Exclude Git folder
.git/
# Exclude node modules (with cache)
node_modules/
# Exclude project snapshots
snapshots/
# Exclude macOS system files
.DS_Store
# Exclude development mode enabling file
.enable-dev-mode
# Exclude log files
*.log*
# Exclude zip files (deprecated)
*.zip
# Exclude database backups (deprecated)
.DS_Store
.editorconfig
.enable-dev-mode
.eslintrc
.git/
_SYNCAPP/
database-backup.json
# Exclude FTP config file
ftp-config.json
# Exclude ESLint configuration file
.eslintrc
# Exclude Editor configuration file
.editorconfig
node_modules/
snapshots/
View
@@ -1,53 +1,19 @@
# This file is updated automatically - Please do not change!
# This file is updated automatically, please add or remove files in the configuration file.
# Exclude Allway Sync folder
_SYNCAPP/
# Exclude Git folder
.git/
# Exclude node modules (with cache)
node_modules/
# Exclude project snapshots
snapshots/
# Exclude macOS system files
.DS_Store
# Exclude development mode enabling file
.enable-dev-mode
# Exclude log files
*.log*
# Exclude zip files (deprecated)
*.zip
# Exclude database backups (deprecated)
database-backup.json
# Exclude FTP config file
ftp-config.json
# Exclude ESLint configuration file
.eslintrc
# Exclude Editor configuration file
.DS_Store
.editorconfig
# Exclude Build folder
.enable-dev-mode
.eslintrc
.git/
DOCUMENTATION.md
_SYNCAPP/
build/
# Exclude Demo folder
database-backup.json
demo/
# Exclude Documentation folder
docs/
# Exclude Documentation file
DOCUMENTATION.md
# Exclude media folder
ftp-config.json
media/
node_modules/
snapshots/
View
@@ -2,6 +2,12 @@
> This page is part of the [App Framework Documentation](DOCUMENTATION.md)
## Next version
### New features
- [x] [#707 - Make .npmignore and .gitignore configurable](https://github.com/scriptPilot/app-framework/issues/707) ([read the docs](https://github.com/scriptPilot/app-framework/blob/master/docs/ignoreFiles.md))
## Version 1.17.1
Released on 2017-10-31
View
@@ -18,6 +18,7 @@ For any open question, feature request or bug, please use our [issue list](https
## Workflow
- [Setup your project](docs/setup.md)
- [Configure .gitignore and .npmignore files](docs/ignoreFiles.md)
- [Design your application](docs/design.md)
- Develop your application
- [App component](docs/app-component.md)
View
@@ -227,5 +227,11 @@
"devServerPort": {
"regexp": "/^[0-9]{4}$/",
"default": "8080"
},
"gitignore": {
"type": "object"
},
"npmignore": {
"type": "object"
}
}
View
@@ -74,5 +74,7 @@
},
"fixCodeOnTest": true,
"fixCodeOnBuild": true,
"devServerPort": "8080"
"devServerPort": "8080",
"gitignore": {},
"npmignore": {}
}
View
@@ -0,0 +1,20 @@
# Configure .gitignore and .npmignore files
> This page is part of the [App Framework Documentation](../DOCUMENTATION.md)
<br />
The *.gitignore* and *.npmignore* files are updated automatically, based on a default configuration.
You can overwrite this configuration in `gitignore` and `npmignore` objects in the *app/config.json* file.
Example: Add a custom folder to the *.npmignore* file and remove the *.editorconfig* file
```
"npmignore": {
"customFolder/": true,
".editorconfig": false
}
```
`true` means, the path will be listed in the ignore file.
@@ -0,0 +1,16 @@
// Purpose: Apply configuration to the project files
// Import modules
const alert = require('./alert')
// Import jobs
const updateIgnoreFiles = require('./jobs/updateIgnoreFiles')
// Run jobs
updateIgnoreFiles
.then(() => {
alert('Configuration applied successfully.')
})
.catch((err) => {
alert('Failed to apply the configuration.', 'issue')
})
View
@@ -290,7 +290,7 @@ fixCode(function () {
cmd(__dirname, 'node addLoginPopup', function () {
updateLicense(function () {
updateDocumentation(function () {
cmd(__dirname, 'node update-ignore-files', function () {
cmd(__dirname, 'node applyConfiguration', function () {
fs.emptyDir(abs(env.cache, 'build'), function (err) {
if (err) {
alert('Failed to empty build folder in cache.', 'issue')
View
@@ -0,0 +1,35 @@
{
"gitignore": {
"_SYNCAPP/": true,
".git/": true,
"node_modules/": true,
"snapshots/": true,
".DS_Store": true,
".enable-dev-mode": true,
"*.log*": true,
"*.zip": true,
"database-backup.json": true,
"ftp-config.json": true,
".eslintrc": true,
".editorconfig": true
},
"npmignore": {
"_SYNCAPP/": true,
".git/": true,
"node_modules/": true,
"snapshots/": true,
".DS_Store": true,
".enable-dev-mode": true,
"*.log*": true,
"*.zip": true,
"database-backup.json": true,
"ftp-config.json": true,
".eslintrc": true,
".editorconfig": true,
"build/": true,
"demo/": true,
"docs/": true,
"DOCUMENTATION.md": true,
"media/": true
}
}
@@ -0,0 +1,37 @@
// Purpose: Update .gitignore and .npmignore files bases on the scripts and app configuration
// Load modules
const path = require('../path')
const fs = require('fs-extra')
const _ = require('lodash')
// Export promise
module.exports = new Promise((resolve, reject) => {
// Load configuration files
const scriptConfig = fs.readJsonSync(path.scripts('config.json'))
const appConfig = fs.readJsonSync(path.app('config.json'))
// Define function to update file
const updateFile = (type) => {
// Check parameters
if (type !== 'git' && type !== 'npm') throw new Error('Type must be either "git" or "npm".')
// Merge configurations
const mergedConfig = _.merge(scriptConfig[`${type}ignore`], appConfig[`${type}ignore`])
// Filter and sort config
const sortedConfig = _(mergedConfig).toPairs().filter([1, true]).sortBy(0).fromPairs().value()
// Create file content
let fileContent = '# This file is updated automatically, please add or remove files in the configuration file.\n\n'
_.forEach(sortedConfig, (toBeIgnored, filePath) => fileContent += filePath + '\n')
// Create/update file
fs.writeFileSync(path.pkg('.' + type + 'ignore'), fileContent)
}
// Run function
updateFile('git')
updateFile('npm')
// Resolve Promise
resolve()
})
View
@@ -25,16 +25,6 @@ let fs = require('fs-extra')
let abs = require('path').resolve
const path = require('path')
// Step: Prepare the project folder setup
let prepareSetup = function (callback) {
if (env.installed) {
// Rename .npmignore to .gitignore
if (found(__dirname, '../.npmignore')) fs.renameSync(abs(__dirname, '../.npmignore'), abs(__dirname, '../.gitignore'))
if (found(__dirname, '../.npmignore')) fs.renameSync(abs(__dirname, '../.npmignore'), abs(__dirname, '../.gitignore'))
}
callback()
}
// Step: Prune node folder
let pruneModules = function (callback) {
alert('Node modules folder clean-up ongoing - please wait ...')
@@ -169,19 +159,17 @@ completePackageJson(() => {
cmd(__dirname, 'node modifications16plus', function () {
pruneModules(function () {
removeCache(function () {
prepareSetup(function () {
setupAppFolder(function () {
setupProjectFolder(function () {
updateScriptsAndVersion(function () {
cmd(__dirname, 'node updateEditorConfigFile', function () {
cmd(__dirname, 'node update-ignore-files', function () {
// Fix configuration
let configFix = jsonScheme.fix(abs(__dirname, '../config-scheme.json'), abs(env.app, 'config.json'))
if (Array.isArray(configFix)) {
alert('Failed to fix config file.\nDetails:\n- ' + configFix.join('\n- '), 'issue', 'error')
}
alert('App Framework installation done.\n\nPlease take a look at the change log:\nhttps://github.com/scriptPilot/app-framework/blob/master/CHANGELOG.md')
})
setupAppFolder(function () {
setupProjectFolder(function () {
updateScriptsAndVersion(function () {
cmd(__dirname, 'node updateEditorConfigFile', function () {
cmd(__dirname, 'node update-ignore-files', function () {
// Fix configuration
let configFix = jsonScheme.fix(abs(__dirname, '../config-scheme.json'), abs(env.app, 'config.json'))
if (Array.isArray(configFix)) {
alert('Failed to fix config file.\nDetails:\n- ' + configFix.join('\n- '), 'issue', 'error')
}
alert('App Framework installation done.\n\nPlease take a look at the change log:\nhttps://github.com/scriptPilot/app-framework/blob/master/CHANGELOG.md')
})
})
})

This file was deleted.

Oops, something went wrong.

0 comments on commit 6fdef14

Please sign in to comment.