From 96769867ed860834ae9af0dcc75d72033de1f089 Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Mon, 26 Oct 2020 19:42:23 -0700 Subject: [PATCH] fix(dev-infra): ensure hashbang is present in both published and local ng-devs (#39443) The node hash bang was incidentally removed in the published ng-dev, it should be included to allow for the command to be run without having to specify node. PR Close #39443 --- dev-infra/BUILD.bazel | 7 +++++++ dev-infra/cli.ts | 1 + dev-infra/ng-dev.js | 8 +------- package.json | 1 + yarn.lock | 19 +++++++++++++++++++ 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/dev-infra/BUILD.bazel b/dev-infra/BUILD.bazel index e3cdd2f5a2..d3e3bee4f2 100644 --- a/dev-infra/BUILD.bazel +++ b/dev-infra/BUILD.bazel @@ -26,12 +26,19 @@ ts_library( rollup_bundle( name = "cli_rollup", + args = [ + "--plugin", + "rollup-plugin-hashbang", + ], entry_point = ":cli.ts", format = "cjs", silent = True, sourcemap = "false", deps = [ ":cli", + # TODO(josephperrott): Determine if this plugin is the best method for ensuring the hashbang + # in both local and published use case. + "@npm//rollup-plugin-hashbang", ], ) diff --git a/dev-infra/cli.ts b/dev-infra/cli.ts index d61055be0e..979bcde5b0 100644 --- a/dev-infra/cli.ts +++ b/dev-infra/cli.ts @@ -1,3 +1,4 @@ +#!/usr/bin/env node /** * @license * Copyright Google LLC All Rights Reserved. diff --git a/dev-infra/ng-dev.js b/dev-infra/ng-dev.js index 7b26460334..d0742e26f9 100755 --- a/dev-infra/ng-dev.js +++ b/dev-infra/ng-dev.js @@ -1,3 +1,4 @@ +#!/usr/bin/env node 'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } @@ -6777,13 +6778,6 @@ function convertReferenceChainToString(chain) { return chain.join(' → '); } -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ yargs.scriptName('ng-dev') .middleware(captureLogOutputForCommand) .demandCommand() diff --git a/package.json b/package.json index c4417a9cf7..44276d589f 100644 --- a/package.json +++ b/package.json @@ -190,6 +190,7 @@ "nock": "^13.0.3", "ora": "^5.0.0", "rewire": "2.5.2", + "rollup-plugin-hashbang": "^2.2.2", "sauce-connect": "https://saucelabs.com/downloads/sc-4.6.2-linux.tar.gz", "semver": "^6.3.0", "ts-node": "^8.6.2", diff --git a/yarn.lock b/yarn.lock index b1cdef9e93..743592f9d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10087,6 +10087,13 @@ magic-string@0.25.7, magic-string@^0.25.2: dependencies: sourcemap-codec "^1.4.4" +magic-string@^0.22.4: + version "0.22.5" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.22.5.tgz#8e9cf5afddf44385c1da5bc2a6a0dbd10b03657e" + integrity sha512-oreip9rJZkzvA8Qzk9HFs8fZGF/u7H/gtrE8EN6RjKJ9kh2HlC+yQ2QezifqTZfGyiuAV0dRv5a+y/8gBb1m9w== + dependencies: + vlq "^0.2.2" + make-dir@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" @@ -13349,6 +13356,13 @@ rollup-plugin-commonjs@^10.1.0: resolve "^1.11.0" rollup-pluginutils "^2.8.1" +rollup-plugin-hashbang@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/rollup-plugin-hashbang/-/rollup-plugin-hashbang-2.2.2.tgz#971fc49b452e63f9dfdc75f79ae7256b3485e750" + integrity sha512-Yxw9ogeK3KncG1e4CvK0I0IKVBNeJP+DTZS3bExGTfGjw0WP1C7xxbY7LtRd8IKx4fFf53hz7XR1XG7UV6xqCw== + dependencies: + magic-string "^0.22.4" + rollup-plugin-node-resolve@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz#730f93d10ed202473b1fb54a5997a7db8c6d8523" @@ -15818,6 +15832,11 @@ vlq@0.2.2: resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.2.tgz#e316d5257b40b86bb43cb8d5fea5d7f54d6b0ca1" integrity sha1-4xbVJXtAuGu0PLjV/qXX9U1rDKE= +vlq@^0.2.2: + version "0.2.3" + resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.3.tgz#8f3e4328cf63b1540c0d67e1b2778386f8975b26" + integrity sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow== + vm-browserify@^1.0.1: version "1.1.2" resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"