opinionated scaffolder for JavaScript projects
REPLACED BY @form8ion/javascript
- Features
- Usage
- Installation
- As one of the languages for scaffolding a project
- Example
- Options
projectRootstring (required)projectNamestring (required)visibilitystring (required)licensestring (required)vcsobject (required)descriptionstring (optional)configsobject (optional)overridesobject (optional)registriesobject (optional)ciServicesobject (optional)applicationTypesobject (optional)unitTestFrameworksobject (required)
- Contributing
- Related Projects
- Sets the node.js version to the latest or LTS version (your choice) using nvm
- Scaffolds the
package.json- Enables linting of:
- JavaScript with ESLint
- Markdown with remark-lint
- Peer-dependency compatibiltiy (by running
npm lsand ensuring a0exit code) - Sensitive files to prevent commiting secrets using ban-sensitive-files
- The
.travis.ymlusing travis-lint, when Travis is the chosen CI
- Enables linting of:
- Enables transpilation with Babel
- Defines and enforces the commit message convention
- Defines badges for inclusion in the
README.md - Defines files to be ignored from
gitandnpm - Scaffolds CI service config from the user choice of the provided scaffolders
$ npm install @travi/javascript-scaffolder --save-prodThis scaffolder is intended to be used to scaffold the language specific details within the project-scaffolder.
const {dialects, projectTypes} = require('@form8ion/javascript-core');
const {scaffold: scaffoldJavaScript, questionNames} = require('./lib/index.cjs');(async () => {
const accountName = 'form8ion';
await scaffoldJavaScript({
projectRoot: process.cwd(),
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`}
},
overrides: {npmAccount: accountName},
ciServices: {},
unitTestFrameworks: {},
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]: 'you@domain.tld',
[questionNames.AUTHOR_URL]: 'https://your.website.tld',
[questionNames.UNIT_TESTS]: true,
[questionNames.INTEGRATION_TESTS]: true
}
});
})();path to the root of the project
name of the project (w/o a scope)
visibility of the project (Public or Private)
hoststring (required) VCS hosting serviceownerstring (required) account name on the host service for the repositorynamestring (required) repository name
short summary of the project
-
eslint: object (optional) details about the shareable config to be used for the projectpackageNamestring (required) name of thenpmpackageprefixstring (required) name to be used when referring to the config within the.eslintrcfiles
⚠️ while i'm not confident that it is the recommended convention, it is assumed the defined config has arules/directory exposed from the package with rulesets defined fores6.jstests/base.jstests/mocha.js
-
commitlintobject (optional) details about the shareable config to be used for the projectpackageNamestring (required) name of thenpmpackagenamestring (required) name to be used when referring to the config within the.commitlintrc.jsfile
-
babelPresetobject (optional) details about the preset to be used for the projectpackageNamestring (required) name of thenpmpackagenamestring (required) shorthand name to be used when referring to the config
-
npmAccountstring (optional) the account the package should be published under. used to suggest a scope. defaults to$ npm whoami -
authorobject (optional) details about the package authornamestring (required) defaults to$npm config get init.author.nameemailstring (optional) defaults to$npm config get init.author.emailurlstring (optional) defaults to$npm config get init.author.url
- keys: string Scope of packages related to this registry (without the
@) - values: string URL for the registry
- keys: string Name of the service
- values: object
scaffolder: function (required) scaffolds the ci service optionspublic: boolean (optional) whether this service should be presented as a public optionprivate: boolean (optional) whether this service should be presented as a private option
- keys: string Name of the type of application
- values: object
scaffolderfunction (required) scaffolds the application
frameworks to be passed to the unit-testing scaffolder
$ nvm install
$ npm install$ npm test