From 551154b43d18385d8f1b76df8d0b95ebc1de1e84 Mon Sep 17 00:00:00 2001 From: Nic Bell Date: Tue, 2 Jan 2024 12:45:25 +0100 Subject: [PATCH 01/12] Create npm-grunt.yml --- .github/workflows/npm-grunt.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/npm-grunt.yml diff --git a/.github/workflows/npm-grunt.yml b/.github/workflows/npm-grunt.yml new file mode 100644 index 0000000..7e813aa --- /dev/null +++ b/.github/workflows/npm-grunt.yml @@ -0,0 +1,28 @@ +name: NodeJS with Grunt + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [14.x, 16.x, 18.x] + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Build + run: | + npm install + grunt From 7acae4ac29f754adcef994cf640f42d4011fca03 Mon Sep 17 00:00:00 2001 From: Nic Bell Date: Tue, 2 Jan 2024 12:57:31 +0100 Subject: [PATCH 02/12] Update npm-grunt.yml --- .github/workflows/npm-grunt.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/npm-grunt.yml b/.github/workflows/npm-grunt.yml index 7e813aa..90d4324 100644 --- a/.github/workflows/npm-grunt.yml +++ b/.github/workflows/npm-grunt.yml @@ -10,19 +10,21 @@ jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [14.x, 16.x, 18.x] - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 18 - name: Build run: | npm install grunt + + - name: Push + run: | + git config user.name github-actions + git config user.email github-actions@github.com + git add . + git commit -a -m "Committed by GitHub Actions [ci skip]" + git push From 14b9251ca97cefcc506bf15645c9f4dd7a374dd9 Mon Sep 17 00:00:00 2001 From: Nic Bell Date: Tue, 2 Jan 2024 12:06:29 +0000 Subject: [PATCH 03/12] Added git ignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7263098 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/node_modules/ +package-lock.json \ No newline at end of file From 2ccea3d16ca0001ae46c0f95780bbdd03b5d74e8 Mon Sep 17 00:00:00 2001 From: Nic Bell Date: Tue, 2 Jan 2024 12:16:44 +0000 Subject: [PATCH 04/12] Update banner --- GruntFile.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GruntFile.js b/GruntFile.js index 59d382d..3ded1a5 100644 --- a/GruntFile.js +++ b/GruntFile.js @@ -42,7 +42,7 @@ module.exports = function (grunt) { }, uglify: { options: { - banner: '/*! <%= pkg.name %> v<%= pkg.version %> | <%= pkg.license %> license | <%= pkg.homepage %> */\n' + banner: '/*! <%= pkg.name %> v<%= pkg.version %> | <%= pkg.license %> license | <%= pkg.homepage %> 🚀 */\n' }, dist: { src: 'attach.js', @@ -64,6 +64,6 @@ module.exports = function (grunt) { grunt.registerTask('test', ['jshint']); grunt.registerTask('default', ['test', 'uglify', 'clean']); - //This is an extra task incase we want to do something different with Travis CI + // This is an extra task incase we want to do something different with Travis CI grunt.registerTask('travis', ['jshint', 'uglify', 'clean']); }; From a2334e6f8cbe3cdee38b7edfb5123d43e5243f0b Mon Sep 17 00:00:00 2001 From: Nic Bell Date: Tue, 2 Jan 2024 12:24:22 +0000 Subject: [PATCH 05/12] Add ref --- .github/workflows/npm-grunt.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/npm-grunt.yml b/.github/workflows/npm-grunt.yml index 90d4324..23eeb23 100644 --- a/.github/workflows/npm-grunt.yml +++ b/.github/workflows/npm-grunt.yml @@ -12,6 +12,9 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.ref_name }} - uses: actions/setup-node@v4 with: node-version: 18 @@ -25,6 +28,5 @@ jobs: run: | git config user.name github-actions git config user.email github-actions@github.com - git add . git commit -a -m "Committed by GitHub Actions [ci skip]" git push From e3b05c4bf38162b30c5e5fabe6403337d6752c7a Mon Sep 17 00:00:00 2001 From: Nic Bell Date: Tue, 2 Jan 2024 12:33:26 +0000 Subject: [PATCH 06/12] Try this --- .github/workflows/npm-grunt.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/npm-grunt.yml b/.github/workflows/npm-grunt.yml index 23eeb23..28f8451 100644 --- a/.github/workflows/npm-grunt.yml +++ b/.github/workflows/npm-grunt.yml @@ -12,9 +12,6 @@ jobs: steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ github.ref_name }} - uses: actions/setup-node@v4 with: node-version: 18 @@ -28,5 +25,6 @@ jobs: run: | git config user.name github-actions git config user.email github-actions@github.com + git checkout ${{ github.event.pull_request.base.ref || github.head_ref || github.ref_name }} git commit -a -m "Committed by GitHub Actions [ci skip]" git push From e29ec44e9de46fbbbe649c9341feba6cf154d26e Mon Sep 17 00:00:00 2001 From: Nic Bell Date: Tue, 2 Jan 2024 12:39:53 +0000 Subject: [PATCH 07/12] Try again --- .github/workflows/npm-grunt.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/npm-grunt.yml b/.github/workflows/npm-grunt.yml index 28f8451..8cbfea2 100644 --- a/.github/workflows/npm-grunt.yml +++ b/.github/workflows/npm-grunt.yml @@ -12,6 +12,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - uses: actions/setup-node@v4 with: node-version: 18 @@ -25,6 +27,5 @@ jobs: run: | git config user.name github-actions git config user.email github-actions@github.com - git checkout ${{ github.event.pull_request.base.ref || github.head_ref || github.ref_name }} git commit -a -m "Committed by GitHub Actions [ci skip]" git push From 4cdcbc4db2bc7033bcea84eba2e8ad873e58a81d Mon Sep 17 00:00:00 2001 From: Nic Bell Date: Tue, 2 Jan 2024 12:47:23 +0000 Subject: [PATCH 08/12] Jokes --- .github/workflows/npm-grunt.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/npm-grunt.yml b/.github/workflows/npm-grunt.yml index 8cbfea2..eebbf69 100644 --- a/.github/workflows/npm-grunt.yml +++ b/.github/workflows/npm-grunt.yml @@ -27,5 +27,6 @@ jobs: run: | git config user.name github-actions git config user.email github-actions@github.com + git checkout ${{ github.event.pull_request.head.ref || github.head_ref || github.ref_name }} git commit -a -m "Committed by GitHub Actions [ci skip]" git push From 2575d7ea8f0d6726784b9b432ae243ad7da081e4 Mon Sep 17 00:00:00 2001 From: github-actions Date: Tue, 2 Jan 2024 12:47:50 +0000 Subject: [PATCH 09/12] Committed by GitHub Actions [ci skip] --- attach.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attach.min.js b/attach.min.js index 88e1f67..2f70d5e 100644 --- a/attach.min.js +++ b/attach.min.js @@ -1,2 +1,2 @@ -/*! attach.js v1.0.5 | MIT license | http://nicbell.github.io/attach.js/ */ +/*! attach.js v1.0.5 | MIT license | http://nicbell.github.io/attach.js/ 🚀 */ !function(a){"use strict";var b={engine:null,items:[],add:function(a,b){this.items.push({id:a,func:b})},remove:function(a){for(var b=this.items.length;b--;)if(this.items[b].id===a){this.items.splice(b,1);break}},run:function(){for(var a=this.engine?this.engine("[data-attach]"):document.querySelectorAll("[data-attach]"),b=0;b=0&&"function"==typeof this.items[c].func&&this.items[c].func.call(this,a,this.items[c].id)}};"function"==typeof define&&define.amd?define(function(){return b}):"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=b),exports.Attach=b):a.Attach=b}(this); \ No newline at end of file From 2cc4c0db3f6564965e84164d23f36d3a904cc553 Mon Sep 17 00:00:00 2001 From: Nic Bell Date: Tue, 2 Jan 2024 12:54:53 +0000 Subject: [PATCH 10/12] Remove travis --- .github/workflows/check.yml | 22 +++++++++++++++++++ .../workflows/{npm-grunt.yml => release.yml} | 8 +++---- .travis.yml | 15 ------------- GruntFile.js | 3 --- 4 files changed, 26 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/check.yml rename .github/workflows/{npm-grunt.yml => release.yml} (87%) delete mode 100644 .travis.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..b04585d --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,22 @@ +name: Grunt build + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Build + run: | + npm install + grunt diff --git a/.github/workflows/npm-grunt.yml b/.github/workflows/release.yml similarity index 87% rename from .github/workflows/npm-grunt.yml rename to .github/workflows/release.yml index eebbf69..0fa831f 100644 --- a/.github/workflows/npm-grunt.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,10 @@ -name: NodeJS with Grunt +name: Release minified on: push: branches: [ "master" ] - pull_request: - branches: [ "master" ] + tags: + - '*' jobs: build: @@ -29,4 +29,4 @@ jobs: git config user.email github-actions@github.com git checkout ${{ github.event.pull_request.head.ref || github.head_ref || github.ref_name }} git commit -a -m "Committed by GitHub Actions [ci skip]" - git push + git push \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9e15079..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: node_js -node_js: -- '0.10' -sudo: false -before_script: -- npm install -g grunt-cli -after_success: -- git config --global user.email "${GIT_EMAIL}" -- git config --global user.name "${GIT_NAME}" -- git checkout master -- git commit -a -m "Committed by Travis-CI [ci skip]" -- git push https://${GH_TOKEN}@github.com/nicbell/attach.js.git master -env: - global: - secure: PHKaro0zAsdL7JmPTujZYftJDUzvr9KE23kjb3sKQbhgaX3ZR6txrKt5dYVaOyPX0L3RZF4kv/waIVLUuOUqiGDTwjscsY5bMmBOKdl7EJvtIt4M9IEtwhvjaxOOG/LdvqMx6QdaezyfAH0dvezjOdTnn2AXArnqZTM6wVSc4t4= diff --git a/GruntFile.js b/GruntFile.js index 3ded1a5..9f2a753 100644 --- a/GruntFile.js +++ b/GruntFile.js @@ -63,7 +63,4 @@ module.exports = function (grunt) { grunt.registerTask('test', ['jshint']); grunt.registerTask('default', ['test', 'uglify', 'clean']); - - // This is an extra task incase we want to do something different with Travis CI - grunt.registerTask('travis', ['jshint', 'uglify', 'clean']); }; From 5cfc78bd216ae7798dd0f2bbe1a9efec55c6bc3c Mon Sep 17 00:00:00 2001 From: Nic Bell Date: Tue, 2 Jan 2024 12:57:05 +0000 Subject: [PATCH 11/12] Remove travis From cf95b6fe3c751aa6e2c0b331bdfa514e0ab4e970 Mon Sep 17 00:00:00 2001 From: Nic Bell Date: Tue, 2 Jan 2024 13:02:52 +0000 Subject: [PATCH 12/12] Tidy up. --- .github/workflows/release.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0fa831f..f7bc51b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release minified +name: Grunt release minified on: push: diff --git a/README.md b/README.md index 12013f5..4399c11 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Attach.js [![NPM](https://nodei.co/npm/attach.js.png?mini=true)](https://nodei.co/npm/attach.js/) [![Build Status](https://travis-ci.org/nicbell/attach.js.png?branch=master)](https://travis-ci.org/nicbell/attach.js) [![Downloads](https://img.shields.io/npm/dt/attach.js.svg)](https://www.npmjs.com/package/attach.js) +# Attach.js [![NPM](https://nodei.co/npm/attach.js.png?mini=true)](https://nodei.co/npm/attach.js/) [![Build Status](https://github.com/nicbell/attach.js/actions/workflows/check.yml/badge.svg)](https://github.com/nicbell/attach.js/actions) [![Downloads](https://img.shields.io/npm/dt/attach.js.svg)](https://www.npmjs.com/package/attach.js) Attach.js removes dependancy on messy CSS selectors when attaching JavaScript to the page. Attach.js also encapsulates all your DOM "attachments" so that they can easily be reattached when the page is dynamically updated (ie. via AJAX).