This repository has been archived by the owner on Dec 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from pattern-lab/dev
plugin-node-tab 2.0
- Loading branch information
Showing
5 changed files
with
40 additions
and
59 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"tabsToAdd":[] | ||
} |
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 |
---|---|---|
@@ -1,39 +1,3 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs-extra'), | ||
glob = require('glob'), | ||
inquirer = require('inquirer'); | ||
|
||
let config = require('./package.json'); | ||
let fileTypes = []; | ||
|
||
var questions = [ | ||
{ | ||
type: 'input', | ||
name: 'types', | ||
message: 'Specify filetype(s) to create a tab for. Separate multiple filetypes with a space, pipe or comma. Example: js css >>> ' | ||
} | ||
]; | ||
|
||
inquirer | ||
.prompt(questions) | ||
.then(function (answers) { | ||
|
||
fileTypes = answers.types.split(/,| /); | ||
|
||
if (fileTypes.length === 1 && fileTypes[0] === '') { | ||
console.log('No filetype(s) provided. Returning unconfigured!'); | ||
return; | ||
} | ||
|
||
for (let i = 0; i < fileTypes.length; i++) { | ||
if (fileTypes[i].charAt(0) === '.') { | ||
fileTypes[i] = fileTypes[i].slice(1); | ||
} | ||
} | ||
|
||
console.log('Adding configuration for tabs', fileTypes, 'inside package.json'); | ||
config.fileTypes = fileTypes; | ||
fs.outputFileSync('./package.json', JSON.stringify(config, null, 2), 'utf-8'); | ||
}); | ||
|
||
console.log('Pattern Lab Node Plugin - "plugin-node-tab" installed. '); | ||
console.log('Configure or disable this plugin inside your patternlab-config.json file.'); | ||
console.log('Add tabs to the Pattern Lab UI by adding file extensions to the "tabsToAdd" array on the plugins.plugin-node-tab.options object.'); |