-
-
Notifications
You must be signed in to change notification settings - Fork 798
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'canary' into add-core-tests
- Loading branch information
Showing
22 changed files
with
4,531 additions
and
316 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ node_modules | |
reports | ||
*.log | ||
**/.env* | ||
coverage | ||
.nyc_output | ||
**/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const {fs} = require('memfs') | ||
|
||
module.exports = fs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,7 @@ node_modules | |
.rts2_cache_umd | ||
.rts2_cache_system | ||
dist | ||
tmp | ||
|
||
# good directory to use for testing app generation | ||
_app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# blitz-cli | ||
|
||
Blitz CLI | ||
|
||
[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io) | ||
[![Version](https://img.shields.io/npm/v/blitz-cli.svg)](https://npmjs.org/package/blitz-cli) | ||
[![Downloads/week](https://img.shields.io/npm/dw/blitz-cli.svg)](https://npmjs.org/package/blitz-cli) | ||
[![License](https://img.shields.io/npm/l/blitz-cli.svg)](https://github.com/mabadir/blitz-cli/blob/master/package.json) | ||
|
||
## Contributing | ||
|
||
Run `yarn` from the monorepo root | ||
|
||
**Run locally from this directory:** | ||
`yarn b [COMMAND]` | ||
|
||
**Run tests:** | ||
`yarn test` | ||
|
||
**Build package:** | ||
`yarn build` | ||
|
||
<!-- toc --> | ||
|
||
- [blitz-cli](#blitz-cli) | ||
- [Usage](#usage) | ||
- [Commands](#commands) | ||
<!-- tocstop --> | ||
|
||
# Usage | ||
|
||
<!-- usage --> | ||
|
||
```sh-session | ||
$ npm install -g @blitzjs/cli | ||
$ blitz COMMAND | ||
running command... | ||
$ blitz (-v|--version|version) | ||
@blitzjs/cli/0.0.1 darwin-x64 node-v12.16.1 | ||
$ blitz --help [COMMAND] | ||
USAGE | ||
$ blitz COMMAND | ||
... | ||
``` | ||
|
||
<!-- usagestop --> | ||
|
||
# Commands | ||
|
||
<!-- commands --> | ||
|
||
- [`blitz help [COMMAND]`](#blitz-help-command) | ||
- [`blitz new [PATH]`](#blitz-new-path) | ||
|
||
## `blitz help [COMMAND]` | ||
|
||
display help for blitz | ||
|
||
``` | ||
USAGE | ||
$ blitz help [COMMAND] | ||
ARGUMENTS | ||
COMMAND command to show help for | ||
OPTIONS | ||
--all see all commands in CLI | ||
``` | ||
|
||
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v2.2.3/src/commands/help.ts)_ | ||
|
||
## `blitz new [PATH]` | ||
|
||
Create a new Blitz project | ||
|
||
``` | ||
USAGE | ||
$ blitz new [PATH] | ||
ARGUMENTS | ||
PATH path to the new project, defaults to the current directory | ||
OPTIONS | ||
-h, --help show CLI help | ||
-t, --[no-]ts generate a TypeScript project | ||
--yarn use Yarn as the package manager | ||
``` | ||
|
||
_See code: [lib/commands/new.js](https://github.com/blitz-js/blitz/blob/v0.0.1/lib/commands/new.js)_ | ||
|
||
<!-- commandsstop --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env node | ||
|
||
require('@oclif/command').run() | ||
.then(require('@oclif/command/flush')) | ||
.catch(require('@oclif/errors/handle')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@echo off | ||
|
||
node "%~dp0\run" %* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
moduleFileExtensions: ['ts', 'js', 'json'], | ||
coverageReporters: ['json', 'lcov', 'text', 'clover'], | ||
// collectCoverage: !!`Boolean(process.env.CI)`, | ||
collectCoverageFrom: ['src/**/*.ts'], | ||
coveragePathIgnorePatterns: ['/templates/'], | ||
// TODO enable threshold | ||
// coverageThreshold: { | ||
// global: { | ||
// branches: 100, | ||
// functions: 100, | ||
// lines: 100, | ||
// statements: 100, | ||
// }, | ||
// }, | ||
globals: { | ||
'ts-jest': { | ||
tsConfig: 'test/tsconfig.json', | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,63 @@ | ||
{ | ||
"name": "@blitzjs/cli", | ||
"description": "Framework for building monolithic, full-stack, serverless React apps with zero data-fetching and zero client-side state management", | ||
"description": "Blitz CLI", | ||
"version": "0.0.1", | ||
"license": "MIT", | ||
"scripts": { | ||
"b": "./bin/run", | ||
"version": "oclif-dev readme && git add README.md", | ||
"build": "oclif-dev pack", | ||
"prepack": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme", | ||
"postpack": "rm -f oclif.manifest.json", | ||
"test": "jest --coverage" | ||
}, | ||
"author": "Mina Abadir @mabadir", | ||
"main": "lib/index.js", | ||
"bin": { | ||
"blitz": "./bin/run" | ||
}, | ||
"types": "lib/index.d.ts", | ||
"files": [ | ||
"/bin", | ||
"/lib", | ||
"/npm-shrinkwrap.json", | ||
"/oclif.manifest.json" | ||
], | ||
"dependencies": { | ||
"@oclif/command": "^1.5.19", | ||
"@oclif/config": "^1.14.0", | ||
"@oclif/plugin-help": "^2.2.3", | ||
"@oclif/plugin-not-found": "^1.2.3", | ||
"yeoman-environment": "^2.8.0", | ||
"yeoman-generator": "^4.5.0" | ||
}, | ||
"devDependencies": { | ||
"@oclif/dev-cli": "^1.22.2", | ||
"@oclif/test": "^1.2.5", | ||
"@types/yeoman-environment": "^2.3.2", | ||
"@types/yeoman-generator": "^3.1.4", | ||
"chai": "^4.2.0", | ||
"globby": "^11.0.0", | ||
"ts-node": "^8.6.2" | ||
}, | ||
"oclif": { | ||
"commands": "./lib/commands", | ||
"bin": "blitz", | ||
"plugins": [ | ||
"@oclif/plugin-help", | ||
"@oclif/plugin-not-found" | ||
] | ||
}, | ||
"engines": { | ||
"yarn": "^1.19.1", | ||
"node": ">=12.16.1" | ||
}, | ||
"keywords": [ | ||
"blitz", | ||
"cli" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/blitz-js/blitz" | ||
}, | ||
"author": { | ||
"name": "Brandon Bayer", | ||
"email": "b@bayer.ws", | ||
"url": "https://twitter.com/flybayer" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Michael Edelman", | ||
"email": "michael@fabulas.io", | ||
"url": "https://twitter.com/edelman215" | ||
} | ||
], | ||
"main": "dist/index.js", | ||
"module": "dist/testtsdx.esm.js", | ||
"typings": "dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"start": "tsdx watch", | ||
"build": "tsdx build", | ||
"test": "tsdx test", | ||
"lint": "tsdx lint" | ||
}, | ||
"peerDependencies": {}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "tsdx lint" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import {Command, flags} from '@oclif/command' | ||
import yeoman = require('yeoman-environment') | ||
const debug = require('debug')('blitz:new') | ||
|
||
export interface Flags { | ||
ts: boolean | ||
yarn: boolean | ||
} | ||
|
||
export default class New extends Command { | ||
static description = 'Create a new Blitz project' | ||
|
||
static args = [ | ||
{ | ||
name: 'path', | ||
required: false, | ||
description: 'path to the new project, defaults to the current directory', | ||
}, | ||
] | ||
|
||
static flags = { | ||
help: flags.help({char: 'h'}), | ||
ts: flags.boolean({ | ||
char: 't', | ||
description: 'generate a TypeScript project', | ||
default: true, | ||
allowNo: true, | ||
}), | ||
yarn: flags.boolean({description: 'use Yarn as the package manager', default: true}), | ||
} | ||
|
||
async run() { | ||
const {args, flags} = this.parse(New) | ||
debug('args: ', args) | ||
debug('flags: ', flags) | ||
const env = yeoman.createEnv() | ||
|
||
env.register(require.resolve('../generators/app'), 'generate:app') | ||
env.run(['generate:app', args.path], flags as Flags, (err: Error | null) => { | ||
if (err) this.error(err) // Maybe tell a bit more... | ||
this.log('App created!') // This needs some sparkles ✨ | ||
}) | ||
} | ||
} |
Oops, something went wrong.