Skip to content

Commit

Permalink
feat: initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
AskeLange committed Apr 15, 2024
0 parents commit 3f80fd9
Show file tree
Hide file tree
Showing 56 changed files with 7,936 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_style = space
indent_size = 2
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ["./node_modules/@limbo-works/lint-configs/.eslintrc.simple.cjs"],
};
40 changes: 40 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release Please and Publish

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write
packages: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node

- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}

- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://npm.pkg.github.com/
if: ${{ steps.release.outputs.release_created }}

- run: yarn
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ steps.release.outputs.release_created }}

- run: yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
56 changes: 56 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Dependencies
node_modules

# Logs
*.log*

# Temp directories
.temp
.tmp
.cache

# Yarn
**/.yarn/cache
**/.yarn/*state*

# Generated dirs
dist

# Nuxt
.nuxt
.output
.data
.vercel_build_output
.build-*
.netlify

# Env
.env

# Testing
reports
coverage
*.lcov
.nyc_output

# VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Intellij idea
*.iml
.idea

# OSX
.DS_Store
.AppleDouble
.LSOverride
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
4 changes: 4 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@limbo-works:registry=https://npm.pkg.github.com

shamefully-hoist=true
strict-peer-dependencies=false
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/iron
34 changes: 34 additions & 0 deletions .playground/app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<template>
<main>
<NuxtPage />
</main>
</template>

<style lang="postcss">
body {
padding: 64px;
}
main {
max-width: 800px;
margin: 0 auto;
}
.list {
display: flex;
flex-direction: column;
row-gap: 32px;
}
.preview {
padding: 24px 48px 36px 48px;
background-color: rgb(240, 240, 240);
max-height: 400px;
overflow: auto;
}
button a {
color: inherit;
text-decoration: none;
}
</style>
52 changes: 52 additions & 0 deletions .playground/components/PreviewCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<template>
<div class="c-preview-card">
<button v-if="to?.length">
<NuxtLink class="c-preview-card__expand" :to="to">
View Single
</NuxtLink>
</button>

<div class="c-preview-card__content">
<pre v-text="data"></pre>
</div>
</div>
</template>

<script setup>
defineProps({
data: {
type: [String, Object],
required: true,
},
to: {
type: String,
required: false,
},
});
</script>

<style lang="postcss">
.c-preview-card {
position: relative;
background-color: rgb(240, 240, 240);
max-height: 400px;
width: 100%;
padding: 24px 48px 36px 48px;
overflow: auto;
}
.c-preview-card button {
opacity: 0;
display: block;
position: sticky;
margin-left: auto;
top: 24px;
right: 24px;
}
.c-preview-card:hover button {
opacity: 1;
}
</style>
9 changes: 9 additions & 0 deletions .playground/nuxt.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default defineNuxtConfig({
modules: ['../src/module'],
devtools: { enabled: true },

shopify: {
shop: 'limbo-example',
token: '8d0648d7c9387bf18db775a414856630',
},
});
13 changes: 13 additions & 0 deletions .playground/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"private": true,
"name": "nuxt-shopify-playground",
"type": "module",
"scripts": {
"dev": "nuxi dev",
"build": "nuxi build",
"generate": "nuxi generate"
},
"devDependencies": {
"nuxt": "latest"
}
}
14 changes: 14 additions & 0 deletions .playground/pages/articles/[id].vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template>
<div class="list">
<pre v-text="data"></pre>
</div>
</template>

<script setup>
const shopify = useShopify();
const id = useRoute().params.id;
const { data } = await useAsyncData(async () => {
return await shopify.articles.getById(id);
});
</script>
40 changes: 40 additions & 0 deletions .playground/pages/articles/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<div class="list">
<PreviewCard
v-for="(article, index) in articles"
:key="index"
:data="article"
:to="`/articles/${encodeURIComponent(article.id)}`"
/>

<div style="margin: 0 auto">
<button v-if="hasNextPage" @click="fetchMore">Load more</button>
</div>
</div>
</template>

<script setup>
const shopify = useShopify();
const limit = ref(1);
const { data } = await useAsyncData(async () => {
return await shopify.articles.get({
first: limit.value,
});
});
const endCursor = ref(data.value.info?.endCursor);
const hasNextPage = ref(data.value.info?.hasNextPage);
const articles = ref(data.value.articles);
async function fetchMore() {
const data = await shopify.articles.get({
first: limit.value,
after: endCursor.value,
});
endCursor.value = data.info?.endCursor;
hasNextPage.value = data.info?.hasNextPage;
articles.value = articles.value.concat(data.articles);
}
</script>
14 changes: 14 additions & 0 deletions .playground/pages/blogs/[id].vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template>
<div class="list">
<pre v-text="data"></pre>
</div>
</template>

<script setup>
const shopify = useShopify();
const id = useRoute().params.id;
const { data } = await useAsyncData(async () => {
return await shopify.blogs.getById(id);
});
</script>
40 changes: 40 additions & 0 deletions .playground/pages/blogs/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<div class="list">
<PreviewCard
v-for="(blog, index) in blogs"
:key="index"
:data="blog"
:to="`/blogs/${encodeURIComponent(blog.id)}`"
/>

<div style="margin: 0 auto">
<button v-if="hasNextPage" @click="fetchMore">Load more</button>
</div>
</div>
</template>

<script setup>
const shopify = useShopify();
const limit = ref(1);
const { data } = await useAsyncData(async () => {
return await shopify.blogs.get({
limit: limit.value,
});
});
const endCursor = ref(data.value.info?.endCursor);
const hasNextPage = ref(data.value.info?.hasNextPage);
const blogs = ref(data.value.blogs);
async function fetchMore() {
const data = await shopify.blogs.get({
limit: limit.value,
after: endCursor.value,
});
endCursor.value = data.info?.endCursor;
hasNextPage.value = data.info?.hasNextPage;
blogs.value = pages.value.concat(data.blogs);
}
</script>
Loading

0 comments on commit 3f80fd9

Please sign in to comment.