Skip to content

Commit

Permalink
tried, but failed
Browse files Browse the repository at this point in the history
  • Loading branch information
jjurman committed Aug 28, 2017
1 parent c826ce1 commit 9d9d846
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
9 changes: 6 additions & 3 deletions generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ module.exports = (options) => {

const processFile = (file, currentPath) => {
const filePath = path.join(currentPath, file)
const newFilePath = filePath.replace('template', options.name)
// console.log(currentPath)
const newFilePath = filePath.replace(path.join(__dirname, 'template'), options.name)
if (fs.existsSync(filePath) && fs.statSync(filePath).isDirectory()) {
// if it is the specs folder, and we don't have tests, don't include
if (!options.tests && filePath === 'template/specs') {
Expand All @@ -31,7 +32,7 @@ module.exports = (options) => {
}
if (file.match(/.*\..*\.js/)) {
// process a js template file
const jsFile = require(path.relative('../template/', filePath))
const jsFile = require(path.join(__dirname, 'template', filePath))
const resultFile = jsFile(options)

// remove trailing or starting newlines
Expand All @@ -55,7 +56,9 @@ module.exports = (options) => {
}
}

const filePath = './template'
const filePath = path.join(__dirname, 'template')
console.log("CREATING STUFF")
console.log(filePath)
const files = fs.readdirSync(filePath)
files.forEach((file) => processFile(file, filePath))
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "tram-one-express",
"version": "1.0.0",
"version": "1.0.7",
"description": "Generator to build Tram-One applications quickly",
"bin": "./prompts.js",
"files": [
"template",
"generate.js",
Expand Down
2 changes: 2 additions & 0 deletions prompts.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env node

const inquirer = require('inquirer')
const generate = require('./generate')

Expand Down

0 comments on commit 9d9d846

Please sign in to comment.