-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1: done vue base
- Loading branch information
Showing
27 changed files
with
786 additions
and
4 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
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 |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
**/*.ejs | ||
**/*.html | ||
package.json | ||
**/template/app/.umirc.js |
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,3 +1,4 @@ | ||
# umi-plugin | ||
|
||
* [@ddot/umi-plugin-service](https://www.npmjs.com/package/@ddot/umi-plugin-service) | ||
* [@ddot/umi-plugin-service](https://www.npmjs.com/package/@ddot/umi-plugin-service) | ||
* [@ddot/umi-plugin-vue](https://www.npmjs.com/package/@ddot/umi-plugin-vue) |
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,10 @@ | ||
/node_modules | ||
/templates/**/node_modules | ||
/templates/**/npm-debug.log* | ||
/templates/**/yarn-error.log | ||
/templates/**/yarn.lock | ||
/templates/**/package-lock.json | ||
/templates/**/.umi | ||
/templates/**/.umi-production | ||
/templates/**/dist | ||
/yarn.lock |
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,15 @@ | ||
# create-umi-vue | ||
|
||
Creates a Vue UmiJS application using the command line. | ||
|
||
## Usage | ||
|
||
```bash | ||
$ yarn create umi-vue <appName> | ||
``` | ||
|
||
## LICENSE | ||
|
||
MIT | ||
|
||
|
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,45 @@ | ||
#!/usr/bin/env node | ||
|
||
const { existsSync } = require("fs"); | ||
const { join } = require("path"); | ||
const semver = require("semver"); | ||
const chalk = require("chalk"); | ||
const mkdirp = require("mkdirp"); | ||
const clipboardy = require("clipboardy"); | ||
|
||
if (!semver.satisfies(process.version, ">= 8.0.0")) { | ||
console.error( | ||
chalk.red("✘ The generator will only work with Node v8.0.0 and up!") | ||
); | ||
process.exit(1); | ||
} | ||
|
||
const script = process.argv[2]; | ||
if (script === "-v" || script === "--version") { | ||
console.log(require("../package").version); | ||
if (existsSync(join(__dirname, "../.local"))) { | ||
console.log(chalk.cyan("@local")); | ||
} | ||
process.exit(0); | ||
} | ||
|
||
if (script) { | ||
mkdirp.sync(script); | ||
process.chdir(script); | ||
} | ||
|
||
const BasicGenerator = require("../lib/BasicGenerator"); | ||
const generator = new BasicGenerator(process.argv.slice(2), { | ||
name: "basic", | ||
env: { | ||
cwd: process.cwd() | ||
}, | ||
resolved: __dirname | ||
}); | ||
generator.run(() => { | ||
if (script) { | ||
clipboardy.writeSync(`cd ${script}`); | ||
console.log("📋 Copied to clipboard, just use Ctrl+V"); | ||
} | ||
console.log("✨ File Generate Done"); | ||
}); |
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,98 @@ | ||
const Generator = require("yeoman-generator"); | ||
const { basename } = require("path"); | ||
const debug = require("debug")("create-umi"); | ||
|
||
module.exports = class BasicGenerator extends Generator { | ||
constructor(args, opts) { | ||
super(args, opts); | ||
|
||
this.name = basename(process.cwd()); | ||
this.props = {}; | ||
} | ||
|
||
// prompting() { | ||
// const prompts = [ | ||
// { | ||
// name: "vue", | ||
// message: "What functionality do your want to enable?", | ||
// type: "checkbox", | ||
// choices: [ ] | ||
// } | ||
// ]; | ||
// return this.prompt(prompts).then(props => { | ||
// this.props = Object.assign(this.props, props); | ||
// }); | ||
// } | ||
|
||
writing() { | ||
debug(`this.name: ${this.name}`); | ||
debug(`this.props: ${JSON.stringify(this.props)}`); | ||
|
||
const context = { | ||
name: this.name, | ||
props: this.props | ||
}; | ||
|
||
this.fs.copy( | ||
this.templatePath("app", "mock", ".*"), | ||
this.destinationPath("mock") | ||
); | ||
this.fs.copy( | ||
this.templatePath("app", "src", "assets"), | ||
this.destinationPath("src/assets") | ||
); | ||
this.fs.copy( | ||
this.templatePath("app", "src", "layouts"), | ||
this.destinationPath("src/layouts") | ||
); | ||
this.fs.copy( | ||
this.templatePath("app", "src", "pages"), | ||
this.destinationPath("src/pages") | ||
); | ||
this.fs.copy( | ||
this.templatePath("app", "src", "global.css"), | ||
this.destinationPath("src/global.css") | ||
); | ||
this.fs.copyTpl( | ||
this.templatePath("app", "package.json"), | ||
this.destinationPath("package.json"), | ||
context | ||
); | ||
this.fs.copy( | ||
this.templatePath("app", "_gitignore"), | ||
this.destinationPath(".gitignore") | ||
); | ||
this.fs.copy( | ||
this.templatePath("app", ".env"), | ||
this.destinationPath(".env") | ||
); | ||
this.fs.copyTpl( | ||
this.templatePath("app", ".umirc.js"), | ||
this.destinationPath(".umirc.js"), | ||
context | ||
); | ||
this.fs.copy( | ||
this.templatePath("app", ".eslintrc"), | ||
this.destinationPath(".eslintrc") | ||
); | ||
this.fs.copy( | ||
this.templatePath("app", ".prettierrc"), | ||
this.destinationPath(".prettierrc") | ||
); | ||
this.fs.copy( | ||
this.templatePath("app", ".prettierignore"), | ||
this.destinationPath(".prettierignore") | ||
); | ||
|
||
if (this.props.react.includes("dva")) { | ||
this.fs.copy( | ||
this.templatePath("app", "src", "models", ".*"), | ||
this.destinationPath("src/models") | ||
); | ||
this.fs.copy( | ||
this.templatePath("app", "src", "dva.js"), | ||
this.destinationPath("src/dva.js") | ||
); | ||
} | ||
} | ||
}; |
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,38 @@ | ||
{ | ||
"name": "create-umi-vue", | ||
"version": "0.0.2", | ||
"description": "Creates a vue UmiJS application using the command line.", | ||
"bin": { | ||
"create-umi": "./bin/cli.js" | ||
}, | ||
"dependencies": { | ||
"chalk": "^2.4.1", | ||
"clipboardy": "^1.2.3", | ||
"debug": "^3.1.0", | ||
"mkdirp": "^0.5.1", | ||
"semver": "^5.5.1", | ||
"yeoman-generator": "^3.1.1" | ||
}, | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/jetsly/umi-plugin/tree/master/packages/create-umi-vue" | ||
}, | ||
"homepage": "https://github.com/jetsly/umi-plugin/tree/master/packages/create-umi-vue", | ||
"authors": [ | ||
"jetsly <cnljli@live.com (https://github.com/jetsly)" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/jetsly/umi-plugin/issues" | ||
}, | ||
"files": [ | ||
"bin", | ||
"lib", | ||
"templates" | ||
], | ||
"keywords": [ | ||
"umi", | ||
"create-umi", | ||
"vue" | ||
] | ||
} |
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 @@ | ||
BROWSER=none |
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,122 @@ | ||
|
||
|
||
# Created by https://www.gitignore.io/api/osx,node,visualstudiocode | ||
|
||
### Node ### | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless | ||
|
||
### OSX ### | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### VisualStudioCode ### | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
|
||
# End of https://www.gitignore.io/api/osx,node,visualstudiocode | ||
|
||
# dependencies | ||
/yarn.lock | ||
/package-lock.json | ||
|
||
# umi | ||
.umi | ||
.umi-production |
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,8 @@ | ||
**/*.md | ||
**/*.svg | ||
**/*.ejs | ||
**/*.html | ||
dist | ||
package.json | ||
.umi | ||
.umi-production |
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 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"printWidth": 100 | ||
} |
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,7 @@ | ||
// ref: https://umijs.org/config/ | ||
export default { | ||
plugins: [ | ||
// ref: https://github.com/jetsly/umi-plugin/tree/master/packages/create-umi-vue | ||
["@ddot/umi-plugin-vue"] | ||
] | ||
}; |
Oops, something went wrong.