From aa2dca522fab1bc1b82eab389584718c033310f4 Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Sat, 27 Jul 2019 15:38:07 +0900 Subject: [PATCH 01/23] Change the package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 826990a..1da4eab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kazssym/redirect", - "version": "1.0.0-beta.1", + "version": "1.0.0-beta.2", "homepage": "https://vx68k.bitbucket.io/redirect.js/", "license": "MIT", "files": [ From 2ca8398fe6fc0a1693f539b21939c46f63451e08 Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Sat, 27 Jul 2019 15:44:23 +0900 Subject: [PATCH 02/23] Add package keywords --- package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package.json b/package.json index 1da4eab..ec38f5b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,11 @@ { "name": "@kazssym/redirect", "version": "1.0.0-beta.2", + "keywords": [ + "browser", + "es2015", + "module" + ], "homepage": "https://vx68k.bitbucket.io/redirect.js/", "license": "MIT", "files": [ From 770513350ed6e17fd6eb696d2d6a9f91e23502c5 Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Mon, 29 Jul 2019 21:02:12 +0900 Subject: [PATCH 03/23] Add the description --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index ec38f5b..eb3fee0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "@kazssym/redirect", "version": "1.0.0-beta.2", + "description": "Module script to redirect web browsers to another location without any server configuration.", "keywords": [ "browser", "es2015", From 0cffd663b7695ea797250f67dbf49a6ccaa2d6f3 Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Mon, 29 Jul 2019 21:11:32 +0900 Subject: [PATCH 04/23] Add the author information --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index eb3fee0..b6cca7e 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,10 @@ ], "homepage": "https://vx68k.bitbucket.io/redirect.js/", "license": "MIT", + "author": { + "name": "Kaz Nishimura", + "email": "kazssym@linuxfront.com" + }, "files": [ "prepack.sh", "**/*.js" From 63bdfe191fa0adcab9e13a4cb8f9a2a07ea11bb5 Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Mon, 29 Jul 2019 21:14:40 +0900 Subject: [PATCH 05/23] Change the package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b6cca7e..7bbb6ef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kazssym/redirect", - "version": "1.0.0-beta.2", + "version": "1.0.0-beta.3", "description": "Module script to redirect web browsers to another location without any server configuration.", "keywords": [ "browser", From 25dcc1ee7be0a2ef9398e10394a80630fabec70b Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Mon, 29 Jul 2019 21:15:35 +0900 Subject: [PATCH 06/23] Change the version for the next release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7bbb6ef..9b0acfc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kazssym/redirect", - "version": "1.0.0-beta.3", + "version": "1.0.0-beta.4", "description": "Module script to redirect web browsers to another location without any server configuration.", "keywords": [ "browser", From e5326bf046e39b33f702a4497f820d6bd333350f Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Tue, 30 Jul 2019 14:16:45 +0900 Subject: [PATCH 07/23] Edit the README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8c7cc1f..3d12800 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ This file documents the `redirect.js` script. # Description -The `redirect.js` script redirects modern web browsers to another location -without any server configuration. +The `redirect.js` script redirects web browsers to another location without +any server configuration. It is *not a script for Node.js* but for web browsers. [![(License)](https://img.shields.io/badge/license-MIT-blue.svg)][MIT] From d1fdaacb5a39ca6fcb3777058c970e343ed3ffde Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Tue, 30 Jul 2019 14:26:27 +0900 Subject: [PATCH 08/23] Edit the README file --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3d12800..068d3d1 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ This file documents the `redirect.js` script. # Description -The `redirect.js` script redirects web browsers to another location without -any server configuration. +The `redirect.js` script redirects web browsers to another location *without +any server configuration*. It is *not a script for Node.js* but for web browsers. [![(License)](https://img.shields.io/badge/license-MIT-blue.svg)][MIT] From 3baee082c66defa2b3f092a66b1240f277e30be7 Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Wed, 7 Aug 2019 13:42:54 +0900 Subject: [PATCH 09/23] Add new constant --- redirect.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/redirect.js b/redirect.js index c90028b..b564ef7 100644 --- a/redirect.js +++ b/redirect.js @@ -50,6 +50,13 @@ */ const PACKAGE_VERSION = "@PACKAGE_VERSION@"; + /** + * Module name. + * + * @private + */ + const MODULE_NAME = "redirect.js"; + /** * Redirects the browser to the location specified by the `data-new-location` * attribute of the root element or the `canonical` link of the document, @@ -82,6 +89,5 @@ export function run() } } -console.info("Loaded: %s (%s %s)", "redirect.js", - PACKAGE_NAME, PACKAGE_VERSION); +console.info("Loaded: %s (%s %s)", MODULE_NAME, PACKAGE_NAME, PACKAGE_VERSION); run(); From c9dbc1077c7677fd744d717dc3e537bedf709fa1 Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Fri, 9 Aug 2019 14:24:27 +0900 Subject: [PATCH 10/23] Add function 'getCanonicalLink' --- redirect.js | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/redirect.js b/redirect.js index b564ef7..70c0c3b 100644 --- a/redirect.js +++ b/redirect.js @@ -57,6 +57,24 @@ */ const MODULE_NAME = "redirect.js"; +/** + * Returns the canonical link of the document. + * + * @return {HTMLLinkElement} the canonical link + */ +export function getCanonicalLink() +{ + let root = document.documentElement; + for (let link of root.getElementsByTagName("link")) { + for (let type of link.relList) { + if (type.toLowerCase() == "canonical") { + return link; + } + } + } + return null; +} + /** * Redirects the browser to the location specified by the `data-new-location` * attribute of the root element or the `canonical` link of the document, @@ -73,13 +91,9 @@ export function run() newLocation = root.dataset.newLocation; } if (newLocation == null) { - for (let link of root.getElementsByTagName("link")) { - for (let type of link.relList) { - if (type.toLowerCase() == "canonical") { - newLocation = link.href; - break; - } - } + let link = getCanonicalLink(); + if (link != null) { + newLocation = link.href; } } From ed95d0f9a21d0dd50adfd9a00b20b2f735b499d8 Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Mon, 12 Aug 2019 15:09:28 +0900 Subject: [PATCH 11/23] Add new script --- etc/upload.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 etc/upload.sh diff --git a/etc/upload.sh b/etc/upload.sh new file mode 100755 index 0000000..a140d52 --- /dev/null +++ b/etc/upload.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# upload.sh - file uploader for Bitbucket Cloud +# Copyright (C) 2018 Kaz Nishimura +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice and +# this notice are preserved. This file is offered as-is, without any warranty. + +REPOSITORY=vx68k/netbeans-bitbucket-plugin + +test -n "$USERNAME" || exit 0 + +for file in "$@"; do + FILES="$FILES --form files=@\"$file\"" +done +test -n "$FILES" || exit 1 + +exec curl --silent --show-error --user "$USERNAME${PASSWORD+:$PASSWORD}" \ + --request POST $FILES \ + https://api.bitbucket.org/2.0/repositories/$REPOSITORY/downloads From 160da207b2ea8dcf92d2cec9044fff7b35c29357 Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Tue, 13 Aug 2019 11:04:06 +0900 Subject: [PATCH 12/23] Add sponsor button configuration --- .github/FUNDING.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..6783d2e --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,9 @@ +# FUNDING.yml - GitHub sponsor button configuration +# Copyright (C) 2019 Kaz Nishimura +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice and +# this notice are preserved. This file is offered as-is, without any warranty. +--- +custom: + - https://salt.bountysource.com/checkout/amount?team=vx68k From a6fca91c09fbfb94c2cd9dd66f645da6b9d813f3 Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Wed, 14 Aug 2019 11:47:19 +0900 Subject: [PATCH 13/23] Add new pipeline --- bitbucket-pipelines.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index a6424ca..91c5eb5 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -17,8 +17,21 @@ definitions: script: - npm install - npm test + - step: &package + name: Packaging + caches: + - node + script: + - npm install + - npm pack + artifacts: + - "*.tgz" image: node:8 pipelines: branches: default: - step: *test + bookmarks: + deployment/test: + - step: + <<: *package From eaad3b35ab4672fcc58466b6ea3431da0a38ff99 Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Wed, 14 Aug 2019 11:52:03 +0900 Subject: [PATCH 14/23] Fix indentation --- bitbucket-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 91c5eb5..957c319 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -34,4 +34,4 @@ pipelines: bookmarks: deployment/test: - step: - <<: *package + <<: *package From 92da5df2f01f092316a9e7a1b1657c54e5773554 Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Thu, 14 Nov 2019 15:30:39 +0900 Subject: [PATCH 15/23] Fix indentation --- .vscode/settings.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index e10fcf4..95b5622 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { - "files.exclude": { - "**/*.rej": true, - "**/*.orig": true, - "**/*~": true - } + "files.exclude": { + "**/*.rej": true, + "**/*.orig": true, + "**/*~": true } +} From 6561d5e36e339cc2e9fe100e29181190a0c9683e Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Mon, 2 Dec 2019 10:45:07 +0900 Subject: [PATCH 16/23] Edit comments --- redirect.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redirect.js b/redirect.js index 70c0c3b..58655ef 100644 --- a/redirect.js +++ b/redirect.js @@ -1,4 +1,4 @@ -// redirect.js - browser script to redirect the browser to a new location +// redirect.js - module script to redirect web browsers to another location // Copyright (C) 2019 Kaz Nishimura // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -24,7 +24,7 @@ // NOTE: this file is a module script. /** - * Browser script to redirect the browser to a new location. + * Module script to redirect web browsers to another location. * * This script can be loaded in a *redirecting* HTML file as follows: * From e76c53afd0d57c4915c33b4bb0587bd1a6be24b3 Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Tue, 3 Dec 2019 20:50:04 +0900 Subject: [PATCH 17/23] Modify pipelines for Git --- bitbucket-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 957c319..77e102f 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -12,6 +12,7 @@ definitions: steps: - step: &test name: Test + image: node:8 caches: - node script: @@ -19,6 +20,7 @@ definitions: - npm test - step: &package name: Packaging + image: node:8 caches: - node script: @@ -26,12 +28,10 @@ definitions: - npm pack artifacts: - "*.tgz" -image: node:8 pipelines: branches: - default: + master: - step: *test - bookmarks: deployment/test: - step: <<: *package From c24fffcabcb34c58efb7ba6499700138291f9cc8 Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Tue, 3 Dec 2019 21:24:10 +0900 Subject: [PATCH 18/23] Run test builds on pull request --- bitbucket-pipelines.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 77e102f..89a10d5 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -35,3 +35,6 @@ pipelines: deployment/test: - step: <<: *package + pull-requests: + "**": + - step: *test From 35b7cef8ff4ff2c5fdc83794fb091781e06989bc Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Tue, 3 Dec 2019 23:58:30 +0900 Subject: [PATCH 19/23] Move scripts --- prepack.sh => etc/prepack.sh | 0 package.json | 4 ++-- etc/upload.sh => upload.sh | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename prepack.sh => etc/prepack.sh (100%) rename etc/upload.sh => upload.sh (100%) diff --git a/prepack.sh b/etc/prepack.sh similarity index 100% rename from prepack.sh rename to etc/prepack.sh diff --git a/package.json b/package.json index 9b0acfc..7037e30 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "email": "kazssym@linuxfront.com" }, "files": [ - "prepack.sh", + "etc/*", "**/*.js" ], "browser": {}, @@ -23,7 +23,7 @@ "url": "https://bitbucket.org/vx68k/redirect.js" }, "scripts": { - "prepack": "sh ./prepack.sh" + "prepack": "sh ./etc/prepack.sh" }, "devDependencies": { "terser": "~4" diff --git a/etc/upload.sh b/upload.sh similarity index 100% rename from etc/upload.sh rename to upload.sh From 880135cf081bf54225b89502035298cf8184a2ff Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Wed, 4 Dec 2019 12:42:20 +0900 Subject: [PATCH 20/23] Add a file for pull request guidelines --- CONTRIBUTING.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..df06b33 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,23 @@ +This file documents the current guidelines for contributing. + +# Conventions + +The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, +“SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be +interpreted as described in [BCP 14][] when, and only when, they appear in all +capitals, as shown here. + +[BCP 14]: https://tools.ietf.org/html/bcp14 + +# Pull request guidelines + +## File encoding + +Unless mandated by the media type, a file SHOULD be encoded either in `UTF-8` +(preferred) or in `US-ASCII`, and if it would be in `UTF-8`, it MUST NOT +contain any BOM (U+FEFF). + +## End-of-line convention + +Unless mandated by the media type, each line of a file SHOULD end with a single +LF (U+000A). From 9d31bfa0190b780519d51e318f2380cda3ba8840 Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Wed, 4 Dec 2019 16:15:48 +0900 Subject: [PATCH 21/23] Set 'user-perm' to true in pipelines --- bitbucket-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 89a10d5..a0032c3 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -16,6 +16,7 @@ definitions: caches: - node script: + - npm config set unsafe-perm true - npm install - npm test - step: &package @@ -24,6 +25,7 @@ definitions: caches: - node script: + - npm config set unsafe-perm true - npm install - npm pack artifacts: From 8c3310e84f32eb52650dc8a5abc0600a19f57517 Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Tue, 14 Apr 2020 00:05:30 +0900 Subject: [PATCH 22/23] Update the repository --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7037e30..3932177 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,8 @@ ], "browser": {}, "repository": { - "type": "hg", - "url": "https://bitbucket.org/vx68k/redirect.js" + "type": "git", + "url": "https://github.com/vx68k/redirect.js.git" }, "scripts": { "prepack": "sh ./etc/prepack.sh" From 5e7df7ac972bc84f8b6bfd338eec9a16bc92e919 Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Tue, 14 Apr 2020 13:20:03 +0900 Subject: [PATCH 23/23] Add an 'azure-pipelines.yml' file --- azure-pipelines.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..e4ba6c2 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,39 @@ +# azure-pipelines.yml - configuration for Azure Pipelines +# Copyright (C) 2020 Kaz Nishimura +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice and +# this notice are preserved. This file is offered as-is, without any warranty. +--- +trigger: + - master + - release/* + - feature/* +stages: + - stage: Default + jobs: + - job: Build + pool: + vmImage: ubuntu-latest + steps: + - task: NodeTool@0 + - bash: | + npm test + displayName: Test + - task: PublishTestResults@2 + condition: succeededOrFailed() + - stage: Release + dependsOn: Default + condition: + and(succeeded(), + startsWith(variables['Build.SourceBranch'], 'refs/heads/release/')) + jobs: + - job: Upload + pool: + vmImage: ubuntu-latest + steps: + - task: NodeTool@0 + - task: Npm@1 + inputs: + command: publish + publishEndpoint: npmjs