Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.
Merged
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
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ console.log(await listFrameworks({ projectDir: './path/to/gatsby/website' }))
// [
// {
// name: 'gatsby',
// title: 'Gatsby',
// category: 'static_site_generator',
// dev: {
// commands: ['gatsby develop'],
Expand All @@ -44,6 +45,7 @@ console.log(await listFrameworks({ projectDir: './path/to/vue/website' }))
// [
// {
// name: 'vue',
// title: 'Vue.js',
// category: 'frontend_framework',
// dev: {
// commands: ['npm run serve'],
Expand All @@ -64,6 +66,7 @@ console.log(await hasFramework('vue', { projectDir: './path/to/vue/website' }))
console.log(await getFramework('vue', { projectDir: './path/to/vue/website' }))
// {
// name: 'vue',
// title: 'Vue.js',
// category: 'frontend_framework',
// dev: {
// commands: ['npm run serve'],
Expand All @@ -88,6 +91,7 @@ $ framework-info --long ./path/to/vue/website
[
{
"name": "vue",
"title": 'Vue.js',
"category": "frontend_framework",
"dev": {
"commands": ["npm run serve"],
Expand Down Expand Up @@ -138,6 +142,12 @@ _Type_: `string`

Name such as `"gatsby"`.

## title

_Type_: `string`

Title such as `"Gatsby"`.

#### category

_Type_: `string`
Expand Down Expand Up @@ -228,6 +238,7 @@ Each framework is a JSON file in the `/src/frameworks/` directory. For example:
```json
{
"name": "gatsby",
"title": "Gatsby",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["gatsby"],
Expand Down Expand Up @@ -255,6 +266,12 @@ _Type_: `string`

Name of the framework, lowercase.

## title

_Type_: `string`

Title of the framework.

## category

_Type_: `string`
Expand Down
5 changes: 4 additions & 1 deletion src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ const getContext = (context) => {

/**
* @typedef {object} Framework
* @property {string} name - Name such as `"gatsby"`
* @property {string} name - framework name such as `"gatsby"`
* @property {string} title - framework title as `"Gatsby"`
* @property {string} category - Category among `"static_site_generator"`, `"frontend_framework"` and `"build_tool"`
* @property {Dev} dev - Information about the dev command
* @property {Build} build - Information about the build command
Expand Down Expand Up @@ -131,6 +132,7 @@ const getProjectInfo = async function ({ pathExists, packageJson, packageJsonPat
const getFrameworkInfo = function (
{
name,
title,
category,
dev: { command: frameworkDevCommand, port },
build: { command: frameworkBuildCommand, directory },
Expand All @@ -143,6 +145,7 @@ const getFrameworkInfo = function (
const recommendedPlugins = getPlugins(plugins, { nodeVersion })
return {
name,
title,
category,
dev: { commands: devCommands, port },
build: { commands: [frameworkBuildCommand], directory },
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/angular.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "angular",
"title": "Angular",
"category": "frontend_framework",
"detect": {
"npmDependencies": ["@angular/cli"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/assemble.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "assemble",
"title": "Assemble",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["assemble"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/brunch.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "brunch",
"title": "Brunch",
"category": "build_tool",
"detect": {
"npmDependencies": ["brunch"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/create-react-app.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "create-react-app",
"title": "Create React App",
"category": "frontend_framework",
"detect": {
"npmDependencies": ["react-scripts"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/docpad.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "docpad",
"title": "DocPad",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["docpad"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/docusaurus-v2.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "docusaurus-v2",
"title": "Docusaurus 2",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicitly use v2 in the title as referenced in https://docusaurus.io/

"category": "static_site_generator",
"detect": {
"npmDependencies": ["@docusaurus/core"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/docusaurus.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "docusaurus",
"title": "Docusaurus",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["docusaurus"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/eleventy.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "eleventy",
"title": "Eleventy",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["@11ty/eleventy"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/ember.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "ember",
"title": "Ember.js",
"category": "frontend_framework",
"detect": {
"npmDependencies": ["ember-cli"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/expo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "expo",
"title": "Expo",
"category": "frontend_framework",
"detect": {
"npmDependencies": ["expo"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/gatsby.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "gatsby",
"title": "Gatsby",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["gatsby"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/gridsome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "gridsome",
"title": "Gridsome",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["gridsome"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/grunt.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "grunt",
"title": "Grunt",
"category": "build_tool",
"detect": {
"npmDependencies": ["grunt"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/gulp.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "gulp",
"title": "gulp.js",
"category": "build_tool",
"detect": {
"npmDependencies": ["gulp"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/harp.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "harp",
"title": "Harp",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["harp"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/hexo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "hexo",
"title": "Hexo",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["hexo"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/hugo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "hugo",
"title": "Hugo",
"category": "static_site_generator",
"detect": {
"npmDependencies": [],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/jekyll.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "jekyll",
"title": "Jekyll",
"category": "static_site_generator",
"detect": {
"npmDependencies": [],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/metalsmith.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "metalsmith",
"title": "Metalsmith",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["metalsmith"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/middleman.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "middleman",
"title": "Middleman",
"category": "static_site_generator",
"detect": {
"npmDependencies": [],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/next.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "next",
"title": "Next.js",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["next"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/nuxt.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "nuxt",
"title": "Next.js",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["nuxt"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/parcel.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "parcel",
"title": "Parcel",
"category": "build_tool",
"detect": {
"npmDependencies": ["parcel-bundler", "parcel"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/phenomic.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "phenomic",
"title": "Phenomic",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["@phenomic/core"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/quasar-v0.17.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "quasar-v0.17",
"title": "Quasar",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't include the version this time as it can mean any version lower than v1

"category": "frontend_framework",
"detect": {
"npmDependencies": ["quasar-cli"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/quasar.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "quasar",
"title": "Quasar",
"category": "frontend_framework",
"detect": {
"npmDependencies": ["@quasar/app"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/react-static.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "react-static",
"title": "React Static",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["react-static"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/roots.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "roots",
"title": "Roots",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["roots"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/sapper.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "sapper",
"title": "Sapper",
"category": "frontend_framework",
"detect": {
"npmDependencies": ["sapper"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/stencil.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "stencil",
"title": "Stencil",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["@stencil/core"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/svelte.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "svelte",
"title": "Svelte",
"category": "frontend_framework",
"detect": {
"npmDependencies": ["svelte"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/vue.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "vue",
"title": "Vue.js",
"category": "frontend_framework",
"detect": {
"npmDependencies": ["@vue/cli-service"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/vuepress.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "vuepress",
"title": "VuePress",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["vuepress"],
Expand Down
1 change: 1 addition & 0 deletions src/frameworks/wintersmith.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "wintersmith",
"title": "Wintersmith",
"category": "static_site_generator",
"detect": {
"npmDependencies": ["wintersmith"],
Expand Down
3 changes: 2 additions & 1 deletion test/frameworks.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ const PLUGIN_SCHEMA = {
const MAX_PORT = 65535
const FRAMEWORK_JSON_SCHEMA = {
type: 'object',
required: ['name', 'category', 'detect', 'dev', 'build', 'env'],
required: ['name', 'title', 'category', 'detect', 'dev', 'build', 'env'],
additionalProperties: false,
properties: {
name: { type: 'string', pattern: '^[a-z\\d_]+', minLength: 1 },
title: { type: 'string', pattern: '^\\w+', minLength: 1 },
category: {
type: 'string',
enum: ['static_site_generator', 'frontend_framework', 'build_tool'],
Expand Down
4 changes: 4 additions & 0 deletions test/snapshots/bin.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Generated by [AVA](https://ava.li).
`[␊
{␊
"name": "vuepress",␊
"title": "VuePress",␊
"category": "static_site_generator",␊
"dev": {␊
"commands": [␊
Expand All @@ -43,6 +44,7 @@ Generated by [AVA](https://ava.li).
},␊
{␊
"name": "vue",␊
"title": "Vue.js",␊
"category": "frontend_framework",␊
"dev": {␊
"commands": [␊
Expand Down Expand Up @@ -75,6 +77,7 @@ Generated by [AVA](https://ava.li).
`[␊
{␊
"name": "next",␊
"title": "Next.js",␊
"category": "static_site_generator",␊
"dev": {␊
"commands": [␊
Expand Down Expand Up @@ -102,6 +105,7 @@ Generated by [AVA](https://ava.li).
`[␊
{␊
"name": "next",␊
"title": "Next.js",␊
"category": "static_site_generator",␊
"dev": {␊
"commands": [␊
Expand Down
Binary file modified test/snapshots/bin.js.snap
Binary file not shown.
2 changes: 2 additions & 0 deletions test/snapshots/main.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Generated by [AVA](https://ava.li).
env: {},
name: 'sapper',
plugins: [],
title: 'Sapper',
}

## Should detect frameworks
Expand All @@ -49,5 +50,6 @@ Generated by [AVA](https://ava.li).
env: {},
name: 'sapper',
plugins: [],
title: 'Sapper',
},
]
Binary file modified test/snapshots/main.js.snap
Binary file not shown.