forked from tools/josh
Migrate to Grunt as build tool
This commit is contained in:
parent
7dc6d2e8a7
commit
740b18241d
|
@ -0,0 +1 @@
|
|||
package-lock.json binary
|
|
@ -1,2 +1,104 @@
|
|||
# Output
|
||||
build/*
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and *not* Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
module.exports = grunt => {
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON("package.json"),
|
||||
clean: {
|
||||
before: ["build/"],
|
||||
after: [".tscache/"]
|
||||
},
|
||||
copy: {
|
||||
images: {
|
||||
files: [{expand: true, cwd: "src/", src: ["**/*.png", "**/*.ico"], dest: "build/"}]
|
||||
},
|
||||
html: {
|
||||
files: [{expand: true, cwd: "src/", src: "**/*.html", dest: "build/"}]
|
||||
},
|
||||
css: {
|
||||
files: [{expand: true, cwd: "src/", src: "**/*.css", dest: "build/"}]
|
||||
}
|
||||
},
|
||||
cssmin: {
|
||||
default: {
|
||||
files: [{expand: true, cwd: "build/", src: "**/*.css", dest: "build/"}]
|
||||
}
|
||||
},
|
||||
htmlmin: {
|
||||
default: {
|
||||
files: [{expand: true, cwd: "build/", src: "**/*.html", dest: "build/"}],
|
||||
options: {
|
||||
removeComments: true,
|
||||
collapseWhitespace: true
|
||||
}
|
||||
}
|
||||
},
|
||||
terser: {
|
||||
default: {
|
||||
files: [{expand: true, cwd: "build/js/", src: "*.js", dest: "build/js/"}],
|
||||
options: {
|
||||
compress: true,
|
||||
mangle: false,
|
||||
module: true
|
||||
}
|
||||
}
|
||||
},
|
||||
ts: {
|
||||
dev: {
|
||||
tsconfig: "./tsconfig.json"
|
||||
},
|
||||
deploy: {
|
||||
tsconfig: "./tsconfig.json",
|
||||
options: {
|
||||
sourceMap: false
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks("grunt-contrib-clean");
|
||||
grunt.loadNpmTasks("grunt-contrib-copy");
|
||||
grunt.loadNpmTasks("grunt-contrib-cssmin");
|
||||
grunt.loadNpmTasks("grunt-contrib-htmlmin");
|
||||
grunt.loadNpmTasks("grunt-terser");
|
||||
grunt.loadNpmTasks("grunt-ts");
|
||||
|
||||
grunt.registerTask("default", [
|
||||
// Pre
|
||||
"clean:before",
|
||||
// Copy files
|
||||
"copy:images",
|
||||
"copy:html",
|
||||
"copy:css",
|
||||
// Compile
|
||||
"ts:dev",
|
||||
// Post
|
||||
"clean:after"
|
||||
]);
|
||||
grunt.registerTask("deploy", [
|
||||
// Pre
|
||||
"clean:before",
|
||||
// Copy files
|
||||
"copy:images",
|
||||
"copy:html",
|
||||
"copy:css",
|
||||
// Compile JS
|
||||
"ts:deploy",
|
||||
// Minify
|
||||
"terser",
|
||||
"cssmin",
|
||||
"htmlmin",
|
||||
// Post
|
||||
"clean:after"
|
||||
]);
|
||||
};
|
19
README.md
19
README.md
|
@ -2,11 +2,22 @@
|
|||
The source code of [my personal website](https://fwdekker.com/).
|
||||
|
||||
## Development
|
||||
### Prerequisites
|
||||
* [npm](https://www.npmjs.com/)
|
||||
* [grunt-cli](https://www.npmjs.com/package/grunt-cli)
|
||||
|
||||
### CLI
|
||||
```shell script
|
||||
# Build the website in `build/`
|
||||
$> ./build.sh
|
||||
# Install dependencies (only needed once)
|
||||
$> npm install
|
||||
```
|
||||
|
||||
```shell script
|
||||
# Build the website in `build/` then copy it to `example/`
|
||||
$> ./build.sh "example/"
|
||||
# Build the application in `build/` for development
|
||||
$> grunt
|
||||
```
|
||||
|
||||
```shell script
|
||||
# Build the application in `build/` for deployment
|
||||
$> grunt deploy
|
||||
```
|
||||
|
|
13
build.sh
13
build.sh
|
@ -1,13 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
mkdir -p build build/js build/css
|
||||
|
||||
tsc -p ./tsconfig.json
|
||||
|
||||
cp ./*.html ./build/
|
||||
cp ./css/*.css ./build/css
|
||||
cp ./favicon.ico ./build/favicon.ico
|
||||
cp ./favicon.png ./build/favicon.png
|
||||
|
||||
if [ "$1" ]; then
|
||||
cp -r ./build/ "$1"
|
||||
fi
|
Binary file not shown.
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "fwdekker.com",
|
||||
"version": "1.0.0",
|
||||
"description": "The source code of [my personal website](https://fwdekker.com/).",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"grunt": "1.0.4",
|
||||
"grunt-contrib-clean": "2.0.0",
|
||||
"grunt-contrib-copy": "1.0.0",
|
||||
"grunt-contrib-cssmin": "3.0.0",
|
||||
"grunt-contrib-htmlmin": "3.1.0",
|
||||
"grunt-terser": "1.0.0",
|
||||
"grunt-ts": "6.0.0-beta.22",
|
||||
"typescript": "3.6.4"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@git.fwdekker.com:FWDekker/fwdekker.com.git"
|
||||
},
|
||||
"author": "Felix W. Dekker"
|
||||
}
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
|
@ -2,17 +2,16 @@
|
|||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"target": "es2019",
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"removeComments": true,
|
||||
"outDir": "./build/js"
|
||||
"rootDir": "./src/js/",
|
||||
"outDir": "./build/js/"
|
||||
},
|
||||
"files": [
|
||||
"js/commands.ts",
|
||||
"js/extensions.d.ts",
|
||||
"js/extensions.ts",
|
||||
"js/fs.ts",
|
||||
"js/shared.ts",
|
||||
"js/terminal.ts"
|
||||
"src/js/commands.ts",
|
||||
"src/js/extensions.d.ts",
|
||||
"src/js/extensions.ts",
|
||||
"src/js/fs.ts",
|
||||
"src/js/shared.ts",
|
||||
"src/js/terminal.ts"
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue