I’m going to write the way how to overcome a messy Vuex usage.

Let’s create an object to use it as a command.

export const COMMAND = {

A: {

LIST: “A_LIST”

LIST_CNT: “A_LIST_CNT”

}

};

import it and use it in a store js file.

import {COMMAND as C } from “@/const/command”;

const COMMAND = C.A;

export default {

state: {

[COMMAND.LIST]: ‘’

[COMMAND.LIST_CNT]: 0

},

mutations: {

[COMMAND.LIST](state, list){

state[COMMAND.LIST] = list;

}

[COMMAND.LIST_CNT](state, cnt){

state[COMMAND.LIST_CNT] = cnt;

}

},

actions: {

[COMMAND.LIST]({commit}, list) {

commit(COMMAND.LIST, list);

},

[COMMAND.LIST_CNT]({commit}, cnt){

commit(COMMAND.LIST_CNT, cnt);

}

},

}

export {mapState: aState, mapActions: aActions} = createNamespaceHelpers(“a/a”);

in your vue file.

computed: {

…aState([COMMAND.A.LIST, COMMAND.A.LIST_CNT]

}

Happy coding!

run the install script.

yarn -D add @vue/cli-plugin-unit-jest @vue/test-utils eslint-plugin-jest identity-obj-proxy

In the root directory, make jest.config.js

module.exports = {
preset: "@vue/cli-plugin-unit-jest",
collectCoverage: false,
testMatch: ["**/__tests__/**/*.test.{j,t}s?(x)"],
modulePathIgnorePatterns: ["<rootDir>/node_modules", "<rootDir>/build", "<rootDir>/dist"],
moduleNameMapper: {
"^~/(.*)$": "<rootDir>/src/$1",
"^@/(.*)$": "<rootDir>/src/$1",
"^.+\\.(css|less|scss)$": "identity-obj-proxy"
},
verbose: true
};
  • you can remove modulePathIgnorePatterns, moduleNameMapper, and modify testMatch(where you put the test files)

In the package.json file. add configurations.

"scripts": {
"test": "vue-cli-service test:unit",
},
"eslintConfig": {
...
"extends" : [
...
"plugin:jest/recommended",
],
...
"overrides": [
{
"files": [
"**/__tests__/**/*.test.{j,t}s?(x)"
],
"env": {
"jest": true
}
}
],
...
}

make some test files, in the testMatch directories.

run the test.

yarn run test

error An unexpected error occurred: “C:\\Users\\…\\node_modules\\core-js: UNKNOWN: unknown error, open ‘C:\\Users\\…\\AppData\\Local\\Temp\\yarn — 1618462180644–0.671544141967781\\yarn.cmd’”.

go to the directory (AppData/Local/Temp) and delete all directories start with ‘yarn-’

npm uninstall -g create-react-app
npm install npm
npm cache clean --force
npx create-react-app my-app --template typescript

I encountered this error messages.

Dataclip ErrorERROR:  relation "wanteds" does not exist
LINE 1: select * from Wanteds;

Here is my sql query.

select * from Wanteds;

Here is my Schema Explorer.

What is wrong with this?

You need to type table name in double quotes like this

select * from "Wanteds";
npm install -g @vue/cli
npm install -g yarn
npm install vue@next
mkdir vite_clone
cd vite_clone
yarn set version berry
yarn init -p
yarn add -D typescript
yarn dlx @yarnpkg/pnpify --sdk vscode

Add the workspaces directories to package.json (root)

,"workspaces": [
"packages/*"
]

Keep typing

mkdir packages
cd packages
yarn create @vitejs/app app
(select…

I’ve installed nginx and start the service with systemctl, but I got an error.
nginx.service: Failed to parse PID from file /var/run/nginx.pid

and I found the solution in the link. check this link if you have the same error.

https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1581864:
Because sudo can be different in some systems, this worked best for me:

# Fix for Nginx PID problem in Ubuntu 16.04 in an EC2 instance
sudo systemctl stop nginx
sudo mkdir /etc/systemd/system/nginx.service.d
# build the file in root where no sudo is needed
printf “[Service]\nExecStartPost=/bin/sleep 0.1\n” > override.conf
sudo cp override.conf /etc/systemd/system/nginx.service.d/override.conf
sudo systemctl daemon-reload
sudo systemctl start nginx

MJ

Fullstack Web Programmer in Korea

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store