Skip to content

Commit 2fd2268

Browse files
committed
test: First passing test!
1 parent fdaafbc commit 2fd2268

11 files changed

Lines changed: 549 additions & 3 deletions

File tree

lib/actions/init/index.js

Lines changed: 81 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,90 @@
1-
const colour = require('../../util/colour')
1+
const c = require('ansi-colors')
2+
const { prompt } = require('enquirer')
3+
const Scaffold = require('@wmfs/tymly-scaffold')
24

3-
function initAction (blueprintName, options) {
5+
async function initAction (blueprintName, options) {
46
if (!blueprintName) {
57
return
68
}
79

810
const workingDirectory = options.path || '.'
9-
console.log(`Creating blueprint ${colour.cyan(blueprintName)} in ${workingDirectory}`)
11+
console.log(c.bold(`Creating blueprint ${c.cyan(blueprintName)} in ${workingDirectory}`))
12+
13+
const blueprintInfoPrompts = [
14+
{
15+
type: 'input',
16+
name: 'description',
17+
message: 'Description'
18+
},
19+
{
20+
type: 'input',
21+
name: 'author',
22+
message: 'Author',
23+
initial: process.env.user
24+
},
25+
{
26+
type: 'input',
27+
name: 'organisation',
28+
message: 'Organisation'
29+
},
30+
{
31+
type: 'input',
32+
name: 'license',
33+
message: 'License',
34+
initial: 'MIT'
35+
}
36+
]
37+
38+
const blueprintInfo = await prompt(blueprintInfoPrompts)
39+
40+
const technicalInfoPrompts = [
41+
{
42+
type: 'input',
43+
name: 'gitHubOwner',
44+
message: 'GitHub Owner',
45+
initial: blueprintInfo.organisation
46+
},
47+
{
48+
type: 'input',
49+
name: 'npmOrg',
50+
message: 'NPM Organisation',
51+
initial: blueprintInfo.organisation
52+
},
53+
{
54+
type: 'confirm',
55+
name: 'semanticVersioning',
56+
message: 'Use Semantic Versioning',
57+
initial: true
58+
},
59+
{
60+
type: 'select',
61+
name: 'ciProfile',
62+
message: 'CI Profile',
63+
initial: 'travis',
64+
choices: [
65+
'travis',
66+
'None'
67+
]
68+
}
69+
]
70+
71+
const technicalInfo = await prompt(technicalInfoPrompts)
72+
73+
const scaffold = new Scaffold({
74+
basePath: workingDirectory
75+
})
76+
scaffold.addBlueprint({
77+
name: blueprintName,
78+
description: blueprintInfo.description,
79+
author: blueprintInfo.author,
80+
organisation: blueprintInfo.organisation,
81+
license: blueprintInfo.license,
82+
gitHubOwner: technicalInfo.gitHubOwner,
83+
npmOrg: technicalInfo.npmOrg,
84+
semanticVersioning: technicalInfo.semanticVersioning,
85+
ciProfile: technicalInfo.ciProfile
86+
})
87+
await scaffold.commit()
1088
}
1189

1290
module.exports = initAction

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,18 @@
3131
"devDependencies": {
3232
"@semantic-release/changelog": "3.0.1",
3333
"@semantic-release/git": "7.0.6",
34+
"bdd-stdin": "0.2.0",
35+
"chai": "4.2.0",
36+
"chai-fs": "2.0.0",
3437
"codecov": "3.1.0",
3538
"conventional-changelog-metahub": "2.0.2",
3639
"cz-conventional-changelog": "2.1.0",
40+
"diff": "4.0.1",
41+
"dirty-chai": "2.0.1",
3742
"mocha": "5.2.0",
3843
"nyc": "13.1.0",
3944
"request-promise-native": "1.0.5",
45+
"rimraf": "2.6.3",
4046
"semantic-release": "15.13.1",
4147
"standard": "12.0.1"
4248
},
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# Compiled source #
2+
###################
3+
*.com
4+
*.class
5+
*.dll
6+
*.exe
7+
*.o
8+
*.so
9+
10+
# Packages #
11+
############
12+
# it's better to unpack these files and commit the raw source
13+
# git has its own built in compression methods
14+
*.7z
15+
*.dmg
16+
*.gz
17+
*.iso
18+
*.jar
19+
*.rar
20+
*.tar
21+
*.zip
22+
23+
# Logs and databases #
24+
######################
25+
*.log
26+
27+
*.sqlite
28+
29+
## Node ###
30+
~*
31+
.~*
32+
\#*
33+
34+
# Logs
35+
logs
36+
*.log
37+
npm-debug.log*
38+
39+
# Runtime data
40+
pids
41+
*.pid
42+
*.seed
43+
*.pid.lock
44+
45+
# Directory for instrumented libs generated by jscoverage/JSCover
46+
lib-cov
47+
48+
# Coverage directory used by tools like istanbul
49+
coverage
50+
51+
# nyc test coverage
52+
.nyc_output
53+
54+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
55+
.grunt
56+
57+
# node-waf configuration
58+
.lock-wscript
59+
60+
# Compiled binary addons (http://nodejs.org/api/addons.html)
61+
build/Release
62+
63+
# Dependency directories
64+
node_modules
65+
jspm_packages
66+
67+
# Optional npm cache directory
68+
.npm
69+
70+
# Optional eslint cache
71+
.eslintcache
72+
73+
# Optional REPL history
74+
.node_repl_history
75+
76+
# Output of 'npm pack'
77+
*.tgz
78+
79+
# Yarn Integrity file
80+
.yarn-integrity
81+
82+
83+
## IDE things ##
84+
85+
# Webstorm
86+
.idea
87+
88+
# Eclipse:
89+
90+
.project
91+
.metadata
92+
bin/
93+
tmp/
94+
*.tmp
95+
*.bak
96+
*.swp
97+
*~.nib
98+
local.properties
99+
.settings/
100+
.loadpath
101+
.recommenders
102+
103+
104+
scratch.txt
105+
package-lock.json
106+
107+
output/
108+
109+
# Ignore Rush temporary files
110+
/common/temp/**
111+
112+
package-deps.json
113+
114+
.yo-rc.json
115+
116+
lerna-debug.log
117+
118+
TEST-result.xml
119+
.gradle/
120+
.embedpostgresql/
121+
build/
122+
123+
# Windows thumbnail cache files
124+
Thumbs.db
125+
ehthumbs.db
126+
ehthumbs_vista.db
127+
128+
# Dump file
129+
*.stackdump
130+
131+
# Folder config file
132+
[Dd]esktop.ini
133+
134+
# Recycle Bin used on file shares
135+
$RECYCLE.BIN/
136+
137+
# Windows Installer files
138+
*.cab
139+
*.msi
140+
*.msix
141+
*.msm
142+
*.msp
143+
144+
# Windows shortcuts
145+
*.lnk
146+
147+
# OS generated files #
148+
######################
149+
.DS_Store
150+
.DS_Store?
151+
._*
152+
.Spotlight-V100
153+
.Trashes
154+
ehthumbs.db
155+
Thumbs.db
156+
.LSOverride
157+
158+
# Icon must end with two \r
159+
Icon
160+
161+
162+
# Thumbnails
163+
._*
164+
165+
# Files that might appear in the root of a volume
166+
.DocumentRevisions-V100
167+
.fseventsd
168+
.Spotlight-V100
169+
.TemporaryItems
170+
.Trashes
171+
.VolumeIcon.icns
172+
.com.apple.timemachine.donotpresent
173+
174+
# Directories potentially created on remote AFP share
175+
.AppleDB
176+
.AppleDesktop
177+
Network Trash Folder
178+
Temporary Items
179+
.apdisk
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"branch": "master",
3+
"analyzeCommits": {
4+
"preset": "angular",
5+
"releaseRules": [
6+
{
7+
"type": "build",
8+
"scope": "deps",
9+
"release": "minor"
10+
}
11+
]
12+
},
13+
"verifyConditions": [
14+
"@semantic-release/changelog",
15+
"@semantic-release/npm",
16+
"@semantic-release/git"
17+
],
18+
"generateNotes": {
19+
"preset": "metahub"
20+
},
21+
"prepare": [
22+
{
23+
"path": "@semantic-release/changelog",
24+
"changelogFile": "CHANGELOG.md"
25+
},
26+
{
27+
"path": "@semantic-release/git",
28+
"assets": [
29+
"CHANGELOG.md"
30+
]
31+
},
32+
"@semantic-release/npm"
33+
],
34+
"publish": [
35+
"@semantic-release/npm",
36+
"@semantic-release/github"
37+
],
38+
"success": [
39+
"@semantic-release/github"
40+
],
41+
"fail": [
42+
"@semantic-release/github"
43+
]
44+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
language: node_js
2+
notifications:
3+
email: false
4+
node_js:
5+
- lts/*
6+
sudo: false
7+
dist: trusty
8+
branches:
9+
only:
10+
- master
11+
env:
12+
global:
13+
- TIMEOUT=15000
14+
install:
15+
- travis_retry npm install
16+
test:
17+
- npm test
18+
before_deploy:
19+
- npm run coverage
20+
deploy:
21+
- provider: script
22+
skip_cleanup: true
23+
script: npx semantic-release
24+
on:
25+
branch: master
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019 West Midlands Fire Service
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)