vue-sfc-rollup
Advanced tools
Comparing version 1.0.0-alpha.0 to 1.0.0
@@ -6,3 +6,3 @@ { | ||
"license": "ISC", | ||
"version": "1.0.0-alpha.0", | ||
"version": "1.0.0", | ||
"bin": { | ||
@@ -18,2 +18,6 @@ "sfc-rollup-init": "./sfc-init.js" | ||
"homepage": "https://github.com/team-innovation/vue-sfc-rollup", | ||
"files": [ | ||
"templates/*", | ||
"sfc-init.js" | ||
], | ||
"scripts": { | ||
@@ -20,0 +24,0 @@ "lint": "eslint ./**/*.js" |
# vue-sfc-rollup | ||
vue-sfc-rollup exists to provide the minimal setup necessary to compile a Vue Single File Component (SFC) into a form ready to share via npm. | ||
vue-sfc-rollup is a utility that scaffolds a minimal setup for compiling a Vue Single File Component (SFC) - or library of multiple SFCs - into a form ready to share via npm. | ||
@@ -10,4 +10,7 @@ ## TL;DR | ||
# fill in prompts | ||
cd my-component | ||
vue serve ./src/my-component.vue # Or other live-refresh coding | ||
cd path/to/my-component-or-lib | ||
# if single component | ||
vue serve ./src/my-component.vue # Use @vue/cli or other live-refresh coding | ||
# if library | ||
vue serve ./src/lib-dev.vue # Use @vue/cli or other live-refresh coding | ||
# Do dev stuff... | ||
@@ -21,5 +24,5 @@ npm run build | ||
The vue-sfc-rollup wizard scaffolds 4 files for you to kick of your SFC development. These files include a minimal [rollup](https://rollupjs.org) config, a corresponding package.json file with build script and dependencies, a wrapper used by rollup when packaging your SFC, and a sample SFC to kick-start development. | ||
The vue-sfc-rollup utility scaffolds 4 files (6 in library mode) for you to kick of your SFC development. These files include a minimal [rollup](https://rollupjs.org) config, a corresponding package.json file with build script and dependencies, a wrapper used by rollup when packaging your SFC, and a sample SFC to kick-start development. In library mode, there is also an 'index' which declares the components exposed as part of your library, and a sample library usage file which can be used to load/test your library during development. | ||
If you wish to integrate this into an existing SFC, please check out [the vue-sfc-rollup source](https://github.com/mgdodge/vue-sfc-rollup). The files generated by the wizard are located inside the `templates` directory of the repository. Merge the important bits of those file with your existing code, and you'll be good to go. | ||
If you wish to integrate this into an existing SFC, please check out [the vue-sfc-rollup source](https://github.com/team-innovation/vue-sfc-rollup). The files generated by this utility are located inside the `templates` directory of the repository. Merge the important bits of those file with your existing code, and you'll be good to go. | ||
@@ -45,17 +48,19 @@ ### Install | ||
- *npm name*: This is how people will find your component in npm. Please refer to [the official npm docs](https://docs.npmjs.com/files/package.json#name) for details of what to enter here | ||
- *component name*: This is the kebab-case version of your SFC component name - what your component's tag would be if you were to use this in an HTML page or another component. Since any kebab-case tag name would also be a safe file name, this will also be the name of the generated files. | ||
- *save path*: Where do you want to save this component? By default, the wizard will use your current directory and create a new folder with the same kebab-case name as your component (eg. ./my-component/). | ||
- *select mode*: Declare whether you want to scaffold a single component or a library of components. | ||
- *npm name*: This is how people will find your component/library in npm. Please refer to [the official npm docs](https://docs.npmjs.com/files/package.json#name) for details of what to enter here | ||
- *component name* (Single Component Mode Only): This is the kebab-case version of your SFC component name - what your component's tag would be if you were to use this in an HTML page or another component. Since any kebab-case tag name would also be a safe file name, this will also be the name of the generated files. | ||
- *save path*: Where do you want to save this component? By default, the wizard will use your current directory and create a new folder with the kebab-case name as your component/library (eg. ./my-component-or-library). | ||
After prompting you for this information, the wizard then creates copies of the files found in the `templates` directory and performs the forementioned {{ variables }} replacement using the information enterd. | ||
After prompting you for this information, the wizard then creates copies of the files found in the `templates` directory and performs some variable replacement using the information enterd. | ||
### Developing your SFC | ||
vue-sfc-rollup is currently focused on packaging your SFC for distribution via npm. The Vue cli is excellent for the actual development process of your SFC, and it is recommended you use the official tooling. | ||
vue-sfc-rollup is currently focused on packaging your SFC for distribution via npm. The [Vue CLI](https://cli.vuejs.org/) is excellent for the actual development process of your SFC, and it is recommended you use the official tooling. With v3 of the Vue CLI installed globally, you can truly develop your SFC with zero configuration just by entering the following commands: | ||
With v3 of the Vue cli installed globally, you can truly develop your SFC with zero conf just by entering the following commands: | ||
```bash | ||
cd ./my-component | ||
cd path/to/my-component-or-lib | ||
# if single component | ||
vue serve ./src/my-component.vue | ||
# if library | ||
vue serve ./src/lib-dev.vue | ||
``` | ||
@@ -67,6 +72,6 @@ | ||
Once your development is done, it's time to package your component to publish to npm. The actual process of [publishing to npm](https://docs.npmjs.com/getting-started/publishing-npm-packages) is left up to you, but the whole purpose of this project is to compile your SFC so that it's packaged and ready to go. | ||
Once your development is done, it's time to package your component to publish to npm. The actual process of [publishing to npm](https://docs.npmjs.com/getting-started/publishing-npm-packages) is left up to you, but the whole purpose of this project is to compile your SFC/library so that it's packaged and ready to go. | ||
```bash | ||
cd ./my-component | ||
cd path/to/my-component-or-lib | ||
npm run build | ||
@@ -73,0 +78,0 @@ # rollup does its thing...done! |
@@ -71,2 +71,3 @@ #! /usr/bin/env node | ||
entryjs: '', | ||
libDev: '', | ||
libExports: '', | ||
@@ -79,2 +80,3 @@ component: '', | ||
entryjs: path.join(savePath, 'src', 'entry.js'), | ||
libDev: null, | ||
libExports: null, | ||
@@ -87,3 +89,3 @@ component: null, | ||
newFiles.package = replaceVars( | ||
fs.readFileSync(path.join(__dirname, 'templates', 'single', 'package.json')).toString(), | ||
fs.readFileSync(path.join(__dirname, 'templates', 'single', 'single-package.json')).toString(), | ||
vars, | ||
@@ -99,2 +101,3 @@ ); | ||
); | ||
delete newFiles.libDev; | ||
delete newFiles.libExports; | ||
@@ -105,2 +108,3 @@ newFiles.component = replaceVars( | ||
); | ||
delete paths.libDev; | ||
delete paths.libExports; | ||
@@ -113,3 +117,3 @@ paths.component = path.join(savePath, 'src', `${kebabName}.vue`); | ||
newFiles.package = replaceVars( | ||
fs.readFileSync(path.join(__dirname, 'templates', 'library', 'package.json')).toString(), | ||
fs.readFileSync(path.join(__dirname, 'templates', 'library', 'library-package.json')).toString(), | ||
vars, | ||
@@ -125,2 +129,6 @@ ); | ||
); | ||
newFiles.libDev = replaceVars( | ||
fs.readFileSync(path.join(__dirname, 'templates', 'library', 'src', 'lib-dev.vue')).toString(), | ||
vars, | ||
); | ||
newFiles.libExports = replaceVars( | ||
@@ -134,2 +142,3 @@ fs.readFileSync(path.join(__dirname, 'templates', 'library', 'src', 'lib-components', 'index.js')).toString(), | ||
); | ||
paths.libDev = path.join(savePath, 'src', 'lib-dev.vue'); | ||
paths.libExports = path.join(savePath, 'src', 'lib-components', 'index.js'); | ||
@@ -136,0 +145,0 @@ paths.component = path.join(savePath, 'src', 'lib-components', `${kebabName}-sample.vue`); |
@@ -19,3 +19,3 @@ // Import vue components | ||
// To auto-install when vue is found | ||
/* global window */ | ||
/* global window global */ | ||
let GlobalVue = null; | ||
@@ -22,0 +22,0 @@ if (typeof window !== 'undefined') { |
@@ -17,3 +17,3 @@ // Import vue component | ||
// To auto-install when vue is found | ||
/* global window */ | ||
/* global window global */ | ||
let GlobalVue = null; | ||
@@ -20,0 +20,0 @@ if (typeof window !== 'undefined') { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
20030
15
260
0
78
0
1