Skip to content

Commit

Permalink
fix paths and folders
Browse files Browse the repository at this point in the history
  • Loading branch information
diogomoretti committed Mar 24, 2019
1 parent 0d4ff16 commit ff37704
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
Empty file modified cli/index.js
100644 → 100755
Empty file.
7 changes: 4 additions & 3 deletions cli/javali/create.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require('fs')
const path = require('path').join
const fullPath = require('path')
const ncp = require('ncp').ncp
const runPath = process.cwd()
const template = require('./template')
Expand All @@ -16,14 +17,14 @@ const isFolderExistsSync = dir => {

const create = app => {
const fullPathFolder = path(runPath, app)
const fullPathTemplate = path(runPath, 'template')
const fullPathTemplate = path(fullPath.resolve(__dirname), '../../template')

if (isFolderExistsSync(app)) {
if (isFolderExistsSync(fullPathFolder)) {
log(`Folder "${app}" already exists`, 'error')
} else {
ncp(fullPathTemplate, fullPathFolder, err => {
if (err) {
return console.error(err)
return log('Error while copying files', 'error')
}
log(`Project folder "${app}" was created =]`, 'success')
template(app)
Expand Down
8 changes: 3 additions & 5 deletions cli/javali/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require('fs')
const log = require('./log')
const manager = require('./manager')
const path = require('path').join
const runPath = process.cwd()
const fullPath = require('path')

_.templateSettings = {
evaluate: /{{([\s\S]+?)}}/g,
Expand All @@ -13,7 +13,7 @@ _.templateSettings = {
}

async function run (app) {
await recursive(path(runPath, app), ['.DS_Store'], (err, files) => {
await recursive(path(fullPath.resolve(__dirname), '../../template'), ['.DS_Store'], (err, files) => {
if (!err) {
const managerType = manager()
const cmd = (managerType === 'yarn') ? 'yarn' : 'npm run'
Expand All @@ -33,9 +33,7 @@ async function run (app) {
log(err, 'error')
}
})
setTimeout(() => {
log(`To get started, run: "cd ${app} && ${cmd} start"`)
}, 300)
log(`To get started, run: "cd ${app} && ${cmd} start"`)
}
})
}
Expand Down
6 changes: 3 additions & 3 deletions template/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "{{= appName }}",
"name": "test",
"version": "0.1.0",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
Expand All @@ -23,11 +23,11 @@
"concurrently": "^4.1.0"
},
"scripts": {
"prepare": "{{= appCmd }} build",
"prepare": "yarn build",
"build": "rollup -c",
"watch": "rollup -c -w",
"server": "live-server --port=7000 -q --no-browser",
"start": "concurrently \"{{= appManager }}:watch\" \"{{= appManager }}:server\"",
"start": "concurrently \"yarn:watch\" \"yarn:server\"",
"test": "jest"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion template/readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 🐗 {{= appName }}
# 🐗 test

> My awesome lib created by [Javali](https://github.com/diogomoretti/javali)

0 comments on commit ff37704

Please sign in to comment.