Skip to content

Commit

Permalink
CSA - move config back into templates, out of app-scripts-* packages (#…
Browse files Browse the repository at this point in the history
…1137)

* update templates to stop using app-scripts for snowpack, babel, tsc config

* Update package.json
  • Loading branch information
FredKSchott committed Sep 29, 2020
1 parent df59d47 commit 54fadca
Show file tree
Hide file tree
Showing 36 changed files with 245 additions and 131 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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' },
],
],
};

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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",
}
}
}
3 changes: 2 additions & 1 deletion create-snowpack-app/app-template-lit-element/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
mount: {
public: '/',
src: '/_dist_',
},
plugins: ['@snowpack/plugin-babel', '@snowpack/plugin-dotenv'],
};

This file was deleted.

22 changes: 21 additions & 1 deletion create-snowpack-app/app-template-preact/babel.config.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}
}
7 changes: 7 additions & 0 deletions create-snowpack-app/app-template-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 11 additions & 0 deletions create-snowpack-app/app-template-preact/snowpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
mount: {
public: '/',
src: '/_dist_',
},
plugins: [
'@snowpack/plugin-babel',
'@snowpack/plugin-dotenv',
'@prefresh/snowpack',
],
};
4 changes: 0 additions & 4 deletions create-snowpack-app/app-template-preact/snowpack.config.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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"]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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'}],
],
};

This file was deleted.

27 changes: 16 additions & 11 deletions create-snowpack-app/app-template-react-typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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",
}
}
8 changes: 7 additions & 1 deletion create-snowpack-app/app-template-react/babel.config.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}
}
5 changes: 5 additions & 0 deletions create-snowpack-app/app-template-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 11 additions & 0 deletions create-snowpack-app/app-template-react/snowpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
mount: {
public: '/',
src: '/_dist_',
},
plugins: [
'@snowpack/plugin-react-refresh',
'@snowpack/plugin-babel',
'@snowpack/plugin-dotenv',
],
};
4 changes: 0 additions & 4 deletions create-snowpack-app/app-template-react/snowpack.config.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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'}],
],
};

This file was deleted.

47 changes: 20 additions & 27 deletions create-snowpack-app/app-template-svelte-typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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",
}
}
3 changes: 3 additions & 0 deletions create-snowpack-app/app-template-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

1 comment on commit 54fadca

@vercel
Copy link

@vercel vercel bot commented on 54fadca Sep 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.