From 66e1b63df33faddbb3c8ac37f9410fb409396a81 Mon Sep 17 00:00:00 2001 From: Zach Hammer Date: Sun, 12 Dec 2021 00:47:36 -0500 Subject: [PATCH] switch to netlify adapter (#32) * update deps * update server const * add router/hydrate consts * try to set up netlify adapter * remove adapter-static * try prerendering pieces * add netlify.toml * try fixing func issue https://github.com/sveltejs/kit/issues/2687#issuecomment-951188975 * Revert "try fixing func issue" This reverts commit 47346d9b0c2972448b28a1a918efdb0726ca603b. nvm, going to do this https://github.com/sveltejs/kit/issues/2687#issuecomment-952153011 * add netlify local dev command * methinks this will work, just manually copy over stuff * try including files in functions * don't need to copy anymore * use old node compatible replaceAll * disable client side router globally why isn't this working? --- .github/workflows/main.yml | 6 +- netlify.toml | 6 + package.json | 102 ++++++------ src/components/Directory.svelte | 5 +- src/components/Piece.svelte | 5 + src/routes/_pieces.ts | 18 ++- svelte.config.js | 5 +- yarn.lock | 267 +++++++++++++++++++++----------- 8 files changed, 267 insertions(+), 147 deletions(-) create mode 100644 netlify.toml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7d28210..efe4169 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,15 +23,15 @@ jobs: - uses: actions/setup-node@v2 with: - node-version: '16' + node-version: "16" # Runs a single command using the runners shell - name: cypress uses: cypress-io/github-action@v2 with: record: true - build: yarn export - start: yarn serve -l 3000 build/ + build: yarn build + start: yarn preview browser: electron env: CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 0000000..fe8a766 --- /dev/null +++ b/netlify.toml @@ -0,0 +1,6 @@ +[build] + command = "yarn build" + publish = "build" + +[functions] + included_files = ["pieces/**"] \ No newline at end of file diff --git a/package.json b/package.json index 92b3f51..d5ed9ab 100644 --- a/package.json +++ b/package.json @@ -1,51 +1,53 @@ { - "name": "writing", - "description": "zach's writing", - "version": "0.0.1", - "type": "module", - "scripts": { - "dev": "svelte-kit dev", - "export": "svelte-kit build", - "start": "node build", - "validate": "svelte-check", - "new": "node scripts/newPiece.js" - }, - "cypress-cucumber-preprocessor": { - "nonGlobalStepDefinitions": true - }, - "dependencies": { - "directory-tree": "^2.2.5", - "yaml": "^1.10.0" - }, - "devDependencies": { - "@babel/core": "^7.0.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/plugin-babel": "^5.0.0", - "@rollup/plugin-commonjs": "^14.0.0", - "@rollup/plugin-node-resolve": "^8.0.0", - "@rollup/plugin-replace": "^2.2.0", - "@rollup/plugin-typescript": "^6.0.0", - "@sveltejs/adapter-static": "^1.0.0-next.21", - "@sveltejs/kit": "^1.0.0-next.196", - "@tsconfig/svelte": "^2.0.1", - "@types/compression": "^1.7.0", - "@types/node": "^14.11.1", - "@types/polka": "^0.5.1", - "cypress": "^9.0.0", - "cypress-cucumber-preprocessor": "^4.3.0", - "node-fetch": "^3.1.0", - "rollup": "^2.3.4", - "rollup-plugin-svelte": "^6.0.0", - "rollup-plugin-terser": "^7.0.0", - "serve": "^13.0.2", - "svelte": "^3.44.2", - "svelte-check": "^2.2.4", - "svelte-preprocess": "^4.7.4", - "tslib": "^2.0.1", - "typescript": "^4.0.3", - "vite": "^2.3.7" - } -} + "name": "writing", + "description": "zach's writing", + "version": "0.0.1", + "type": "module", + "scripts": { + "dev": "svelte-kit dev", + "build": "svelte-kit build", + "preview": "svelte-kit preview", + "netlify": "netlify dev -d build/ -f ./netlify/functions-internal", + "start": "node build", + "validate": "svelte-check", + "new": "node scripts/newPiece.js" + }, + "cypress-cucumber-preprocessor": { + "nonGlobalStepDefinitions": true + }, + "dependencies": { + "@sveltejs/adapter-netlify": "^1.0.0-next.35", + "directory-tree": "^2.2.5", + "yaml": "^1.10.0" + }, + "devDependencies": { + "@babel/core": "^7.0.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/plugin-babel": "^5.0.0", + "@rollup/plugin-commonjs": "^14.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "@rollup/plugin-replace": "^2.2.0", + "@rollup/plugin-typescript": "^6.0.0", + "@sveltejs/kit": "^1.0.0-next.201", + "@tsconfig/svelte": "^2.0.1", + "@types/compression": "^1.7.0", + "@types/node": "^14.11.1", + "@types/polka": "^0.5.1", + "cypress": "^9.0.0", + "cypress-cucumber-preprocessor": "^4.3.0", + "node-fetch": "^3.1.0", + "rollup": "^2.61.1", + "rollup-plugin-svelte": "^7.1.0", + "rollup-plugin-terser": "^7.0.0", + "serve": "^13.0.2", + "svelte": "^3.44.2", + "svelte-check": "^2.2.10", + "svelte-preprocess": "^4.9.8", + "tslib": "^2.0.1", + "typescript": "^4.0.3", + "vite": "^2.7.1" + } +} \ No newline at end of file diff --git a/src/components/Directory.svelte b/src/components/Directory.svelte index b6383ce..12fa8c1 100644 --- a/src/components/Directory.svelte +++ b/src/components/Directory.svelte @@ -1,4 +1,7 @@ +