Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/inquiries/starterkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const starterkitSetup = [{
choices: [
{
name: 'starterkit-mustache-demo',
value: 'starterkit-mustache-demo'
value: '@pattern-lab/starterkit-mustache-demo'
},
{
name: 'starterkit-mustache-bootstrap',
Expand Down Expand Up @@ -44,7 +44,7 @@ const starterkitSetup = [{
},
{
name: 'starterkit-mustache-base',
value: 'starterkit-mustache-base'
value: '@pattern-lab/starterkit-mustache-base'
},
new inquirer.Separator(),
{
Expand Down
8 changes: 5 additions & 3 deletions bin/install-starterkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ const checkAndInstallPackage = require('./utils').checkAndInstallPackage;
const copyAsync = require('./utils').copyAsync;
const wrapAsync = require('./utils').wrapAsync;

const installStarterkit = (starterkit, config) => wrapAsync(function*() {
const installStarterkit = (starterkit, config) => wrapAsync(function * () {
const sourceDir = config.paths.source.root;
const name = starterkit.name || starterkit;
const url = `pattern-lab/${name}`;
const name = starterkit.value || starterkit;
const url = name.startsWith('@pattern-lab/')
? name
: `pattern-lab/${name}`;
yield checkAndInstallPackage(name, url);
yield copyAsync(path.resolve('./node_modules', name, 'dist'), path.resolve(sourceDir));
return name;
Expand Down
2 changes: 1 addition & 1 deletion bin/serve.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
const chokidar = require('chokidar');
const liveServer = require('live-server');
const liveServer = require('@pattern-lab/live-server');
const patternlab = require('patternlab-node');
const path = require('path');
const _ = require('lodash');
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "patternlab-node-cli",
"description": "Command-line interface (CLI) for the patternlab-node core.",
"version": "0.0.1-alpha.10",
"version": "0.0.1-alpha.11",
"bin": {
"patternlab": "bin/patternlab.js"
},
Expand All @@ -10,26 +10,26 @@
},
"private": true,
"dependencies": {
"archiver": "2.0.3",
"chalk": "2.1.0",
"chokidar": "1.7.0",
"commander": "2.11.0",
"execa": "0.8.0",
"@pattern-lab/live-server": "1.3.2",
"archiver": "2.1.1",
"chalk": "2.3.1",
"chokidar": "2.0.2",
"commander": "2.14.1",
"execa": "0.9.0",
"fs-promise": "2.0.3",
"glob": "7.1.2",
"has-yarn": "1.0.0",
"inquirer": "3.3.0",
"live-server": "pattern-lab/live-server",
"lodash": "4.17.4",
"ora": "1.3.0",
"inquirer": "5.1.0",
"lodash": "4.17.5",
"ora": "1.4.0",
"path-exists": "3.0.0",
"patternlab-node": "2.12.0",
"sanitize-filename": "1.6.1"
},
"devDependencies": {
"eslint": "4.8.0",
"eslint": "4.17.0",
"proxyquire": "1.8.0",
"tap": "10.7.2"
"tap": "11.1.0"
},
"files": [
"bin"
Expand Down
8 changes: 7 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@


## Installation
`npm install pattern-lab/patternlab-node-cli` or `yarn add pattern-lab/patternlab-node-cli`
*Note: Global installs are currently not supported and will be fixed when the Pattern Lab core hits v3.0.0*

#### Via NPM
`npm install pattern-lab/patternlab-node-cli --save-dev`

#### Via Yarn
`yarn add pattern-lab/patternlab-node-cli --dev`

## Getting Started
1. In order to use PatternLab you need to initialize a PatternLab project with `patternlab init`. The CLI will ask you some setup question and scaffold your project based on it.
Expand Down
2 changes: 1 addition & 1 deletion test/cli-build.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const wrapAsync = require('../bin/utils').wrapAsync;
const projectRoot = getUniqueProjectPath();

tap.test('Init and build ->', t => wrapAsync(function*() {
yield spawnCmd(['init', '--verbose', '--project-dir', projectRoot, '--edition', 'edition-node', '--starterkit', 'starterkit-mustache-base']);
yield spawnCmd(['init', '--verbose', '--project-dir', projectRoot, '--edition', 'edition-node', '--starterkit', '@pattern-lab/starterkit-mustache-base']);
yield spawnCmd(['build', '--config', `${projectRoot}/patternlab-config.json`]);
t.ok(exists.sync(path.resolve(projectRoot, 'public')), 'should build all files into public dir');
t.ok(exists.sync(path.resolve(projectRoot, 'public', 'annotations')), 'with a annotations dir');
Expand Down
2 changes: 1 addition & 1 deletion test/cli-export.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const wrapAsync = require('../bin/utils').wrapAsync;
const projectRoot = getUniqueProjectPath();

tap.test('Init and export ->', t => wrapAsync(function*() {
yield spawnCmd(['init', '--verbose', '--project-dir', projectRoot, '--edition', 'edition-node', '--starterkit', 'starterkit-mustache-base']);
yield spawnCmd(['init', '--verbose', '--project-dir', projectRoot, '--edition', 'edition-node', '--starterkit', '@pattern-lab/starterkit-mustache-base']);
yield spawnCmd(['export', '--config', `${projectRoot}/patternlab-config.json`]);
t.ok(exists.sync(path.resolve(projectRoot, 'pattern_exports', 'patterns.zip')), ' should create patterns.zip');
t.end();
Expand Down
2 changes: 1 addition & 1 deletion test/cli-init.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const wrapAsync = require('../bin/utils').wrapAsync;
const projectRoot = getUniqueProjectPath();

tap.test('Init ->', t => wrapAsync(function*() {
yield spawnCmd(['init', '--verbose', '--project-dir', projectRoot, '--edition', 'edition-node', '--starterkit', 'starterkit-mustache-base']);
yield spawnCmd(['init', '--verbose', '--project-dir', projectRoot, '--edition', 'edition-node', '--starterkit', '@pattern-lab/starterkit-mustache-base']);
t.ok(exists.sync(path.resolve(projectRoot)), 'should initialize a PatternLab project');
t.ok(exists.sync(path.resolve(projectRoot, 'source')), 'with a source dir');
t.ok(exists.sync(path.resolve(projectRoot, 'public')), 'with a public dir');
Expand Down
8 changes: 4 additions & 4 deletions test/install-starterkit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ const minimalConfig = {
};

tap.test('Install starterkit-mustache-demo ->', t => wrapAsync(function*() {
yield installStarterkit('starterkit-mustache-demo', minimalConfig);
const pkg = yield moduleExist('starterkit-mustache-demo');
yield installStarterkit('@pattern-lab/starterkit-mustache-demo', minimalConfig);
const pkg = yield moduleExist('@pattern-lab/starterkit-mustache-demo');
t.ok(pkg, 'module should exist after install');
t.end();
}));

tap.test('Install starterkit-mustache-base ->', t => wrapAsync(function*() {
yield installStarterkit('starterkit-mustache-base', minimalConfig);
const pkg = yield moduleExist('starterkit-mustache-base');
yield installStarterkit('@pattern-lab/starterkit-mustache-base', minimalConfig);
const pkg = yield moduleExist('@pattern-lab/starterkit-mustache-base');
t.ok(pkg, 'module should exist after install');
t.end();
}));
Expand Down
2 changes: 1 addition & 1 deletion test/serve.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const liveServerMock = require('./mocks/liverserver.mock.js');
const wrapAsync = require('../bin/utils').wrapAsync;

// Require preview but mock patternlab so that we only test the module behavior
const preview = proxyquire('../bin/serve', {'live-server': liveServerMock});
const preview = proxyquire('../bin/serve', {'@pattern-lab/live-server': liveServerMock});

tap.test('Serve ->', t => wrapAsync(function*() {
const config = yield resolveConfig('./test/fixtures/patternlab-config.json');
Expand Down
Loading