static-website-boilerplate

所属分类:FaaS/Serverless
开发工具:HTML
文件大小:84618KB
下载次数:0
上传日期:2023-06-11 22:01:40
上 传 者sh-1993
说明:  用于无服务器静态网站项目的Boilerplate-使用CloudFront和AWS部署到AWS。
(Boilerplate for a serverless static website project - deployed to AWS using CloudFront and AWS.)

文件列表:
.eslintignore (121, 2023-09-02)
.eslintrc.json (1557, 2023-09-02)
.nodemonx.json (139, 2023-09-02)
.nvmrc (7, 2023-09-02)
.pnp.cjs (1146802, 2023-09-02)
.pnp.loader.mjs (69530, 2023-09-02)
.prettierignore (181, 2023-09-02)
.prettierrc.json (85, 2023-09-02)
.vscode (0, 2023-09-02)
.vscode\extensions.json (162, 2023-09-02)
.vscode\settings.json (867, 2023-09-02)
.yarn (0, 2023-09-02)
.yarn\cache (0, 2023-09-02)
.yarn\cache\@ampproject-remapping-npm-2.1.2-d1536e36d6-e023f92cdd.zip (24307, 2023-09-02)
.yarn\cache\@babel-code-frame-npm-7.10.1-97c774762b-060b84203a.zip (4203, 2023-09-02)
.yarn\cache\@babel-code-frame-npm-7.10.4-ab1ee3c93e-feb4543c8a.zip (4203, 2023-09-02)
.yarn\cache\@babel-code-frame-npm-7.16.7-093eb9e124-db2f7faa31.zip (3934, 2023-09-02)
.yarn\cache\@babel-compat-data-npm-7.17.10-78bb00a360-e85051087c.zip (9072, 2023-09-02)
.yarn\cache\@babel-compat-data-npm-7.17.7-cb4c3e4df9-bf13476676.zip (9070, 2023-09-02)
.yarn\cache\@babel-core-npm-7.17.10-1a94847d37-2545fb24b4.zip (89388, 2023-09-02)
.yarn\cache\@babel-core-npm-7.17.9-a17b8c8593-2d301e4561.zip (88525, 2023-09-02)
.yarn\cache\@babel-generator-npm-7.17.10-6e6a510ddb-9ec596a6ff.zip (32072, 2023-09-02)
.yarn\cache\@babel-generator-npm-7.17.9-314134f0b2-afbdd4afbf.zip (32058, 2023-09-02)
.yarn\cache\@babel-helper-compilation-targets-npm-7.17.10-4648377de1-5f547c7ebd.zip (8817, 2023-09-02)
.yarn\cache\@babel-helper-compilation-targets-npm-7.17.7-b0b90e42d8-24bf851539.zip (8813, 2023-09-02)
.yarn\cache\@babel-helper-environment-visitor-npm-7.16.7-3ee2ba2019-c03a10105d.zip (2953, 2023-09-02)
.yarn\cache\@babel-helper-function-name-npm-7.17.9-baf558fead-a59b2e5af5.zip (3929, 2023-09-02)
.yarn\cache\@babel-helper-hoist-variables-npm-7.16.7-25cc3abba4-6ae1641f4a.zip (3049, 2023-09-02)
.yarn\cache\@babel-helper-module-imports-npm-7.16.7-19c74fd92b-ddd2c4a600.zip (6270, 2023-09-02)
.yarn\cache\@babel-helper-module-transforms-npm-7.17.7-d26786bf84-0b8f023aa7.zip (12608, 2023-09-02)
... ...

Generated with Goldstack

Static Website Boilerplate

