Skip to content

Commit

Permalink
build(examples): switch all examples to new snowpack setup
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Dec 6, 2020
1 parent fef1948 commit 9f1c5ed
Show file tree
Hide file tree
Showing 692 changed files with 11,026 additions and 3,296 deletions.
7 changes: 4 additions & 3 deletions examples/adaptive-threshold/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.cache
out
build
dev
node_modules
yarn.lock
*.js
!snowpack.config.js
!*.d.ts
15 changes: 6 additions & 9 deletions examples/adaptive-threshold/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@
"author": "Karsten Schmidt <[email protected]>",
"license": "Apache-2.0",
"scripts": {
"clean": "rm -rf .cache build out",
"build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting",
"build:webpack": "../../node_modules/.bin/webpack --mode production",
"start": "parcel index.html -p 8080 --open --no-cache"
},
"devDependencies": {
"parcel-bundler": "^1.12.4",
"terser": "^5.2.1",
"typescript": "^4.1.2"
"clean": "../../node_modules/.bin/rimraf build node_modules/.cache",
"start": "../../node_modules/.bin/snowpack dev",
"build": "../../node_modules/.bin/snowpack build"
},
"dependencies": {
"@thi.ng/api": "latest",
Expand All @@ -39,5 +33,8 @@
"transducers-hdom"
],
"screenshot": "examples/adaptive-threshold.png"
},
"devDependencies": {
"@types/snowpack-env": "^2.3.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
>Source code</a
>
</div>
<script type="text/javascript" src="./src/index.ts"></script>
<script type="module" src="/_dist_/index.js"></script>
</body>
</html>
29 changes: 29 additions & 0 deletions examples/adaptive-threshold/snowpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/** @type {import("snowpack").SnowpackUserConfig } */
module.exports = {
mount: {
public: "/",
src: "/_dist_",
},
plugins: [
"@snowpack/plugin-typescript",
[
"@snowpack/plugin-webpack",
{
extendConfig: (config) => {
config.node = {
process: false,
setImmediate: false,
util: "empty",
};
return config;
},
},
],
],
installOptions: {
installTypes: true,
},
buildOptions: {
baseUrl: "/adaptive-threshold",
},
};
2 changes: 1 addition & 1 deletion examples/adaptive-threshold/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Val1 } from "@thi.ng/api";
import { PackedBuffer } from "@thi.ng/pixel";
import type { PackedBuffer } from "@thi.ng/pixel";

// event ID constants
export const SET_IMAGE = "set-image";
Expand Down
2 changes: 1 addition & 1 deletion examples/adaptive-threshold/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { peek } from "@thi.ng/arrays";
import { PackedBuffer } from "@thi.ng/pixel";
import type { PackedBuffer } from "@thi.ng/pixel";
import { fromRAF, sidechainPartition } from "@thi.ng/rstream";
import { map } from "@thi.ng/transducers";
import { updateDOM } from "@thi.ng/transducers-hdom";
Expand Down
59 changes: 59 additions & 0 deletions examples/adaptive-threshold/src/static.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/* Use this file to declare any custom file extensions for importing */
/* Use this folder to also add/extend a package d.ts file, if needed. */

/* CSS MODULES */
declare module "*.module.css" {
const classes: { [key: string]: string };
export default classes;
}
declare module "*.module.scss" {
const classes: { [key: string]: string };
export default classes;
}
declare module "*.module.sass" {
const classes: { [key: string]: string };
export default classes;
}
declare module "*.module.less" {
const classes: { [key: string]: string };
export default classes;
}
declare module "*.module.styl" {
const classes: { [key: string]: string };
export default classes;
}

/* CSS */
declare module "*.css";
declare module "*.scss";
declare module "*.sass";
declare module "*.less";
declare module "*.styl";

/* IMAGES */
declare module "*.svg" {
const ref: string;
export default ref;
}
declare module "*.bmp" {
const ref: string;
export default ref;
}
declare module "*.gif" {
const ref: string;
export default ref;
}
declare module "*.jpg" {
const ref: string;
export default ref;
}
declare module "*.jpeg" {
const ref: string;
export default ref;
}
declare module "*.png" {
const ref: string;
export default ref;
}

/* CUSTOM: ADD YOUR OWN HERE */
3 changes: 0 additions & 3 deletions examples/adaptive-threshold/src/webpack.d.ts

This file was deleted.

11 changes: 5 additions & 6 deletions examples/adaptive-threshold/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"extends": "../../tsconfig.json",
"extends": "../tsconfig.json",
"include": ["src"],
"compilerOptions": {
"outDir": ".",
"target": "es2017",
"sourceMap": true
},
"include": ["./src/**/*.ts"]
"baseUrl": "./",
"paths": { "*": ["web_modules/.types/*"] }
}
}
23 changes: 0 additions & 23 deletions examples/adaptive-threshold/webpack.config.js

This file was deleted.

