These instructions will guide you through how to use NPM to setup a project without using Vite ore React projects. The purpose of the exercise is to remove your dependency on other's works and provide the base understanding of how NPM and Node function.
By cloning this project, the following work has been completed for you it is your responsibility to understand how to setup a project. you may want to run through these steps if you do not know how.
Using your terminal program, run the following commands. Please note, on Windows system you'll need to replace "$HOME" with "%HOMEPATH%".
mkdir -p $HOME/projects/wdg/chutes_and_ladders
cd $HOME/projects/wdg/chutes_and_ladders
npm init -y
npm install --save-dev jest typescript
npm install --save-dev babel-jest @babel/core @babel/preset-env @babel/preset-typescript
npm install --save-dev @types/node @types/jest
Start Visual Studio Code
code .
Edit the package.json file, and add the following:
...
"author": "<YOUR NAME>",
"description": "<PROJECT DESCRIPTION>",
"main": "main.ts",
"scripts": {
"test": "jest"
},
...
Create the following files:
tsconfig.json
{
"compilerOptions": {
"module": "ESNext",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true
},
"include": ["src/**/*"],
"exclude": ["**/*.spec.ts"]
}
babel.config.cjs
module.exports = {
presets: [
['@babel/preset-env', {targets: {node: 'current'}}],
'@babel/preset-typescript',
],
};
With these steps, you've create a project structure that will allow you to use javascript and/or typescript. In addition, you'll be able to write test cases using the 'jest' test framework.