diff --git a/sass-linux-ia32/package.json b/sass-linux-ia32/package.json index ab2b667..7bb5331 100644 --- a/sass-linux-ia32/package.json +++ b/sass-linux-ia32/package.json @@ -12,5 +12,8 @@ ], "cpu": [ "ia32" - ] + ], + "scripts": { + "postinstall": "node ./postinstall.js" + } } diff --git a/sass-linux-ia32/postinstall.js b/sass-linux-ia32/postinstall.js new file mode 100644 index 0000000..da3a5af --- /dev/null +++ b/sass-linux-ia32/postinstall.js @@ -0,0 +1,23 @@ +"use strict"; + +const { name, os, cpu } = require("./package.json"); + +if (os && !os.includes(process.platform)) { + throw new Error( + `${name} does not support the platform you are using. You are using: "${ + process.platform + }" and ${name} supports: ${os.join( + "," + )}. If you think this is a mistake, please contact Origami or open an issue on https://github.com/Financial-Times/sass/issues` + ); +} + +if (cpu && !cpu.includes(process.arch)) { + throw new Error( + `${name} does not support the cpu you are using. You are using: "${ + process.arch + }" and ${name} supports: ${cpu.join( + "," + )}. If you think this is a mistake, please contact Origami or open an issue on https://github.com/Financial-Times/sass/issues` + ); +} diff --git a/sass-linux-x64/package.json b/sass-linux-x64/package.json index 4cf4212..07b6905 100644 --- a/sass-linux-x64/package.json +++ b/sass-linux-x64/package.json @@ -12,5 +12,8 @@ ], "cpu": [ "x64" - ] + ], + "scripts": { + "postinstall": "node ./postinstall.js" + } } diff --git a/sass-linux-x64/postinstall.js b/sass-linux-x64/postinstall.js new file mode 100644 index 0000000..da3a5af --- /dev/null +++ b/sass-linux-x64/postinstall.js @@ -0,0 +1,23 @@ +"use strict"; + +const { name, os, cpu } = require("./package.json"); + +if (os && !os.includes(process.platform)) { + throw new Error( + `${name} does not support the platform you are using. You are using: "${ + process.platform + }" and ${name} supports: ${os.join( + "," + )}. If you think this is a mistake, please contact Origami or open an issue on https://github.com/Financial-Times/sass/issues` + ); +} + +if (cpu && !cpu.includes(process.arch)) { + throw new Error( + `${name} does not support the cpu you are using. You are using: "${ + process.arch + }" and ${name} supports: ${cpu.join( + "," + )}. If you think this is a mistake, please contact Origami or open an issue on https://github.com/Financial-Times/sass/issues` + ); +} diff --git a/sass-macos-x64/package.json b/sass-macos-x64/package.json index 574c5ed..6319dde 100644 --- a/sass-macos-x64/package.json +++ b/sass-macos-x64/package.json @@ -9,5 +9,8 @@ }, "os": [ "darwin" - ] + ], + "scripts": { + "postinstall": "node ./postinstall.js" + } } diff --git a/sass-macos-x64/postinstall.js b/sass-macos-x64/postinstall.js new file mode 100644 index 0000000..da3a5af --- /dev/null +++ b/sass-macos-x64/postinstall.js @@ -0,0 +1,23 @@ +"use strict"; + +const { name, os, cpu } = require("./package.json"); + +if (os && !os.includes(process.platform)) { + throw new Error( + `${name} does not support the platform you are using. You are using: "${ + process.platform + }" and ${name} supports: ${os.join( + "," + )}. If you think this is a mistake, please contact Origami or open an issue on https://github.com/Financial-Times/sass/issues` + ); +} + +if (cpu && !cpu.includes(process.arch)) { + throw new Error( + `${name} does not support the cpu you are using. You are using: "${ + process.arch + }" and ${name} supports: ${cpu.join( + "," + )}. If you think this is a mistake, please contact Origami or open an issue on https://github.com/Financial-Times/sass/issues` + ); +} diff --git a/sass-windows-ia32/package.json b/sass-windows-ia32/package.json index b197791..76b368f 100644 --- a/sass-windows-ia32/package.json +++ b/sass-windows-ia32/package.json @@ -12,5 +12,8 @@ ], "cpu": [ "ia32" - ] + ], + "scripts": { + "postinstall": "node ./postinstall.js" + } } diff --git a/sass-windows-ia32/postinstall.js b/sass-windows-ia32/postinstall.js new file mode 100644 index 0000000..da3a5af --- /dev/null +++ b/sass-windows-ia32/postinstall.js @@ -0,0 +1,23 @@ +"use strict"; + +const { name, os, cpu } = require("./package.json"); + +if (os && !os.includes(process.platform)) { + throw new Error( + `${name} does not support the platform you are using. You are using: "${ + process.platform + }" and ${name} supports: ${os.join( + "," + )}. If you think this is a mistake, please contact Origami or open an issue on https://github.com/Financial-Times/sass/issues` + ); +} + +if (cpu && !cpu.includes(process.arch)) { + throw new Error( + `${name} does not support the cpu you are using. You are using: "${ + process.arch + }" and ${name} supports: ${cpu.join( + "," + )}. If you think this is a mistake, please contact Origami or open an issue on https://github.com/Financial-Times/sass/issues` + ); +} diff --git a/sass-windows-x64/package.json b/sass-windows-x64/package.json index c2ce832..1dd39e0 100644 --- a/sass-windows-x64/package.json +++ b/sass-windows-x64/package.json @@ -12,5 +12,8 @@ ], "cpu": [ "x64" - ] + ], + "scripts": { + "postinstall": "node ./postinstall.js" + } } diff --git a/sass-windows-x64/postinstall.js b/sass-windows-x64/postinstall.js new file mode 100644 index 0000000..da3a5af --- /dev/null +++ b/sass-windows-x64/postinstall.js @@ -0,0 +1,23 @@ +"use strict"; + +const { name, os, cpu } = require("./package.json"); + +if (os && !os.includes(process.platform)) { + throw new Error( + `${name} does not support the platform you are using. You are using: "${ + process.platform + }" and ${name} supports: ${os.join( + "," + )}. If you think this is a mistake, please contact Origami or open an issue on https://github.com/Financial-Times/sass/issues` + ); +} + +if (cpu && !cpu.includes(process.arch)) { + throw new Error( + `${name} does not support the cpu you are using. You are using: "${ + process.arch + }" and ${name} supports: ${cpu.join( + "," + )}. If you think this is a mistake, please contact Origami or open an issue on https://github.com/Financial-Times/sass/issues` + ); +}