tns-template-tab-navigation
Advanced tools
Comparing version 4.2.1 to 4.2.2
@@ -1,2 +0,2 @@ | ||
const application = require("application"); | ||
const application = require("tns-core-modules/application"); | ||
@@ -3,0 +3,0 @@ application.run({ moduleName: "app-root" }); |
@@ -1,2 +0,2 @@ | ||
const observableModule = require("data/observable"); | ||
const observableModule = require("tns-core-modules/data/observable"); | ||
@@ -3,0 +3,0 @@ function BrowseViewModel() { |
@@ -1,2 +0,2 @@ | ||
const observableModule = require("data/observable"); | ||
const observableModule = require("tns-core-modules/data/observable"); | ||
@@ -3,0 +3,0 @@ function HomeItemsViewModel() { |
@@ -1,2 +0,2 @@ | ||
const observableModule = require("data/observable"); | ||
const observableModule = require("tns-core-modules/data/observable"); | ||
@@ -3,0 +3,0 @@ function SearchViewModel() { |
const fs = require("fs"); | ||
const path = require("path"); | ||
const exec = require("child_process").exec; | ||
console.log("after-createProject script running..."); | ||
module.exports = function (hookArgs) { | ||
const srcGitignore = "dot.gitignore"; | ||
const destGitignore = ".gitignore"; | ||
let appRootFolder = hookArgs.projectDir; | ||
const srcGitignore = "dot.gitignore"; | ||
const destGitignore = ".gitignore"; | ||
let appRootFolder; | ||
return copyFile(srcGitignore, destGitignore) | ||
.then(() => { | ||
const toolsDir = path.join(appRootFolder, 'tools'); | ||
deleteFolderSync(toolsDir); | ||
findAppRootFolder() | ||
.then(() => { | ||
return copyFile(srcGitignore, destGitignore); | ||
}) | ||
.then(() => { | ||
console.log("Removing tools directory..."); | ||
const toolsDir = path.join(appRootFolder, 'tools'); | ||
deleteFolderSync(toolsDir); | ||
deleteFolderSync(__dirname); | ||
}) | ||
.catch((err) => { | ||
console.log(err); | ||
}); | ||
console.log("Removing after-createProject..."); | ||
deleteFolderSync(__dirname); | ||
}) | ||
.catch((err) => { | ||
console.log(err); | ||
}); | ||
function copyFile(srcFilename, destFilename = srcFilename) { | ||
return new Promise((resolve, reject) => { | ||
const sourcePath = path.join(appRootFolder, 'tools', srcFilename); | ||
const destPath = path.join(appRootFolder, destFilename); | ||
function copyFile(srcFilename, destFilename = srcFilename) { | ||
return new Promise((resolve, reject) => { | ||
const sourcePath = path.join(appRootFolder, 'tools', srcFilename); | ||
const destPath = path.join(appRootFolder, destFilename); | ||
fs.rename(sourcePath, destPath, (err) => { | ||
if (err) { | ||
return reject(err); | ||
} | ||
console.log(`Creating ${path.resolve(destPath)}...`); | ||
fs.rename(sourcePath, destPath, (err) => { | ||
if (err) { | ||
return reject(err); | ||
} | ||
resolve(); | ||
resolve(); | ||
}); | ||
}); | ||
}); | ||
} | ||
} | ||
function findAppRootFolder() { | ||
return new Promise((resolve, reject) => { | ||
// npm prefix returns the closest parent directory to contain a package.json file | ||
exec(`cd ${__dirname} && npm prefix`, (err, stdout) => { | ||
if (err) { | ||
return reject(err); | ||
} | ||
function deleteFolderSync(folderPath) { | ||
if (fs.statSync(folderPath).isDirectory()) { | ||
fs.readdirSync(folderPath).forEach((file) => { | ||
const content = path.join(folderPath, file); | ||
const contentDirs = fs.statSync(content).isDirectory(); | ||
appRootFolder = stdout.toString().trim(); | ||
resolve(); | ||
}); | ||
}); | ||
} | ||
if (contentDirs) { | ||
deleteFolderSync(content); | ||
} else { | ||
fs.unlinkSync(content); | ||
} | ||
}); | ||
function deleteFolderSync(folderPath) { | ||
if (fs.statSync(folderPath).isDirectory()) { | ||
fs.readdirSync(folderPath).forEach((file) => { | ||
const content = path.join(folderPath, file); | ||
const contentDirs = fs.statSync(content).isDirectory(); | ||
if (contentDirs) { | ||
deleteFolderSync(content); | ||
} | ||
else { | ||
fs.unlinkSync(content); | ||
} | ||
}); | ||
fs.rmdirSync(folderPath); | ||
fs.rmdirSync(folderPath); | ||
} | ||
} | ||
} | ||
} |
@@ -15,3 +15,3 @@ { | ||
"templateType": "App template", | ||
"version": "4.2.1", | ||
"version": "4.2.2", | ||
"description": "Tabbed interface template", | ||
@@ -18,0 +18,0 @@ "author": "Telerik <support@telerik.com>", |
Sorry, the diff of this file is not supported yet
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
0
2843057
486