This repository has been archived by the owner on Jun 16, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
1,667 additions
and
95 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
This file was deleted.
Oops, something went wrong.
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,13 @@ | ||
const defaultConfigFiles = [ | ||
'.babelrc', | ||
'jest.config.js', | ||
'.editorconfig', | ||
'.gitignore', | ||
'.travis.yml', | ||
'package.json', | ||
'README.md', | ||
'.eslintrc', | ||
'.npmignore' | ||
]; | ||
|
||
module.exports = defaultConfigFiles; |
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,183 @@ | ||
const path = require('path'); | ||
const os = require('os'); | ||
const fs = require('fs'); | ||
const assert = require('yeoman-assert'); | ||
const helpers = require('yeoman-test'); | ||
const constants = require('./constants'); | ||
|
||
describe('template generator', function() { | ||
const name = 'test'; | ||
const description = 'An amazing verdaccio plugin'; | ||
const githubUsername = 'testing'; | ||
const authorName = 'test'; | ||
const authorEmail = 'test'; | ||
const keywords = ['verdaccio, plugin, typescript']; | ||
const license = 'MIT'; | ||
const repository = 'verdaccio/generator-test'; | ||
const getBuildAsset = (tempRoot, pluginType, item) => { | ||
const prefixPath = path.join(tempRoot, `/verdaccio-${pluginType}-${name}`); | ||
return `${prefixPath}/${item}`; | ||
} | ||
|
||
describe('generate app', function() { | ||
const tempRoot = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), 'generator-app')); | ||
|
||
describe('typescript', function() { | ||
const lang = 'typescript'; | ||
|
||
it('should check storage files', function(done) { | ||
pluginType = 'storage'; | ||
helpers.run(path.join(__dirname, '../generators/app')).inDir(tempRoot).withPrompts({ | ||
name, | ||
lang, | ||
pluginType, | ||
description, | ||
githubUsername, | ||
authorName, | ||
authorEmail, | ||
keywords, | ||
license, | ||
repository | ||
}).then(function() { | ||
assert.file([ | ||
...constants.map(item => getBuildAsset(tempRoot, pluginType, item)), | ||
getBuildAsset(tempRoot, pluginType, '/index.ts'), | ||
getBuildAsset(tempRoot, pluginType, '/types/index.ts'), | ||
getBuildAsset(tempRoot, pluginType, '/tsconfig.json'), | ||
getBuildAsset(tempRoot, pluginType, '/src/index.ts'), | ||
getBuildAsset(tempRoot, pluginType, '/src/plugin.ts'), | ||
getBuildAsset(tempRoot, pluginType, '/src/PackageStorage.ts'), | ||
]) | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should check auth files', function(done) { | ||
pluginType = 'auth'; | ||
helpers.run(path.join(__dirname, '../generators/app')).inDir(tempRoot).withPrompts({ | ||
name, | ||
lang, | ||
pluginType, | ||
description, | ||
githubUsername, | ||
authorName, | ||
authorEmail, | ||
keywords, | ||
license, | ||
repository | ||
}).then(function() { | ||
assert.file([ | ||
...constants.map(item => getBuildAsset(tempRoot, pluginType, item)), | ||
getBuildAsset(tempRoot, pluginType, '/src/index.ts'), | ||
getBuildAsset(tempRoot, pluginType, '/index.ts'), | ||
getBuildAsset(tempRoot, pluginType, '/types/index.ts'), | ||
getBuildAsset(tempRoot, pluginType, '/tsconfig.json'), | ||
]) | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should check middleware files', function(done) { | ||
pluginType = 'middleware'; | ||
helpers.run(path.join(__dirname, '../generators/app')).inDir(tempRoot).withPrompts({ | ||
name, | ||
lang, | ||
pluginType, | ||
description, | ||
githubUsername, | ||
authorName, | ||
authorEmail, | ||
keywords, | ||
license, | ||
repository | ||
}).then(function() { | ||
assert.file([ | ||
...constants.map(item => getBuildAsset(tempRoot, pluginType, item)), | ||
getBuildAsset(tempRoot, pluginType, '/src/index.ts'), | ||
getBuildAsset(tempRoot, pluginType, '/index.ts'), | ||
getBuildAsset(tempRoot, pluginType, '/types/index.ts'), | ||
getBuildAsset(tempRoot, pluginType, '/tsconfig.json'), | ||
]) | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('javascript', function() { | ||
const lang = 'javascript'; | ||
let pluginType; | ||
|
||
it('should check storage files', function(done) { | ||
pluginType = 'storage'; | ||
helpers.run(path.join(__dirname, '../generators/app')).inDir(tempRoot).withPrompts({ | ||
name, | ||
lang, | ||
pluginType, | ||
description, | ||
githubUsername, | ||
authorName, | ||
authorEmail, | ||
keywords, | ||
license, | ||
repository | ||
}).then(function() { | ||
assert.file([ | ||
...constants.map(item => getBuildAsset(tempRoot, pluginType, item)), | ||
getBuildAsset(tempRoot, pluginType, '/src/index.js'), | ||
getBuildAsset(tempRoot, pluginType, '/index.js'), | ||
getBuildAsset(tempRoot, pluginType, '/src/plugin.js'), | ||
getBuildAsset(tempRoot, pluginType, '/src/PackageStorage.js'), | ||
]) | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should check auth files', function(done) { | ||
pluginType = 'auth'; | ||
helpers.run(path.join(__dirname, '../generators/app')).inDir(tempRoot).withPrompts({ | ||
name, | ||
lang, | ||
pluginType, | ||
description, | ||
githubUsername, | ||
authorName, | ||
authorEmail, | ||
keywords, | ||
license, | ||
repository | ||
}).then(function() { | ||
assert.file([ | ||
...constants.map(item => getBuildAsset(tempRoot, pluginType, item)), | ||
getBuildAsset(tempRoot, pluginType, '/src/index.js'), | ||
getBuildAsset(tempRoot, pluginType, '/index.js'), | ||
]) | ||
done(); | ||
}); | ||
}); | ||
|
||
|
||
it('should check middleware files', function(done) { | ||
pluginType = 'middleware'; | ||
helpers.run(path.join(__dirname, '../generators/app')).inDir(tempRoot).withPrompts({ | ||
name, | ||
lang, | ||
pluginType, | ||
description, | ||
githubUsername, | ||
authorName, | ||
authorEmail, | ||
keywords, | ||
license, | ||
repository | ||
}).then(function() { | ||
assert.file([ | ||
...constants.map(item => getBuildAsset(tempRoot, pluginType, item)), | ||
getBuildAsset(tempRoot, pluginType, '/src/index.js'), | ||
getBuildAsset(tempRoot, pluginType, '/index.js'), | ||
]) | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.