build(*): Add base files

This commit is contained in:
Josh Creek
2022-10-07 08:52:22 +01:00
parent f4143b3608
commit 4cfcf65121
13 changed files with 15487 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
ARG VARIANT=16-bullseye
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}
# [Optional] Uncomment this section to install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends inotify-tools
# [Optional] Uncomment if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
# [Optional] Uncomment if you want to install more global node packages
# RUN su node -c "npm install -g <your-package-list -here>"
+17
View File
@@ -0,0 +1,17 @@
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
ARG VARIANT=16-bullseye
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
# Install tslint, typescript. eslint is installed by javascript image
ARG NODE_MODULES="tslint-to-eslint-config typescript"
COPY library-scripts/meta.env /usr/local/etc/vscode-dev-containers
RUN su node -c "umask 0002 && npm install -g ${NODE_MODULES}" \
&& npm cache clean --force > /dev/null 2>&1
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
# [Optional] Uncomment if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
+51
View File
@@ -0,0 +1,51 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/typescript-node
{
"name": "Node.js & TypeScript",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 18, 16, 14.
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"args": {
"VARIANT": "16-bullseye"
}
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"formulahendry.auto-rename-tag",
"EditorConfig.EditorConfig",
"dbaeumer.vscode-eslint",
"bierner.github-markdown-preview",
"eamodio.gitlens",
"xabikos.JavaScriptSnippets",
"ritwickdey.LiveServer",
"yzhang.markdown-all-in-one",
"bierner.markdown-emoji",
"bierner.markdown-footnotes",
"bierner.markdown-preview-github-styles",
"bierner.markdown-yaml-preamble",
"DavidAnson.vscode-markdownlint",
"PKief.material-icon-theme",
"christian-kohler.npm-intellisense",
"christian-kohler.path-intellisense",
"esbenp.prettier-vscode",
"gencer.html-slim-scss-css-class-completion"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [3000],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm install",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
}
+2
View File
@@ -0,0 +1,2 @@
dist
node_modules
+32
View File
@@ -0,0 +1,32 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"airbnb-base",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
]
}
}
+1
View File
@@ -0,0 +1 @@
* text=auto eol=lf
+2
View File
@@ -0,0 +1,2 @@
dist
node_modules
+19
View File
@@ -0,0 +1,19 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch via NPM",
"request": "launch",
"runtimeArgs": [
"run",
"dev"
],
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"stopOnEntry": true,
}
]
}
+15218
View File
File diff suppressed because it is too large Load Diff
+39
View File
@@ -0,0 +1,39 @@
{
"name": "SelectionWheel",
"version": "1.0.0",
"description": "A fun and simple selection wheel.",
"main": "index.js",
"scripts": {
"build": "webpack",
"dev": "webpack serve",
"lint": "eslint --ignore-path .eslintignore --ext .js,.ts ."
},
"repository": {
"type": "git",
"url": "https://github.com/jcreek/SelectionWheel"
},
"keywords": [],
"author": "jcreek",
"license": "GNU General Public License v3.0",
"devDependencies": {
"@babel/core": "^7.18.5",
"@babel/preset-env": "^7.18.2",
"@babel/preset-typescript": "^7.17.12",
"@typescript-eslint/eslint-plugin": "^5.28.0",
"@typescript-eslint/parser": "^5.28.0",
"babel-loader": "^8.2.5",
"css-loader": "^6.7.1",
"eslint": "^8.17.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.26.0",
"html-webpack-plugin": "^5.5.0",
"react-dev-utils": "^12.0.1",
"sass": "^1.52.3",
"sass-loader": "^13.0.0",
"style-loader": "^3.3.1",
"typescript": "^4.7.3",
"webpack": "^5.73.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.9.2"
}
}
+4
View File
@@ -0,0 +1,4 @@
declare module '*.svg' {
const content: any;
export default content;
}
+7
View File
@@ -0,0 +1,7 @@
{
"compilerOptions": {
"preserveConstEnums": true
},
"include": ["src/**/*", "src/custom.d.ts"],
"exclude": ["node_modules", "**/*.spec.ts"]
}
+81
View File
@@ -0,0 +1,81 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
module.exports = {
mode: 'development',
entry: {
bundle: path.resolve(__dirname, 'src/index.ts'),
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].[contenthash].js',
clean: true,
assetModuleFilename: '[name].[contenthash][ext]',
publicPath: './',
},
devtool: 'source-map',
devServer: {
static: {
directory: path.resolve(__dirname, 'dist'),
},
port: 3000,
open: true,
hot: true,
compress: true,
historyApiFallback: true,
devMiddleware: {
index: true,
mimeTypes: { phtml: 'text/html' },
writeToDisk: true,
},
},
watchOptions: { poll: true },
module: {
rules: [
{
// Use these loaders for any matching scss file types
test: /\.scss$/,
use: [
'style-loader',
'css-loader',
'sass-loader',
],
},
{
// Add backwards compatibility
test: /\.(js|ts)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-typescript'],
},
},
},
{
// Add support for images
test: /\.(png|jpg|jpeg|gif)$/i,
type: 'asset/resource',
},
{
// Add inlining of SVG
test: /\.svg$/i,
type: 'asset/inline',
},
],
},
resolve: {
// Specify the order in which to resolve files by their extension
extensions: ['*', '.js', '.ts'],
},
plugins: [
new HtmlWebpackPlugin({
inject: 'body',
title: 'Selection Wheel - the funnest way to make decisions',
filename: 'index.html',
template: 'src/template.html',
}),
new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/.*/]),
],
};