forked from node-cube/cube
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update esprima, update cubeignore, update version to 1.0.0
- Loading branch information
剪巽
committed
Dec 18, 2015
1 parent
be67302
commit 75b89e5
Showing
11 changed files
with
626 additions
and
196 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
**.min.js | ||
**/*.min.js | ||
example/** | ||
test/** | ||
node_modules/** | ||
runtime/cube_css.strict.js | ||
runtime/jade_runtime.js | ||
runtime/ejs_runtime.js |
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,69 @@ | ||
'use strict'; | ||
|
||
var fs = require('xfs'); | ||
var path = require('path'); | ||
|
||
function filePath(file) { | ||
var base = getCwd(); | ||
return path.join(base, file); | ||
} | ||
function checkFile(file) { | ||
return fs.existsSync(filePath(file)); | ||
} | ||
|
||
function getCwd() { | ||
return process.cwd(); | ||
} | ||
|
||
module.exports = function (option) { | ||
// TODO init project | ||
// copy cube.js | ||
if (!checkFile('./cube.min.js') || option.force) { | ||
var codeCube = fs.readFileSync(sourcePath('./runtime/cube.min.js')).toString(); | ||
if (option.css) { | ||
console.log('enable mcss'); | ||
codeCube += '\n//cube_css.min.js\n' + fs.readFileSync(sourcePath('./runtime/cube_css.min.js')); | ||
optmizeInfo(); | ||
} | ||
fs.sync().save(filePath('./cube.min.js'), codeCube); | ||
|
||
if (option.jade) { | ||
console.log('enable jade'); | ||
codeCube = '\n//jade_runtime\n' + fs.readFileSync(sourcePath('./runtime/jade_runtime.min.js')); | ||
fs.sync().save(filePath('./node_modules/jade_runtime.js'), codeCube); | ||
} | ||
if (option.ejs) { | ||
console.log('enable ejs'); | ||
codeCube = '\n//ejs_runtime\n' + fs.readFileSync(sourcePath('./runtime/ejs_runtime.min.js')); | ||
fs.sync().save(filePath('./node_modules/ejs_runtime.js'), codeCube); | ||
} | ||
console.log('inited cube.min.js'); | ||
} else { | ||
console.log('file already exist: ./cube.min.js'); | ||
} | ||
if (!checkFile('./start.html')) { | ||
fs.sync().save(filePath('./start.html'), fs.readFileSync(sourcePath('./runtime/start.html'))); | ||
console.log('inited start.html'); | ||
} else { | ||
console.log('file already exist: ./start.html'); | ||
} | ||
if (!checkFile('./package.json')) { | ||
fs.sync().save(filePath('./package.json'), fs.readFileSync(sourcePath('./runtime/cube.json'))); | ||
console.log('inited cube.json'); | ||
} else { | ||
console.log('file already exist: ./cube.json'); | ||
} | ||
if (!checkFile('./main.js')) { | ||
fs.sync().save(filePath('./main.js'), | ||
'document.getElementById("msg").innerHTML = "hello, Cube";\n' + | ||
'document.getElementById("show").value = document.getElementById("initscript").innerHTML;\n' + | ||
'exports.run = function () {console.log("app started!")};' | ||
); | ||
console.log('inited main.js'); | ||
} else { | ||
console.log('file already exist: ./main.js'); | ||
} | ||
fs.sync().mkdir('test'); | ||
|
||
console.log('successfully inited'); | ||
} |
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 |
---|---|---|
@@ -1 +1,5 @@ | ||
/lib/ | ||
[skip] | ||
/lib/ | ||
|
||
[ignore] | ||
/test/test_ignore.js |
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 @@ | ||
test_ignore |
Oops, something went wrong.