Sapper switched to rollup and amplify configuration
This commit is contained in:
parent
8b6cd87f50
commit
5064d0b88d
11
.gitignore
vendored
11
.gitignore
vendored
@ -4,3 +4,14 @@
|
|||||||
yarn-error.log
|
yarn-error.log
|
||||||
/cypress/screenshots/
|
/cypress/screenshots/
|
||||||
/__sapper__/
|
/__sapper__/
|
||||||
|
|
||||||
|
#amplify
|
||||||
|
amplify/\#current-cloud-backend
|
||||||
|
amplify/.config/local-*
|
||||||
|
amplify/backend/amplify-meta.json
|
||||||
|
amplify/backend/awscloudformation
|
||||||
|
build/
|
||||||
|
dist/
|
||||||
|
node_modules/
|
||||||
|
aws-exports.js
|
||||||
|
awsconfiguration.json
|
17
amplify/.config/project-config.json
Normal file
17
amplify/.config/project-config.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"projectName": "michalvankodev",
|
||||||
|
"version": "2.0",
|
||||||
|
"frontend": "javascript",
|
||||||
|
"javascript": {
|
||||||
|
"framework": "none",
|
||||||
|
"config": {
|
||||||
|
"SourceDir": "src",
|
||||||
|
"DistributionDir": "__sapper__/export",
|
||||||
|
"BuildCommand": "npm run-script export",
|
||||||
|
"StartCommand": "npm run-script start"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"providers": [
|
||||||
|
"awscloudformation"
|
||||||
|
]
|
||||||
|
}
|
8
amplify/backend/backend-config.json
Normal file
8
amplify/backend/backend-config.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"hosting": {
|
||||||
|
"S3AndCloudFront": {
|
||||||
|
"service": "S3AndCloudFront",
|
||||||
|
"providerPlugin": "awscloudformation"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
amplify/backend/hosting/S3AndCloudFront/parameters.json
Normal file
3
amplify/backend/hosting/S3AndCloudFront/parameters.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"bucketName": "michalvankodev-20190712100852-hostingbucket"
|
||||||
|
}
|
113
amplify/backend/hosting/S3AndCloudFront/template.json
Normal file
113
amplify/backend/hosting/S3AndCloudFront/template.json
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"AWSTemplateFormatVersion": "2010-09-09",
|
||||||
|
"Description": "Hosting resource stack creation using Amplify CLI",
|
||||||
|
"Parameters": {
|
||||||
|
"env": {
|
||||||
|
"Type": "String"
|
||||||
|
},
|
||||||
|
"bucketName": {
|
||||||
|
"Type": "String"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Conditions": {
|
||||||
|
"ShouldNotCreateEnvResources": {
|
||||||
|
"Fn::Equals": [
|
||||||
|
{
|
||||||
|
"Ref": "env"
|
||||||
|
},
|
||||||
|
"NONE"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Resources": {
|
||||||
|
"S3Bucket": {
|
||||||
|
"Type": "AWS::S3::Bucket",
|
||||||
|
"DeletionPolicy": "Retain",
|
||||||
|
"Properties": {
|
||||||
|
"BucketName": {
|
||||||
|
"Fn::If": [
|
||||||
|
"ShouldNotCreateEnvResources",
|
||||||
|
{
|
||||||
|
"Ref": "bucketName"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Fn::Join": [
|
||||||
|
"",
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"Ref": "bucketName"
|
||||||
|
},
|
||||||
|
"-",
|
||||||
|
{
|
||||||
|
"Ref": "env"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"AccessControl": "Private",
|
||||||
|
"WebsiteConfiguration": {
|
||||||
|
"IndexDocument": "index.html",
|
||||||
|
"ErrorDocument": "index.html"
|
||||||
|
},
|
||||||
|
"CorsConfiguration": {
|
||||||
|
"CorsRules": [
|
||||||
|
{
|
||||||
|
"AllowedHeaders": [
|
||||||
|
"Authorization",
|
||||||
|
"Content-Length"
|
||||||
|
],
|
||||||
|
"AllowedMethods": [
|
||||||
|
"GET"
|
||||||
|
],
|
||||||
|
"AllowedOrigins": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"MaxAge": 3000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Outputs": {
|
||||||
|
"Region": {
|
||||||
|
"Value": {
|
||||||
|
"Ref": "AWS::Region"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"HostingBucketName": {
|
||||||
|
"Description": "Hosting bucket name",
|
||||||
|
"Value": {
|
||||||
|
"Ref": "S3Bucket"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"WebsiteURL": {
|
||||||
|
"Value": {
|
||||||
|
"Fn::GetAtt": [
|
||||||
|
"S3Bucket",
|
||||||
|
"WebsiteURL"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Description": "URL for website hosted on S3"
|
||||||
|
},
|
||||||
|
"S3BucketSecureURL": {
|
||||||
|
"Value": {
|
||||||
|
"Fn::Join": [
|
||||||
|
"",
|
||||||
|
[
|
||||||
|
"https://",
|
||||||
|
{
|
||||||
|
"Fn::GetAtt": [
|
||||||
|
"S3Bucket",
|
||||||
|
"DomainName"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Description": "Name of S3 bucket to hold website content"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
26
amplify/team-provider-info.json
Normal file
26
amplify/team-provider-info.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"dev": {
|
||||||
|
"awscloudformation": {
|
||||||
|
"AuthRoleName": "michalvankodev-dev-20190712095737-authRole",
|
||||||
|
"UnauthRoleArn": "arn:aws:iam::359485202421:role/michalvankodev-dev-20190712095737-unauthRole",
|
||||||
|
"AuthRoleArn": "arn:aws:iam::359485202421:role/michalvankodev-dev-20190712095737-authRole",
|
||||||
|
"Region": "eu-central-1",
|
||||||
|
"DeploymentBucketName": "michalvankodev-dev-20190712095737-deployment",
|
||||||
|
"UnauthRoleName": "michalvankodev-dev-20190712095737-unauthRole",
|
||||||
|
"StackName": "michalvankodev-dev-20190712095737",
|
||||||
|
"StackId": "arn:aws:cloudformation:eu-central-1:359485202421:stack/michalvankodev-dev-20190712095737/b705b240-a47a-11e9-8ccd-02c3d40e0dd8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"master": {
|
||||||
|
"awscloudformation": {
|
||||||
|
"AuthRoleName": "michalvankodev-master-20190712123826-authRole",
|
||||||
|
"UnauthRoleArn": "arn:aws:iam::359485202421:role/michalvankodev-master-20190712123826-unauthRole",
|
||||||
|
"AuthRoleArn": "arn:aws:iam::359485202421:role/michalvankodev-master-20190712123826-authRole",
|
||||||
|
"Region": "eu-central-1",
|
||||||
|
"DeploymentBucketName": "michalvankodev-master-20190712123826-deployment",
|
||||||
|
"UnauthRoleName": "michalvankodev-master-20190712123826-unauthRole",
|
||||||
|
"StackName": "michalvankodev-master-20190712123826",
|
||||||
|
"StackId": "arn:aws:cloudformation:eu-central-1:359485202421:stack/michalvankodev-master-20190712123826/2e2fd290-a491-11e9-add7-0aee446e3232"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
2164
package-lock.json
generated
Normal file
2164
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@ -4,7 +4,7 @@
|
|||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "sapper dev",
|
"dev": "sapper dev",
|
||||||
"build": "sapper build",
|
"build": "sapper build --legacy",
|
||||||
"export": "sapper export",
|
"export": "sapper export",
|
||||||
"start": "node __sapper__/build",
|
"start": "node __sapper__/build",
|
||||||
"cy:run": "cypress run",
|
"cy:run": "cypress run",
|
||||||
@ -20,7 +20,17 @@
|
|||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"sapper": "^0.27.0",
|
"sapper": "^0.27.0",
|
||||||
"svelte": "^3.0.0",
|
"svelte": "^3.0.0",
|
||||||
"svelte-loader": "^2.9.0",
|
"@babel/core": "^7.0.0",
|
||||||
"webpack": "^4.7.0"
|
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
|
||||||
|
"@babel/plugin-transform-runtime": "^7.0.0",
|
||||||
|
"@babel/preset-env": "^7.0.0",
|
||||||
|
"@babel/runtime": "^7.0.0",
|
||||||
|
"rollup": "^1.12.0",
|
||||||
|
"rollup-plugin-babel": "^4.0.2",
|
||||||
|
"rollup-plugin-commonjs": "^10.0.0",
|
||||||
|
"rollup-plugin-node-resolve": "^5.2.0",
|
||||||
|
"rollup-plugin-replace": "^2.0.0",
|
||||||
|
"rollup-plugin-svelte": "^5.0.1",
|
||||||
|
"rollup-plugin-terser": "^4.0.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
101
rollup.config.js
Normal file
101
rollup.config.js
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
import resolve from 'rollup-plugin-node-resolve';
|
||||||
|
import replace from 'rollup-plugin-replace';
|
||||||
|
import commonjs from 'rollup-plugin-commonjs';
|
||||||
|
import svelte from 'rollup-plugin-svelte';
|
||||||
|
import babel from 'rollup-plugin-babel';
|
||||||
|
import { terser } from 'rollup-plugin-terser';
|
||||||
|
import config from 'sapper/config/rollup.js';
|
||||||
|
import pkg from './package.json';
|
||||||
|
|
||||||
|
const mode = process.env.NODE_ENV;
|
||||||
|
const dev = mode === 'development';
|
||||||
|
const legacy = !!process.env.SAPPER_LEGACY_BUILD;
|
||||||
|
|
||||||
|
const onwarn = (warning, onwarn) => (warning.code === 'CIRCULAR_DEPENDENCY' && /[/\\]@sapper[/\\]/.test(warning.message)) || onwarn(warning);
|
||||||
|
const dedupe = importee => importee === 'svelte' || importee.startsWith('svelte/');
|
||||||
|
|
||||||
|
export default {
|
||||||
|
client: {
|
||||||
|
input: config.client.input(),
|
||||||
|
output: config.client.output(),
|
||||||
|
plugins: [
|
||||||
|
replace({
|
||||||
|
'process.browser': true,
|
||||||
|
'process.env.NODE_ENV': JSON.stringify(mode)
|
||||||
|
}),
|
||||||
|
svelte({
|
||||||
|
dev,
|
||||||
|
hydratable: true,
|
||||||
|
emitCss: true
|
||||||
|
}),
|
||||||
|
resolve({
|
||||||
|
browser: true,
|
||||||
|
dedupe
|
||||||
|
}),
|
||||||
|
commonjs(),
|
||||||
|
|
||||||
|
legacy && babel({
|
||||||
|
extensions: ['.js', '.mjs', '.html', '.svelte'],
|
||||||
|
runtimeHelpers: true,
|
||||||
|
exclude: ['node_modules/@babel/**'],
|
||||||
|
presets: [
|
||||||
|
['@babel/preset-env', {
|
||||||
|
targets: '> 0.25%, not dead'
|
||||||
|
}]
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
'@babel/plugin-syntax-dynamic-import',
|
||||||
|
['@babel/plugin-transform-runtime', {
|
||||||
|
useESModules: true
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
|
||||||
|
!dev && terser({
|
||||||
|
module: true
|
||||||
|
})
|
||||||
|
],
|
||||||
|
|
||||||
|
onwarn,
|
||||||
|
},
|
||||||
|
|
||||||
|
server: {
|
||||||
|
input: config.server.input(),
|
||||||
|
output: config.server.output(),
|
||||||
|
plugins: [
|
||||||
|
replace({
|
||||||
|
'process.browser': false,
|
||||||
|
'process.env.NODE_ENV': JSON.stringify(mode)
|
||||||
|
}),
|
||||||
|
svelte({
|
||||||
|
generate: 'ssr',
|
||||||
|
dev
|
||||||
|
}),
|
||||||
|
resolve({
|
||||||
|
dedupe
|
||||||
|
}),
|
||||||
|
commonjs()
|
||||||
|
],
|
||||||
|
external: Object.keys(pkg.dependencies).concat(
|
||||||
|
require('module').builtinModules || Object.keys(process.binding('natives'))
|
||||||
|
),
|
||||||
|
|
||||||
|
onwarn,
|
||||||
|
},
|
||||||
|
|
||||||
|
serviceworker: {
|
||||||
|
input: config.serviceworker.input(),
|
||||||
|
output: config.serviceworker.output(),
|
||||||
|
plugins: [
|
||||||
|
resolve(),
|
||||||
|
replace({
|
||||||
|
'process.browser': true,
|
||||||
|
'process.env.NODE_ENV': JSON.stringify(mode)
|
||||||
|
}),
|
||||||
|
commonjs(),
|
||||||
|
!dev && terser()
|
||||||
|
],
|
||||||
|
|
||||||
|
onwarn,
|
||||||
|
}
|
||||||
|
};
|
@ -1,75 +0,0 @@
|
|||||||
const webpack = require('webpack');
|
|
||||||
const config = require('sapper/config/webpack.js');
|
|
||||||
const pkg = require('./package.json');
|
|
||||||
|
|
||||||
const mode = process.env.NODE_ENV;
|
|
||||||
const dev = mode === 'development';
|
|
||||||
|
|
||||||
const extensions = ['.mjs', '.js', '.json', '.svelte', '.html'];
|
|
||||||
const mainFields = ['svelte', 'module', 'browser', 'main'];
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
client: {
|
|
||||||
entry: config.client.entry(),
|
|
||||||
output: config.client.output(),
|
|
||||||
resolve: { extensions, mainFields },
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.(svelte|html)$/,
|
|
||||||
use: {
|
|
||||||
loader: 'svelte-loader',
|
|
||||||
options: {
|
|
||||||
dev,
|
|
||||||
hydratable: true,
|
|
||||||
hotReload: false // pending https://github.com/sveltejs/svelte/issues/2377
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
mode,
|
|
||||||
plugins: [
|
|
||||||
// pending https://github.com/sveltejs/svelte/issues/2377
|
|
||||||
// dev && new webpack.HotModuleReplacementPlugin(),
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
'process.browser': true,
|
|
||||||
'process.env.NODE_ENV': JSON.stringify(mode)
|
|
||||||
}),
|
|
||||||
].filter(Boolean),
|
|
||||||
devtool: dev && 'inline-source-map'
|
|
||||||
},
|
|
||||||
|
|
||||||
server: {
|
|
||||||
entry: config.server.entry(),
|
|
||||||
output: config.server.output(),
|
|
||||||
target: 'node',
|
|
||||||
resolve: { extensions, mainFields },
|
|
||||||
externals: Object.keys(pkg.dependencies).concat('encoding'),
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.(svelte|html)$/,
|
|
||||||
use: {
|
|
||||||
loader: 'svelte-loader',
|
|
||||||
options: {
|
|
||||||
css: false,
|
|
||||||
generate: 'ssr',
|
|
||||||
dev
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
mode: process.env.NODE_ENV,
|
|
||||||
performance: {
|
|
||||||
hints: false // it doesn't matter if server.js is large
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
serviceworker: {
|
|
||||||
entry: config.serviceworker.entry(),
|
|
||||||
output: config.serviceworker.output(),
|
|
||||||
mode: process.env.NODE_ENV
|
|
||||||
}
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user