Compare commits

...

13 Commits

Author SHA1 Message Date
fc1a58cae5 added yarn cache clean to yarn install script 2022-02-07 18:29:11 +01:00
6be45b2728 updated yarn install script 2022-02-07 18:20:36 +01:00
ab1ae0f63c updated yarn shell script 2022-02-07 17:23:19 +01:00
ff165f0c49 updated readme 2022-02-06 20:47:13 +01:00
f96fe4a589 added yarn + added yarn2 install script 2022-02-04 19:12:41 +01:00
1ff307685e set new version 2022-01-24 17:55:31 +01:00
b3b79103bd updated readme 2022-01-23 12:48:48 +01:00
503e91860c removed react-modules 2022-01-23 12:47:23 +01:00
5da9234dee removed react-modules from index 2022-01-23 12:43:37 +01:00
51f92d36a7 added readme 2022-01-23 12:37:12 +01:00
2c520e6212 added package.json 2022-01-23 12:16:47 +01:00
43da38b972 removed .idea folder 2022-01-22 16:39:11 +01:00
293d09af5c added gitignore 2022-01-22 16:38:29 +01:00
13 changed files with 1459 additions and 55 deletions

225
.gitignore vendored Normal file
View File

@@ -0,0 +1,225 @@
# Created by https://www.toptal.com/developers/gitignore/api/yarn,react,phpstorm,jetbrains
# Edit at https://www.toptal.com/developers/gitignore?templates=yarn,react,phpstorm,jetbrains
### JetBrains ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# build
build
build/*
!build/build.xml
.idea
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### JetBrains Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/
# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml
# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/
# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$
# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml
### PhpStorm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
# AWS User-specific
# Generated files
# Sensitive or high-churn files
# Gradle
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
# Mongo Explorer plugin
# File-based project format
# IntelliJ
# mpeltonen/sbt-idea plugin
# JIRA plugin
# Cursive Clojure plugin
# SonarLint plugin
# Crashlytics plugin (for Android Studio and IntelliJ)
# Editor-based Rest Client
# Android studio 3.1+ serialized cache file
### PhpStorm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
### react ###
.DS_*
*.log
logs
**/*.backup.*
**/*.back.*
node_modules
bower_components
*.sublime*
psd
thumb
sketch
### yarn ###
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.yarn/*
!.yarn/releases
!.yarn/patches
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
# if you are NOT using Zero-installs, then:
# comment the following lines
#!.yarn/cache
# and uncomment the following lines
.pnp.*
# End of https://www.toptal.com/developers/gitignore/api/yarn,react,phpstorm,jetbrains

8
.idea/.gitignore generated vendored
View File

@@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

8
.idea/modules.xml generated
View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/snippets.iml" filepath="$PROJECT_DIR$/.idea/snippets.iml" />
</modules>
</component>
</project>

8
.idea/snippets.iml generated
View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

File diff suppressed because one or more lines are too long

768
.yarn/releases/yarn-3.1.1.cjs vendored Executable file

File diff suppressed because one or more lines are too long

7
.yarnrc.yml Normal file
View File

@@ -0,0 +1,7 @@
nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
yarnPath: .yarn/releases/yarn-3.1.1.cjs

11
README.md Normal file
View File

@@ -0,0 +1,11 @@
# snippets
### Import with yarn 2
```
yarn add 'snippets@https://git.harting.dev/vikingowl/snippets.git'
```
### Run yarn2 script
```
wget -O - https://git.harting.dev/vikingowl/snippets/raw/branch/master/yarn2.sh | bash
```

7
index.js Normal file
View File

@@ -0,0 +1,7 @@
import {bootstrapNavCloser} from "./bootstrap-nav-closer";
import {setImage} from "./set-image-url";
export {
bootstrapNavCloser,
setImage
}

12
package.json Normal file
View File

@@ -0,0 +1,12 @@
{
"name": "snippets",
"version": "1.0.1",
"main": "index.js",
"repository": {
"type": "git",
"url": "gitea@harting.dev:vikingowl/snippets.git"
},
"author": "vikingowl",
"license": "ISC",
"packageManager": "yarn@3.1.1"
}

View File

@@ -1,31 +0,0 @@
import React, {useState} from 'react'
export const ScrollTopButton = () => {
const [visible, setVisible] = useState(false)
const toggleVisible = () => {
const scrolled = document.documentElement.scrollTop
if (scrolled > 300) {
setVisible(true)
} else if (scrolled <= 300) {
setVisible(false)
}
}
const scrollToTop = () => {
window.scrollTo({
top: 0,
behavior: 'smooth'
})
}
window.addEventListener('scroll', toggleVisible)
return (
<i
className="bi bi-arrow-up-square scroll-top-btn text-info"
onClick={() => scrollToTop()}
style={{display: visible ? 'inline' : 'none'}}
/>
)
}

11
yarn.lock Normal file
View File

@@ -0,0 +1,11 @@
# This file is generated by running "yarn install" inside your project.
# Manual changes might be lost - proceed with caution!
__metadata:
version: 5
"snippets@workspace:.":
version: 0.0.0-use.local
resolution: "snippets@workspace:."
languageName: unknown
linkType: soft

55
yarn2.sh Executable file
View File

@@ -0,0 +1,55 @@
#!/usr/bin/env sh
dir=$(pwd)
# shellcheck disable=SC2129
printf "\n"
printf "|##########################################|\n"
printf "| Write to gitignore |\n"
printf "|##########################################|\n"
printf "\n"
printf "\n" >> "$dir/.gitignore"
printf "\n###Yarn 2" >> "$dir/.gitignore"
printf "\n.yarn/*" >> "$dir/.gitignore"
printf "\n!.yarn/releases" >> "$dir/.gitignore"
printf "\n!.yarn/plugins" >> "$dir/.gitignore"
printf "\n.pnp.*" >> "$dir/.gitignore"
# removes node_modules
printf "\n"
printf "|##########################################|\n"
printf "| Delete node_modules |\n"
printf "|##########################################|\n"
printf "\n"
rm -rf node_modules
# Upgrade Yarn to Berry (latest Yarn 2 version known to Yarn 1)
printf "\n"
printf "|##########################################|\n"
printf "| Set version berry |\n"
printf "|##########################################|\n"
printf "\n"
yarn set version berry
# (optional) Adds `yarn upgrade-interactive` command back
printf "\n"
printf "|##########################################|\n"
printf "| Add interactive-tools |\n"
printf "|##########################################|\n"
printf "\n"
yarn plugin import interactive-tools
# Cleans yarn cache
printf "\n"
printf "|##########################################|\n"
printf "| Cleans yarn cache |\n"
printf "|##########################################|\n"
printf "\n"
yarn cache clean
# Re-installs project using Yarn 2. This will also update your yarn.lock file, but will NOT sneakily upgrade the dependencies
printf "\n"
printf "|##########################################|\n"
printf "| Yarn install |\n"
printf "|##########################################|\n"
printf "\n"
yarn install