Skip to content

Commit

Permalink
major update for simplicity and modern node
Browse files Browse the repository at this point in the history
  • Loading branch information
btopro committed Apr 26, 2024
1 parent 794f1cf commit a0f97e0
Show file tree
Hide file tree
Showing 307 changed files with 1,083 additions and 28,005 deletions.
11 changes: 0 additions & 11 deletions packages/cli/.editorconfig

This file was deleted.

8 changes: 0 additions & 8 deletions packages/cli/.gitignore

This file was deleted.

10 changes: 5 additions & 5 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ A factory that churns out web components, library agnostic with a unified develo
Make sure you have a version of node >=6.0 and above.
Verify that you have yarn enabled — if not [install yarn globally](https://yarnpkg.com/lang/en/docs/install/).
```bash
yarn global add @wcfactory/cli
$ yarn global add @wcfactory/cli
```
## Usage (company)
A company helps you manage multiple factories and the products they produce so you'll need to create one before you do anything else. **The company MUST be created in a directory above your user directory** in some manner. example: `/home/dana/Documents/git/company` or any directory above `/home/dana`.
```bash
# create a new company, a series of factories linked by the owner
mkdir my-company-name && cd my-company-name && wcf start
$ mkdir my-company-name && cd my-company-name && wcf start
# create a new factory after you've made the company
wcf factory
# add a new element to the factory-name that you produced in the previous step
wcf element
```
Answer the prompts for your new element and your off and running. To work on your new element called `new-name` perform the following:
```bash
cd {factoryName}/elements/new-name
yarn start
$ cd {factoryName}/elements/new-name
$ yarn start
```
This will open the folder to the `elements/new-name/src` folder, start watching it for changes which will be compiled automatically (and documented), and open a mini-server (via `polymer serve`) which will allow you to edit the src directory files, compile them together and make them available for the localhost window for viewing.

Expand Down Expand Up @@ -59,7 +59,7 @@ The factories produced by this come equiped with storybook integration. To publi
- Never have to understand the complexities of tooling
- CLI should seek to empower as many people as possible
- Anyone should be able to manage, create, and share elements in an element library
- Seamless sharing to npmjs.com, and git
- Seamless sharing to webcomponents.org, npmjs.com, and git
- Unify CLI, build step, and element packaging across all libraries
- Allow advanced developers to fork, tinker, and repurpose to their will

Expand Down
146 changes: 146 additions & 0 deletions packages/cli/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/cli/oclif.manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"0.8.7","commands":{"build":{"id":"build","description":"Create a new Build","pluginName":"@wcfactory/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"name":{"name":"name","type":"option","char":"n","description":"Folder name for the build"},"description":{"name":"description","type":"option","char":"d","description":"Brief description for the build"},"factory":{"name":"factory","type":"option","char":"f","description":"Factory to build from"},"buildTarget":{"name":"buildTarget","type":"option","char":"t","description":"Type of build target"}},"args":[]},"element":{"id":"element","description":"Create a new element","pluginName":"@wcfactory/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"factory":{"name":"factory","type":"option","char":"f","description":"Factory to use"},"customElementTemplate":{"name":"customElementTemplate","type":"option","char":"c","description":"Custom element template to use"},"name":{"name":"name","type":"option","char":"n","description":"Name of the element"},"description":{"name":"description","type":"option","char":"d","description":"Description of the element"},"useSass":{"name":"useSass","type":"boolean","char":"s","description":"Description of the element","allowNo":true},"addProps":{"name":"addProps","type":"boolean","char":"p","description":"Add properties","allowNo":true},"useHAX":{"name":"useHAX","type":"boolean","char":"h","description":"Use HAX","allowNo":true}},"args":[]},"factory":{"id":"factory","description":"Create mono repo for your element library.","pluginName":"@wcfactory/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose mode","allowNo":false},"humanName":{"name":"humanName","type":"option","char":"h","description":"Name of this factory"},"description":{"name":"description","type":"option","char":"d","description":"Description of this factory"},"orgNpm":{"name":"orgNpm","type":"option","char":"o","description":"NPM organization name (include @)"},"orgGit":{"name":"orgGit","type":"option","char":"O","description":"Git organization name"},"name":{"name":"name","type":"option","char":"n","description":"Git organization name"},"gitRepo":{"name":"gitRepo","type":"option","char":"g","description":"Your Repo name. Must be a valid git/npm name"}},"args":[]},"operation":{"id":"operation","description":"Run a script specified in a package.","pluginName":"@wcfactory/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"description":{"name":"description","type":"option","char":"d","description":"Run the develop command for an element."}},"args":[]},"start":{"id":"start","description":"Create a company for your factories.","pluginName":"@wcfactory/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"author":{"name":"author","type":"option","char":"a","description":"Author name for your elements"},"copyrightOwner":{"name":"copyrightOwner","type":"option","char":"c","description":"Copyright owner of your work"},"license":{"name":"license","type":"option","char":"l","description":"Software License to use","helpValue":"(Apache-2.0|MIT|BSD-3-Clause|BSD-2-Clause)","options":["Apache-2.0","MIT","BSD-3-Clause","BSD-2-Clause"]}},"args":[]},"unbundled:build":{"id":"unbundled:build","description":"Build a project.","pluginName":"@wcfactory/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"unbundled:generate":{"id":"unbundled:generate","description":"Generate an unbundled build project.","pluginName":"@wcfactory/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"unbundled":{"id":"unbundled","description":"[In Development] Generate Unbundled Builds. A method of packaging web components for production.","pluginName":"@wcfactory/cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]}}}
24 changes: 11 additions & 13 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@wcfactory/cli",
"description": "CLI for managing your custom elements at scale.",
"version": "0.13.1",
"version": "0.8.7",
"author": "heyMP @heyMP",
"bin": {
"wcf": "./bin/run"
Expand All @@ -11,29 +11,27 @@
"@oclif/command": "^1",
"@oclif/config": "^1",
"@oclif/plugin-help": "^2",
"@wcfactory/common": "^0.13.0",
"@wcfactory/generator-wcfactory": "^0.13.1",
"@wcfactory/graphql-server": "^0.13.0",
"@wcfactory/ui": "^0.13.0",
"@web/dev-server": "0.1.28",
"@wcfactory/common": "^0.8.6",
"@wcfactory/generator-wcfactory": "^0.8.7",
"date-fns": "^1.29.0",
"fuse.js": "^3.4.2",
"glob": "^10.2.7",
"glob": "^7.1.3",
"inquirer": "^7.0.0",
"inquirer-autocomplete-prompt": "^1.0.1",
"inquirer-recursive": "^0.0.7",
"inquirer-recursive": "^0.0.6",
"listr": "^0.14.2",
"listr-update-renderer": "^0.5.0",
"listr-verbose-renderer": "^0.6.0",
"lodash": "^4.17.11",
"terser": "^5.0.0",
"polymer-cli": "1.9.11",
"terser": "^4.7.0",
"yeoman-environment": "^2.3.3",
"yeoman-generator": "^4.0.0"
},
"devDependencies": {
"@oclif/dev-cli": "1.26.0",
"@oclif/test": "1.2.8",
"globby": "10.0.2"
"@oclif/dev-cli": "1.22.2",
"@oclif/test": "1.2.5",
"globby": "10.0.1"
},
"engines": {
"node": ">=8.0.0"
Expand Down Expand Up @@ -69,5 +67,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "72f5a446893e45d8c2df8ea2116ef3e741e13849"
"gitHead": "7ff583e930d906d39c5a05334745eb1927574e8f"
}
1 change: 0 additions & 1 deletion packages/cli/src/commands/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Element.flags = {
customElementTemplate: flags.string({ char: 'c', description: 'Custom element template to use' }),
name: flags.string({ char: 'n', description: 'Name of the element' }),
description: flags.string({ char: 'd', description: 'Description of the element' }),
useCLI: flags.boolean({ char: 'l', description: 'Use CLI', allowNo: true }),
useSass: flags.boolean({ char: 's', description: 'Description of the element', allowNo: true }),
addProps: flags.boolean({ char: 'p', description: 'Add properties', allowNo: true }),
useHAX: flags.boolean({ char: 'h', description: 'Use HAX', allowNo: true }),
Expand Down
5 changes: 1 addition & 4 deletions packages/cli/src/commands/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ class Factory extends Command {
// process the user input
let { args, flags } = this.parse(Factory)
// prompt the user for more info
if (!flags.yes) {
flags = await promptUser(questions, flags, this)
}
flags = await promptUser(questions, flags, this)
// add a year
flags.year = new Date().getFullYear()
// kick off generator
Expand All @@ -36,7 +34,6 @@ Factory.flags = {
orgGit: flags.string({ char: 'O', description: 'Git organization name' }),
name: flags.string({ char: 'n', description: 'Git organization name' }),
gitRepo: flags.string({ char: 'g', description: 'Your Repo name. Must be a valid git/npm name' }),
yes: flags.boolean({ char: 'y', description: 'Skip prompts' }),
}

module.exports = Factory
8 changes: 6 additions & 2 deletions packages/cli/src/commands/operation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ const path = require('path')
const { Command, flags } = require('@oclif/command')
const { promptUser } = require('../utils/commands')
const { questions } = require('../questions/operation')
const { runScript } = require('@wcfactory/common')
const { spawn } = require('child_process');

class Operation extends Command {
async run() {
let { args, flags } = this.parse(Operation)
// prompt the user for remaining flags
flags = await promptUser(questions, flags, this)
// run the operation for that element
runScript(flags.script, flags.element)
const ls = spawn('npm', ['run', flags.script], {
cwd: flags.element,
stdio: 'inherit',
shell: true
});
}
}

Expand Down
23 changes: 0 additions & 23 deletions packages/cli/src/commands/template/index.js

This file was deleted.

23 changes: 0 additions & 23 deletions packages/cli/src/commands/template/update.js

This file was deleted.

0 comments on commit a0f97e0

Please sign in to comment.