Skip to content

Commit

Permalink
Add auditFix as a blockly-script and put in all existing plugin packa…
Browse files Browse the repository at this point in the history
…ge.json files
  • Loading branch information
rachel-fenichel committed Oct 14, 2020
1 parent 3e011b5 commit 7833c04
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 14 deletions.
2 changes: 1 addition & 1 deletion plugins/block-plus-minus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "2.0.12",
"description": "A group of blocks that replace the built-in mutator UI with a +/- based UI.",
"scripts": {
"audit:fix": "npm install && npm audit fix",
"audit:fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "blockly-scripts lint",
Expand Down
2 changes: 1 addition & 1 deletion plugins/block-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.1",
"description": "A group of Blockly test blocks.",
"scripts": {
"audit:fix": "npm install && npm audit fix",
"audit:fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "blockly-scripts lint",
Expand Down
2 changes: 1 addition & 1 deletion plugins/dev-create/templates/block/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"peerDependencies": {
"blockly": ">=2"
}
}
}
14 changes: 12 additions & 2 deletions plugins/dev-scripts/bin/blockly-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,19 @@
const args = process.argv.slice(2);
const {spawnSync} = require('child_process');

const available_scripts = [
'build',
'start',
'clean',
'predeploy',
'lint',
'test',
'postinstall',
'auditFix'
];

const script = args[0];
if (['build', 'start', 'clean', 'predeploy', 'lint', 'test', 'postinstall']
.includes(script)) {
if (available_scripts.includes(script)) {
const result = spawnSync('node',
[].concat(require.resolve('../scripts/' + script))
.concat(args.slice(1)), {stdio: 'inherit'}
Expand Down
24 changes: 24 additions & 0 deletions plugins/dev-scripts/scripts/auditFix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview An audit and fix script for Blockly extension packages.
* This script:
* - Runs `npm install` to get a clean (not locally linked) installation.
* - Runs `npm audit fix` to do the fixes.
* @author [email protected] (Rachel Fenichel)
*/
'use strict';

const execSync = require('child_process').execSync;

console.log(`Running npm audit fix steps for ${packageJson.name}`);

// Run npm install.
execSync(`npm install`, {stdio: [0, 1, 2] });

// Audit fix.
execSync(`npm audit fix`, {stdio: [0, 1, 2] });
2 changes: 1 addition & 1 deletion plugins/dev-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "2.0.3",
"description": "A library of common utilities for Blockly extension development.",
"scripts": {
"audit:fix": "npm install && npm audit fix",
"audit:fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "blockly-scripts lint",
Expand Down
2 changes: 1 addition & 1 deletion plugins/field-date/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "4.1.4",
"description": "A Blockly date picker field that uses the Google Closure date picker.",
"scripts": {
"audit:fix": "npm install && npm audit fix",
"audit:fix": "blockly-scripts auditFix",
"build": "gulp build",
"clean": "blockly-scripts clean",
"predeploy": "npm run build && blockly-scripts predeploy",
Expand Down
2 changes: 1 addition & 1 deletion plugins/field-slider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "2.1.4",
"description": "A Blockly slider field.",
"scripts": {
"audit:fix": "npm install && npm audit fix",
"audit:fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "blockly-scripts lint",
Expand Down
2 changes: 1 addition & 1 deletion plugins/modal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "2.1.3",
"description": "A Blockly plugin that creates a modal.",
"scripts": {
"audit:fix": "npm install && npm audit fix",
"audit:fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "blockly-scripts lint",
Expand Down
2 changes: 1 addition & 1 deletion plugins/nominal-connection-checker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"description": "A Blockly plugin for creating more advanced connection checks, targeted at nominally typed languages.",
"scripts": {
"audit:fix": "npm install && npm audit fix",
"audit:fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "blockly-scripts lint",
Expand Down
2 changes: 1 addition & 1 deletion plugins/strict-connection-checker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.1",
"description": "A Blockly plugin that makes connection checks strict.",
"scripts": {
"audit:fix": "npm install && npm audit fix",
"audit:fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "blockly-scripts lint",
Expand Down
2 changes: 1 addition & 1 deletion plugins/theme-modern/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "2.1.3",
"description": "A Blockly modern theme with darker block borders.",
"scripts": {
"audit:fix": "npm install && npm audit fix",
"audit:fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "blockly-scripts lint",
Expand Down
2 changes: 1 addition & 1 deletion plugins/typed-variable-modal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "3.1.3",
"description": "A Blockly plugin to create a modal for creating typed variables.",
"scripts": {
"audit:fix": "npm install && npm audit fix",
"audit:fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "blockly-scripts lint",
Expand Down
2 changes: 1 addition & 1 deletion plugins/workspace-search/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "2.1.3",
"description": "A Blockly plugin that adds workspace search support.",
"scripts": {
"audit:fix": "npm install && npm audit fix",
"audit:fix": "blockly-scripts auditFix",
"build": "blockly-scripts build",
"clean": "blockly-scripts clean",
"lint": "blockly-scripts lint",
Expand Down

0 comments on commit 7833c04

Please sign in to comment.