Do not copy "missing" files from default template (§5)
Fixes #24
Also don't create empty platforms & plugins dirs. These will be created
by Cordova when required.
diff --git a/index.js b/index.js
index ed6b4a0..5e03f9a 100644
--- a/index.js
+++ b/index.js
@@ -142,12 +142,6 @@
emit('verbose', 'Copying assets.');
fs.copySync(import_from_path, dir);
}
-
- // If following were not copied from template, copy from stock app hello world
- // TODO: get stock package.json if template does not contain package.json;
- copyIfNotExists(stockAssetPath('www'), path.join(dir, 'www'));
- copyIfNotExists(stockAssetPath('hooks'), path.join(dir, 'hooks'));
- copyIfNotExists(stockAssetPath('config.xml'), path.join(dir, 'config.xml'));
} catch (e) {
if (!dirAlreadyExisted) {
fs.removeSync(dir);
@@ -176,10 +170,6 @@
fs.writeFileSync(pkgjsonPath, JSON.stringify(pkgjson, null, 4), 'utf8');
}
- // Create basic project structure.
- fs.ensureDirSync(path.join(dir, 'platforms'));
- fs.ensureDirSync(path.join(dir, 'plugins'));
-
// Write out id, name and default version to config.xml
var configPath = path.join(dir, 'config.xml');
var conf = new ConfigParser(configPath);
@@ -196,22 +186,6 @@
: () => {};
}
-/**
- * Recursively copies folder to destination if folder is not found in destination (including symlinks).
- * @param {string} src for copying
- * @param {string} dst for copying
- * @return No return value
- */
-function copyIfNotExists (src, dst) {
- if (!fs.existsSync(dst) && src) {
- fs.copySync(src, dst);
- }
-}
-
-function stockAssetPath (p) {
- return path.join(require('cordova-app-hello-world').dirname, p);
-}
-
// Creates temp dir that is deleted on process exit
function getSelfDestructingTempDir () {
return tmp.dirSync({
diff --git a/spec/create.spec.js b/spec/create.spec.js
index f8b7e6e..e5f53d4 100644
--- a/spec/create.spec.js
+++ b/spec/create.spec.js
@@ -58,14 +58,8 @@
describe('create end-to-end', function () {
function checkCommonArtifacts () {
- // Check that top level dirs exist
- var dirs = ['hooks', 'platforms', 'plugins', 'www'];
- dirs.forEach(function (d) {
- expect(path.join(project, d)).toExist();
- });
-
- // Check that README.md exists inside of hooks
- expect(path.join(project, 'hooks', 'README.md')).toExist();
+ // Check that www dir exist
+ expect(path.join(project, 'www')).toExist();
// Check that index.html exists inside of www
expect(path.join(project, 'www', 'index.html')).toExist();