Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump sshpk from 1.13.1 to 1.16.1 #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
node_modules
node_modules
21 changes: 7 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"type": "git"
},
"scripts": {
"test": "jest && npm run lint",
"lint": "xo *.js test/*.js"
"test": "jest"
},
"jest": {
"modulePathIgnorePatterns": [
Expand All @@ -32,20 +31,14 @@
"npm",
"package"
],
"xo": {
"extends": "rem",
"envs": [
"jest"
]
},
"dependencies": {
"camelcase": "^4.0.0",
"superb": "^1.3.0"
"camelcase": "^6.0.0",
"superb": "^4.0.0"
},
"devDependencies": {
"eslint-config-rem": "^4.0.0",
"jest": "^22.4.3",
"sao": "^1.0.0",
"xo": "^0.20.3"
"@types/jest": "^26.0.5",
"jest": "^26.1.0",
"prettier": "^2.0.5",
"sao": "1.7.2-canary.145.30b2bdb.0"
}
}
91 changes: 53 additions & 38 deletions saofile.js
Original file line number Diff line number Diff line change
@@ -1,97 +1,106 @@
// @ts-check
const superb = require('superb')
const camelcase = require('camelcase')

module.exports = {
/** @type {import('sao').GeneratorConfig} */
const config = {
description: 'Scaffolding out a node module.',
transformerOptions: {
context: {
camelcase
}
},
generators: [
subGenerators: [
{
name: 'donation',
from: './generators/donation'
}
generator: './generators/donation',
},
],
prompts() {
return [
{
type: 'input',
name: 'name',
message: 'What is the name of the new project',
default: this.outFolder
default: this.outFolder,
},
{
type: 'input',
name: 'description',
message: 'How would you describe the new project',
default: `my ${superb()} project`
default: `my ${superb.random()} project`,
},
{
type: 'input',
name: 'author',
message: 'What is your name',
default: this.gitUser.name,
store: true,
required: true
required: true,
},
{
type: 'input',
name: 'username',
message: 'What is your GitHub username',
default: ({ author }) => this.gitUser.username || author.toLowerCase(),
store: true
default: ({ answers }) =>
this.gitUser.username || answers.author.toLowerCase(),
store: true,
},
{
type: 'input',
name: 'email',
message: 'What is your GitHub email',
default: this.gitUser.email,
store: true,
validate: v => /.+@.+/.test(v)
validate: (v) => /.+@.+/.test(v),
},
{
type: 'input',
name: 'website',
message: 'What is the url of your website',
default({ username }) {
return `https://github.com/${username}`
default({ answers }) {
return `https://github.com/${answers.username}`
},
store: true
store: true,
},
{
type: 'confirm',
name: 'unitTest',
message: 'Do you need unit test',
type: 'confirm',
default: false
default: false,
},
{
type: 'confirm',
name: 'coverage',
message: 'Do you want to add test coverage support',
type: 'confirm',
default: false,
when: answers => answers.unitTest
skip({ answers }) {
return !answers.unitTest
},
},
{
type: 'select',
name: 'eslint',
message: 'Choose an ESLint tool',
type: 'list',
default: 'xo',
choices: ['xo', 'standard', 'disabled']
choices: ['xo', 'standard', 'disabled'],
},
{
type: 'confirm',
name: 'compile',
message: 'Do you need to compile ES2015 code',
type: 'confirm',
default: false
default: false,
},
{
type: 'confirm',
name: 'cli',
message: 'Do you want to add a CLI',
type: 'confirm',
default: false,
when: answers => !answers.compile
skip({ answers }) {
return answers.compile
},
},
{
type: 'input',
name: 'twitter',
message: 'What is your twitter username',
store: true
}
store: true,
},
]
},
actions() {
Expand All @@ -105,8 +114,11 @@ module.exports = {
'index.js': '!compile',
'cli.js': 'cli',
'circle-npm.yml': this.npmClient === 'npm',
'circle-yarn.yml': this.npmClient === 'yarn'
}
'circle-yarn.yml': this.npmClient === 'yarn',
},
data: {
camelcase,
},
},
{
type: 'move',
Expand All @@ -116,19 +128,22 @@ module.exports = {
// `.gitignore` file will be ignored!
gitignore: '.gitignore',
'circle-*.yml': 'circle.yml',
'_package.json': 'package.json'
}
'_package.json': 'package.json',
},
},
{
type: 'modify',
files: 'package.json',
handler: data => require('./lib/update-pkg')(this.answers, data)
}
// @ts-ignore
handler: (data) => require('./lib/update-pkg')(this.answers, data),
},
]
},
async completed() {
await this.gitInit()
await this.npmInstall({ packageManager: this.answers.pm })
await this.npmInstall({ npmClient: this.answers.pm })
this.showProjectTips()
}
},
}

