From 54fadca4838d94e35d1a6ea8018f96dea09742f5 Mon Sep 17 00:00:00 2001 From: "Fred K. Schott" Date: Tue, 29 Sep 2020 13:31:22 -0700 Subject: [PATCH] CSA - move config back into templates, out of app-scripts-* packages (#1137) * update templates to stop using app-scripts for snowpack, babel, tsc config * Update package.json --- .../package.json | 4 +- .../snowpack.config.js | 14 ++++++ .../snowpack.config.json | 4 -- .../tsconfig.json | 35 ++++++++------ .../app-template-lit-element/package.json | 3 +- .../snowpack.config.js | 7 +++ .../snowpack.config.json | 4 -- .../app-template-preact/babel.config.json | 22 ++++++++- .../app-template-preact/package.json | 7 +++ .../app-template-preact/snowpack.config.js | 11 +++++ .../app-template-preact/snowpack.config.json | 4 -- .../babel.config.json | 8 +++- .../package.json | 8 +++- .../snowpack.config.js | 12 +++++ .../snowpack.config.json | 4 -- .../tsconfig.json | 27 ++++++----- .../app-template-react/babel.config.json | 8 +++- .../app-template-react/package.json | 5 ++ .../app-template-react/snowpack.config.js | 11 +++++ .../app-template-react/snowpack.config.json | 4 -- .../package.json | 4 +- .../snowpack.config.js | 15 ++++++ .../snowpack.config.json | 23 --------- .../tsconfig.json | 47 ++++++++----------- .../app-template-svelte/package.json | 3 ++ .../app-template-svelte/snowpack.config.js | 14 ++++++ .../app-template-svelte/snowpack.config.json | 4 -- .../app-template-vue-typescript/package.json | 2 +- .../snowpack.config.js | 11 +++++ .../snowpack.config.json | 4 -- .../app-template-vue-typescript/tsconfig.json | 27 ++++++----- .../app-template-vue/package.json | 3 +- .../app-template-vue/snowpack.config.js | 7 +++ .../app-template-vue/snowpack.config.json | 4 -- .../create-snowpack-app.test.js | 4 +- yarn.lock | 2 +- 36 files changed, 245 insertions(+), 131 deletions(-) create mode 100644 create-snowpack-app/app-template-lit-element-typescript/snowpack.config.js delete mode 100644 create-snowpack-app/app-template-lit-element-typescript/snowpack.config.json create mode 100644 create-snowpack-app/app-template-lit-element/snowpack.config.js delete mode 100644 create-snowpack-app/app-template-lit-element/snowpack.config.json create mode 100644 create-snowpack-app/app-template-preact/snowpack.config.js delete mode 100644 create-snowpack-app/app-template-preact/snowpack.config.json create mode 100644 create-snowpack-app/app-template-react-typescript/snowpack.config.js delete mode 100644 create-snowpack-app/app-template-react-typescript/snowpack.config.json create mode 100644 create-snowpack-app/app-template-react/snowpack.config.js delete mode 100644 create-snowpack-app/app-template-react/snowpack.config.json create mode 100644 create-snowpack-app/app-template-svelte-typescript/snowpack.config.js delete mode 100644 create-snowpack-app/app-template-svelte-typescript/snowpack.config.json create mode 100644 create-snowpack-app/app-template-svelte/snowpack.config.js delete mode 100644 create-snowpack-app/app-template-svelte/snowpack.config.json create mode 100644 create-snowpack-app/app-template-vue-typescript/snowpack.config.js delete mode 100644 create-snowpack-app/app-template-vue-typescript/snowpack.config.json create mode 100644 create-snowpack-app/app-template-vue/snowpack.config.js delete mode 100644 create-snowpack-app/app-template-vue/snowpack.config.json diff --git a/create-snowpack-app/app-template-lit-element-typescript/package.json b/create-snowpack-app/app-template-lit-element-typescript/package.json index 61ff18ad3e..2ef011367a 100644 --- a/create-snowpack-app/app-template-lit-element-typescript/package.json +++ b/create-snowpack-app/app-template-lit-element-typescript/package.json @@ -23,7 +23,9 @@ "@babel/plugin-proposal-class-properties": "^7.10.4", "@babel/plugin-proposal-decorators": "^7.10.5", "@babel/preset-typescript": "^7.10.4", - "@snowpack/app-scripts-lit-element": "^1.8.5", + "@snowpack/plugin-babel": "^2.1.0", + "@snowpack/plugin-dotenv": "^2.0.1", + "@snowpack/plugin-run-script": "^2.1.2", "@types/snowpack-env": "^2.3.0", "prettier": "^2.0.5", "snowpack": "^2.12.1", diff --git a/create-snowpack-app/app-template-lit-element-typescript/snowpack.config.js b/create-snowpack-app/app-template-lit-element-typescript/snowpack.config.js new file mode 100644 index 0000000000..16f03532c1 --- /dev/null +++ b/create-snowpack-app/app-template-lit-element-typescript/snowpack.config.js @@ -0,0 +1,14 @@ +module.exports = { + mount: { + public: '/', + src: '/_dist_', + }, + plugins: [ + '@snowpack/plugin-babel', + '@snowpack/plugin-dotenv', + [ + '@snowpack/plugin-run-script', + { cmd: 'tsc --noEmit', watch: '$1 --watch' }, + ], + ], +}; diff --git a/create-snowpack-app/app-template-lit-element-typescript/snowpack.config.json b/create-snowpack-app/app-template-lit-element-typescript/snowpack.config.json deleted file mode 100644 index 6355495514..0000000000 --- a/create-snowpack-app/app-template-lit-element-typescript/snowpack.config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "@snowpack/app-scripts-lit-element", - "plugins": [] -} diff --git a/create-snowpack-app/app-template-lit-element-typescript/tsconfig.json b/create-snowpack-app/app-template-lit-element-typescript/tsconfig.json index 18680c10ef..70b2e531fd 100644 --- a/create-snowpack-app/app-template-lit-element-typescript/tsconfig.json +++ b/create-snowpack-app/app-template-lit-element-typescript/tsconfig.json @@ -1,20 +1,25 @@ { - "extends": "@snowpack/app-scripts-lit-element/tsconfig.base.json", "include": ["src", "types"], "exclude": ["node_modules"], "compilerOptions": { - // LitElement makes use of experimental decorator syntax. - "experimentalDecorators": true, - "emitDecoratorMetadata": true, - // You can't currently define paths in your 'extends' config, - // so we have to set 'baseUrl' & 'paths' here. - // Don't change these unless you know what you're doing. - // See: https://github.com/microsoft/TypeScript/issues/25430 - "baseUrl": "./", - /* more strict checking for errors that per-file transpilers like `esbuild` would crash */ - "isolatedModules": true, - "paths": { "*": ["web_modules/.types/*"] } - // Feel free to add/edit new config options below: - // ... + "module": "esnext", + "target": "esnext", + "moduleResolution": "node", + "jsx": "preserve", + "baseUrl": "./", + /* paths - If you configure Snowpack import aliases, add them here. */ + "paths": {}, + /* noEmit - Snowpack builds (emits) files, not tsc. */ + "noEmit": true, + /* LitElement - Add decorator support! */ + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + /* Additional Options */ + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true, + "importsNotUsedAsValues": "error", } -} +} \ No newline at end of file diff --git a/create-snowpack-app/app-template-lit-element/package.json b/create-snowpack-app/app-template-lit-element/package.json index dfd6e67662..ff633ab6a4 100644 --- a/create-snowpack-app/app-template-lit-element/package.json +++ b/create-snowpack-app/app-template-lit-element/package.json @@ -22,7 +22,8 @@ "devDependencies": { "@babel/plugin-proposal-class-properties": "^7.10.4", "@babel/plugin-proposal-decorators": "^7.10.5", - "@snowpack/app-scripts-lit-element": "^1.8.5", + "@snowpack/plugin-babel": "^2.1.0", + "@snowpack/plugin-dotenv": "^2.0.1", "prettier": "^2.0.5", "snowpack": "^2.12.1" }, diff --git a/create-snowpack-app/app-template-lit-element/snowpack.config.js b/create-snowpack-app/app-template-lit-element/snowpack.config.js new file mode 100644 index 0000000000..e208c2078b --- /dev/null +++ b/create-snowpack-app/app-template-lit-element/snowpack.config.js @@ -0,0 +1,7 @@ +module.exports = { + mount: { + public: '/', + src: '/_dist_', + }, + plugins: ['@snowpack/plugin-babel', '@snowpack/plugin-dotenv'], +}; diff --git a/create-snowpack-app/app-template-lit-element/snowpack.config.json b/create-snowpack-app/app-template-lit-element/snowpack.config.json deleted file mode 100644 index 6355495514..0000000000 --- a/create-snowpack-app/app-template-lit-element/snowpack.config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "@snowpack/app-scripts-lit-element", - "plugins": [] -} diff --git a/create-snowpack-app/app-template-preact/babel.config.json b/create-snowpack-app/app-template-preact/babel.config.json index 7bf55aaf58..7df1c81db5 100644 --- a/create-snowpack-app/app-template-preact/babel.config.json +++ b/create-snowpack-app/app-template-preact/babel.config.json @@ -1,3 +1,23 @@ { - "extends": "@snowpack/app-scripts-preact/babel.config.json" + "presets": [ + [ + "@babel/preset-react", + { + "pragma": "h", + "pragmaFrag": "Fragment" + } + ], + [ + "@babel/preset-typescript", + { + "jsxPragma": "h" + } + ] + ], + "plugins": ["@babel/plugin-syntax-import-meta"], + "env": { + "development": { + "plugins": ["@prefresh/babel-plugin"] + } + } } diff --git a/create-snowpack-app/app-template-preact/package.json b/create-snowpack-app/app-template-preact/package.json index 2f4e0bdea1..2cf879128c 100644 --- a/create-snowpack-app/app-template-preact/package.json +++ b/create-snowpack-app/app-template-preact/package.json @@ -19,6 +19,13 @@ "preact": "^10.4.6" }, "devDependencies": { + "@babel/plugin-syntax-import-meta": "^7.10.4", + "@babel/preset-env": "^7.10.4", + "@babel/preset-react": "^7.10.4", + "@prefresh/babel-plugin": "^0.1.0", + "@prefresh/snowpack": "~1.1.1", + "@snowpack/plugin-babel": "^2.1.0", + "@snowpack/plugin-dotenv": "^2.0.1", "@snowpack/app-scripts-preact": "^1.9.0", "@testing-library/jest-dom": "^5.5.0", "@testing-library/preact": "^1.0.2", diff --git a/create-snowpack-app/app-template-preact/snowpack.config.js b/create-snowpack-app/app-template-preact/snowpack.config.js new file mode 100644 index 0000000000..0596dd60d9 --- /dev/null +++ b/create-snowpack-app/app-template-preact/snowpack.config.js @@ -0,0 +1,11 @@ +module.exports = { + mount: { + public: '/', + src: '/_dist_', + }, + plugins: [ + '@snowpack/plugin-babel', + '@snowpack/plugin-dotenv', + '@prefresh/snowpack', + ], +}; diff --git a/create-snowpack-app/app-template-preact/snowpack.config.json b/create-snowpack-app/app-template-preact/snowpack.config.json deleted file mode 100644 index 189154a34a..0000000000 --- a/create-snowpack-app/app-template-preact/snowpack.config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "@snowpack/app-scripts-preact", - "plugins": [] -} diff --git a/create-snowpack-app/app-template-react-typescript/babel.config.json b/create-snowpack-app/app-template-react-typescript/babel.config.json index 9357351e1a..cf74e349cf 100644 --- a/create-snowpack-app/app-template-react-typescript/babel.config.json +++ b/create-snowpack-app/app-template-react-typescript/babel.config.json @@ -1,3 +1,9 @@ { - "extends": "@snowpack/app-scripts-react/babel.config.json" + "presets": [["@babel/preset-react"], "@babel/preset-typescript"], + "plugins": ["@babel/plugin-syntax-import-meta"], + "env": { + "development": { + "plugins": ["react-refresh/babel"] + } + } } diff --git a/create-snowpack-app/app-template-react-typescript/package.json b/create-snowpack-app/app-template-react-typescript/package.json index 83bd15f95c..b406ba491d 100644 --- a/create-snowpack-app/app-template-react-typescript/package.json +++ b/create-snowpack-app/app-template-react-typescript/package.json @@ -20,10 +20,16 @@ "react-dom": "^16.13.1" }, "devDependencies": { + "@babel/plugin-syntax-import-meta": "^7.10.4", + "@babel/preset-react": "^7.10.4", + "@babel/preset-typescript": "^7.10.4", "@snowpack/app-scripts-react": "^1.11.0", + "@snowpack/plugin-babel": "^2.1.0", + "@snowpack/plugin-dotenv": "^2.0.1", + "@snowpack/plugin-react-refresh": "^2.1.0", "@testing-library/jest-dom": "^5.5.0", "@testing-library/react": "^10.0.3", - "@types/react": "^16.9.35", + "@types/react": "^16.9.49", "@types/react-dom": "^16.9.8", "@types/snowpack-env": "^2.3.0", "jest": "^26.2.2", diff --git a/create-snowpack-app/app-template-react-typescript/snowpack.config.js b/create-snowpack-app/app-template-react-typescript/snowpack.config.js new file mode 100644 index 0000000000..f64968ed5b --- /dev/null +++ b/create-snowpack-app/app-template-react-typescript/snowpack.config.js @@ -0,0 +1,12 @@ +module.exports = { + mount: { + public: '/', + src: '/_dist_', + }, + plugins: [ + '@snowpack/plugin-react-refresh', + '@snowpack/plugin-babel', + '@snowpack/plugin-dotenv', + ['@snowpack/plugin-run-script', {cmd: 'tsc --noEmit', watch: '$1 --watch'}], + ], +}; diff --git a/create-snowpack-app/app-template-react-typescript/snowpack.config.json b/create-snowpack-app/app-template-react-typescript/snowpack.config.json deleted file mode 100644 index 5c25d9b27f..0000000000 --- a/create-snowpack-app/app-template-react-typescript/snowpack.config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "@snowpack/app-scripts-react", - "plugins": [] -} diff --git a/create-snowpack-app/app-template-react-typescript/tsconfig.json b/create-snowpack-app/app-template-react-typescript/tsconfig.json index c74fe8f0cf..d0e3f0b6fb 100644 --- a/create-snowpack-app/app-template-react-typescript/tsconfig.json +++ b/create-snowpack-app/app-template-react-typescript/tsconfig.json @@ -1,17 +1,22 @@ { "include": ["src", "types"], "exclude": ["node_modules"], - "extends": "@snowpack/app-scripts-react/tsconfig.base.json", "compilerOptions": { - // You can't currently define paths in your 'extends' config, - // so we have to set 'baseUrl' & 'paths' here. - // Don't change these unless you know what you're doing. - // See: https://github.com/microsoft/TypeScript/issues/25430 - "baseUrl": "./", - /* more strict checking for errors that per-file transpilers like `esbuild` would crash */ - "isolatedModules": true, - "paths": { "*": ["web_modules/.types/*"] } - // Feel free to add/edit new config options below: - // ... + "module": "esnext", + "target": "esnext", + "moduleResolution": "node", + "jsx": "preserve", + "baseUrl": "./", + /* paths - If you configure Snowpack import aliases, add them here. */ + "paths": {}, + /* noEmit - Snowpack builds (emits) files, not tsc. */ + "noEmit": true, + /* Additional Options */ + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true, + "importsNotUsedAsValues": "error", } } diff --git a/create-snowpack-app/app-template-react/babel.config.json b/create-snowpack-app/app-template-react/babel.config.json index 9357351e1a..9da0beca23 100644 --- a/create-snowpack-app/app-template-react/babel.config.json +++ b/create-snowpack-app/app-template-react/babel.config.json @@ -1,3 +1,9 @@ { - "extends": "@snowpack/app-scripts-react/babel.config.json" + "presets": [["@babel/preset-react"]], + "plugins": ["@babel/plugin-syntax-import-meta"], + "env": { + "development": { + "plugins": ["react-refresh/babel"] + } + } } diff --git a/create-snowpack-app/app-template-react/package.json b/create-snowpack-app/app-template-react/package.json index 0402ae89fa..d615328a77 100644 --- a/create-snowpack-app/app-template-react/package.json +++ b/create-snowpack-app/app-template-react/package.json @@ -20,7 +20,12 @@ "react-dom": "^16.13.1" }, "devDependencies": { + "@babel/plugin-syntax-import-meta": "^7.10.4", + "@babel/preset-react": "^7.10.4", "@snowpack/app-scripts-react": "^1.11.0", + "@snowpack/plugin-babel": "^2.1.0", + "@snowpack/plugin-dotenv": "^2.0.1", + "@snowpack/plugin-react-refresh": "^2.1.0", "@testing-library/jest-dom": "^5.5.0", "@testing-library/react": "^10.0.3", "jest": "^26.2.2", diff --git a/create-snowpack-app/app-template-react/snowpack.config.js b/create-snowpack-app/app-template-react/snowpack.config.js new file mode 100644 index 0000000000..77deed545c --- /dev/null +++ b/create-snowpack-app/app-template-react/snowpack.config.js @@ -0,0 +1,11 @@ +module.exports = { + mount: { + public: '/', + src: '/_dist_', + }, + plugins: [ + '@snowpack/plugin-react-refresh', + '@snowpack/plugin-babel', + '@snowpack/plugin-dotenv', + ], +}; diff --git a/create-snowpack-app/app-template-react/snowpack.config.json b/create-snowpack-app/app-template-react/snowpack.config.json deleted file mode 100644 index 5c25d9b27f..0000000000 --- a/create-snowpack-app/app-template-react/snowpack.config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "@snowpack/app-scripts-react", - "plugins": [] -} diff --git a/create-snowpack-app/app-template-svelte-typescript/package.json b/create-snowpack-app/app-template-svelte-typescript/package.json index 628746fad5..6b687e01c4 100644 --- a/create-snowpack-app/app-template-svelte-typescript/package.json +++ b/create-snowpack-app/app-template-svelte-typescript/package.json @@ -17,8 +17,10 @@ "svelte": "^3.24.0" }, "devDependencies": { - "@snowpack/app-scripts-svelte": "^1.8.5", + "@snowpack/plugin-dotenv": "^2.0.1", "@snowpack/plugin-run-script": "^2.1.3", + "@snowpack/plugin-svelte": "^2.0.4", + "@snowpack/app-scripts-svelte": "^1.8.5", "@testing-library/jest-dom": "^5.5.0", "@testing-library/svelte": "^3.0.0", "@tsconfig/svelte": "^1.0.3", diff --git a/create-snowpack-app/app-template-svelte-typescript/snowpack.config.js b/create-snowpack-app/app-template-svelte-typescript/snowpack.config.js new file mode 100644 index 0000000000..be4ac4148a --- /dev/null +++ b/create-snowpack-app/app-template-svelte-typescript/snowpack.config.js @@ -0,0 +1,15 @@ +module.exports = { + mount: { + public: '/', + src: '/_dist_', + }, + plugins: [ + '@snowpack/plugin-svelte', + '@snowpack/plugin-dotenv', + [ + '@snowpack/plugin-run-script', + {cmd: 'svelte-check --output human', watch: '$1 --watch', output: 'stream'}, + ], + ['@snowpack/plugin-run-script', {cmd: 'tsc --noEmit', watch: '$1 --watch'}], + ], +}; diff --git a/create-snowpack-app/app-template-svelte-typescript/snowpack.config.json b/create-snowpack-app/app-template-svelte-typescript/snowpack.config.json deleted file mode 100644 index bd5e112224..0000000000 --- a/create-snowpack-app/app-template-svelte-typescript/snowpack.config.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "extends": "@snowpack/app-scripts-svelte", - "mount": { - "public": "/", - "src": "/_dist_" - }, - "plugins": [ - [ - "@snowpack/plugin-run-script", - { - "cmd": "tsc --noEmit", - "watch": "$1 --watch" - } - ], - [ - "@snowpack/plugin-run-script", - {"cmd": "svelte-check --output human", "watch": "$1 --watch", "output": "stream"} - ] - ], - "installOptions": { - "installTypes": true - } -} diff --git a/create-snowpack-app/app-template-svelte-typescript/tsconfig.json b/create-snowpack-app/app-template-svelte-typescript/tsconfig.json index 3bfe5a4590..b2b1f67d41 100644 --- a/create-snowpack-app/app-template-svelte-typescript/tsconfig.json +++ b/create-snowpack-app/app-template-svelte-typescript/tsconfig.json @@ -1,30 +1,23 @@ { - "extends": "@tsconfig/svelte/tsconfig.json", - "compilerOptions": { - "module": "esnext", - "target": "esnext", - "jsx": "preserve", - "allowSyntheticDefaultImports": true, - /* more strict checking for errors that per-file transpilers like `esbuild` would crash */ - "isolatedModules": true, - /* noEmit - We only use TypeScript for type checking. */ - "noEmit": true, - /* Additional Options */ - "strict": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "resolveJsonModule": true, - "useDefineForClassFields": true, - - // You can't currently define paths in your 'extends' config, - // so we have to set 'baseUrl' & 'paths' here. - // Don't change these unless you know what you're doing. - // See: https://github.com/microsoft/TypeScript/issues/25430 - "baseUrl": "./", - "paths": {"*": ["web_modules/.types/*"]}, - - "types": ["snowpack-env", "svelte", "jest", "@testing-library/jest-dom"] - }, "include": ["src", "types"], - "exclude": ["node_modules"] + "exclude": ["node_modules"], + "compilerOptions": { + "module": "esnext", + "target": "esnext", + "moduleResolution": "node", + "jsx": "preserve", + "baseUrl": "./", + /* paths - If you configure Snowpack import aliases, add them here. */ + "paths": {}, + /* noEmit - Snowpack builds (emits) files, not tsc. */ + "noEmit": true, + /* Additional Options */ + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "useDefineForClassFields": true, + "allowSyntheticDefaultImports": true, + "importsNotUsedAsValues": "error", + } } diff --git a/create-snowpack-app/app-template-svelte/package.json b/create-snowpack-app/app-template-svelte/package.json index 045be03daa..1208aef791 100644 --- a/create-snowpack-app/app-template-svelte/package.json +++ b/create-snowpack-app/app-template-svelte/package.json @@ -17,6 +17,9 @@ "svelte": "^3.24.0" }, "devDependencies": { + "@snowpack/plugin-dotenv": "^2.0.1", + "@snowpack/plugin-run-script": "^2.1.2", + "@snowpack/plugin-svelte": "^2.0.4", "@snowpack/app-scripts-svelte": "^1.8.5", "@testing-library/jest-dom": "^5.5.0", "@testing-library/svelte": "^3.0.0", diff --git a/create-snowpack-app/app-template-svelte/snowpack.config.js b/create-snowpack-app/app-template-svelte/snowpack.config.js new file mode 100644 index 0000000000..bb6431521b --- /dev/null +++ b/create-snowpack-app/app-template-svelte/snowpack.config.js @@ -0,0 +1,14 @@ +module.exports = { + mount: { + public: '/', + src: '/_dist_', + }, + plugins: [ + '@snowpack/plugin-svelte', + '@snowpack/plugin-dotenv', + [ + '@snowpack/plugin-run-script', + {cmd: 'svelte-check --output human', watch: '$1 --watch', output: 'stream'}, + ], + ], +}; diff --git a/create-snowpack-app/app-template-svelte/snowpack.config.json b/create-snowpack-app/app-template-svelte/snowpack.config.json deleted file mode 100644 index c40a4ee4ca..0000000000 --- a/create-snowpack-app/app-template-svelte/snowpack.config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "@snowpack/app-scripts-svelte", - "plugins": [] -} diff --git a/create-snowpack-app/app-template-vue-typescript/package.json b/create-snowpack-app/app-template-vue-typescript/package.json index 15a6e2f3d4..83837159e9 100644 --- a/create-snowpack-app/app-template-vue-typescript/package.json +++ b/create-snowpack-app/app-template-vue-typescript/package.json @@ -18,7 +18,7 @@ "vue": "^3.0.0" }, "devDependencies": { - "@snowpack/app-scripts-vue": "^1.8.6", + "@snowpack/plugin-dotenv": "^2.0.1", "@snowpack/plugin-vue": "^2.2.1", "snowpack": "^2.12.1", "typescript": "^4.0.2" diff --git a/create-snowpack-app/app-template-vue-typescript/snowpack.config.js b/create-snowpack-app/app-template-vue-typescript/snowpack.config.js new file mode 100644 index 0000000000..bb884ed669 --- /dev/null +++ b/create-snowpack-app/app-template-vue-typescript/snowpack.config.js @@ -0,0 +1,11 @@ +module.exports = { + mount: { + public: '/', + src: '/_dist_', + }, + plugins: [ + '@snowpack/plugin-vue', + '@snowpack/plugin-vue/plugin-tsx-jsx.js', + '@snowpack/plugin-dotenv', + ], +}; diff --git a/create-snowpack-app/app-template-vue-typescript/snowpack.config.json b/create-snowpack-app/app-template-vue-typescript/snowpack.config.json deleted file mode 100644 index a8a1420122..0000000000 --- a/create-snowpack-app/app-template-vue-typescript/snowpack.config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "@snowpack/app-scripts-vue", - "plugins": ["@snowpack/plugin-vue/plugin-tsx-jsx.js"] -} diff --git a/create-snowpack-app/app-template-vue-typescript/tsconfig.json b/create-snowpack-app/app-template-vue-typescript/tsconfig.json index 72be6aed87..d0e3f0b6fb 100644 --- a/create-snowpack-app/app-template-vue-typescript/tsconfig.json +++ b/create-snowpack-app/app-template-vue-typescript/tsconfig.json @@ -1,17 +1,22 @@ { "include": ["src", "types"], "exclude": ["node_modules"], - "extends": "@snowpack/app-scripts-vue/tsconfig.base.json", "compilerOptions": { - // You can't currently define paths in your 'extends' config, - // so we have to set 'baseUrl' & 'paths' here. - // Don't change these unless you know what you're doing. - // See: https://github.com/microsoft/TypeScript/issues/25430 - "baseUrl": "./", - /* more strict checking for errors that per-file transpilers like `esbuild` would crash */ - "isolatedModules": true, - "paths": {"*": ["web_modules/.types/*"]} - // Feel free to add/edit new config options below: - // ... + "module": "esnext", + "target": "esnext", + "moduleResolution": "node", + "jsx": "preserve", + "baseUrl": "./", + /* paths - If you configure Snowpack import aliases, add them here. */ + "paths": {}, + /* noEmit - Snowpack builds (emits) files, not tsc. */ + "noEmit": true, + /* Additional Options */ + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true, + "importsNotUsedAsValues": "error", } } diff --git a/create-snowpack-app/app-template-vue/package.json b/create-snowpack-app/app-template-vue/package.json index 3322fa1687..18bb3bfaf3 100644 --- a/create-snowpack-app/app-template-vue/package.json +++ b/create-snowpack-app/app-template-vue/package.json @@ -17,7 +17,8 @@ "vue": "3.0.0" }, "devDependencies": { - "@snowpack/app-scripts-vue": "^1.8.6", + "@snowpack/plugin-dotenv": "^2.0.1", + "@snowpack/plugin-vue": "^2.2.0", "snowpack": "^2.12.1" }, "gitHead": "a01616bb0787d56cd782f94cecf2daa12c7594e4" diff --git a/create-snowpack-app/app-template-vue/snowpack.config.js b/create-snowpack-app/app-template-vue/snowpack.config.js new file mode 100644 index 0000000000..e26bef8715 --- /dev/null +++ b/create-snowpack-app/app-template-vue/snowpack.config.js @@ -0,0 +1,7 @@ +module.exports = { + mount: { + public: '/', + src: '/_dist_', + }, + plugins: ['@snowpack/plugin-vue', '@snowpack/plugin-dotenv'], +}; diff --git a/create-snowpack-app/app-template-vue/snowpack.config.json b/create-snowpack-app/app-template-vue/snowpack.config.json deleted file mode 100644 index ff24bed8ac..0000000000 --- a/create-snowpack-app/app-template-vue/snowpack.config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "@snowpack/app-scripts-vue", - "plugins": [] -} diff --git a/test/create-snowpack-app/create-snowpack-app.test.js b/test/create-snowpack-app/create-snowpack-app.test.js index cffff9d726..71413d3d14 100644 --- a/test/create-snowpack-app/create-snowpack-app.test.js +++ b/test/create-snowpack-app/create-snowpack-app.test.js @@ -36,7 +36,7 @@ describe('create-snowpack-app', () => { // snowpack.config.json is a file we can test for to assume successful // install, since it’s added at the end. - const snowpackConfigExists = fs.existsSync(path.join(installDir, 'snowpack.config.json')); + const snowpackConfigExists = fs.existsSync(path.join(installDir, 'snowpack.config.json')) || fs.existsSync(path.join(installDir, 'snowpack.config.js')); expect(snowpackConfigExists).toBe(true); // install node_modules by default @@ -67,7 +67,7 @@ describe('create-snowpack-app', () => { // snowpack.config.json is a file we can test for to assume successful // install, since it’s added at the end. - const snowpackConfigExists = fs.existsSync(path.join(installDir, 'snowpack.config.json')); + const snowpackConfigExists = fs.existsSync(path.join(installDir, 'snowpack.config.json')) || fs.existsSync(path.join(installDir, 'snowpack.config.js')); expect(snowpackConfigExists).toBe(true); // install node_modules by default diff --git a/yarn.lock b/yarn.lock index 2a706e3f2f..eff8ae91dd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2892,7 +2892,7 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@^16.9.35": +"@types/react@*", "@types/react@^16.9.49": version "16.9.49" resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.49.tgz#09db021cf8089aba0cdb12a49f8021a69cce4872" integrity sha512-DtLFjSj0OYAdVLBbyjhuV9CdGVHCkHn2R+xr3XkBvK2rS1Y1tkc14XSGjYgm5Fjjr90AxH9tiSzc1pCFMGO06g==