-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit dc0253d
Showing
4,970 changed files
with
54,398 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
const eleventySass = require("eleventy-sass"); | ||
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation"); | ||
const { EleventyI18nPlugin } = require("@11ty/eleventy"); | ||
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight"); | ||
const markdownIt = require('markdown-it') | ||
const markdownItAttrs = require('markdown-it-attrs') | ||
const markdownItOptions = { | ||
html: true, | ||
breaks: true, | ||
linkify: false | ||
} | ||
const markdownLib = markdownIt(markdownItOptions).use(markdownItAttrs).disable('code'); | ||
|
||
|
||
function sortByOrder(values) { | ||
let vals = [...values]; // this *seems* to prevent collection mutation... | ||
return vals.sort((a, b) => Math.sign(a.data.order - b.data.order)); | ||
} | ||
|
||
module.exports = function (config) { | ||
|
||
config.setQuietMode(true); | ||
|
||
config.addCollection('everything', (collectionApi) => { | ||
const imageWithMode = `{% from "src/_includes/macros/macros.njk" import imageWithMode %}`; | ||
const imageOnGreyBackground = `{% from "src/_includes/macros/macros.njk" import imageOnGreyBackground %}`; | ||
const principleImage = `{% from "src/_includes/macros/macros.njk" import principleImage %}`; | ||
const svgImage = `{% from "src/_includes/macros/macros.njk" import svgImage %}`; | ||
const webpImage = `{% from "src/_includes/macros/macros.njk" import webpImage %}`; | ||
const buttonGroup = `{% from "src/_includes/macros/macros.njk" import buttonGroup %}`; | ||
const specificationLinks = `{% from "src/_includes/macros/macros.njk" import specificationLinks %}`; | ||
const imageSpec = `{% from "src/_includes/macros/macros.njk" import imageSpec %}`; | ||
const lynedemo = `{% from "src/_includes/macros/macros.njk" import lynedemo %}`; | ||
|
||
let collection = collectionApi.getFilteredByGlob(["src/**/*.md", "src/**/*.njk"]); | ||
collection.forEach((item) => { | ||
item.template.frontMatter.content = `${svgImage}\n${webpImage}\n${imageWithMode}\n${imageOnGreyBackground}\n${principleImage}\n${buttonGroup}\n${specificationLinks}\n${imageSpec}\n${lynedemo}\n${item.template.frontMatter.content}` | ||
}) | ||
return collection; | ||
}); | ||
|
||
config.addPlugin(syntaxHighlight); | ||
config.addPlugin(eleventyNavigationPlugin); | ||
config.setLibrary('md', markdownLib) | ||
config.addPassthroughCopy("src/assets/images"); | ||
config.addPassthroughCopy("src/assets/js"); | ||
config.addPassthroughCopy("src/assets/downloads"); | ||
config.addPlugin(eleventySass, [ | ||
{ | ||
compileOptions: { | ||
cache: true | ||
}, | ||
sass: { | ||
loadPaths: ["node_modules/", "./"], | ||
sourceMap: false | ||
}, | ||
dir: { | ||
input: "src", | ||
output: "dist/assets/css" | ||
} | ||
}]); | ||
|
||
config.addFilter("sortByOrder", sortByOrder); | ||
config.addFilter("lastOfArray", function(array) { | ||
return array.slice(-1);} | ||
); | ||
|
||
config.addFilter("defaultlanguagecontent", (array, currPage) => { | ||
currPage = currPage.slice(3); | ||
const pageArr = array.filter((page) => page.url == "/de"+currPage); | ||
return pageArr; | ||
}); | ||
|
||
config.addPlugin(EleventyI18nPlugin, { | ||
defaultLanguage: "de", | ||
}); | ||
|
||
|
||
|
||
config.addFilter("lyneexample", (pattern) => { | ||
const lyneStories = require('@sbb-esta/lyne-components/dist/collection/storybundle'); | ||
const rawStories = lyneStories[pattern]; | ||
const stories = []; | ||
let ignoreArgs = []; | ||
const defaultExport = rawStories.default; | ||
const defaultExportKeys = Object.keys(defaultExport); | ||
|
||
if (defaultExportKeys.includes('documentation')) { | ||
const docu = defaultExport.documentation; | ||
const docuKeys = Object.keys(docu); | ||
|
||
if (docuKeys.includes('disableArgs')) { | ||
ignoreArgs = docu.disableArgs; | ||
} | ||
} | ||
Object.keys(rawStories).forEach((key) => { | ||
if (key !== 'default') { | ||
const storyObject = {}; | ||
const story = rawStories[key]; | ||
const storyKeys = Object.keys(story); | ||
|
||
// handle documentation key | ||
if (storyKeys.includes('documentation')) { | ||
storyObject.documentation = story.documentation; | ||
} else { | ||
storyObject.documentation = {}; | ||
} | ||
|
||
// handle container key | ||
const docuKeys = Object.keys(storyObject.documentation); | ||
|
||
if (docuKeys.includes('container')) { | ||
storyObject.documentation.container = story.documentation.container; | ||
} else { | ||
storyObject.documentation.container = {}; | ||
} | ||
|
||
const unCamelCase = (string) => | ||
string.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/\b([A-Z]+)([A-Z])([a-z])/, '$1 $2$3'); | ||
|
||
storyObject.documentation.title = unCamelCase(key); | ||
|
||
// adopt styles | ||
const containerKeys = Object.keys(storyObject.documentation.container); | ||
|
||
if (containerKeys.includes('styles')) { | ||
const rawStyles = storyObject.documentation.container.styles; | ||
const stylesKeys = Object.keys(rawStyles); | ||
let styles = ''; | ||
|
||
stylesKeys.forEach((styleKey) => { | ||
const style = rawStyles[styleKey]; | ||
|
||
styles += `${styleKey}: ${style};`; | ||
}); | ||
|
||
storyObject.documentation.container.styles = styles; | ||
} else { | ||
storyObject.documentation.container.styles = ''; | ||
} | ||
|
||
if (story && Object.keys(story).includes('args')) { | ||
storyObject.element = story.args; | ||
|
||
|
||
|
||
|
||
// const rawElement = story.args; | ||
/* | ||
if (ignoreArgs.length > 0) { | ||
ignoreArgs.forEach((arg) => { | ||
rawElement.removeAttribute(arg); | ||
}); | ||
} | ||
*/ | ||
//storyObject.elementRaw = rawElement; | ||
} | ||
stories.push(storyObject); | ||
} | ||
}); | ||
return stories; | ||
}); | ||
|
||
|
||
return { | ||
templateFormats: ["njk", "md"], | ||
markdownTemplateEngine: "njk", | ||
htmlTemplateEngine: "njk", | ||
dir: { | ||
input: "src", | ||
includes: "_includes", | ||
layouts: "_layouts", | ||
data: "_data", | ||
output: "dist" | ||
} | ||
}; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Community Asset for digital.sbb.ch | ||
description: Add new community asset for digital.sbb.ch | ||
title: "Title: " | ||
labels: communityasset | ||
body: | ||
- type: input | ||
id: title_pattern | ||
attributes: | ||
label: Title for digital.sbb.ch | ||
validations: | ||
required: true | ||
- type: input | ||
id: design | ||
attributes: | ||
label: Link to design file (Figma) | ||
validations: | ||
required: true | ||
- type: input | ||
id: code | ||
attributes: | ||
label: Link to repository (Github, Bitbucket) | ||
validations: | ||
required: false | ||
- type: textarea | ||
id: keyword_list | ||
attributes: | ||
label: "Keywords" | ||
description: Comma-separated | ||
placeholder: e.g. button, secondary, negative | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: description | ||
attributes: | ||
label: "Description" | ||
validations: | ||
required: false | ||
- type: input | ||
id: contact_user | ||
attributes: | ||
label: Contact | ||
placeholder: Livia Müller | ||
validations: | ||
required: true | ||
- type: dropdown | ||
id: design_system | ||
attributes: | ||
label: Design System | ||
options: | ||
- 'Web Lean' | ||
- 'Web Legacy' | ||
- 'Lyne' | ||
- 'Mobile' | ||
- 'Automat' | ||
validations: | ||
required: true | ||
- type: dropdown | ||
id: pattern_type | ||
attributes: | ||
label: Type | ||
options: | ||
- 'Components' | ||
- 'Patterns' | ||
- 'Templates' | ||
validations: | ||
required: true | ||
- type: dropdown | ||
id: component_state | ||
attributes: | ||
label: State | ||
options: | ||
- 'In progress' | ||
- 'Stable' | ||
validations: | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Convert issue to json | ||
on: | ||
issues: | ||
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issues | ||
types: | ||
- labeled | ||
jobs: | ||
update_library: | ||
runs-on: ubuntu-latest | ||
name: Convert data | ||
# require an `approved` label for moderation | ||
if: contains( github.event.issue.labels.*.name, 'communityasset') | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: GitHub Issue to JSON | ||
uses: zachleat/[email protected] | ||
with: | ||
# This controls where the JSON files are generated | ||
folder: "src/_data/communityassets/" | ||
# This tells the action which GitHub Issue Form template file to use | ||
issue-template: "communityasset.yml" | ||
# This controls which property we use to key the file name hash off of (values should be unique in your data set) | ||
hash-property-name: "design" | ||
- name: Commit files | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add * | ||
git commit -m "Adding data for #${{ env.IssueNumber }}" | ||
git push | ||
- name: Close issue | ||
uses: peter-evans/close-issue@v1 | ||
with: | ||
issue-number: "${{ env.IssueNumber }}" | ||
comment: "Thank you! Your data file has been added!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.netlify/ | ||
.vscode/ | ||
.cache/ | ||
node_modules/ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM cloud.docker.bin.sbb.ch/cloud/plattform-nginx:1.20.2-rootless | ||
|
||
# Copy dist files to nginx html folder | ||
COPY dist . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"$schema": "https://clew-resources.sbb-cloud.net/tekton-schema.json", | ||
"productName": "digital-sbb-ch", | ||
"npm": { | ||
"additionalNpmScripts": "build" | ||
}, | ||
"docker": { | ||
"dockerFile": "Dockerfile", | ||
"artifactoryDockerRepo": "esta.docker", | ||
"imageName": "digital-sbb-ch-eleventy" | ||
}, | ||
"pipelines": [ | ||
{ | ||
"name": "continous", | ||
"triggerType": ["GITEVENT", "USER"], | ||
"branchNamePrefixes": ["master"], | ||
"build": { | ||
"buildDockerImage": true, | ||
"deployDockerImage": true, | ||
"additionalDockerImageTags": "latest", | ||
"sonarScan": { | ||
"enabled": true | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "release", | ||
"triggerType": ["GITEVENT"], | ||
"versionTagEventPatterns": ["^.+$"], | ||
"build": { | ||
"buildDockerImage": true, | ||
"sonarScan": { | ||
"enabled": true | ||
} | ||
} | ||
} | ||
], | ||
"notifications": [ | ||
{ | ||
"type": "EMAIL", | ||
"enabled": true, | ||
"recipients": ["$actor"] | ||
} | ||
] | ||
} |
Oops, something went wrong.