@form8ion/javascript
v13.0.2
Published
JavaScript language plugin for the @form8ion toolset
Downloads
5,173
Readme
javascript
JavaScript language plugin for the @form8ion toolset
Table of Contents
Usage
Installation
$ npm install @form8ion/javascript --save
Example
Import
const {dialects, projectTypes} = require('@form8ion/javascript-core');
const {
scaffold: scaffoldJavaScript,
lift: liftJavascript,
test: thisIsAJavaScriptProject,
scaffoldUnitTesting,
questionNames
} = require('@form8ion/javascript');
Execute
(async () => {
const accountName = 'form8ion';
const projectRoot = process.cwd();
await scaffoldJavaScript({
projectRoot,
projectName: 'project-name',
visibility: 'Public',
license: 'MIT',
configs: {
eslint: {scope: `@${accountName}`},
remark: `@${accountName}/remark-lint-preset`,
babelPreset: {name: `@${accountName}`, packageName: `@${accountName}/babel-preset`},
commitlint: {name: `@${accountName}`, packageName: `@${accountName}/commitlint-config`}
},
plugins: {
unitTestFrameworks: {},
applicationTypes: {},
packageTypes: {},
packageBundlers: {},
ciServices: {}
},
decisions: {
[questionNames.DIALECT]: dialects.BABEL,
[questionNames.NODE_VERSION_CATEGORY]: 'LTS',
[questionNames.PACKAGE_MANAGER]: 'npm',
[questionNames.PROJECT_TYPE]: projectTypes.PACKAGE,
[questionNames.SHOULD_BE_SCOPED]: true,
[questionNames.SCOPE]: accountName,
[questionNames.AUTHOR_NAME]: 'Your Name',
[questionNames.AUTHOR_EMAIL]: '[email protected]',
[questionNames.AUTHOR_URL]: 'https://your.website.tld',
[questionNames.UNIT_TESTS]: true,
[questionNames.INTEGRATION_TESTS]: true,
[questionNames.PROVIDE_EXAMPLE]: true
}
});
if (await thisIsAJavaScriptProject({projectRoot})) {
await liftJavascript({
projectRoot,
configs: {eslint: {scope: '@foo'}},
results: {
dependencies: [],
devDependencies: [],
scripts: {},
eslint: {configs: [], ignore: {directories: []}},
packageManager: 'npm'
},
enhancers: {
PluginName: {
test: () => true,
lift: () => ({})
}
}
});
}
await scaffoldUnitTesting({
projectRoot: process.cwd(),
frameworks: {
Mocha: {scaffold: options => options},
Jest: {scaffold: options => options}
},
visibility: 'Public',
vcs: {host: 'GitHub', owner: 'foo', name: 'bar'},
decisions: {[questionNames.UNIT_TEST_FRAMEWORK]: 'Mocha'}
});
})();
Documentation
Contributing
Dependencies
$ nvm install
$ npm install
Verification
$ npm test