Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
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
5 changes: 4 additions & 1 deletion packages/common/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export enum ProjectType {
AngularCLI = 'angular-cli',
CreateReactApp = 'create-react-app',
Gatsby = 'gatsby',
CreateReactAppTypeScript = 'create-react-app-typescript'
CreateReactAppTypeScript = 'create-react-app-typescript',
// Vue uses different templates. We cannot determine
// the correct one since they are quite generic.
Vue = 'Vue'
}

export interface ProjectLayout {
Expand Down
10 changes: 8 additions & 2 deletions packages/parser/__tests__/detect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('detect', () => {
});

describe('create-react-app', () => {
it('should detect an create-react-app', () => {
it('should detect a create-react-app', () => {
expect(detect('packages/parser/__tests__/fixtures/react-app').type).toBe(ProjectType.CreateReactApp);
});
});
Expand All @@ -21,11 +21,17 @@ describe('detect', () => {
});

describe('gatsby', () => {
it('should detect an gatsby', () => {
it('should detect a gatsby', () => {
expect(detect('packages/parser/__tests__/fixtures/gatsby').type).toBe(ProjectType.Gatsby);
});
});

describe('vue', () => {
it('should detect a vue', () => {
expect(detect('packages/parser/__tests__/fixtures/vue-cli-webpack').type).toBe(ProjectType.Vue);
});
});

describe('unknown', () => {
it('should not detect unknown app', () => {
expect(detect('packages/parser/__tests__/fixtures/unknown')).toBe(undefined);
Expand Down
12 changes: 12 additions & 0 deletions packages/parser/__tests__/fixtures/vue-cli-webpack/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
14 changes: 14 additions & 0 deletions packages/parser/__tests__/fixtures/vue-cli-webpack/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.DS_Store
node_modules/
/dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
10 changes: 10 additions & 0 deletions packages/parser/__tests__/fixtures/vue-cli-webpack/.postcssrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// https://github.com/michael-ciniawsky/postcss-load-config

module.exports = {
"plugins": {
"postcss-import": {},
"postcss-url": {},
// to edit target browsers: use "browserslist" field in package.json
"autoprefixer": {}
}
}
21 changes: 21 additions & 0 deletions packages/parser/__tests__/fixtures/vue-cli-webpack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# vue-cli-webpack

> A Vue.js project

## Build Setup

``` bash
# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report
```

For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')

module.exports = merge(prodEnv, {
NODE_ENV: '"development"'
})
69 changes: 69 additions & 0 deletions packages/parser/__tests__/fixtures/vue-cli-webpack/config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.

const path = require('path')

module.exports = {
dev: {

// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},

// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false,
errorOverlay: true,
notifyOnErrors: true,
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-


/**
* Source Maps
*/

// https://webpack.js.org/configuration/devtool/#development
devtool: 'cheap-module-eval-source-map',

// If you have problems debugging vue-files in devtools,
// set this to false - it *may* help
// https://vue-loader.vuejs.org/en/options.html#cachebusting
cacheBusting: true,

cssSourceMap: true
},

build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),

// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/',

/**
* Source Maps
*/

productionSourceMap: true,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',

// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'],

// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use strict'
module.exports = {
NODE_ENV: '"production"'
}
12 changes: 12 additions & 0 deletions packages/parser/__tests__/fixtures/vue-cli-webpack/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>vue-cli-webpack</title>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
Loading