-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: vue template support * feat: update create command description * fix: create typo description * fix: manifest destination folder
- Loading branch information
1 parent
83d086a
commit c27f5f5
Showing
7 changed files
with
173 additions
and
12 deletions.
There are no files selected for viewing
File renamed without changes.
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
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 |
---|---|---|
|
@@ -51,7 +51,7 @@ func init() { | |
templates := []LibTemplate{ | ||
{ | ||
Type: "vue", | ||
Link: "", | ||
Link: "[email protected]:websublime/sublime-vue-template.git", | ||
}, | ||
{ | ||
Type: "lit", | ||
|
@@ -61,10 +61,6 @@ func init() { | |
Type: "solid", | ||
Link: "[email protected]:websublime/sublime-solid-template.git", | ||
}, | ||
{ | ||
Type: "react", | ||
Link: "", | ||
}, | ||
{ | ||
Type: "typescript", | ||
Link: "[email protected]:websublime/sublime-typescript-template.git", | ||
|
@@ -83,14 +79,14 @@ func init() { | |
createCmd.Flags().StringVar(&cmd.Type, "type", "", "Type of package (lib or pkg) [REQUIRED]") | ||
createCmd.MarkFlagRequired("name") | ||
|
||
createCmd.Flags().StringVar(&cmd.Template, "template", "lit", "Kind of template (lit) incoming support to: (react, solid, vue, typescript)") | ||
createCmd.Flags().StringVar(&cmd.Template, "template", "lit", "Kind of template: (lit, solid, vue, typescript)") | ||
createCmd.MarkFlagRequired("template") | ||
} | ||
|
||
func NewCreateCmd(cmdCreate *CreateCommand) *cobra.Command { | ||
return &cobra.Command{ | ||
Use: "create", | ||
Short: "Create libs or packages from lit, solid, vue or react", | ||
Short: "Create libs or packages from lit, solid, vue or typescript", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
cmdCreate.CreatPackage((cmd)) | ||
cmdCreate.YarnLink() | ||
|
@@ -121,7 +117,7 @@ func (ctx *CreateCommand) CreatPackage(cmd *cobra.Command) { | |
} | ||
|
||
if link == "" { | ||
color.Error.Println("Unable to determine template. Valid types are: lit, solid, vue, react or typescript") | ||
color.Error.Println("Unable to determine template. Valid types are: lit, solid, vue or typescript") | ||
cobra.CheckErr("Template error") | ||
} | ||
|
||
|
@@ -144,6 +140,12 @@ func (ctx *CreateCommand) CreatPackage(cmd *cobra.Command) { | |
libViteConfigJson = "templates/vite-config-solid.json" | ||
} | ||
|
||
if ctx.Template == "vue" { | ||
libPackageJson = "templates/lib-package-vue.json" | ||
libTsconfigJson = "templates/tsconfig-lib-vue.json" | ||
libViteConfigJson = "templates/vite-config-vue.json" | ||
} | ||
|
||
if ctx.Template == "typescript" { | ||
libViteConfigJson = "templates/vite-config-typescript.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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"name": "{{ .Namespace }}", | ||
"private": false, | ||
"version": "0.0.4", | ||
"source": "./src", | ||
"scripts": { | ||
"start": "vite --debug", | ||
"build": "yarn dts && vite build --mode=production && yarn types", | ||
"dts": "tsc --declaration --emitDeclarationOnly", | ||
"types": "mkdir dist/docs && api-extractor run --local && rm -rf ./declarations", | ||
"release": "yarn changeset publish" | ||
}, | ||
"devDependencies": { | ||
"{{ .Scope }}/vite": "0.0.1", | ||
"@vitejs/plugin-vue": "^2.3.3", | ||
"@microsoft/api-documenter": "^7.17.15", | ||
"@microsoft/api-extractor": "^7.24.1", | ||
"@types/jest": "^27.0.1", | ||
"@types/node": "^16.11.12", | ||
"@typescript-eslint/eslint-plugin": "^5.14.0", | ||
"@typescript-eslint/parser": "^5.14.0", | ||
"eslint": "^8.13.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint-plugin-sort-destructure-keys": "^1.4.0", | ||
"eslint-plugin-unicorn": "^42.0.0", | ||
"jest": "^26.1.0", | ||
"prettier": "^2.5.1", | ||
"rollup-plugin-postcss": "^4.0.2", | ||
"rollup-plugin-postcss-lit": "^2.0.0", | ||
"rollup-plugin-typescript2": "^0.31.2", | ||
"sass": "^1.51.0", | ||
"ts-jest": "^26.1.1", | ||
"typescript": "^4.5.4", | ||
"vite": "^2.8.0" | ||
}, | ||
"dependencies": { | ||
"vue": "^3.2.37" | ||
}, | ||
"main": "./dist/{{ .Name }}.cjs.js", | ||
"module": "./dist/{{ .Name }}.es.js", | ||
"types": "./dist/@types/index.d.ts", | ||
"exports": { | ||
".": { | ||
"require": "./dist/{{ .Name }}.cjs.js", | ||
"import": "./dist/{{ .Name }}.es.js" | ||
} | ||
}, | ||
"publishConfig": { | ||
"registry": "https://npm.pkg.github.com" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "ssh://[email protected]:{{ .Repo }}.git", | ||
"directory": "libs/{{ .Name }}" | ||
}, | ||
"files": [ | ||
"dist/", | ||
"./LICENSE.md", | ||
"./README.md" | ||
] | ||
} | ||
|
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,39 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowSyntheticDefaultImports": true, | ||
"useDefineForClassFields": false, | ||
"declaration": true, | ||
"experimentalDecorators": true, | ||
"importHelpers": true, | ||
"inlineSources": true, | ||
"isolatedModules": true, | ||
"lib": ["es2017", "dom", "dom.iterable"], | ||
"module": "esNext", | ||
"moduleResolution": "node", | ||
"noImplicitReturns": true, | ||
"noUnusedParameters": true, | ||
"noUnusedLocals": true, | ||
"noImplicitAny": false, | ||
"rootDir": ".", | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"sourceMap": true, | ||
"target": "es2017", | ||
"baseUrl": ".", | ||
"paths": { | ||
"*": ["./types/*", "*"], | ||
"{{ .Namespace }}/*": ["./src/*"] | ||
}, | ||
"declarationDir": "./declarations", | ||
"removeComments": false, | ||
"incremental": false, | ||
"composite": false | ||
}, | ||
"include": ["src/**/*.ts", "src/**/*.d.ts", "types/**/*.d.ts", "src/**/*.tsx", "types/**/*.d.ts"], | ||
"extends": "../../tsconfig.base.json", | ||
"references": [ | ||
{ | ||
"path": "{{ .Vite }}" | ||
} | ||
] | ||
} |
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,56 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
/* eslint-disable import/no-import-module-exports */ | ||
import path from 'path'; | ||
|
||
import { workspacesAlias } from '{{ .Scope }}/vite'; | ||
import postcss from 'rollup-plugin-postcss'; | ||
import vue from '@vitejs/plugin-vue'; | ||
import { defineConfig } from 'vite'; | ||
|
||
module.exports = defineConfig({ | ||
build: { | ||
lib: { | ||
entry: path.resolve(__dirname, 'src/index.tsx'), | ||
fileName: (format) => `{{ .Name }}.${format}.js`, | ||
formats: ['es', 'cjs', 'umd'], | ||
name: '{{ .Name }}' | ||
}, | ||
polyfillDynamicImport: false, | ||
rollupOptions: { | ||
// make sure to externalize deps that shouldn't be bundled | ||
// into your library | ||
external: [], | ||
output: { | ||
// Provide global variables to use in the UMD build | ||
// for externalized deps | ||
globals: {} | ||
} | ||
}, | ||
sourcemap: true, | ||
target: 'modules' | ||
}, | ||
css: { | ||
preprocessorOptions: { | ||
sass: { | ||
includePaths: ['node_modules'] | ||
}, | ||
scss: { | ||
includePaths: ['node_modules'] | ||
} | ||
} | ||
}, | ||
plugins: [ | ||
postcss({ | ||
inject: false | ||
}), | ||
vue({ | ||
template: { | ||
compilerOptions: { | ||
// treat all tags with a dash as custom elements | ||
isCustomElement: (tag) => tag.includes('-') | ||
} | ||
} | ||
}), | ||
workspacesAlias(['../../'], ['vite']) | ||
] | ||
}); |