From 37b34bbd754c8857c8612b0e70e8d7078f0208d5 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 28 Sep 2022 21:24:20 +0200 Subject: [PATCH] chore: wip --- .github/CONTRIBUTING.md | 79 ++++++++++++++++++++-- .github/workflows/lock-closed-issues.yml | 23 ------- .stacks/artisan/src/cli/index.ts | 3 +- .stacks/artisan/src/cli/update.ts | 15 +++++ .stacks/artisan/src/index.ts | 3 +- .stacks/components/package.json | 2 +- .stacks/functions/package.json | 2 +- .stacks/web-components/package.json | 2 +- README.md | 86 +++--------------------- config/components.ts | 12 +--- package.json | 2 +- 11 files changed, 107 insertions(+), 122 deletions(-) delete mode 100644 .github/workflows/lock-closed-issues.yml create mode 100644 .stacks/artisan/src/cli/update.ts diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index e38949a..b097a12 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,22 +1,22 @@ # Contributing -First off, thank you for taking the time to contribute to the Open Web Foundation ❀️ +First off, thank you for taking the time to contribute to Open Web ❀️ ## πŸ’­ Knowledge ### TypeScript -It's important to note early on that this project is written with [TypeScript][typescript]. If you're unfamiliar with it or any strongly typed languages such as Java then this may be a slight roadblock. However, there's never a truly perfect time to start learning it, so ... why not today! +It's important to note early on that these projects are written with [TypeScript][typescript]. If you're unfamiliar with it or any strongly typed languages such as Java then this may be a slight roadblock. However, there's never a truly perfect time to start learning it, so ... why not today! -Don't be discouraged, because you likely will get by and learning TypeScript on the fly as you view some of the component examples within the codebase. +Don't be discouraged, because you likely will get by learning TypeScript on-the-fly as you view some of the component examples within the codebase. It's easy getting startedβ€”the code is very readable! -### Vue 3.2 & Vite +### Stacks -This project uses [Vue][vue] & [Vite][vite] to build [Vue components][vue-components], Web Components, and "composable functions". +This project uses Stacks as its framework/engine. Under the hood, it is powered by [Vue][vue] & [Vite][vite] to build [Vue components][vue-components], Web Components, and "composable functions". ### Architecture -An understanding of the library architecture and design will help if you're looking to contribute long-term, or you are working on a big PR. Browse the source and read our documentation to get a better idea on how it is structured. Feel free to ask any question, we would love to elaborate. +An understanding of the library architecture and design will help if you're looking to contribute long-term, or you are working on a big PR. Browse the source and read our documentation to get a better idea on how it is structured. Feel free to ask any question _(Twitter, Discord, or GitHub Discussions)_, we would love to elaborate. ## πŸŽ’ Getting Started @@ -57,6 +57,73 @@ git branch --set-upstream-to=upstream/main main git pull ``` +## Artisan Toolkit + +The following list is of some of the most common ways to interact with the Stacks API. Meet Artisan: + +```bash +pnpm artisan install # installs all dependencies +pnpm artisan dev # starts one of the dev servers (components, functions, pages, or docs) +pnpm artisan build # follow CLI prompts to select which library (or server) to build +pnpm artisan commit # follow CLI prompts for committing changes +pnpm artisan release # creates the releases for the stack & consequently, publishes them to npm + +pnpm artisan make:component HelloWorld # bootstraps a HelloWorld component +pnpm artisan make:function HelloWorld # bootstraps a HelloWorld function +pnpm artisan make:page hello-world # bootstraps a HelloWorld page (https://127.0.0.1/hello-world) + +pnpm artisan help +``` + +
+View the complete Artisan Toolkit + +```bash +pnpm artisan install # or `pnpm i` +pnpm artisan fresh # fresh reinstall of all deps + +pnpm artisan dev # starts one of the dev servers (components, functions, or docs) +pnpm artisan dev:components # starts local playground dev server +pnpm artisan dev:docs # starts local docs dev server + +pnpm artisan make:component HelloWorld +pnpm artisan make:function hello-world + +pnpm artisan stub # stubs all the libraries +pnpm artisan stub:components # stubs the component library +pnpm artisan stub:functions # stubs the function library + +pnpm artisan lint # runs linter +pnpm artisan lint:fix # runs linter and fixes issues + +pnpm artisan commit # follow CLI prompts for committing staged changes +pnpm artisan release # creates the releases for the stack & triggers the Release Action (workflow) +pnpm artisan changelog # generates CHANGELOG.md + +# building for production (e.g. npm) +pnpm artisan build # select a specific build (follow CLI prompts) +pnpm artisan build:components # builds component libraries +pnpm artisan build:functions # builds function library +pnpm artisan build:web-components # builds framework agnostic Web Component library (i.e. Custom Elements) + +# when building for Vercel, Netlify, and more +pnpm artisan deploy:docs + +# creates a server to be deployed into any VPS +pnpm artisan server:functions # wip + +pnpm artisan example # select the example to run (follow CLI prompts) + +# test your stack +pnpm artisan test # runs test suite +pnpm artisan test:unit # runs unit tests +pnpm artisan test:e2e # runs e2e tests +pnpm artisan test:coverage # runs test coverage +pnpm artisan test:types # runs typecheck +``` + +
+ ## πŸ§ͺ Test ### Unit diff --git a/.github/workflows/lock-closed-issues.yml b/.github/workflows/lock-closed-issues.yml deleted file mode 100644 index 4c24227..0000000 --- a/.github/workflows/lock-closed-issues.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Lock Closed Issues - -on: - schedule: - - cron: '0 0 * * *' - -permissions: - issues: write - -jobs: - action: - runs-on: ubuntu-latest - steps: - - uses: dessant/lock-threads@v3 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - issue-inactive-days: '14' - # issue-comment: | - # This issue has been locked since it has been closed for more than 14 days. - # - # If you have found a concrete bug or regression related to it, please open a new [bug report](https://github.com/ow3org/stacks/new/choose) with a reproduction against the latest Stacks version. If you have any other comments you should join the chat at [Stacks Land](https://discord.ow3.org) or create a new [discussion](https://github.com/ow3org/stacks). - issue-lock-reason: '' - process-only: issues diff --git a/.stacks/artisan/src/cli/index.ts b/.stacks/artisan/src/cli/index.ts index b58a51f..3b05603 100644 --- a/.stacks/artisan/src/cli/index.ts +++ b/.stacks/artisan/src/cli/index.ts @@ -5,5 +5,6 @@ import { makeCommands } from './make' import { exampleCommands } from './example' import { testCommands } from './test' import { initCommands } from './init' +import { updateCommands } from './update' -export { devCommands, buildCommands, utilityCommands, makeCommands, exampleCommands, testCommands, initCommands } +export { devCommands, buildCommands, utilityCommands, makeCommands, exampleCommands, testCommands, initCommands, updateCommands } diff --git a/.stacks/artisan/src/cli/update.ts b/.stacks/artisan/src/cli/update.ts new file mode 100644 index 0000000..23da20c --- /dev/null +++ b/.stacks/artisan/src/cli/update.ts @@ -0,0 +1,15 @@ +import type { CAC } from 'cac' +import { component as makeComponent } from '../scripts/make' + +async function updateCommands(artisan: CAC) { + artisan + .command('update', 'Updates the dependencies & framework core') + .option('-d, --dependencies', 'Updates the dependencies') + .option('-f, --framework', 'Updates the framework core') + .option('-a, --all', 'Updates the dependencies & framework core') + .action(async (options: any) => { + await makeComponent(options) + }) +} + +export { updateCommands } diff --git a/.stacks/artisan/src/index.ts b/.stacks/artisan/src/index.ts index cdf65fc..b950752 100644 --- a/.stacks/artisan/src/index.ts +++ b/.stacks/artisan/src/index.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node import cac from 'cac' import { isInitialized } from '../../src/core/helpers' -import { buildCommands, devCommands, exampleCommands, initCommands, makeCommands, testCommands, utilityCommands } from './cli' +import { buildCommands, devCommands, exampleCommands, initCommands, makeCommands, testCommands, updateCommands, utilityCommands } from './cli' import { ExitCode } from './cli/exit-code' import { generate as generateAppKey } from './scripts/key' @@ -24,6 +24,7 @@ async function main() { await initCommands(artisan) } else { + await updateCommands(artisan) await devCommands(artisan) await buildCommands(artisan) await utilityCommands(artisan) diff --git a/.stacks/components/package.json b/.stacks/components/package.json index 77bcd84..a39ee5f 100644 --- a/.stacks/components/package.json +++ b/.stacks/components/package.json @@ -1,7 +1,7 @@ { "name": "@ow3/hello-world-vue", "type": "module", - "version": "0.33.3", + "version": "0.0.0", "packageManager": "pnpm@7.12.2", "description": "Your Vue component library description", "author": "Chris Breuer", diff --git a/.stacks/functions/package.json b/.stacks/functions/package.json index 2c0eed6..8215a3e 100644 --- a/.stacks/functions/package.json +++ b/.stacks/functions/package.json @@ -1,7 +1,7 @@ { "name": "@ow3/hello-world-fx", "type": "module", - "version": "0.33.3", + "version": "0.0.0", "packageManager": "pnpm@7.12.2", "description": "Your function library description.", "author": "Chris Breuer", diff --git a/.stacks/web-components/package.json b/.stacks/web-components/package.json index 5c5f909..0a92c1f 100644 --- a/.stacks/web-components/package.json +++ b/.stacks/web-components/package.json @@ -1,7 +1,7 @@ { "name": "@ow3/hello-world-elements", "type": "module", - "version": "0.33.3", + "version": "0.0.0", "packageManager": "pnpm@7.12.2", "description": "Your framework agnostic web component library description.", "author": "Chris Breuer", diff --git a/README.md b/README.md index a0631c5..581aefe 100644 --- a/README.md +++ b/README.md @@ -10,100 +10,31 @@ Command Palettes, similar to kbar, are often used within applications. This library is to help create a custom & performant command palette for your application. Useful functions & headless components included. -**πŸ€– Zero-config, by design** -**🎨 Built-in animations** -**πŸ§™πŸΌβ€β™€οΈ Fully customizable components** -**✨ Highly performant** +πŸ€– **Zero-config, by design**
+🎨 **Built-in animations**
+πŸ§™πŸΌβ€β™€οΈ **Fully customizable components**
+✨ **Highly performant**
> _The simple way to to use & design `⌘-k` command palettes._ ## Get Started -It's incredibly easy to get started with this Command Palette stack. Simply run either of the following commands in your terminal, based on whether you want to use framework agnostic Web Components or Vue components. +It's incredibly easy to get started with this Command Palette stack. Simply install either of the following packages, dependent on whether you want to use framework agnostic Web Components or Vue components. ```bash -npm install @ow3/command-palette-vue npm install @ow3/command-palette-elements +npm install @ow3/command-palette-vue ``` ## πŸ€– Usage -The following list is of some of the most common ways to interact with the Stacks API. Meet the Artisan Toolkit: - -```bash -pnpm artisan install # installs all dependencies -pnpm artisan dev # starts one of the dev servers (components, functions, pages, or docs) -pnpm artisan build # follow CLI prompts to select which library (or server) to build -pnpm artisan commit # follow CLI prompts for committing changes -pnpm artisan release # creates the releases for the stack & consequently, publishes them to npm - -pnpm artisan make:component HelloWorld # bootstraps a HelloWorld component -pnpm artisan make:function HelloWorld # bootstraps a HelloWorld function -pnpm artisan make:page hello-world # bootstraps a HelloWorld page (https://127.0.0.1/hello-world) - -pnpm artisan help -``` - -
-View the complete Stacks Artisan Toolkit - -```bash -pnpm artisan install # or `pnpm i` -pnpm artisan fresh # fresh reinstall of all deps - -pnpm artisan dev # starts one of the dev servers (components, functions, or docs) -pnpm artisan dev:components # starts local playground dev server -pnpm artisan dev:docs # starts local docs dev server - -pnpm artisan make:component HelloWorld -pnpm artisan make:function hello-world - -pnpm artisan stub # stubs all the libraries -pnpm artisan stub:components # stubs the component library -pnpm artisan stub:functions # stubs the function library - -pnpm artisan lint # runs linter -pnpm artisan lint:fix # runs linter and fixes issues - -pnpm artisan commit # follow CLI prompts for committing staged changes -pnpm artisan release # creates the releases for the stack & triggers the Release Action (workflow) -pnpm artisan changelog # generates CHANGELOG.md - -# building for production (e.g. npm) -pnpm artisan build # select a specific build (follow CLI prompts) -pnpm artisan build:components # builds component libraries -pnpm artisan build:functions # builds function library -pnpm artisan build:web-components # builds framework agnostic Web Component library (i.e. Custom Elements) - -# when building for Vercel, Netlify, and more -pnpm artisan deploy:docs - -# creates a server to be deployed into any VPS -pnpm artisan server:functions # wip - -pnpm artisan example # select the example to run (follow CLI prompts) - -# test your stack -pnpm artisan test # runs test suite -pnpm artisan test:unit # runs unit tests -pnpm artisan test:e2e # runs e2e tests -pnpm artisan test:coverage # runs test coverage -pnpm artisan test:types # runs typecheck -``` - -
- -## πŸ“š Utilizing the Built Libraries - -Because Command Palette is created with reusability & composability in mind, our primary intention is to always _keep it simple, yet configurable._ Read more here about the Stacks CLI in the documentation. -
Web Component usage ```html - + @@ -136,10 +67,11 @@ npm install command-palette-fx After you installed the command-palette library, you can then make of functions in the following way: ```ts -import { isDark } from 'command-palette-fx' +import { isDark, toggleDark } from 'command-palette-fx' console.log('is dark mode?', isDark) ``` +
## πŸ§ͺ Testing diff --git a/config/components.ts b/config/components.ts index 2f7c43f..5c1f26a 100644 --- a/config/components.ts +++ b/config/components.ts @@ -1,17 +1,9 @@ /** * This is where you define the components that need to * be included in your library. Ensure that those - * component names exist in ../components/** + * components exist in ../components/** */ -// TODO: implement to be triggered in correct Vite plugin build hook -// needs to generate a file that exports all components/defines the web components -const components = [ - ['Counter', 'RenamedComponent'], - 'ToggleDark', - 'Logo', - 'HelloWorld', - 'Demo', -] +const components = ['CommandPalette'] export { components } diff --git a/package.json b/package.json index fd678e8..f466206 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@ow3/command-palette", "type": "module", - "version": "0.33.3", + "version": "0.0.0", "packageManager": "pnpm@7.12.2", "description": "The easy way to build your command palette.", "author": "Chris Breuer",