7 changes: 4 additions & 3 deletions examples/async-effect/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.cache
out
build
dev
node_modules
yarn.lock
*.js
!snowpack.config.js
!*.d.ts
15 changes: 6 additions & 9 deletions examples/async-effect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@
"author": "Karsten Schmidt <[email protected]>",
"license": "Apache-2.0",
"scripts": {
"clean": "rm -rf .cache build out",
"prep": "yarn clean && mkdir -p out && cp foo.json out",
"build": "yarn prep && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./",
"start": "yarn prep && parcel index.html -p 8080 --open -d out"
},
"devDependencies": {
"parcel-bundler": "^1.12.4",
"terser": "^5.2.1",
"typescript": "^4.1.2"
"clean": "../../node_modules/.bin/rimraf build node_modules/.cache",
"start": "../../node_modules/.bin/snowpack dev",
"build": "../../node_modules/.bin/snowpack build"
},
"dependencies": {
"@thi.ng/api": "latest",
Expand All @@ -31,5 +25,8 @@
"readme": [
"interceptors"
]
},
"devDependencies": {
"@types/snowpack-env": "^2.3.2"
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ <h1>async side effect handling</h1>
>
</p>
<div id="app"></div>
<script type="text/javascript" src="./src/index.ts"></script>
<script type="module" src="/_dist_/index.js"></script>
</body>
</html>
29 changes: 29 additions & 0 deletions examples/async-effect/snowpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/** @type {import("snowpack").SnowpackUserConfig } */
module.exports = {
mount: {
public: "/",
src: "/_dist_",
},
plugins: [
"@snowpack/plugin-typescript",
[
"@snowpack/plugin-webpack",
{
extendConfig: (config) => {
config.node = {
process: false,
setImmediate: false,
util: "empty",
};
return config;
},
},
],
],
installOptions: {
installTypes: true,
},
buildOptions: {
baseUrl: "/async-effect",
},
};
59 changes: 59 additions & 0 deletions examples/async-effect/src/static.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/* Use this file to declare any custom file extensions for importing */
/* Use this folder to also add/extend a package d.ts file, if needed. */

/* CSS MODULES */
declare module "*.module.css" {
const classes: { [key: string]: string };
export default classes;
}
declare module "*.module.scss" {
const classes: { [key: string]: string };
export default classes;
}
declare module "*.module.sass" {
const classes: { [key: string]: string };
export default classes;
}
declare module "*.module.less" {
const classes: { [key: string]: string };
export default classes;
}
declare module "*.module.styl" {
const classes: { [key: string]: string };
export default classes;
}

/* CSS */
declare module "*.css";
declare module "*.scss";
declare module "*.sass";
declare module "*.less";
declare module "*.styl";

/* IMAGES */
declare module "*.svg" {
const ref: string;
export default ref;
}
declare module "*.bmp" {
const ref: string;
export default ref;
}
declare module "*.gif" {
const ref: string;
export default ref;
}
declare module "*.jpg" {
const ref: string;
export default ref;
}
declare module "*.jpeg" {
const ref: string;
export default ref;
}
declare module "*.png" {
const ref: string;
export default ref;
}

/* CUSTOM: ADD YOUR OWN HERE */
12 changes: 5 additions & 7 deletions examples/async-effect/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"extends": "../../tsconfig.json",
"extends": "../tsconfig.json",
"include": ["src"],
"compilerOptions": {
"outDir": ".",
"module": "es2020",
"target": "es2017",
"sourceMap": true
},
"include": ["./src/**/*.ts"]
"baseUrl": "./",
"paths": { "*": ["web_modules/.types/*"] }
}
}
7 changes: 4 additions & 3 deletions examples/bitmap-font/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.cache
out
build
dev
node_modules
yarn.lock
*.js
!snowpack.config.js
!*.d.ts
16 changes: 6 additions & 10 deletions examples/bitmap-font/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,9 @@
"author": "Karsten Schmidt <[email protected]>",
"license": "Apache-2.0",
"scripts": {
"clean": "rm -rf .cache build out",
"build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting",
"build:webpack": "../../node_modules/.bin/webpack --mode production",
"start": "parcel index.html -p 8080 --open --no-cache"
},
"devDependencies": {
"parcel-bundler": "^1.12.4",
"rimraf": "^2.6.3",
"terser": "^5.2.1",
"typescript": "^4.1.2"
"clean": "../../node_modules/.bin/rimraf build node_modules/.cache",
"start": "../../node_modules/.bin/snowpack dev",
"build": "../../node_modules/.bin/snowpack build"
},
"dependencies": {
"@thi.ng/api": "latest",
Expand All @@ -40,5 +33,8 @@
"transducers-hdom"
],
"screenshot": "examples/bitmap-font.gif"
},
"devDependencies": {
"@types/snowpack-env": "^2.3.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
>Source code</a
>
</div>
<script type="text/javascript" src="./src/index.ts"></script>
<script type="module" src="/_dist_/index.js"></script>
</body>
</html>
Loading

0 comments on commit 9f1c5ed

Please sign in to comment.