https://github.com/form8ion/javascript-scaffolder
opinionated scaffolder for JavaScript projects
https://github.com/form8ion/javascript-scaffolder
Last synced: about 2 months ago
JSON representation
opinionated scaffolder for JavaScript projects
- Host: GitHub
- URL: https://github.com/form8ion/javascript-scaffolder
- Owner: form8ion
- License: mit
- Archived: true
- Created: 2018-04-15T17:21:06.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-12-09T17:38:54.000Z (over 3 years ago)
- Last Synced: 2024-05-01T13:02:32.222Z (about 1 year ago)
- Language: JavaScript
- Homepage: https://npm.im/@travi/javascript-scaffolder
- Size: 8.96 MB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 38
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - javascript-scaffolder
README
# javascript-scaffolder
opinionated scaffolder for JavaScript projects
**REPLACED BY [@form8ion/javascript](https://github.com/form8ion/javascript)**
[](https://codecov.io/github/travi/javascript-scaffolder)
[![Node CI Workflow Status][github-actions-ci-badge]][github-actions-ci-link]## Table of Contents
* [Features](#features)
* [Usage](#usage)
* [Installation](#installation)
* [As one of the languages for scaffolding a project](#as-one-of-the-languages-for-scaffolding-a-project)
* [Example](#example)
* [Dependencies:](#dependencies)
* [Execute](#execute)
* [Options](#options)
* [`projectRoot` __string__ (_required_)](#projectroot-string-required)
* [`projectName` __string__ (_required_)](#projectname-string-required)
* [`visibility` __string__ (_required_)](#visibility-string-required)
* [`license` __string__ (_required_)](#license-string-required)
* [`vcs` __object__ (_required_)](#vcs-object-required)
* [`description` __string__ (_optional_)](#description-string-optional)
* [`configs` __object__ (_optional_)](#configs-object-optional)
* [`overrides` __object__ (_optional_)](#overrides-object-optional)
* [`registries` __object__ (_optional_)](#registries-object-optional)
* [`ciServices` __object__ (_optional_)](#ciservices-object-optional)
* [`applicationTypes` __object__ (_optional_)](#applicationtypes-object-optional)
* [`unitTestFrameworks` __object__ (_required_)](#unittestframeworks-object-required)
* [Contributing](#contributing)
* [Dependencies](#dependencies-1)
* [Verification](#verification)
* [Related Projects](#related-projects)## Features
* Sets the [node.js](https://nodejs.org/) version to the latest or LTS version
(your choice) using [nvm](https://github.com/creationix/nvm)
* Scaffolds the `package.json`
* Enables linting of:
* JavaScript with [ESLint](https://eslint.org/)
* Markdown with [remark-lint](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint)
* Peer-dependency compatibiltiy (by running `npm ls` and ensuring a `0`
exit code)
* Sensitive files to prevent commiting secrets using [ban-sensitive-files](https://github.com/bahmutov/ban-sensitive-files)
* The `.travis.yml` using [travis-lint](https://github.com/pwmckenna/node-travis-lint),
when [Travis](https://travis-ci.com) is the chosen CI
* Enables transpilation with [Babel](https://babeljs.io)
* Defines and enforces the [commit message convention](https://conventionalcommits.org/)
* Defines [badges](https://shields.io) for inclusion in the `README.md`
* Defines files to be ignored from `git` and `npm`
* Scaffolds CI service config from the user choice of the
[provided scaffolders](#ciservices-object-optional)## Usage
[![npm][npm-badge]][npm-link]
![node][node-badge]
[![MIT license][license-badge]][license-link]### Installation
```sh
$ npm install @travi/javascript-scaffolder --save-prod
```### As one of the languages for scaffolding a project
This scaffolder is intended to be used to scaffold the
[language specific details](https://github.com/form8ion/project#languages-optional)
within the [project-scaffolder](https://github.com/form8ion/project).#### Example
##### Dependencies:
```javascript
const {dialects, projectTypes} = require('@form8ion/javascript-core');
const {scaffold: scaffoldJavaScript, questionNames} = require('./lib/index.cjs');
```##### Execute
```javascript
(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]: '[email protected]',
[questionNames.AUTHOR_URL]: 'https://your.website.tld',
[questionNames.UNIT_TESTS]: true,
[questionNames.INTEGRATION_TESTS]: true
}
});
})();
```#### Options
##### `projectRoot` __string__ (_required_)
path to the root of the project
##### `projectName` __string__ (_required_)
name of the project (w/o a [scope](https://docs.npmjs.com/misc/scope))
##### `visibility` __string__ (_required_)
visibility of the project (`Public` or `Private`)
##### `license` __string__ (_required_)
##### `vcs` __object__ (_required_)
* `host` __string__ (_required_)
VCS hosting service
* `owner` __string__ (_required_)
account name on the host service for the repository
* `name` __string__ (_required_)
repository name##### `description` __string__ (_optional_)
short summary of the project
##### `configs` __object__ (_optional_)
* `eslint`: __object__ (_optional_)
details about the [shareable config](https://eslint.org/docs/developer-guide/shareable-configs)
to be used for the project* `packageName` __string__ (_required_)
name of the `npm` package
* `prefix` __string__ (_required_)
name to be used when referring to the config within the `.eslintrc` files:warning: while i'm not confident that it is the recommended convention, it
is assumed the defined config has a `rules/` directory exposed from the
package with rulesets defined for* `es6.js`
* `tests/base.js`
* `tests/mocha.js`* `commitlint` __object__ (_optional_)
details about the [shareable config](https://marionebl.github.io/commitlint/#/concepts-shareable-config)
to be used for the project
* `packageName` __string__ (_required_)
name of the `npm` package
* `name` __string__ (_required_)
name to be used when referring to the config within the `.commitlintrc.js`
file* `babelPreset` __object__ (_optional_)
details about the [preset](https://babeljs.io/docs/plugins/#creating-a-preset)
to be used for the project
* `packageName` __string__ (_required_)
name of the `npm` package
* `name` __string__ (_required_)
shorthand name to be used when referring to the config##### `overrides` __object__ (_optional_)
* `npmAccount` __string__ (_optional_)
the account the package should be published under. used to suggest a
[scope](https://docs.npmjs.com/misc/scope). defaults to `$ npm whoami`
* `author` __object__ (_optional_)
[details](https://docs.npmjs.com/files/package.json#people-fields-author-contributors)
about the package author* `name` __string__ (_required_) defaults to `$npm config get init.author.name`
* `email` __string__ (_optional_) defaults to `$npm config get init.author.email`
* `url` __string__ (_optional_) defaults to `$npm config get init.author.url`##### `registries` __object__ (_optional_)
* keys: __string__ Scope of packages related to this registry (without the `@`)
* values: __string__ URL for the registry##### `ciServices` __object__ (_optional_)
* keys: __string__ Name of the service
* values: __object__
* `scaffolder`: __function__ (_required_) scaffolds the ci service options
* `public`: __boolean__ (_optional_) whether this service should be presented
as a public option
* `private`: __boolean__ (_optional_) whether this service should be presented
as a private option##### `applicationTypes` __object__ (_optional_)
* keys: __string__ Name of the type of application
* values: __object__
* `scaffolder` __function__ (_required_) scaffolds the application##### `unitTestFrameworks` __object__ (_required_)
[frameworks](https://github.com/form8ion/awesome#unit-testing-frameworks) to be
passed to the [unit-testing scaffolder](https://github.com/form8ion/javascript-core#frameworks-object-required)## Contributing
[![Conventional Commits][commit-convention-badge]][commit-convention-link]
[![Commitizen friendly][commitizen-badge]][commitizen-link]
[](https://github.com/semantic-release/semantic-release)
[![PRs Welcome][prs-badge]][prs-link]
[![Renovate][renovate-badge]][renovate-link]### Dependencies
```sh
$ nvm install
$ npm install
```### Verification
```sh
$ npm test
```## Related Projects
* [project-scaffolder](https://npm.im/@form8ion/project)
* [travis-scaffolder-javascript](https://github.com/travi/travis-scaffolder-javascript)
* [cli](https://npm.im/@travi/cli)[npm-link]: https://www.npmjs.com/package/@travi/javascript-scaffolder
[npm-badge]: https://img.shields.io/npm/v/@travi/javascript-scaffolder.svg
[node-badge]: https://img.shields.io/node/v/@travi/javascript-scaffolder.svg
[license-link]: LICENSE
[license-badge]: https://img.shields.io/github/license/travi/javascript-scaffolder.svg
[commit-convention-link]: https://conventionalcommits.org
[commit-convention-badge]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg
[commitizen-link]: http://commitizen.github.io/cz-cli/
[commitizen-badge]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg
[prs-link]: http://makeapullrequest.com
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg
[renovate-link]: https://renovatebot.com
[renovate-badge]: https://img.shields.io/badge/renovate-enabled-brightgreen.svg?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNjkgMzY5Ij48Y2lyY2xlIGN4PSIxODkuOSIgY3k9IjE5MC4yIiByPSIxODQuNSIgZmlsbD0iI2ZmZTQyZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTUgLTYpIi8+PHBhdGggZmlsbD0iIzhiYjViNSIgZD0iTTI1MSAyNTZsLTM4LTM4YTE3IDE3IDAgMDEwLTI0bDU2LTU2YzItMiAyLTYgMC03bC0yMC0yMWE1IDUgMCAwMC03IDBsLTEzIDEyLTktOCAxMy0xM2ExNyAxNyAwIDAxMjQgMGwyMSAyMWM3IDcgNyAxNyAwIDI0bC01NiA1N2E1IDUgMCAwMDAgN2wzOCAzOHoiLz48cGF0aCBmaWxsPSIjZDk1NjEyIiBkPSJNMzAwIDI4OGwtOCA4Yy00IDQtMTEgNC0xNiAwbC00Ni00NmMtNS01LTUtMTIgMC0xNmw4LThjNC00IDExLTQgMTUgMGw0NyA0N2M0IDQgNCAxMSAwIDE1eiIvPjxwYXRoIGZpbGw9IiMyNGJmYmUiIGQ9Ik04MSAxODVsMTgtMTggMTggMTgtMTggMTh6Ii8+PHBhdGggZmlsbD0iIzI1YzRjMyIgZD0iTTIyMCAxMDBsMjMgMjNjNCA0IDQgMTEgMCAxNkwxNDIgMjQwYy00IDQtMTEgNC0xNSAwbC0yNC0yNGMtNC00LTQtMTEgMC0xNWwxMDEtMTAxYzUtNSAxMi01IDE2IDB6Ii8+PHBhdGggZmlsbD0iIzFkZGVkZCIgZD0iTTk5IDE2N2wxOC0xOCAxOCAxOC0xOCAxOHo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0yMmw4LThjNi02IDE2LTYgMjIgMGw0NyA0NmM2IDcgNiAxNyAwIDIzbC04IDhjLTMgMy03IDQtMTEgNHptLTM5LTc2Yy0xIDAtMyAwLTQgMmwtOCA3Yy0yIDMtMiA3IDAgOWw0NyA0N2E2IDYgMCAwMDkgMGw3LThjMy0yIDMtNiAwLTlsLTQ2LTQ2Yy0yLTItMy0yLTUtMnoiLz48L3N2Zz4=
[github-actions-ci-link]: https://github.com/travi/javascript-scaffolder/actions?query=workflow%3A%22Node.js+CI%22+branch%3Amaster
[github-actions-ci-badge]: https://github.com/travi/javascript-scaffolder/workflows/Node.js%20CI/badge.svg