Skip to content

Commit

Permalink
Initial upload with build script
Browse files Browse the repository at this point in the history
  • Loading branch information
GormFrank committed Apr 11, 2024
1 parent 2a689ff commit 214bb60
Show file tree
Hide file tree
Showing 14 changed files with 3,240 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"extends": [
"eslint:recommended"
],
"parserOptions": {
"ecmaVersion": 11,
"sourceType": "module"
},
"env": {
"browser": true,
"es6": true,
"node": true,
"jquery": true
},
"globals": {
"JSON": true
},
"rules": {
"indent": ["error", "tab", { "outerIIFEBody": 0 }],
"eqeqeq": [2, "allow-null"],
"no-eq-null": 2,
"no-unused-expressions": [2, { "allowTernary": true }],
"wrap-iife": [
2,
"any"
],
"no-unused-vars": [2, { "varsIgnorePattern": "wet_boew_"}],
"camelcase": 0,
"max-len": [
2,
500
],
"no-irregular-whitespace": 2,
"no-nested-ternary": 0,
"linebreak-style": 0
}
}
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Continous integration

on:
pull_request:

jobs:
integration-check:

runs-on: ubuntu-latest

environment: github-ci

strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install global dependencies
run: |
npm i -g grunt-cli
npm ci
- name: Build distribution files (dist)
run: grunt
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
*.orig
*.tmp

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
Expand Down Expand Up @@ -128,3 +130,27 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Artifacts
lib/
dist/*

# OS generated files #
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ethumbs.db
Thumbs.db

# IDEs
nbproject/*
.c9revisions/*
*.sublime-project
*.sublime-workspace
.pydevproject
.idea/
/.project
.settings
.vscode/*
100 changes: 100 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

clean: {
dist: ['dist']
},

copy: {
main: {
expand: true,
flatten: true,
src: 'src/headless.esm.js',
dest: 'dist/',
},
},

uglify: {
options: {
banner: '/*!\n * Canada.ca Search UI Connector / Connecteur IU de Recherche pour Canada.ca\n' +
' * @license https://github.com/ServiceCanada/search-ui/?tab=MIT-1-ov-file\n' +
' * v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %>\n*/'
},

dist: {
files: {
'dist/connector.min.js': ['src/connector.js']
}
}
},

cssmin: {
dist: {
files: {
'dist/connector.min.css': ['src/connector.css']
}
}
},

usebanner: {
taskName: {
options: {
position: 'top',
banner: '/*!\n * Canada.ca Search UI Connector / Connecteur IU de Recherche pour Canada.ca\n' +
' * @license https://github.com/ServiceCanada/search-ui/?tab=MIT-1-ov-file\n' +
' * v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %>\n*/',
linebreak: true
},
files: {
src: [ 'dist/connector.min.css' ]
}
}
},

htmllint: {
all: {
src: ['*.html']
},

options: {
"attr-name-style": "dash",
"attr-quote-style": false,
"id-class-style": "dash",
"indent-style": "tabs",
"indent-width": 4,
"line-end-style": "lf",
"attr-no-unsafe-char": false
}
},

jshint: {
all: {
options: {
esversion: 11,
'-W067': true // To ignore Unorthodox function invocation
},
src: ['Gruntfile.js', 'src/connector.js']
}
},

eslint: {
options: {
overrideConfigFile: ".eslintrc.json",
quiet: true
},
target: ['Gruntfile.js', 'src/connector.js']
}
});

grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-banner');
grunt.loadNpmTasks('grunt-htmllint');
grunt.loadNpmTasks('grunt-eslint');

grunt.registerTask('default', ['clean', 'htmllint', 'jshint', 'eslint', 'copy', 'uglify', 'cssmin', 'usebanner']);
};
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
# search-ui
Search user interface with headless

## Getting started

1. run: npm install -g grunt-cli
2. run: npm install
3. run: grunt (build script; tasks to lint, test & minify content in "dist")
4. To test web pages: Push to GitHub and run your GitHub Pages
5. To Deploy: Take the content of the "dist" folder and put it on a server

## Versioning API

Each new verion of this project is defined based on an evaluaton of the impacts of changes against any formerly up-to-date Search UI implementation. The scope constitutes of all files within the "dist" folder (distribution files), which are JavaScript scripts and CSS styles.

Search UI follows [Semantic Versioning 2.0.0](https://semver.org/)
10 changes: 10 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
remote_theme: wet-boew/gcweb-jekyll
title: Search UI for Canada.ca Search

#
# Page front matter defaults
defaults:
- scope:
path: "" # Ensure it's applied to all pages
values:
layout: default
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Search user interface (UI) with Headless
---

<p class="lead">This is a demo site for the Search UI.</p>

<h2 id="test">Testing</h2>

<ul>
<li><a href="test/srb-en.html">Sample basic search page</a></li>
<!--<li><a href="test/src-en.html">Sample contextual search page</a></li>-->
<li><a href="test/srb-fr.html" hreflang="fr" lang="fr">Exemple de page de résultats de la recherche (base)</a></li>
<!--<li><a href="test/src-fr.html" hreflang="fr" lang="fr">Exemple de page de résultats de la recherche (contextuelle)</a></li>-->
</ul>
Loading

0 comments on commit 214bb60

Please sign in to comment.