Skip to content

Commit 8947165

Browse files
committed
Copy configs in templates folder
1 parent c83269f commit 8947165

16 files changed

+181
-6
lines changed

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
{
22
"name": "@kdcsoftware/create-nodejs",
3-
"version": "0.1.7",
3+
"version": "0.1.8",
44
"description": "NodeJs boilerplate",
55
"main": "lib/index.js",
66
"bin": "./cli.js",
77
"files": [
88
"lib",
9-
".*",
10-
"jest.config.js"
9+
"templates"
1110
],
1211
"scripts": {
1312
"build:commonjs": "babel src --out-dir lib",

src/configs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ const CONFIG_FILES = [
44
'.eslintrc',
55
'.gitignore',
66
'.prettierrc',
7+
'.vscode/launch.json',
8+
'codecov.yml',
79
'jest.config.js',
810
'.github/workflows/push.yml',
911
'.github/workflows/publish.yml',
1012
'LICENSE',
11-
'.vscode/launch.json',
12-
'codecov.yml',
1313
];
1414

1515
export default CONFIG_FILES;

src/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ const run = async ({ packageName }) => {
3232

3333
// copy config
3434
CONFIG_FILES.forEach((c) => {
35-
fse.copySync(resolve(`${PKG_DIR}/..`, c), `${CUR_DIR}/${c}`);
35+
fse.copySync(
36+
resolve(`${PKG_DIR}/..`, `templates/${c}`),
37+
`${CUR_DIR}/${c}`
38+
);
3639
});
3740

3841
// copy source templates

templates/.babelrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["@babel/preset-env"],
3+
"plugins": ["@babel/plugin-transform-runtime"]
4+
}

templates/.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
# General settings for whole project
3+
[*]
4+
indent_style = space
5+
end_of_line = lf
6+
indent_size = 2
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
# Format specific overrides
10+
[*.md]
11+
max_line_length = 0
12+
trim_trailing_whitespace = false

templates/.eslintrc

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"parser": "babel-eslint",
3+
"extends": ["airbnb-base", "prettier"],
4+
"plugins": ["prettier"],
5+
"rules": {
6+
"prettier/prettier": ["error"]
7+
},
8+
"env": {
9+
"commonjs": true,
10+
"node": true,
11+
"jest": true
12+
},
13+
"ignorePatterns": ["node_modules/", "coverage/", "lib/", "bin/"]
14+
}
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v1
13+
with:
14+
node-version: '12.x'
15+
registry-url: https://registry.npmjs.org/
16+
- run: npm ci
17+
- run: npm test
18+
- run: npm run lint
19+
- run: npm run build
20+
- run: npm publish --access public
21+
env:
22+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

templates/.github/workflows/push.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-node@v1
15+
with:
16+
node-version: '12.x'
17+
- run: npm ci
18+
- run: npm test
19+
- run: npm run lint
20+
- run: npm run coverage
21+
- uses: codecov/codecov-action@v1
22+
with:
23+
token: ${{ secrets.CODECOV_TOKEN }}
24+
file: ./coverage/lcov.info

templates/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
coverage/
3+
lib/
4+
hello-world
5+
.serverless
6+
.webpack

templates/.npmignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
tests
2+
coverage
3+
src
4+
codecov.yml
5+
jest.config.js

templates/.prettierrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

templates/.vscode/launch.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Jest All",
11+
"program": "${workspaceFolder}/node_modules/.bin/jest",
12+
"args": ["--runInBand"],
13+
"console": "integratedTerminal",
14+
"internalConsoleOptions": "neverOpen",
15+
"disableOptimisticBPs": true,
16+
"windows": {
17+
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
18+
}
19+
},
20+
{
21+
"type": "node",
22+
"request": "launch",
23+
"name": "Jest Current File",
24+
"program": "${workspaceFolder}/node_modules/.bin/jest",
25+
"args": ["${fileBasenameNoExtension}", "--config", "jest.config.js"],
26+
"console": "integratedTerminal",
27+
"internalConsoleOptions": "neverOpen",
28+
"disableOptimisticBPs": true,
29+
"windows": {
30+
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
31+
}
32+
}
33+
]
34+
}

templates/LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 KDC Software
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

templates/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Create NodeJs
2+
3+
Boilerplate for NodeJs projects
4+
5+
## Usage
6+
7+
```bash
8+
npx @kdcsoftware/create-nodejs package-name
9+
```

templates/codecov.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
codecov:
2+
require_ci_to_pass: yes

templates/jest.config.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
testEnvironment: 'node',
3+
testPathIgnorePatterns: [
4+
'/node_modules/',
5+
'/tests/__helpers',
6+
'/hello-world/',
7+
],
8+
collectCoverage: true,
9+
coverageReporters: ['lcov'],
10+
collectCoverageFrom: ['src/**/*.js'],
11+
watchPathIgnorePatterns: [
12+
'<rootDir>/node_nodules/',
13+
'<rootDir>/lib/',
14+
'<rootDir>/coverage/',
15+
'<rootDir>/hello-world/',
16+
],
17+
};

0 commit comments

Comments
 (0)