Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit

Permalink
feat: Add CircleCI and Travis CI (#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChargedByte authored Mar 10, 2021
1 parent f4d543b commit 1cfe0d4
Show file tree
Hide file tree
Showing 6 changed files with 258 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ yarn create nuxt-app <my-project>
- [Dependabot (for GitHub only)](https://dependabot.com/)
1. Continous Integration
- [GitHub Actions](https://github.com/features/actions)
- [Travis CI](https://travis-ci.com)
- [CircleCI](https://circleci.com)

## CLI Options

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
version: 2

jobs:
ci:
docker:
- image: cimg/node:lts
steps:
- checkout

- restore_cache:
keys:
<%_ if (pm === 'npm') { _%>
- node-v1-{{ checksum "package-lock.json" }}
<%_ } _%>
<%_ if (pm === 'yarn') { _%>
- yarn-v1-{{ checksum "yarn.lock" }}
<%_ } _%>

- run:
name: Install dependencies
command: <%= pm === 'yarn' ? 'yarn --frozen-lockfile --cache-folder ~/.cache/yarn': 'npm ci' %>

- save_cache:
<%_ if (pm === 'npm') { _%>
key: node-v1-{{ checksum "package-lock.json" }}
paths:
- ~/.npm
<%_ } _%>
<%_ if (pm === 'yarn') { _%>
key: yarn-v1-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
<%_ } _%>

<%_ if (linter.length > 0) { _%>
- run:
name: Run linter
command: <%= pmRun %> lint
<%_ } _%>

<%_ if (test !== 'none') { _%>
- run:
name: Run tests
command: <%= pmRun %> test
<%_ } _%>

workflows:
version: 2
ci:
jobs:
- ci:
filters:
branches:
only:
- main
- master
27 changes: 27 additions & 0 deletions packages/cna-template/template/frameworks/travis-ci/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
language: node_js
node_js:
- lts/*

os:
- linux
dist: focal

branches:
only:
- main
- master

<%_ if (pm === 'yarn') { _%>
cache: yarn
<%_ } _%>
<%_ if (pm === 'npm') { _%>
cache: npm
<%_ } _%>

script:
<%_ if (linter.length > 0) { _%>
- <%= pmRun %> lint
<%_ } _%>
<%_ if (test !== 'none') { _%>
- <%= pmRun %> test
<%_ } _%>
4 changes: 3 additions & 1 deletion packages/create-nuxt-app/lib/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ module.exports = [
type: 'list',
choices: [
{ name: 'None', value: 'none' },
{ name: 'GitHub Actions (GitHub only)', value: 'github-actions' }
{ name: 'GitHub Actions (GitHub only)', value: 'github-actions' },
{ name: 'Travis CI', value: 'travis-ci' },
{ name: 'CircleCI', value: 'circleci' }
],
default: 'none'
},
Expand Down
170 changes: 170 additions & 0 deletions packages/create-nuxt-app/test/snapshots/index.test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -4024,6 +4024,176 @@ Generated by [AVA](https://avajs.dev).

## verify ci: GitHub Actions (GitHub only)

> Generated files
[
'.editorconfig',
'.gitignore',
'README.md',
'assets/README.md',
'components/Logo.vue',
'components/README.md',
'layouts/README.md',
'layouts/default.vue',
'middleware/README.md',
'nuxt.config.js',
'package.json',
'pages/README.md',
'pages/index.vue',
'plugins/README.md',
'static/README.md',
'static/favicon.ico',
'store/README.md',
]

> package.json
{
dependencies: {
'core-js': '^3.9.1',
nuxt: '^2.15.2',
},
devDependencies: {},
private: true,
scripts: {
build: 'nuxt build',
dev: 'nuxt',
generate: 'nuxt generate',
start: 'nuxt start',
},
}

> Generated nuxt.config.js
`export default {␊
// Global page headers: https://go.nuxtjs.dev/config-head␊
head: {␊
title: 'output',␊
htmlAttrs: {␊
lang: 'en'␊
},␊
meta: [␊
{ charset: 'utf-8' },␊
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },␊
{ hid: 'description', name: 'description', content: '' }␊
],␊
link: [␊
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }␊
]␊
},␊
// Global CSS: https://go.nuxtjs.dev/config-css␊
css: [␊
],␊
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins␊
plugins: [␊
],␊
// Auto import components: https://go.nuxtjs.dev/config-components␊
components: true,␊
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules␊
buildModules: [␊
],␊
// Modules: https://go.nuxtjs.dev/config-modules␊
modules: [␊
],␊
// Build Configuration: https://go.nuxtjs.dev/config-build␊
build: {␊
}␊
}␊
`

## verify ci: Travis CI

> Generated files
[
'.editorconfig',
'.gitignore',
'README.md',
'assets/README.md',
'components/Logo.vue',
'components/README.md',
'layouts/README.md',
'layouts/default.vue',
'middleware/README.md',
'nuxt.config.js',
'package.json',
'pages/README.md',
'pages/index.vue',
'plugins/README.md',
'static/README.md',
'static/favicon.ico',
'store/README.md',
]

> package.json
{
dependencies: {
'core-js': '^3.9.1',
nuxt: '^2.15.2',
},
devDependencies: {},
private: true,
scripts: {
build: 'nuxt build',
dev: 'nuxt',
generate: 'nuxt generate',
start: 'nuxt start',
},
}

> Generated nuxt.config.js
`export default {␊
// Global page headers: https://go.nuxtjs.dev/config-head␊
head: {␊
title: 'output',␊
htmlAttrs: {␊
lang: 'en'␊
},␊
meta: [␊
{ charset: 'utf-8' },␊
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },␊
{ hid: 'description', name: 'description', content: '' }␊
],␊
link: [␊
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }␊
]␊
},␊
// Global CSS: https://go.nuxtjs.dev/config-css␊
css: [␊
],␊
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins␊
plugins: [␊
],␊
// Auto import components: https://go.nuxtjs.dev/config-components␊
components: true,␊
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules␊
buildModules: [␊
],␊
// Modules: https://go.nuxtjs.dev/config-modules␊
modules: [␊
],␊
// Build Configuration: https://go.nuxtjs.dev/config-build␊
build: {␊
}␊
}␊
`

## verify ci: CircleCI

> Generated files
[
Expand Down
Binary file modified packages/create-nuxt-app/test/snapshots/index.test.js.snap
Binary file not shown.

0 comments on commit 1cfe0d4

Please sign in to comment.