This is a set of initialization scripts that use common tools and shell scripts to help me prototype projects.
It makes heavy use of npm as a script runner and package.json for storing project data.
The project's capabilities can be extended by running scripts (see below).
These commands are designed to work on linux and unix machines, including machines running macOS.
If you're running Windows 10 Professional, you can run them using the Windows subsystem for Linux or within a Docker container.
If you're running some other version of Windows, the npm scripts should work, but extension scripts will fail. You might want to try cygwin in this case, or try downloading and running the script source manually.
Ensure that these utilities are installed first:
- sh
- node / npm
- git
- curl (curl is only necessary for extension scripts)
In your project directory, run the following script:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/johnhenry/startled/master/init.sh)"
This and also adds get, set, and delete npm scripts that allow manipulation of the package as a key-value store.
Once you've run that script, you can run any of below installation scripts to add functionality to your project.
Running installation scripts will usually add an npm command.
The following commands are installed when adding the above initial script.
npm run get < path in package.json >
npm run set < path in package.json > 'value to set'
npm run delete < path in package.json >
set up with 'save=true' to save installed dependencies automatically
set up to ignore 'node_modules/' folder
Update project capabilities by running scripts in the project directory.
-
Compile a readme from json and ejs
-
Creates script:
- npm run generate-readme
-
Creates files:
- readme/readme.md.json
- readme/readme.md.ejs
- readme/.script/generate.js
- readme/readme.md.json
-
Compiles to files:
- readme.md
sh -c "$(curl -fsSL https://raw.githubusercontent.com/johnhenry/startled/master/.startled/scripts/js-next-browser-slug.sh)"
-
Tag repo with package version upon running git version <'major'|'minor'|'patch'>
-
Note: must be run after cloning repository or running git init
-
Creates scripts:
- npm run install < package name >
- npm run uninstall < package name >
sh -c "$(curl -fsSL https://raw.githubusercontent.com/johnhenry/startled/master/.startled/scripts/tag-git-npm-version.sh)"
- Compile latest version of javascript into a self-contained slug for use in the browser
- Creates script:
- npm run build-js-browser
- Creates files:
- script/index.js
- Compiles to files:
- dist/index.js
sh -c "$(curl -fsSL https://raw.githubusercontent.com/johnhenry/startled/master/.startled/scripts/js-next-browser-slug.sh)"
- Run a node script written in the latest version of javascript
- Creates script:
- npm run node
- Creates files:
- node/index.js
sh -c "$(curl -fsSL https://raw.githubusercontent.com/johnhenry/startled/master/.startled/scripts/node-next.sh)"
- Compile latest version of css into a self-contained slug
- Creates script:
- npm run build-css
- Creates files:
- style/index.css
- Compiles to files:
- dist/index.css
sh -c "$(curl -fsSL https://raw.githubusercontent.com/johnhenry/startled/master/.startled/scripts/css-next-slug.sh)"
- Compile react components into static html files.
- Creates script:
- npm run build-html
- Creates files:
- html/.md.jsx.html.js
- html/index.jsx
- Compiles to files:
- dist/index.js
sh -c "$(curl -fsSL https://raw.githubusercontent.com/johnhenry/startled/master/.startled/scripts/html.sh)"
- Run static server
- Creates script:
- npm run serve-static
- Requires files:
- dist/
sh -c "$(curl -fsSL https://raw.githubusercontent.com/johnhenry/startled/master/.startled/scripts/serve-static.sh)"
These scripts will be ready soon.
- Compile latest version of javascript into a self-contained slug
- Creates script:
- npm run build-js
- Creates files:
- script/index.js
- Compiles to files:
- dist/index.js
sh -c "$(curl -fsSL https://raw.githubusercontent.com/johnhenry/startled/master/.startled/scripts/js-next-slug.sh)"
- Lint JavaScript
- Creates scripts:
- npm run lint-js < package name >
sh -c "$(curl -fsSL https://raw.githubusercontent.com/johnhenry/startled/master/.startled/scripts/lint-js.sh)"
- Lint CSS
- Creates scripts:
- npm run lint-css < package name >
sh -c "$(curl -fsSL https://raw.githubusercontent.com/johnhenry/startled/master/.startled/scripts/lint-css.sh)"
- Move static files into dist directory
- Creates script:
- npm run move
- Requires files:
- static/*
- dist/
sh -c "$(curl -fsSL https://raw.githubusercontent.com/johnhenry/startled/master/.startled/scripts/move.sh)"
- Push static site to https://surge.sh
- Creates script:
- npm run deploy-surge
- Requires files:
- dist/*
sh -c "$(curl -fsSL https://raw.githubusercontent.com/johnhenry/startled/master/.startled/scripts/deploy-surge.sh)"