-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daveed
committed
Sep 24, 2023
1 parent
dbcb415
commit 01fcac0
Showing
5 changed files
with
102 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const logger = require('../../utils/logger'); | ||
const config = require('../../core/project.config'); | ||
const _setup = require('../../commands/setup'); | ||
const fs = require('fs'); | ||
|
||
/** | ||
* Normally called as part of another command, but it can be used | ||
* directly for debugging purposes. | ||
* When given an output argument it will write the results and | ||
* additional information to disk in a json file. | ||
* | ||
* Default include-paths are pages and posts. | ||
* @param {string} argv.dest If present, write result to destination file | ||
*/ | ||
const setup = (argv) => { | ||
const { defaults } = config; | ||
|
||
_setup.run({ config: defaults }, argv.overwrite).then((project) => { | ||
// logger.log(); | ||
|
||
return project; | ||
}); | ||
}; | ||
|
||
const options = { | ||
overwrite: { | ||
default: false, | ||
description: `Overwrite existing files: not yet supported.`, | ||
}, | ||
}; | ||
|
||
module.exports = { | ||
command: `setup`, | ||
aliases: [], | ||
describe: `Attemps to create a _config.yml file and the necesary folders.`, | ||
builder: options, | ||
handler: setup, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const $q = require('q'); | ||
const logger = require('../utils/logger'); | ||
const config = require('../core/project.config'); | ||
const root = process.cwd(); | ||
const path = require('path'); | ||
|
||
// Actual collect file that the bin file calls after it processed the arguments or whatever | ||
const run = (project) => { | ||
const { writeYaml } = config; | ||
|
||
// @TODO: create folders described in _config files to avoid errors during first run | ||
|
||
writeYaml(project.config); | ||
logger.log(project.config); | ||
return $q.resolve(); | ||
}; | ||
|
||
module.exports = { | ||
run, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters