Merge pull request #1191 from NativeScript/hdeshev/bom-check

Check for UTF-8 BOM's in package.json files
This commit is contained in:
Hristo Deshev
2015-12-01 17:03:37 +02:00
92 changed files with 198 additions and 191 deletions

View File

@ -1,2 +1,2 @@
{ "name" : "application",
{ "name" : "application",
"main" : "application.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "absolute-layout-demo",
{ "name" : "absolute-layout-demo",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "testsapp",
{ "name" : "testsapp",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "editable-text-demo",
{ "name" : "editable-text-demo",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "gallery-app",
{ "name" : "gallery-app",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "modal-views-demo",
{ "name" : "modal-views-demo",
"main" : "app.js" }

View File

@ -1,4 +1,4 @@
{
{
"name" : "testsapp",
"main" : "app.js"
}

View File

@ -1,2 +1,2 @@
{ "name" : "ApplicationLoadTimeAndFPS",
{ "name" : "ApplicationLoadTimeAndFPS",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "ApplicationSize",
{ "name" : "ApplicationSize",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "ComplexObjectGraphMemoryTest",
{ "name" : "ComplexObjectGraphMemoryTest",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "ControlCreationSpeedTest",
{ "name" : "ControlCreationSpeedTest",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "LargeObjectArrayMemoryLeakTest",
{ "name" : "LargeObjectArrayMemoryLeakTest",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "LargeObjectArrayMemoryTest",
{ "name" : "LargeObjectArrayMemoryTest",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "NavigationMemoryLeakTest",
{ "name" : "NavigationMemoryLeakTest",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "NavigationTest",
{ "name" : "NavigationTest",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "SingleUIObjectMemoryLeakTest",
{ "name" : "SingleUIObjectMemoryLeakTest",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "SpeedTests",
{ "name" : "SpeedTests",
"main" : "app.js" }

View File

@ -1,4 +1,4 @@
{
{
"name" : "Performance Tests",
"main" : "./ApplicationSize/app.js"
}

View File

@ -1,2 +1,2 @@
{ "name" : "pickers-demo",
{ "name" : "pickers-demo",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "template-hello-world",
{ "name" : "template-hello-world",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "tab-view-demo",
{ "name" : "tab-view-demo",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "template-blank-app",
{ "name" : "template-blank-app",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "template-hello-world",
{ "name" : "template-hello-world",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "template-master-detail",
{ "name" : "template-master-detail",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "template-settings",
{ "name" : "template-settings",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "template-tab-navigation",
{ "name" : "template-tab-navigation",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "testsapp",
{ "name" : "testsapp",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "Tests",
{ "name" : "Tests",
"main" : "app/app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "testsapp",
{ "name" : "testsapp",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "styling",
{ "name" : "styling",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "MyControl",
{ "name" : "MyControl",
"main" : "MyControl.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "MyControl",
{ "name" : "MyControl",
"main" : "MyControl.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "xml-declaration",
{ "name" : "xml-declaration",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "ui-tests-app",
{ "name" : "ui-tests-app",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "web-view-demo",
{ "name" : "web-view-demo",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "wrap-layout-demo",
{ "name" : "wrap-layout-demo",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "xml-demo",
{ "name" : "xml-demo",
"main" : "app.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "camera",
{ "name" : "camera",
"main" : "camera.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "color",
{ "name" : "color",
"main" : "color.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "console",
{ "name" : "console",
"main" : "console.js" }

View File

@ -1,4 +1,4 @@
{
{
"name" : "observable-array",
"main" : "observable-array.js"
}

View File

@ -1,4 +1,4 @@
{
{
"name" : "observable",
"main" : "observable.js"
}

View File

@ -1,4 +1,4 @@
{
{
"name" : "virtual-array",
"main" : "virtual-array.js"
}

View File

@ -1,2 +1,2 @@
{ "name" : "file-system",
{ "name" : "file-system",
"main" : "file-system.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "fps-meter",
{ "name" : "fps-meter",
"main" : "fps-meter.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "globals",
{ "name" : "globals",
"main" : "globals.js" }

View File

@ -422,16 +422,6 @@ module.exports = function(grunt) {
NODE_PATH: localCfg.outModulesDir,
}
},
bom: {
allTargetFiles: {
src: [
pathModule.join(localCfg.outDir, "**/*.ts"),
pathModule.join(localCfg.outDir, "**/*.js"),
pathModule.join(localCfg.outDir, "**/*.css"),
pathModule.join(localCfg.outDir, "**/*.xml")
]
}
},
typedoc: {
build: {
options: {
@ -463,7 +453,6 @@ module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-shell");
grunt.loadNpmTasks("grunt-env");
grunt.loadNpmTasks("grunt-simple-mocha");
grunt.loadNpmTasks('grunt-bom-removal');
grunt.loadNpmTasks('grunt-typedoc');
var cloneTasks = function(originalTasks, taskNameSuffix) {
@ -564,6 +553,25 @@ module.exports = function(grunt) {
"copy:readyAppFiles",
"clean:readyAppFiles"
]);
grunt.registerTask("check-packagejson-boms", function() {
function hasBOM(filepath) {
var buf = grunt.file.read(filepath, { encoding: null });
return (buf[0] === 0xEF && buf[1] === 0xBB && buf[2] === 0xBF);
}
var packageDescriptors = grunt.file.expand({}, [
'**/package.json',
'!node_modules/**'
]);
var errors = packageDescriptors.map(function(packagePath) {
if (hasBOM(packagePath)) {
return "File " + packagePath + " contains a UTF-8 BOM.";
} else {
return null;
}
}).filter(function(errorMessage) { return !!errorMessage; });
if (errors.length > 0)
grunt.fail.fatal("\n" + errors.join("\n"));
});
grunt.registerTask("distribute-ts-apps-files", [
"copy:readyTsAppFiles"
]);
@ -606,8 +614,8 @@ module.exports = function(grunt) {
grunt.registerTask("compile-modules", [
"clean:build",
"shell:getGitSHA",
"check-packagejson-boms",
"compile-ts",
"bom:allTargetFiles",
"collect-modules-raw-files",
"copy:modulesPackageDef",
"copy:definitionFiles",

View File

@ -1,2 +1,2 @@
{ "name" : "http",
{ "name" : "http",
"main" : "http.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "image-source",
{ "name" : "image-source",
"main" : "image-source.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "location",
{ "name" : "location",
"main" : "location.js" }

View File

@ -18,7 +18,6 @@
"shelljs": "0.5.3",
"chai": "3.2.0",
"grunt": "0.4.5",
"grunt-bom-removal": "0.2.0",
"grunt-contrib-clean": "0.6.0",
"grunt-contrib-copy": "git+https://github.com/ErjanGavalji/grunt-contrib-copy.git#1c976a133210be4ce8c96313f5daf14833f7f8f9",
"grunt-env": "0.4.4",

View File

@ -1,2 +1,2 @@
{ "name" : "platform",
{ "name" : "platform",
"main" : "platform.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "text",
{ "name" : "text",
"main" : "text.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "timer",
{ "name" : "timer",
"main" : "timer.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "trace",
{ "name" : "trace",
"main" : "trace.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "activity-indicator",
{ "name" : "activity-indicator",
"main" : "activity-indicator.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "border",
{ "name" : "border",
"main" : "border.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "builder",
{ "name" : "builder",
"main" : "builder.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "button",
{ "name" : "button",
"main" : "button.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "content-view",
{ "name" : "content-view",
"main" : "content-view.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "date-picker",
{ "name" : "date-picker",
"main" : "date-picker.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "dialogs",
{ "name" : "dialogs",
"main" : "dialogs.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "editable-text-base",
{ "name" : "editable-text-base",
"main" : "editable-text-base.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "enums",
{ "name" : "enums",
"main" : "enums.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "frame",
{ "name" : "frame",
"main" : "frame.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "gestures",
{ "name" : "gestures",
"main" : "gestures.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "html-view",
{ "name" : "html-view",
"main" : "html-view.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "image-cache",
{ "name" : "image-cache",
"main" : "image-cache.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "image",
{ "name" : "image",
"main" : "image.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "label",
{ "name" : "label",
"main" : "label.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "absolute-layout",
{ "name" : "absolute-layout",
"main" : "absolute-layout.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "dock-layout",
{ "name" : "dock-layout",
"main" : "dock-layout.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "grid-layout",
{ "name" : "grid-layout",
"main" : "grid-layout.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "stack-layout",
{ "name" : "stack-layout",
"main" : "stack-layout.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "wrap-layout",
{ "name" : "wrap-layout",
"main" : "wrap-layout.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "list-picker",
{ "name" : "list-picker",
"main" : "list-picker.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "list-view",
{ "name" : "list-view",
"main" : "list-view.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "page",
{ "name" : "page",
"main" : "page.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "placeholder",
{ "name" : "placeholder",
"main" : "placeholder.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "progress",
{ "name" : "progress",
"main" : "progress.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "scroll-view",
{ "name" : "scroll-view",
"main" : "scroll-view.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "search-bar",
{ "name" : "search-bar",
"main" : "search-bar.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "segmented-bar",
{ "name" : "segmented-bar",
"main" : "segmented-bar.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "slider",
{ "name" : "slider",
"main" : "slider.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "styling",
{ "name" : "styling",
"main" : "styling.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "switch",
{ "name" : "switch",
"main" : "switch.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "ui/tab-view",
{ "name" : "ui/tab-view",
"main" : "tab-view.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "text-base",
{ "name" : "text-base",
"main" : "text-base.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "text-field",
{ "name" : "text-field",
"main" : "text-field.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "text-view",
{ "name" : "text-view",
"main" : "text-view.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "time-picker",
{ "name" : "time-picker",
"main" : "time-picker.js" }

View File

@ -1,2 +1,2 @@
{ "name" : "web-view",
{ "name" : "web-view",
"main" : "web-view.js" }