module.exports = config
2 changes: 1 addition & 1 deletion template/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% const camelcasedName = this.camelcase(name) -%>
<% const camelcasedName = camelcase(name) -%>

# <%= name %>

Expand Down
6 changes: 3 additions & 3 deletions template/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<%_ if (compile) { -%>
import <%= this.camelcase(name) %> from '../src'
import <%= camelcase(name) %> from '../src'
<%_ } else { -%>
const <%= this.camelcase(name) %> = require('../')
const <%= camelcase(name) %> = require('../')
<%_ } -%>

test('main', () => {
expect(typeof <%= this.camelcase(name) %>).toBe('function')
expect(typeof <%= camelcase(name) %>).toBe('function')
})
49 changes: 33 additions & 16 deletions test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @ts-check
const path = require('path')
const sao = require('sao')
const { SAO } = require('sao')

const generator = path.join(__dirname, '..')

Expand All @@ -12,37 +13,53 @@ const getPkg = (pkg, fields) => {
}

test('use defaults', async () => {
const helper = await sao.mock({ generator })
expect(helper.fileList).toMatchSnapshot()
const sao = new SAO({ generator, mock: true })
await sao.run()
expect(await sao.getOutputFiles()).toMatchSnapshot()
})

test('add unit test', async () => {
const helper = await sao.mock({ generator }, {
unitTest: true
const sao = new SAO({
generator,
mock: true,
answers: {
unitTest: true,
},
})
await sao.run()

expect(helper.fileList).toMatchSnapshot('files')
expect(await sao.getOutputFiles()).toMatchSnapshot('files')
expect(
getPkg(await helper.readFile('package.json'), ['scripts', 'devDependencies'])
getPkg(await sao.readOutputFile('package.json'), ['scripts', 'devDependencies'])
).toMatchSnapshot('package.json')
})

test('add coverage', async () => {
const helper = await sao.mock({ generator }, {
unitTest: true,
coverage: true
const sao = new SAO({
generator,
mock: true,
answers: {
unitTest: true,
coverage: true,
},
})
await sao.run()

expect(helper.fileList).toMatchSnapshot('files')
expect(await helper.readFile('circle.yml')).toMatchSnapshot('circle.yml')
expect(await sao.getOutputFiles()).toMatchSnapshot('files')
expect(await sao.readOutputFile('circle.yml')).toMatchSnapshot('circle.yml')
})

test('add cli', async () => {
const helper = await sao.mock({ generator }, {
cli: true
const sao = new SAO({
generator,
mock: true,
answers: {
cli: true,
},
})
expect(helper.fileList).toMatchSnapshot('files')
await sao.run()
expect(await sao.getOutputFiles()).toMatchSnapshot('files')
expect(
getPkg(await helper.readFile('package.json'), ['bin', 'dependencies'])
getPkg(await sao.readOutputFile('package.json'), ['bin', 'dependencies'])
).toMatchSnapshot('package.json')
})
Loading