-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(templates/angular-starter-buttercms): New template
Add new template angular-starter-buttercms.
- Loading branch information
1 parent
f2917e7
commit 3e77e19
Showing
108 changed files
with
28,148 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
templates/angular/angular-starter-buttercms/.browserslistrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. | ||
# For additional information regarding the format and rule options, please see: | ||
# https://github.com/browserslist/browserslist#queries | ||
|
||
# For the full list of supported browsers by the Angular framework, please see: | ||
# https://angular.io/guide/browser-support | ||
|
||
# You can see what browsers were selected by your queries by running: | ||
# npx browserslist | ||
|
||
last 1 Chrome version | ||
last 1 Firefox version | ||
last 2 Edge major versions | ||
last 2 Safari major versions | ||
last 2 iOS major versions | ||
Firefox ESR | ||
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Editor configuration, see https://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.ts] | ||
quote_type = single | ||
|
||
[*.md] | ||
max_line_length = off | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
NG_APP_ANGULAR_BUTTER_CMS_API_KEY= | ||
NG_APP_ANGULAR_BUTTER_CMS_PREVIEW=false |
39 changes: 39 additions & 0 deletions
39
templates/angular/angular-starter-buttercms/.github/workflows/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Main Edge Deploy | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
branches: | ||
- "main" | ||
|
||
jobs: | ||
deploy: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js 18.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Install dependencies | ||
run: yarn | ||
|
||
- name: Install Azion CLI | ||
run: | | ||
curl -o azionlinux https://downloads.azion.com/linux/x86_64/azion | ||
sudo mv azionlinux /usr/bin/azion | ||
sudo chmod u+x /usr/bin/azion | ||
- name: Azion Action Deploy | ||
run: | | ||
azion -t ${{ secrets.AZION_PERSONAL_TOKEN }} | ||
azion deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# See http://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# compiled output | ||
/dist | ||
/tmp | ||
/out-tsc | ||
# Only exists if Bazel was run | ||
/bazel-out | ||
|
||
# dependencies | ||
/node_modules | ||
|
||
# profiling files | ||
chrome-profiler-events*.json | ||
speed-measure-plugin*.json | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
.history/* | ||
|
||
# misc | ||
/.angular/cache | ||
/.sass-cache | ||
/connect.lock | ||
/coverage | ||
/libpeerconnection.log | ||
npm-debug.log | ||
yarn-error.log | ||
testem.log | ||
/typings | ||
|
||
# System Files | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# azion | ||
.edge | ||
.vulcan | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
![recommended node version](https://img.shields.io/badge/node-v16-green) | ||
|
||
# Angular + ButterCMS Starter Project | ||
|
||
This Angular starter project fully integrates with dynamic sample content from your ButterCMS account, including main menu, pages, blog posts, categories, and tags, all with a beautiful, custom theme with already-implemented search functionality. All of the included sample content is automatically created in your account dashboard when you sign up for a free trial of ButterCMS. | ||
|
||
[View our live demo hosted at Vercel](https://test.vercel.app/), or you can click a button below to deploy your own copy of our starter | ||
project to the provider of your choice. | ||
|
||
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FButterCMS%2Fangular-starter-buttercms&env=NG_APP_ANGULAR_BUTTER_CMS_API_KEY&envDescription=Your%20ButterCMS%20API%20Token&envLink=https%3A%2F%2Fbuttercms.com%2Fsettings%2F&project-name=angular-starter-buttercms&repo-name=angular-starter-buttercms&redirect-url=https%3A%2F%2Fbuttercms.com%2Fonboarding%2Fvercel-starter-deploy-callback%2F&production-deploy-hook=Deploy%20Triggered%20from%20ButterCMS&demo-title=ButterCMS%20Angular%20Starter&demo-description=Fully%20integrated%20with%20your%20ButterCMS%20account&demo-url=https%3A%2F%2Ftest.vercel.app%2F&demo-image=https://cdn.buttercms.com/r0tGK8xFRti2iRKBJ0eY&repository-name=angular-starter-buttercms) | ||
|
||
## 1. Installation | ||
|
||
First, clone the repo and install the dependencies by running `npm install` | ||
|
||
```bash | ||
git clone https://github.com/ButterCMS/angular-starter-buttercms | ||
cd angular-starter-buttercms | ||
npm install | ||
``` | ||
|
||
### 2. Set API Token | ||
|
||
To fetch your ButterCMS content, add your API token as an environment variable. | ||
|
||
```bash | ||
$ echo 'NG_APP_ANGULAR_BUTTER_CMS_API_KEY=<Your API Token>' >> .env | ||
``` | ||
|
||
### 3. Run local server | ||
|
||
To view the app in the browser, you'll need to run the local development server: | ||
|
||
```bash | ||
$ npm run start | ||
``` | ||
|
||
Congratulations! Your starter project is now live at [http://localhost:4200/](http://localhost:4200/). | ||
|
||
## 4. Deploy on Vercel | ||
|
||
Deploy your Angular app using Vercel, the creators of Next.js. With a single click, you'll create a copy of our starter project in your Git provider account, instantly deploy it, and institute a full content workflow connected to your ButterCMS account. Smooth. | ||
|
||
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FButterCMS%2Fangular-starter-buttercms&env=NG_APP_ANGULAR_BUTTER_CMS_API_KEY&envDescription=Your%20ButterCMS%20API%20Token&envLink=https%3A%2F%2Fbuttercms.com%2Fsettings%2F&project-name=angular-starter-buttercms&repo-name=angular-starter-buttercms&redirect-url=https%3A%2F%2Fbuttercms.com%2Fonboarding%2Fvercel-starter-deploy-callback%2F&production-deploy-hook=Deploy%20Triggered%20from%20ButterCMS&demo-title=ButterCMS%20Angular%20Starter&demo-description=Fully%20integrated%20with%20your%20ButterCMS%20account&demo-url=https%3A%2F%2Ftest.vercel.app%2F&demo-image=https://cdn.buttercms.com/r0tGK8xFRti2iRKBJ0eY&repository-name=angular-starter-buttercms) | ||
|
||
### 5. Webhooks | ||
|
||
The ButterCMS webhook settings are located at https://buttercms.com/webhooks/ | ||
|
||
### 6. Previewing Draft Changes | ||
|
||
By default, your starter project is set up to allow previewing of draft changes saved in your ButterCMS.com account. To disable this functionality, set the following value in your .env file: NG_APP_ANGULAR_BUTTER_CMS_PREVIEW=false |
125 changes: 125 additions & 0 deletions
125
templates/angular/angular-starter-buttercms/angular.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
{ | ||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", | ||
"version": 1, | ||
"newProjectRoot": "projects", | ||
"projects": { | ||
"angular-tour-of-heroes": { | ||
"projectType": "application", | ||
"schematics": {}, | ||
"root": "", | ||
"sourceRoot": "src", | ||
"prefix": "app", | ||
"architect": { | ||
"build": { | ||
"builder": "@angular-builders/custom-webpack:browser", | ||
"options": { | ||
"customWebpackConfig": { | ||
"path": "./webpack.config.js" | ||
}, | ||
"outputPath": "dist/angular-tour-of-heroes", | ||
"index": "src/index.html", | ||
"main": "src/main.ts", | ||
"polyfills": "src/polyfills.ts", | ||
"tsConfig": "tsconfig.app.json", | ||
"assets": [ | ||
"src/favicon.ico", | ||
"src/assets" | ||
], | ||
"styles": [ | ||
"src/styles.css" | ||
], | ||
"scripts": [], | ||
"vendorChunk": true, | ||
"extractLicenses": false, | ||
"buildOptimizer": false, | ||
"sourceMap": true, | ||
"optimization": false, | ||
"namedChunks": true | ||
}, | ||
"configurations": { | ||
"production": { | ||
"fileReplacements": [ | ||
{ | ||
"replace": "src/environments/environment.ts", | ||
"with": "src/environments/environment.prod.ts" | ||
} | ||
], | ||
"optimization": true, | ||
"outputHashing": "all", | ||
"sourceMap": false, | ||
"namedChunks": false, | ||
"extractLicenses": true, | ||
"vendorChunk": false, | ||
"buildOptimizer": true, | ||
"budgets": [ | ||
{ | ||
"type": "initial", | ||
"maximumWarning": "2mb", | ||
"maximumError": "5mb" | ||
}, | ||
{ | ||
"type": "anyComponentStyle", | ||
"maximumWarning": "6kb", | ||
"maximumError": "10kb" | ||
} | ||
] | ||
} | ||
}, | ||
"defaultConfiguration": "" | ||
}, | ||
"serve": { | ||
"builder": "@angular-builders/custom-webpack:dev-server", | ||
"options": { | ||
"browserTarget": "angular-tour-of-heroes:build" | ||
}, | ||
"configurations": { | ||
"production": { | ||
"browserTarget": "angular-tour-of-heroes:build:production" | ||
} | ||
} | ||
}, | ||
"extract-i18n": { | ||
"builder": "@angular-devkit/build-angular:extract-i18n", | ||
"options": { | ||
"browserTarget": "angular-tour-of-heroes:build" | ||
} | ||
}, | ||
"test": { | ||
"builder": "@angular-devkit/build-angular:karma", | ||
"options": { | ||
"main": "src/test.ts", | ||
"polyfills": "src/polyfills.ts", | ||
"tsConfig": "tsconfig.spec.json", | ||
"karmaConfig": "karma.conf.js", | ||
"assets": [ | ||
"src/favicon.ico", | ||
"src/assets" | ||
], | ||
"styles": [ | ||
"src/styles.css" | ||
], | ||
"scripts": [] | ||
} | ||
}, | ||
"e2e": { | ||
"builder": "@angular-devkit/build-angular:protractor", | ||
"options": { | ||
"customWebpackConfig": { | ||
"path": "webpack.config.js" | ||
}, | ||
"protractorConfig": "e2e/protractor.conf.js", | ||
"devServerTarget": "angular-tour-of-heroes:serve" | ||
}, | ||
"configurations": { | ||
"production": { | ||
"devServerTarget": "angular-tour-of-heroes:serve:production" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"cli": { | ||
"analytics": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
build: { | ||
preset: { | ||
name: 'angular' | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
templates/angular/angular-starter-buttercms/e2e/protractor.conf.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// @ts-check | ||
// Protractor configuration file, see link for more information | ||
// https://github.com/angular/protractor/blob/master/lib/config.ts | ||
|
||
const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); | ||
|
||
/** | ||
* @type { import("protractor").Config } | ||
*/ | ||
exports.config = { | ||
allScriptsTimeout: 11000, | ||
specs: [ | ||
'./src/**/*.e2e-spec.ts' | ||
], | ||
capabilities: { | ||
browserName: 'chrome' | ||
}, | ||
directConnect: true, | ||
SELENIUM_PROMISE_MANAGER: false, | ||
baseUrl: 'http://localhost:4200/', | ||
framework: 'jasmine', | ||
jasmineNodeOpts: { | ||
showColors: true, | ||
defaultTimeoutInterval: 30000, | ||
print: function() {} | ||
}, | ||
onPrepare() { | ||
require('ts-node').register({ | ||
project: require('path').join(__dirname, './tsconfig.json') | ||
}); | ||
jasmine.getEnv().addReporter(new SpecReporter({ | ||
spec: { | ||
displayStacktrace: StacktraceOption.PRETTY | ||
} | ||
})); | ||
} | ||
}; |
23 changes: 23 additions & 0 deletions
23
templates/angular/angular-starter-buttercms/e2e/src/app.e2e-spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { browser, logging } from 'protractor'; | ||
import { AppPage } from './app.po'; | ||
|
||
describe('workspace-project App', () => { | ||
let page: AppPage; | ||
|
||
beforeEach(() => { | ||
page = new AppPage(); | ||
}); | ||
|
||
it('should display welcome message', async () => { | ||
await page.navigateTo(); | ||
expect(await page.getTitleText()).toEqual('angular-tour-of-heroes app is running!'); | ||
}); | ||
|
||
afterEach(async () => { | ||
// Assert that there are no errors emitted from the browser | ||
const logs = await browser.manage().logs().get(logging.Type.BROWSER); | ||
expect(logs).not.toContain(jasmine.objectContaining({ | ||
level: logging.Level.SEVERE, | ||
} as logging.Entry)); | ||
}); | ||
}); |
11 changes: 11 additions & 0 deletions
11
templates/angular/angular-starter-buttercms/e2e/src/app.po.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { browser, by, element } from 'protractor'; | ||
|
||
export class AppPage { | ||
async navigateTo(): Promise<unknown> { | ||
return browser.get(browser.baseUrl); | ||
} | ||
|
||
async getTitleText(): Promise<string> { | ||
return element(by.css('app-root .content span')).getText(); | ||
} | ||
} |
Oops, something went wrong.