diff --git a/package-lock.json b/package-lock.json index f17c26c..7eace19 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,7 +41,6 @@ "rollup": "^2.45.2", "rollup-plugin-cleanup": "^3.2.1", "rollup-plugin-delete": "^2.0.0", - "rollup-plugin-execute": "^1.1.1", "rollup-plugin-typescript2": "^0.30.0", "ts-jest": "^27.0.3", "tsconfig-paths-webpack-plugin": "^3.5.1", @@ -7009,12 +7008,6 @@ "node": ">=10" } }, - "node_modules/rollup-plugin-execute": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-execute/-/rollup-plugin-execute-1.1.1.tgz", - "integrity": "sha512-isCNR/VrwlEfWJMwsnmt5TBRod8dW1IjVRxcXCBrxDmVTeA1IXjzeLSS3inFBmRD7KDPlo38KSb2mh5v5BoWgA==", - "dev": true - }, "node_modules/rollup-plugin-typescript2": { "version": "0.30.0", "resolved": "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.30.0.tgz", @@ -13436,12 +13429,6 @@ "del": "^5.1.0" } }, - "rollup-plugin-execute": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-execute/-/rollup-plugin-execute-1.1.1.tgz", - "integrity": "sha512-isCNR/VrwlEfWJMwsnmt5TBRod8dW1IjVRxcXCBrxDmVTeA1IXjzeLSS3inFBmRD7KDPlo38KSb2mh5v5BoWgA==", - "dev": true - }, "rollup-plugin-typescript2": { "version": "0.30.0", "resolved": "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.30.0.tgz", diff --git a/package.json b/package.json index fbaeaa1..acd699c 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "rollup": "^2.45.2", "rollup-plugin-cleanup": "^3.2.1", "rollup-plugin-delete": "^2.0.0", - "rollup-plugin-execute": "^1.1.1", "rollup-plugin-typescript2": "^0.30.0", "ts-jest": "^27.0.3", "tsconfig-paths-webpack-plugin": "^3.5.1", diff --git a/rollup.config.js b/rollup.config.js index dd6e754..2fc6916 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,9 +1,10 @@ import typescript from 'rollup-plugin-typescript2'; import { join } from 'path'; import { readdirSync } from 'fs'; -import execute from 'rollup-plugin-execute'; import del from 'rollup-plugin-delete'; import cleanup from 'rollup-plugin-cleanup'; +import { spawnSync } from 'child_process'; + const cliConfig = require('./config/cliConfig.json'); @@ -78,14 +79,13 @@ export default [ }, plugins: [ ...plugins, - ((rollupPlugin) => ({ - ...rollupPlugin, - // Moving to a later lifecycle hook as generateBundle has not written - // the file disk yet. Removing execution from generateBundle hook and - // moved it to the writeBundle hook. - writeBundle: rollupPlugin.generateBundle, - generateBundle: undefined, - }))(execute(`chmod +x dist/${cliConfig.name}`)), + // add execute permission to the executable + { + name: 'writeBundle', + writeBundle: () => { + spawnSync(`chmod`, ['u+x', `dist/${cliConfig.name}`]); + } + }, !process.env.ROLLUP_WATCH ? del({ targets: 'dist/**/*' }) : undefined, ], },