## Initialization and manual publish
npm install @wns-vote-for-skill/common- initialize a new npm project
``shell`
npm init -y
- change the name in package.json to @organization/project
- initialize git repository and commit
- publish your package
`shell`
npm login
npm publish --access public
- check your profile on https://www.npmjs.com/
- create tsconfig.json
`shell`
tsc --init
- install dependencies
`shell`
npm install typescript del-cli --save-dev
- create src/index.ts with some ts codetsconfig.json
- update `json`
{
...
"declaration": true, / Generates corresponding '.d.ts' file. /
"outDir": "./lib", / Redirect output structure to the directory. /
...
}
- update package.json scripts to be sure to clean the lib directory`json`
{
...
"scripts": {
"clean": "del .lib/*",
"build": "npm run clean && tsc"
},
...
}
- make sure to gitignore lib/
- fill main, types and files in package.json`json`
{
...
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"files": [
"./lib/*/"
],
...
}
- commit your changes
- update your version number manually or run command:
`shell`
npm version patch`
- build and publishshell`
npm run build
npm publish
`shell`
git remote add origin git@github.com:github-account/project-name.git
git branch -M main
git push -u origin main
- create and copy a npm publish access token
- create a repository secret NPM_TOKEN on your Github repository
- copy .github/workflows/publish.yml in you repositorymain` think of updating the package version
- before pushing to