4.0.3 ā€¢ Published 2 years ago

@apollo-elements/create v4.0.3

Weekly downloads
30
License
ISC
Repository
github
Last release
2 years ago

@apollo-elements/create

Published on npm Published on webcomponents.org ISC License Release

āš”ļø App and Component Generator for Apollo Elements šŸš€

šŸ”Ž Read the Full API Docs šŸ”Ž

To quickly get started with apollo-elements, generate a skeleton app with this command

npm init @apollo-elements

Which will prompt you to generate a full app, or a component thereof.

App Generator

npm init @apollo-elements -- app

Generate an Apollo Elements Skeleton App

Example

npm init @apollo-elements -- \
  app \
    --pkg-manager yarn \
    --uri '/graphql' \
    --install \
    --start \
    --overwrite

Options

FlagDescriptiontypedefault
--helpShow helpboolean
--versionShow version numberboolean
--pkg-managerPreferred package managernpm or yarnnpm
--uri, -uURI to your GraphQL endpointstring
--overwriteOverwrite existing filesboolean
--package-defaultsUse default package.json fields (e.g. author, license)boolean
--codegenRun codegen after scaffolding filesbooleantrue
--install, -iAutomatically install dependenciesboolean
--start, -sLaunch the dev server after scaffoldingboolean

šŸ”‹ Batteries Included

The generated app comes with plenty of bells-and-whistles:

  • TypeScript
  • Linting with eslint and an opinionated ruleset
  • Buildless development workflow with @web/dev-server
  • Minified production bundle
  • A basic Apollo Client instance
  • Simple, unopinionated SPA routing
  • Code-generated TypeScript typings for GraphQL documents
  • import MyQuery from './My.query.graphql'
  • import styles from './my-element.css'

šŸ›Ž Scripts

These npm scripts help you get your work done in style:

npm start
yarn start

runs the code generator and the development server in watch mode

npm run build
yarn build

bundles the app into /build. The build will bundle and minify your javascript, and minify your HTML. Just upload to your static file host and you're good.

npm run lint
yarn lint

Lint your app with an opinionated set of rules for JavaScript and TypeScript

npm test
yarn test

The generator currently doesn't offer strong opinions on testing your UI components, so npm test currently exist with an error code. For unit testing business logic (i.e. typePolicies), we recommend @web/test-runner

Component Generator

npm init @apollo-elements -- component

Generate an Apollo Element

Example

npm init @apollo-elements -- \
  component \
    --type mutation \
    --name x-user-profile \
    --subdir user \
    --schema-path '#schema' \
    --shared-css-path '#components/shared.css' \
    --variables '$input: UpdateProfileInput!' \
    --fields 'updateProfile(input: $input) { id }' \
    --no-codegen
    --overwrite

Options

FlagDescriptiontypedefault
--helpShow helpboolean
--versionShow version numberboolean
--pkg-managerPreferred package managernpm or yarnnpm
--type, -tElement typequery, mutation, or subscriptionquery
--name, -nCustom element tag namestring
--subdir, -dOptional subdir under src/componentsstring
--overwriteOverwrite existing filesbooleanfalse
--codegenRun codegen after scaffolding filesbooleantrue
--schema-pathOptional custom path to schema types filestring
--shared-css-pathOptional custom path to shared component styles filestring
--variablesOptional custom variables e.g. input: $UpdateUserInputstring
--fieldsOptional custom fields e.g. id name picture { alt url }string
4.0.3

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

4.0.2

2 years ago

3.1.4-next.0

2 years ago

3.1.3

2 years ago

3.1.2

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.1-next.2

3 years ago

2.0.1-next.1

3 years ago

2.0.1

3 years ago

2.0.1-next.0

3 years ago

2.0.0

3 years ago

2.0.0-next.6

3 years ago

2.0.0-next.4

3 years ago

2.0.0-next.5

3 years ago

2.0.0-next.3

3 years ago

2.0.0-next.2

3 years ago

1.5.0-next.1

3 years ago

1.5.0-next.0

3 years ago

1.4.0

3 years ago

1.4.0-alpha.0

3 years ago

1.4.0-alpha.1

3 years ago

1.4.0-alpha.2

3 years ago

1.3.0

3 years ago

1.3.0-alpha.0

3 years ago

1.2.1

3 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.0

4 years ago

1.0.0-alpha.2

4 years ago

1.0.0-alpha.1

4 years ago

0.0.2-alpha.7

4 years ago

0.0.2-alpha.6

4 years ago

0.0.2-alpha.5

4 years ago

0.0.2-alpha.4

4 years ago