Develop a static website using HTML and CSS. Test the website locally. Deploy to AWS using [CloudFront](https://aws.amazon.com/s3/) and [S3](https://aws.amazon.com/cloudfront/). This boilerplate has been automatically generated using the template:

Static Website

Feel free to fork this repository and modify it for your needs, or use the [Goldstack project builder](https://goldstack.party/build) to generate a boilerplate specifically configured for your project. # Getting Started Thank you for using this boilerplate. For any questions or feedback, please be welcome to [raise an issue on GitHub](https://github.com/goldstack/goldstack/issues) ¤— . ## 1. Fork and clone the repository [Fork this repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo) and then [clone](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) the fork your local machine. ## 2. Install required local dependencies A few dependencies need to be available in your development system. Please verify they are present or install them. - Node v12+ - Yarn v1.22.5+ - Docker v19+ Open a terminal and run the following commands: ```bash node -v yarn -v docker --version ``` This should produce the following output: ![Confirming versions in the console](https://cdn.goldstack.party/img/202203/confirm_versions.png) If you need to install or update any of the dependencies, please see the following guides: - [Downloading and installing Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) - [Yarn Installation](https://yarnpkg.com/getting-started/install) - [Install Docker for Windows](https://docs.docker.com/docker-for-windows/install/) / [Install Docker for Mac](https://docs.docker.com/docker-for-mac/install/) ## 3. Initialise project and install NPM Dependencies Run `yarn` in your project directory to install and download all dependencies. The installation process should take around 3-10 minutes depending on the dependencies that need to be downloaded. ![Installing project dependencies](https://cdn.goldstack.party/img/202203/install_project.gif) You can confirm everything was installed correctly by running `yarn -v`. This should show a yarn version of `3.0.0+`. ![Confirming Yarn Version after install](https://cdn.goldstack.party/img/202203/confirm_yarn_version_after_install.png) ## 4. Build modules Make sure that the project compiles correctly by running `yarn build` your project directory: ![Building your project](https://cdn.goldstack.party/img/202203/build_project.gif) Note that this command also ensures that all TypeScript project references are configured correctly. ## 5. Configure VSCode In order to setup VSCode, open the project in VSCode. VSCode may prompt you to ask if you trust the authors of the workspace. Respond with Yes. VSCode Prompt trust authors You may also be asked if you want to install recommended extensions for this workspace. We recommend to do so since the template will be optimised to work with the suggested extensions. ![VSCode Prompt install extensions](https://cdn.goldstack.party/img/202201/install_extensions.png) If you want to install the necessary extensions manually, here are links to the extensions required: - [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) - [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) - [ZipFS](https://marketplace.visualstudio.com/items?itemName=arcanis.vscode-zipfs) (optional) ## 6. Initialise TypeScript Locate a `.ts` or `.tsx` file in the workspace and open it. When asked whether to use the workspace TypeScript version, click _Allow_. VSCode Locate TypeScript In the status bar on the bottom right-hand corner of the VSCode editor you should now see _TypeScript_. ![TypeScript status icon in VSCode](https://cdn.goldstack.party/img/202203/typescript_init.png) ## 7. Local Development Go to the folder `packages/static-website-aws` and run `yarn watch`. This will start a local development server. VSCode Locate TypeScript To make changes to the web page, edit the files in the folder `packages\static-website-aws\web`. Edit webpage included in template ## 8. Deploy to AWS If you want to deploy your project to AWS, you will need to make some changes to the configuration files included in this project. Specifically, the [goldstack.json](https://github.com/goldstack/static-website-boilerplate/blob/master/packages/static-website-1/goldstack.json) in the `packages/static-website-aws` folder. ```json { "$schema": "./schemas/package.schema.json", "name": "static-website-1", "template": "static-website-aws", "templateVersion": "0.1.0", "configuration": {}, "deployments": [ { "name": "prod", "awsUser": "goldstack-dev", "awsRegion": "us-west-2", "configuration": { "hostedZoneDomain": "dev.goldstack.party", "websiteDomain": "staticwebsite1-1651273869629.tests.dev.goldstack.party", "websiteDomainRedirect": "www.staticwebsite1-1651273869629.tests.dev.goldstack.party", "defaultCacheDuration": 10 }, "tfStateKey": "static-website-1-prod-0397e051cd046f2d46e7.tfstate" } ] } ``` The key properties you will need to update are: - `deployments[0].configuration.hostedZoneDomain` - `deployments[0].configuration.websiteDomain` Also you need to _delete_ `deployments[0].tfStateKey`. For more information on these configuration options, see [Goldstack Documentation / Static Website AWS Template / Configure](https://docs.goldstack.party/docs/templates/static-website-aws#configure). You will also need to ensure that you have a valid AWS user configure to deploy to AWS. For this, create a file in `/config/infra/config.json` (relative to project root). { "users": [ { "name": "goldstack-dev", "type": "apiKey", "config": { "awsAccessKeyId": "...", "awsSecretAccessKey": "...", "awsDefaultRegion": "us-west-2" } }, { "name": "goldstack-prod", "type": "apiKey", "config": { "awsAccessKeyId": "...", "awsSecretAccessKey": "", "awsDefaultRegion": "us-west-2" } } ] } For more information on configuring your local AWS users, please see [Goldstack Documentation / AWS Configuration](https://docs.goldstack.party/docs/goldstack/configuration#aws-configuration). Once your AWS user is configured you can run `yarn infra up prod` in the `/packages/static-website-aws` folder. For more information on the infrastructure commands for this project, see [Goldstack Documentation / Static Website Template / Infrastructure](https://docs.goldstack.party/docs/templates/static-website-aws#infrastructure). ## 9. Contribute to Goldstack Have questions or ideas or want to contribute to the project? Please head over to [github.com/goldstack/goldstack](https://github.com/goldstack/goldstack).

近期下载者

相关文件


收藏者